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

Unified Diff: src/gpu/gl/GrGLProgramEffects.h

Issue 491673002: Initial refactor of shaderbuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 months 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
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.cpp ('k') | src/gpu/gl/GrGLProgramEffects.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLProgramEffects.h
diff --git a/src/gpu/gl/GrGLProgramEffects.h b/src/gpu/gl/GrGLProgramEffects.h
index 7ae925b69b51073f57731b02d3b8a932f134c851..e4d84a013b8c866be2da06d28cdd2e157c5cb454 100644
--- a/src/gpu/gl/GrGLProgramEffects.h
+++ b/src/gpu/gl/GrGLProgramEffects.h
@@ -16,9 +16,9 @@
class GrEffect;
class GrEffectStage;
class GrGLVertexProgramEffectsBuilder;
-class GrGLShaderBuilder;
-class GrGLFullShaderBuilder;
-class GrGLFragmentOnlyShaderBuilder;
+class GrGLProgramBuilder;
+class GrGLFullProgramBuilder;
+class GrGLFragmentOnlyProgramBuilder;
/**
* This class encapsulates an array of GrGLEffects and their supporting data (coord transforms
@@ -54,6 +54,8 @@ public:
const GrGLProgramDataManager&,
const GrEffectStage* effectStages[]) = 0;
+ void addEffect(GrGLEffect* effect) { fGLEffects.push_back(effect); }
+
/**
* Passed to GrGLEffects so they can add transformed coordinates to their shader code.
*/
@@ -100,6 +102,7 @@ public:
typedef SkTArray<TextureSampler> TextureSamplerArray;
protected:
+
/**
* Helpers for GenEffectMetaKey.
*/
@@ -117,7 +120,7 @@ protected:
* appends the necessary data to the TextureSamplerArray* object so effects can add texture
* lookups to their code. This method is only meant to be called during the construction phase.
*/
- void emitSamplers(GrGLShaderBuilder*, const GrEffect*, TextureSamplerArray*);
+ void emitSamplers(GrGLProgramBuilder*, const GrEffect*, TextureSamplerArray*);
/**
* Helper for setData(). Binds all the textures for an effect.
@@ -134,6 +137,7 @@ protected:
SkTArray<SkSTArray<4, Sampler, true> > fSamplers;
private:
+ friend class GrGLFragmentO;
typedef SkRefCnt INHERITED;
};
@@ -143,7 +147,6 @@ private:
class GrGLProgramEffectsBuilder {
public:
virtual ~GrGLProgramEffectsBuilder() { }
-
/**
* Emits the effect's shader code, and stores the necessary uniforms internally.
*/
@@ -166,19 +169,17 @@ public:
const GrEffectStage* effectStages[]) SK_OVERRIDE;
private:
- friend class GrGLVertexProgramEffectsBuilder;
+ friend class GrGLFullProgramBuilder;
GrGLVertexProgramEffects(int reserveCount, bool explicitLocalCoords)
: INHERITED(reserveCount)
, fTransforms(reserveCount)
, fHasExplicitLocalCoords(explicitLocalCoords) {
}
-
/**
- * Helper for GrGLProgramEffectsBuilder::emitEfffect(). This method is meant to only be called
- * during the construction phase.
+ * This method is meant to only be called during the construction phase.
*/
- void emitEffect(GrGLFullShaderBuilder*,
+ void emitEffect(GrGLFullProgramBuilder*,
const GrEffectStage&,
const GrEffectKey&,
const char* outColor,
@@ -188,7 +189,7 @@ private:
/**
* Helper for emitEffect(). Emits any attributes an effect may have.
*/
- void emitAttributes(GrGLFullShaderBuilder*, const GrEffectStage&);
+ void emitAttributes(GrGLFullProgramBuilder*, const GrEffectStage&);
/**
* Helper for emitEffect(). Emits code to implement an effect's coord transforms in the VS.
@@ -197,7 +198,7 @@ private:
* of the varyings in the VS and FS as well their types are appended to the
* TransformedCoordsArray* object, which is in turn passed to the effect's emitCode() function.
*/
- void emitTransforms(GrGLFullShaderBuilder*,
+ void emitTransforms(GrGLFullProgramBuilder*,
const GrDrawEffect&,
TransformedCoordsArray*);
@@ -215,6 +216,8 @@ private:
SkTArray<SkSTArray<2, Transform, true> > fTransforms;
bool fHasExplicitLocalCoords;
+ friend class GrGLVertexProgramEffectsBuilder;
+
typedef GrGLProgramEffects INHERITED;
};
@@ -223,25 +226,21 @@ private:
*/
class GrGLVertexProgramEffectsBuilder : public GrGLProgramEffectsBuilder {
public:
- GrGLVertexProgramEffectsBuilder(GrGLFullShaderBuilder*, int reserveCount);
+ GrGLVertexProgramEffectsBuilder(GrGLFullProgramBuilder*, int reserveCount);
virtual ~GrGLVertexProgramEffectsBuilder() { }
-
virtual void emitEffect(const GrEffectStage&,
const GrEffectKey&,
const char* outColor,
const char* inColor,
int stageIndex) SK_OVERRIDE;
-
/**
* Finalizes the building process and returns the effect array. After this call, the builder
* becomes invalid.
*/
GrGLProgramEffects* finish() { return fProgramEffects.detach(); }
-
private:
- GrGLFullShaderBuilder* fBuilder;
+ GrGLFullProgramBuilder* fBuilder;
SkAutoTDelete<GrGLVertexProgramEffects> fProgramEffects;
-
typedef GrGLProgramEffectsBuilder INHERITED;
};
@@ -258,7 +257,7 @@ public:
const GrEffectStage* effectStages[]) SK_OVERRIDE;
private:
- friend class GrGLPathTexGenProgramEffectsBuilder;
+ friend class GrGLFragmentOnlyProgramBuilder;
GrGLPathTexGenProgramEffects(int reserveCount)
: INHERITED(reserveCount)
@@ -266,10 +265,9 @@ private:
}
/**
- * Helper for GrGLProgramEffectsBuilder::emitEfffect(). This method is meant to only be called
- * during the construction phase.
+ * This method is meant to only be called during the construction phase.
*/
- void emitEffect(GrGLFragmentOnlyShaderBuilder*,
+ void emitEffect(GrGLFragmentOnlyProgramBuilder*,
const GrEffectStage&,
const GrEffectKey&,
const char* outColor,
@@ -284,7 +282,7 @@ private:
* types are appended to the TransformedCoordsArray* object, which is in turn passed to the
* effect's emitCode() function.
*/
- void setupPathTexGen(GrGLFragmentOnlyShaderBuilder*,
+ void setupPathTexGen(GrGLFragmentOnlyProgramBuilder*,
const GrDrawEffect&,
TransformedCoordsArray*);
@@ -302,6 +300,7 @@ private:
SkTArray<Transforms> fTransforms;
+ friend class GrGLPathTexGenProgramEffectsBuilder;
typedef GrGLProgramEffects INHERITED;
};
@@ -310,26 +309,23 @@ private:
*/
class GrGLPathTexGenProgramEffectsBuilder : public GrGLProgramEffectsBuilder {
public:
- GrGLPathTexGenProgramEffectsBuilder(GrGLFragmentOnlyShaderBuilder*, int reserveCount);
+ GrGLPathTexGenProgramEffectsBuilder(GrGLFragmentOnlyProgramBuilder*, int reserveCount);
virtual ~GrGLPathTexGenProgramEffectsBuilder() { }
-
virtual void emitEffect(const GrEffectStage&,
const GrEffectKey&,
const char* outColor,
const char* inColor,
int stageIndex) SK_OVERRIDE;
-
/**
* Finalizes the building process and returns the effect array. After this call, the builder
* becomes invalid.
*/
GrGLProgramEffects* finish() { return fProgramEffects.detach(); }
-
private:
- GrGLFragmentOnlyShaderBuilder* fBuilder;
+ GrGLFragmentOnlyProgramBuilder* fBuilder;
SkAutoTDelete<GrGLPathTexGenProgramEffects> fProgramEffects;
-
typedef GrGLProgramEffectsBuilder INHERITED;
};
+
#endif
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.cpp ('k') | src/gpu/gl/GrGLProgramEffects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698