Index: src/gpu/gl/GrGLEffect.h |
diff --git a/src/gpu/gl/GrGLEffect.h b/src/gpu/gl/GrGLEffect.h |
index 24c20c6d57367468a7bf8e0af0be940ab97cc3cc..398bc9a6302c9514ff796e705c24130b224d26ea 100644 |
--- a/src/gpu/gl/GrGLEffect.h |
+++ b/src/gpu/gl/GrGLEffect.h |
@@ -34,11 +34,53 @@ class GrGLTexture; |
class GrGLGeometryProcessor; |
class GrGLEffect { |
- |
public: |
- typedef GrGLProgramEffects::TransformedCoordsArray TransformedCoordsArray; |
- typedef GrGLProgramEffects::TextureSampler TextureSampler; |
- typedef GrGLProgramEffects::TextureSamplerArray TextureSamplerArray; |
+ typedef GrGLProgramDataManager::UniformHandle UniformHandle; |
+ |
+ /** |
+ * Passed to GrGLEffects so they can add transformed coordinates to their shader code. |
+ */ |
+ class TransformedCoords { |
bsalomon
2014/09/18 18:08:33
Curious whether this should be a GrGLShaderVar
|
+ public: |
+ TransformedCoords(const SkString& name, GrSLType type) |
+ : fName(name), fType(type) { |
+ } |
+ |
+ const char* c_str() const { return fName.c_str(); } |
+ GrSLType type() const { return fType; } |
+ const SkString& getName() const { return fName; } |
+ |
+ private: |
+ SkString fName; |
+ GrSLType fType; |
+ }; |
+ |
+ typedef SkTArray<TransformedCoords> TransformedCoordsArray; |
+ |
+ /** |
+ * Passed to GrGLEffects so they can add texture reads to their shader code. |
+ */ |
+ class TextureSampler { |
+ public: |
+ TextureSampler(UniformHandle uniform, const GrTextureAccess& access) |
+ : fSamplerUniform(uniform) |
+ , fConfigComponentMask(GrPixelConfigComponentMask(access.getTexture()->config())) { |
+ SkASSERT(0 != fConfigComponentMask); |
+ memcpy(fSwizzle, access.getSwizzle(), 5); |
+ } |
+ |
+ UniformHandle samplerUniform() const { return fSamplerUniform; } |
bsalomon
2014/09/18 18:08:33
Do they need this?
|
+ // bitfield of GrColorComponentFlags present in the texture's config. |
+ uint32_t configComponentMask() const { return fConfigComponentMask; } |
+ const char* swizzle() const { return fSwizzle; } |
bsalomon
2014/09/18 18:08:33
Maybe a comment that this is ".abcd"
|
+ |
+ private: |
+ UniformHandle fSamplerUniform; |
+ uint32_t fConfigComponentMask; |
+ char fSwizzle[5]; |
+ }; |
+ |
+ typedef SkTArray<TextureSampler> TextureSamplerArray; |
GrGLEffect(const GrBackendEffectFactory& factory) |
: fFactory(factory) |