Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Unified Diff: src/gpu/gl/builders/GrGLProgramBuilder.h

Issue 1434483002: Add addFragPosUniform to GrGLrogramBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/gl/builders/GrGLProgramBuilder.h
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h
index e1525c42efca2cbfdf00f6baf62e25d46d4e0856..4228d24485f037dd26d29645ba1b9376302ad72d 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.h
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.h
@@ -68,7 +68,19 @@ public:
GrSLPrecision precision,
const char* name,
int arrayCount,
- const char** outName = nullptr) = 0;
+ const char** outName = nullptr) {
+ return this->internalAddUniformArray(visibility, type, precision, name, true, arrayCount,
+ outName);
+ }
+
+ UniformHandle addFragPosUniform(uint32_t visibility,
joshualitt 2015/11/04 21:50:52 However you want to handle this, it should be priv
egdaniel 2015/11/05 21:49:59 Done.
+ GrSLType type,
+ GrSLPrecision precision,
+ const char* name,
+ const char** outName) {
+ return this->internalAddUniformArray(visibility, type, precision, name, false, 0, outName);
+ }
+
virtual const GrGLSLShaderVar& getUniformVariable(UniformHandle u) const = 0;
@@ -86,6 +98,15 @@ public:
/*
* *NOTE* NO MEMBERS ALLOWED, MULTIPLE INHERITANCE
*/
+private:
+ virtual UniformHandle internalAddUniformArray(
+ uint32_t visibility,
+ GrSLType type,
+ GrSLPrecision precision,
+ const char* name,
+ bool mangleName,
+ int arrayCount,
+ const char** outName) = 0;
};
// TODO move this into GrGLGPBuilder and move them both out of this file
@@ -239,12 +260,13 @@ public:
*/
static GrGLProgram* CreateProgram(const DrawArgs&, GrGLGpu*);
joshualitt 2015/11/04 21:50:52 This should be private
egdaniel 2015/11/05 21:49:59 Done.
- UniformHandle addUniformArray(uint32_t visibility,
- GrSLType type,
- GrSLPrecision precision,
- const char* name,
- int arrayCount,
- const char** outName) override;
+ UniformHandle internalAddUniformArray(uint32_t visibility,
+ GrSLType type,
+ GrSLPrecision precision,
+ const char* name,
+ bool mangleName,
+ int arrayCount,
+ const char** outName) override;
const GrGLSLShaderVar& getUniformVariable(UniformHandle u) const override {
return fUniforms[u.toIndex()].fVariable;
@@ -300,8 +322,8 @@ protected:
// Generates a name for a variable. The generated string will be name prefixed by the prefix
// char (unless the prefix is '\0'). It also mangles the name to be stage-specific if we're
- // generating stage code.
- void nameVariable(SkString* out, char prefix, const char* name);
+ // generating stage code and mangle is true.
+ void nameVariable(SkString* out, char prefix, const char* name, bool mangle = true);
// Generates a possibly mangled name for a stage variable and writes it to the fragment shader.
// If GrGLSLExpr4 has a valid name then it will use that instead
void nameExpression(GrGLSLExpr4*, const char* baseName);
@@ -362,16 +384,6 @@ protected:
}
void addStage() { fStageIndex++; }
- // This simple class exits the stage and then restores the stage when it goes out of scope
- class AutoStageRestore {
- public:
- AutoStageRestore(GrGLProgramBuilder* pb)
- : fPB(pb), fOutOfStage(pb->fOutOfStage) { pb->exitStage(); }
- ~AutoStageRestore() { fPB->fOutOfStage = fOutOfStage; }
- private:
- GrGLProgramBuilder* fPB;
- bool fOutOfStage;
- };
class AutoStageAdvance {
public:
AutoStageAdvance(GrGLProgramBuilder* pb)

Powered by Google App Engine
This is Rietveld 408576698