diff --git a/src/mbgl/mtl/texture2d.cpp b/src/mbgl/mtl/texture2d.cpp index 816ed9a085d..d847326ae09 100644 --- a/src/mbgl/mtl/texture2d.cpp +++ b/src/mbgl/mtl/texture2d.cpp @@ -21,6 +21,11 @@ Texture2D::~Texture2D() { } gfx::Texture2D& Texture2D::setSamplerConfiguration(const SamplerState& samplerState_) noexcept { + if (samplerState.filter == samplerState_.filter && samplerState.wrapU == samplerState_.wrapU && + samplerState.wrapV == samplerState_.wrapV) { + return *this; + } + samplerState = samplerState_; samplerStateDirty = true; return *this; @@ -216,6 +221,8 @@ void Texture2D::updateSamplerConfiguration() noexcept { ? MTL::SamplerAddressModeClampToEdge : MTL::SamplerAddressModeRepeat); metalSamplerState = context.createMetalSamplerState(samplerDescriptor); + + samplerStateDirty = false; } void Texture2D::bind(RenderPass& renderPass, int32_t location) noexcept {