From 67e52cf47de574996832c4f344dd795eb6dbfbfc Mon Sep 17 00:00:00 2001 From: John Stiles Date: Fri, 9 Apr 2021 17:57:51 -0400 Subject: [PATCH] Remove last vestiges of u_skRTWidth. This was not used anywhere. (u_skRTHeight, on the other hand, is used to support Y-flipped surfaces.) Change-Id: I0cb803e8f82834715a47366a00c8ec913ee3c6e5 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/394898 Commit-Queue: John Stiles Auto-Submit: John Stiles Reviewed-by: Brian Osman --- src/gpu/GrPersistentCacheUtils.cpp | 4 ++-- src/gpu/gl/GrGLProgram.cpp | 6 +----- src/gpu/gl/builders/GrGLProgramBuilder.cpp | 3 --- src/gpu/glsl/GrGLSLProgramBuilder.cpp | 8 -------- src/gpu/glsl/GrGLSLProgramBuilder.h | 4 ---- src/gpu/glsl/GrGLSLUniformHandler.h | 2 -- src/sksl/SkSLGLSLCodeGenerator.cpp | 6 ------ src/sksl/ir/SkSLProgram.h | 9 +-------- 8 files changed, 4 insertions(+), 38 deletions(-) diff --git a/src/gpu/GrPersistentCacheUtils.cpp b/src/gpu/GrPersistentCacheUtils.cpp index 8235da27cc..876fb1cea4 100644 --- a/src/gpu/GrPersistentCacheUtils.cpp +++ b/src/gpu/GrPersistentCacheUtils.cpp @@ -13,14 +13,14 @@ namespace GrPersistentCacheUtils { -static constexpr int kCurrentVersion = 4; +static constexpr int kCurrentVersion = 5; int GetCurrentVersion() { // The persistent cache stores a copy of the SkSL::Program::Inputs struct. If you alter the // Program::Inputs struct in any way, you must increment kCurrentVersion to invalidate the // outdated persistent cache files. The KnownSkSLProgramInputs struct must also be updated to // match the new contents of Program::Inputs. - struct KnownSkSLProgramInputs { bool width, height, flipY; }; + struct KnownSkSLProgramInputs { bool height, flipY; }; static_assert(sizeof(SkSL::Program::Inputs) == sizeof(KnownSkSLProgramInputs)); return kCurrentVersion; diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index 4bb7f08382..5f21218989 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -152,11 +152,7 @@ void GrGLProgram::bindTextures(const GrGeometryProcessor& geomProc, void GrGLProgram::setRenderTargetState(const GrRenderTarget* rt, GrSurfaceOrigin origin, const GrGeometryProcessor& geomProc) { - // Load the RT size uniforms if they are needed - if (fBuiltinUniformHandles.fRTWidthUni.isValid() && - fRenderTargetState.fRenderTargetSize.fWidth != rt->width()) { - fProgramDataManager.set1f(fBuiltinUniformHandles.fRTWidthUni, SkIntToScalar(rt->width())); - } + // Load the RT height uniform if it is needed if (fBuiltinUniformHandles.fRTHeightUni.isValid() && fRenderTargetState.fRenderTargetSize.fHeight != rt->height()) { fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni, SkIntToScalar(rt->height())); diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp index 986aed4599..15050f2887 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp +++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp @@ -149,9 +149,6 @@ void GrGLProgramBuilder::computeCountsAndStrides(GrGLuint programID, } void GrGLProgramBuilder::addInputVars(const SkSL::Program::Inputs& inputs) { - if (inputs.fRTWidth) { - this->addRTWidthUniform(SKSL_RTWIDTH_NAME); - } if (inputs.fRTHeight) { this->addRTHeightUniform(SKSL_RTHEIGHT_NAME); } diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp index a858d25d0f..db4a2c2391 100644 --- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp +++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp @@ -319,14 +319,6 @@ void GrGLSLProgramBuilder::appendUniformDecls(GrShaderFlags visibility, SkString this->uniformHandler()->appendUniformDecls(visibility, out); } -void GrGLSLProgramBuilder::addRTWidthUniform(const char* name) { - SkASSERT(!fUniformHandles.fRTWidthUni.isValid()); - GrGLSLUniformHandler* uniformHandler = this->uniformHandler(); - fUniformHandles.fRTWidthUni = - uniformHandler->internalAddUniformArray(nullptr, kFragment_GrShaderFlag, kHalf_GrSLType, - name, false, 0, nullptr); -} - void GrGLSLProgramBuilder::addRTHeightUniform(const char* name) { SkASSERT(!fUniformHandles.fRTHeightUni.isValid()); GrGLSLUniformHandler* uniformHandler = this->uniformHandler(); diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.h b/src/gpu/glsl/GrGLSLProgramBuilder.h index bc5f51a71d..d54d118075 100644 --- a/src/gpu/glsl/GrGLSLProgramBuilder.h +++ b/src/gpu/glsl/GrGLSLProgramBuilder.h @@ -71,10 +71,6 @@ public: return this->uniformHandler()->inputSamplerSwizzle(handle); } - // Used to add a uniform for the RenderTarget width (used for u_skRTWidth) without mangling - // the name of the uniform inside of a stage. - void addRTWidthUniform(const char* name); - // Used to add a uniform for the RenderTarget height (used for u_skRTHeight and frag position) // without mangling the name of the uniform inside of a stage. void addRTHeightUniform(const char* name); diff --git a/src/gpu/glsl/GrGLSLUniformHandler.h b/src/gpu/glsl/GrGLSLUniformHandler.h index 779e845fb3..aacb75be75 100644 --- a/src/gpu/glsl/GrGLSLUniformHandler.h +++ b/src/gpu/glsl/GrGLSLUniformHandler.h @@ -23,8 +23,6 @@ class GrSurfaceProxy; // Handles for program uniforms (other than per-effect uniforms) struct GrGLSLBuiltinUniformHandles { GrGLSLProgramDataManager::UniformHandle fRTAdjustmentUni; - // Render target width, used to implement u_skRTWidth - GrGLSLProgramDataManager::UniformHandle fRTWidthUni; // Render target height, used to implement u_skRTHeight and to calculate sk_FragCoord when // origin_upper_left is not supported. GrGLSLProgramDataManager::UniformHandle fRTHeightUni; diff --git a/src/sksl/SkSLGLSLCodeGenerator.cpp b/src/sksl/SkSLGLSLCodeGenerator.cpp index 04349066f8..bde944ed78 100644 --- a/src/sksl/SkSLGLSLCodeGenerator.cpp +++ b/src/sksl/SkSLGLSLCodeGenerator.cpp @@ -1472,12 +1472,6 @@ void GLSLCodeGenerator::writeProgramElement(const ProgramElement& e) { } void GLSLCodeGenerator::writeInputVars() { - if (fProgram.fInputs.fRTWidth) { - const char* precision = usesPrecisionModifiers() ? "highp " : ""; - fGlobals.writeText("uniform "); - fGlobals.writeText(precision); - fGlobals.writeText("float " SKSL_RTWIDTH_NAME ";\n"); - } if (fProgram.fInputs.fRTHeight) { const char* precision = usesPrecisionModifiers() ? "highp " : ""; fGlobals.writeText("uniform "); diff --git a/src/sksl/ir/SkSLProgram.h b/src/sksl/ir/SkSLProgram.h index 75c7eeb24f..c762f4d1fb 100644 --- a/src/sksl/ir/SkSLProgram.h +++ b/src/sksl/ir/SkSLProgram.h @@ -27,9 +27,6 @@ #include "src/gpu/vk/GrVkCaps.h" #endif -// name of the render target width uniform -#define SKSL_RTWIDTH_NAME "u_skRTWidth" - // name of the render target height uniform #define SKSL_RTHEIGHT_NAME "u_skRTHeight" @@ -70,9 +67,6 @@ struct Program { using Settings = ProgramSettings; struct Inputs { - // if true, this program requires the render target width uniform to be defined - bool fRTWidth; - // if true, this program requires the render target height uniform to be defined bool fRTHeight; @@ -81,13 +75,12 @@ struct Program { bool fFlipY; void reset() { - fRTWidth = false; fRTHeight = false; fFlipY = false; } bool isEmpty() { - return !fRTWidth && !fRTHeight && !fFlipY; + return !fRTHeight && !fFlipY; } };