aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/glsl/GrGLSLCaps.h
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-01-08 11:38:41 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-08 11:38:41 -0800
commit1a1efeacf7cc94a8c2977114dfe230fed3efc105 (patch)
treee91f058ed01fc4c25f410d7609e8123b1af776bc /src/gpu/glsl/GrGLSLCaps.h
parent04d975ac34c97d4869f819d2ad7c9fda47c198af (diff)
Add a class representing texture swizzle.
Store config swizzle GrGLCaps and shader swizzles in GrGLSLCaps. Remove GrTextureAccess's swizzle and update users of it to swizzle in their shader code. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1567733005 Review URL: https://codereview.chromium.org/1567733005
Diffstat (limited to 'src/gpu/glsl/GrGLSLCaps.h')
-rwxr-xr-xsrc/gpu/glsl/GrGLSLCaps.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/gpu/glsl/GrGLSLCaps.h b/src/gpu/glsl/GrGLSLCaps.h
index 21c59e7b16..eba9602e5a 100755
--- a/src/gpu/glsl/GrGLSLCaps.h
+++ b/src/gpu/glsl/GrGLSLCaps.h
@@ -11,6 +11,7 @@
#include "GrCaps.h"
#include "GrGLSL.h"
+#include "GrSwizzle.h"
class GrGLSLCaps : public GrShaderCaps {
public:
@@ -104,14 +105,14 @@ public:
return fExternalTextureExtensionString;
}
- bool mustSwizzleInShader() const { return fMustSwizzleInShader; }
-
/**
- * Returns a string which represents how to map from an internal GLFormat to a given
- * GrPixelConfig. The function mustSwizzleInShader determines whether this swizzle is applied
- * in the generated shader code or using sample state in the 3D API.
+ * Given a texture's config, this determines what swizzle must be appended to accesses to the
+ * texture in generated shader code. Swizzling may be implemented in texture parameters or a
+ * sampler rather than in the shader. In this case the shader swizzle will always be "rgba".
*/
- const char* getSwizzleMap(GrPixelConfig config) const { return fConfigSwizzle[config]; }
+ const GrSwizzle& configTextureSwizzle(GrPixelConfig config) const {
+ return fConfigTextureSwizzle[config];
+ }
GrGLSLGeneration generation() const { return fGLSLGeneration; }
@@ -148,13 +149,11 @@ private:
AdvBlendEqInteraction fAdvBlendEqInteraction;
- bool fMustSwizzleInShader;
- const char* fConfigSwizzle[kGrPixelConfigCnt];
+ GrSwizzle fConfigTextureSwizzle[kGrPixelConfigCnt];
friend class GrGLCaps; // For initialization.
typedef GrShaderCaps INHERITED;
};
-
#endif