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 {
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;

View File

@ -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()));

View File

@ -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);
}

View File

@ -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();

View File

@ -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);

View File

@ -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;

View File

@ -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 ");

View File

@ -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;
}
};