diff --git a/gm/yuvtorgbsubset.cpp b/gm/yuvtorgbsubset.cpp index df41aa1b95..e2f707c499 100644 --- a/gm/yuvtorgbsubset.cpp +++ b/gm/yuvtorgbsubset.cpp @@ -140,13 +140,12 @@ protected: const SkRect* subset = j > 0 ? &kColorRect : nullptr; - GrSamplerState samplerState; - samplerState.setFilterMode(kFilters[i]); + auto wm = GrSamplerState::WrapMode::kClamp; if (j > 0) { - auto wm = static_cast(j - 1); - samplerState.setWrapModeX(wm); - samplerState.setWrapModeY(wm); + wm = static_cast(j - 1); } + GrSamplerState samplerState(wm, kFilters[i]); + const auto& caps = *rContext->priv().caps(); std::unique_ptr fp = GrYUVtoRGBEffect::Make(fProxies, samplerState, caps, SkMatrix::I(), subset); diff --git a/src/gpu/GrGeometryProcessor.cpp b/src/gpu/GrGeometryProcessor.cpp index 63fcfdaeba..f7e6d4a1ed 100644 --- a/src/gpu/GrGeometryProcessor.cpp +++ b/src/gpu/GrGeometryProcessor.cpp @@ -61,7 +61,10 @@ void GrGeometryProcessor::TextureSampler::reset(GrSamplerState samplerState, const GrBackendFormat& backendFormat, const skgpu::Swizzle& swizzle) { fSamplerState = samplerState; - fSamplerState.setFilterMode(clamp_filter(backendFormat.textureType(), samplerState.filter())); + fSamplerState = GrSamplerState(samplerState.wrapModeX(), + samplerState.wrapModeY(), + clamp_filter(backendFormat.textureType(), samplerState.filter()), + samplerState.mipmapMode()); fBackendFormat = backendFormat; fSwizzle = swizzle; fIsInitialized = true; diff --git a/src/gpu/GrSamplerState.h b/src/gpu/GrSamplerState.h index 8f65507b3b..0b776c8d1c 100644 --- a/src/gpu/GrSamplerState.h +++ b/src/gpu/GrSamplerState.h @@ -78,14 +78,6 @@ public: return GrMipmapped(fMipmapMode != MipmapMode::kNone); } - constexpr void setFilterMode(Filter filterMode) { fFilter = filterMode; } - - constexpr void setMipmapMode(MipmapMode mm) { fMipmapMode = mm; } - - constexpr void setWrapModeX(const WrapMode wrap) { fWrapModes[0] = wrap; } - - constexpr void setWrapModeY(const WrapMode wrap) { fWrapModes[1] = wrap; } - constexpr bool operator==(GrSamplerState that) const { return fWrapModes[0] == that.fWrapModes[0] && fWrapModes[1] == that.fWrapModes[1] && fFilter == that.fFilter && fMipmapMode == that.fMipmapMode; diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp index 25392c6de7..5ffd780d98 100644 --- a/src/gpu/effects/GrYUVtoRGBEffect.cpp +++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp @@ -177,7 +177,10 @@ std::unique_ptr GrYUVtoRGBEffect::Make(const GrYUVATextureP } else { GrSamplerState planeSampler = samplerState; if (makeLinearWithSnap) { - planeSampler.setFilterMode(GrSamplerState::Filter::kLinear); + planeSampler = GrSamplerState(samplerState.wrapModeX(), + samplerState.wrapModeY(), + GrSamplerState::Filter::kLinear, + samplerState.mipmapMode()); } planeFPs[i] = GrTextureEffect::Make(std::move(view), kUnknown_SkAlphaType, diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index f47f8beef6..5871919a45 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -2664,7 +2664,10 @@ void GrGLGpu::bindTexture(int unitIdx, GrSamplerState samplerState, const skgpu: if (samplerState.mipmapped() == GrMipmapped::kYes) { if (!this->caps()->mipmapSupport() || texture->mipmapped() == GrMipmapped::kNo) { - samplerState.setMipmapMode(GrSamplerState::MipmapMode::kNone); + samplerState = GrSamplerState(samplerState.wrapModeX(), + samplerState.wrapModeY(), + samplerState.filter(), + GrSamplerState::MipmapMode::kNone); } else { SkASSERT(!texture->mipmapsAreDirty()); } diff --git a/src/image/SkImage_GpuYUVA.cpp b/src/image/SkImage_GpuYUVA.cpp index 4a49e57e4d..af3e59ee8a 100644 --- a/src/image/SkImage_GpuYUVA.cpp +++ b/src/image/SkImage_GpuYUVA.cpp @@ -194,7 +194,10 @@ std::unique_ptr SkImage_GpuYUVA::onAsFragmentProcessor( auto wmy = SkTileModeToWrapMode(tileModes[1]); GrSamplerState sampler(wmx, wmy, sampling.filter, sampling.mipmap); if (sampler.mipmapped() == GrMipmapped::kYes && !this->setupMipmapsForPlanes(context)) { - sampler.setMipmapMode(GrSamplerState::MipmapMode::kNone); + sampler = GrSamplerState(sampler.wrapModeX(), + sampler.wrapModeY(), + sampler.filter(), + GrSamplerState::MipmapMode::kNone); } const auto& yuvM = sampling.useCubic ? SkMatrix::I() : m;