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 <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
John Stiles 2021-04-09 17:57:51 -04:00 committed by Skia Commit-Bot
parent cc6492ba9c
commit 67e52cf47d
8 changed files with 4 additions and 38 deletions

View File

@ -13,14 +13,14 @@
namespace GrPersistentCacheUtils { namespace GrPersistentCacheUtils {
static constexpr int kCurrentVersion = 4; static constexpr int kCurrentVersion = 5;
int GetCurrentVersion() { int GetCurrentVersion() {
// The persistent cache stores a copy of the SkSL::Program::Inputs struct. If you alter the // 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 // 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 // outdated persistent cache files. The KnownSkSLProgramInputs struct must also be updated to
// match the new contents of Program::Inputs. // 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)); static_assert(sizeof(SkSL::Program::Inputs) == sizeof(KnownSkSLProgramInputs));
return kCurrentVersion; return kCurrentVersion;

View File

@ -152,11 +152,7 @@ void GrGLProgram::bindTextures(const GrGeometryProcessor& geomProc,
void GrGLProgram::setRenderTargetState(const GrRenderTarget* rt, void GrGLProgram::setRenderTargetState(const GrRenderTarget* rt,
GrSurfaceOrigin origin, GrSurfaceOrigin origin,
const GrGeometryProcessor& geomProc) { const GrGeometryProcessor& geomProc) {
// Load the RT size uniforms if they are needed // Load the RT height uniform if it is needed
if (fBuiltinUniformHandles.fRTWidthUni.isValid() &&
fRenderTargetState.fRenderTargetSize.fWidth != rt->width()) {
fProgramDataManager.set1f(fBuiltinUniformHandles.fRTWidthUni, SkIntToScalar(rt->width()));
}
if (fBuiltinUniformHandles.fRTHeightUni.isValid() && if (fBuiltinUniformHandles.fRTHeightUni.isValid() &&
fRenderTargetState.fRenderTargetSize.fHeight != rt->height()) { fRenderTargetState.fRenderTargetSize.fHeight != rt->height()) {
fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni, SkIntToScalar(rt->height())); fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni, SkIntToScalar(rt->height()));

View File

@ -149,9 +149,6 @@ void GrGLProgramBuilder::computeCountsAndStrides(GrGLuint programID,
} }
void GrGLProgramBuilder::addInputVars(const SkSL::Program::Inputs& inputs) { void GrGLProgramBuilder::addInputVars(const SkSL::Program::Inputs& inputs) {
if (inputs.fRTWidth) {
this->addRTWidthUniform(SKSL_RTWIDTH_NAME);
}
if (inputs.fRTHeight) { if (inputs.fRTHeight) {
this->addRTHeightUniform(SKSL_RTHEIGHT_NAME); this->addRTHeightUniform(SKSL_RTHEIGHT_NAME);
} }

View File

@ -319,14 +319,6 @@ void GrGLSLProgramBuilder::appendUniformDecls(GrShaderFlags visibility, SkString
this->uniformHandler()->appendUniformDecls(visibility, out); 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) { void GrGLSLProgramBuilder::addRTHeightUniform(const char* name) {
SkASSERT(!fUniformHandles.fRTHeightUni.isValid()); SkASSERT(!fUniformHandles.fRTHeightUni.isValid());
GrGLSLUniformHandler* uniformHandler = this->uniformHandler(); GrGLSLUniformHandler* uniformHandler = this->uniformHandler();

View File

@ -71,10 +71,6 @@ public:
return this->uniformHandler()->inputSamplerSwizzle(handle); 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) // 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. // without mangling the name of the uniform inside of a stage.
void addRTHeightUniform(const char* name); void addRTHeightUniform(const char* name);

View File

@ -23,8 +23,6 @@ class GrSurfaceProxy;
// Handles for program uniforms (other than per-effect uniforms) // Handles for program uniforms (other than per-effect uniforms)
struct GrGLSLBuiltinUniformHandles { struct GrGLSLBuiltinUniformHandles {
GrGLSLProgramDataManager::UniformHandle fRTAdjustmentUni; 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 // Render target height, used to implement u_skRTHeight and to calculate sk_FragCoord when
// origin_upper_left is not supported. // origin_upper_left is not supported.
GrGLSLProgramDataManager::UniformHandle fRTHeightUni; GrGLSLProgramDataManager::UniformHandle fRTHeightUni;

View File

@ -1472,12 +1472,6 @@ void GLSLCodeGenerator::writeProgramElement(const ProgramElement& e) {
} }
void GLSLCodeGenerator::writeInputVars() { 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) { if (fProgram.fInputs.fRTHeight) {
const char* precision = usesPrecisionModifiers() ? "highp " : ""; const char* precision = usesPrecisionModifiers() ? "highp " : "";
fGlobals.writeText("uniform "); fGlobals.writeText("uniform ");

View File

@ -27,9 +27,6 @@
#include "src/gpu/vk/GrVkCaps.h" #include "src/gpu/vk/GrVkCaps.h"
#endif #endif
// name of the render target width uniform
#define SKSL_RTWIDTH_NAME "u_skRTWidth"
// name of the render target height uniform // name of the render target height uniform
#define SKSL_RTHEIGHT_NAME "u_skRTHeight" #define SKSL_RTHEIGHT_NAME "u_skRTHeight"
@ -70,9 +67,6 @@ struct Program {
using Settings = ProgramSettings; using Settings = ProgramSettings;
struct Inputs { 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 // if true, this program requires the render target height uniform to be defined
bool fRTHeight; bool fRTHeight;
@ -81,13 +75,12 @@ struct Program {
bool fFlipY; bool fFlipY;
void reset() { void reset() {
fRTWidth = false;
fRTHeight = false; fRTHeight = false;
fFlipY = false; fFlipY = false;
} }
bool isEmpty() { bool isEmpty() {
return !fRTWidth && !fRTHeight && !fFlipY; return !fRTHeight && !fFlipY;
} }
}; };