aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/builders
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-02-09 17:01:22 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-13 14:49:09 +0000
commit3865711259e25a90a1d72480f848863ada202067 (patch)
tree4fc40848238f7d38123fa19032513751923e6bea /src/gpu/gl/builders
parentb34727f1a3150de2e3e95beb79900a0a848a984c (diff)
Replaced all calls to fragmentPosition() with sk_FragCoord
Change-Id: I2ed4558aea74b3ae7ee11dfe4736cdbcb16ae49e Reviewed-on: https://skia-review.googlesource.com/8278 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/gpu/gl/builders')
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.cpp12
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.h7
2 files changed, 14 insertions, 5 deletions
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<GrGLuint>& 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,