From 3865711259e25a90a1d72480f848863ada202067 Mon Sep 17 00:00:00 2001 From: Ethan Nicholas Date: Thu, 9 Feb 2017 17:01:22 -0500 Subject: Replaced all calls to fragmentPosition() with sk_FragCoord Change-Id: I2ed4558aea74b3ae7ee11dfe4736cdbcb16ae49e Reviewed-on: https://skia-review.googlesource.com/8278 Reviewed-by: Ethan Nicholas Commit-Queue: Ethan Nicholas --- src/gpu/gl/builders/GrGLProgramBuilder.cpp | 12 +++++++++--- src/gpu/gl/builders/GrGLProgramBuilder.h | 7 +++++-- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src/gpu/gl/builders') diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp index c3e81fb358..4f1909eecf 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp +++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp @@ -30,7 +30,7 @@ GrGLProgram* GrGLProgramBuilder::CreateProgram(const GrPipeline& pipeline, const GrPrimitiveProcessor& primProc, - const GrProgramDesc& desc, + GrProgramDesc* desc, GrGLGpu* gpu) { GrAutoLocaleSetter als("C"); @@ -56,7 +56,7 @@ GrGLProgram* GrGLProgramBuilder::CreateProgram(const GrPipeline& pipeline, GrGLProgramBuilder::GrGLProgramBuilder(GrGLGpu* gpu, const GrPipeline& pipeline, const GrPrimitiveProcessor& primProc, - const GrProgramDesc& desc) + GrProgramDesc* desc) : INHERITED(pipeline, primProc, desc) , fGpu(gpu) , fVaryingHandler(this) @@ -89,6 +89,12 @@ bool GrGLProgramBuilder::compileAndAttachShaders(GrGLSLShaderBuilder& shader, } *shaderIds->append() = shaderId; + if (outInputs->fFlipY) { + GrProgramDesc* d = this->desc(); + d->setSurfaceOriginKey(GrGLSLFragmentShaderBuilder::KeyForSurfaceOrigin( + this->pipeline().getRenderTarget()->origin())); + d->finalize(); + } return true; } @@ -244,7 +250,7 @@ void GrGLProgramBuilder::cleanupShaders(const SkTDArray& shaderIDs) { GrGLProgram* GrGLProgramBuilder::createProgram(GrGLuint programID) { return new GrGLProgram(fGpu, - this->desc(), + *this->desc(), fUniformHandles, programID, fUniformHandler.fUniforms, diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h index 84d6d91a57..cfbb734155 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.h +++ b/src/gpu/gl/builders/GrGLProgramBuilder.h @@ -29,11 +29,14 @@ public: * The program implements what is specified in the stages given as input. * After successful generation, the builder result objects are available * to be used. + * This function may modify the GrProgramDesc by setting the surface origin + * key to 0 (unspecified) if it turns out the program does not care about + * the surface origin. * @return true if generation was successful. */ static GrGLProgram* CreateProgram(const GrPipeline&, const GrPrimitiveProcessor&, - const GrProgramDesc&, + GrProgramDesc*, GrGLGpu*); const GrCaps* caps() const override; @@ -42,7 +45,7 @@ public: private: GrGLProgramBuilder(GrGLGpu*, const GrPipeline&, const GrPrimitiveProcessor&, - const GrProgramDesc&); + GrProgramDesc*); bool compileAndAttachShaders(GrGLSLShaderBuilder& shader, GrGLuint programId, -- cgit v1.2.3