diff options
author | 2012-08-02 15:15:16 +0000 | |
---|---|---|
committer | 2012-08-02 15:15:16 +0000 | |
commit | a5e65ec434fed44dc616e4f64950b835b541181b (patch) | |
tree | ffe3592179c7c3ce78db8e5e485c641900042015 /src/gpu/gl/GrGLShaderBuilder.h | |
parent | eb7ad4a8b9c67743d6aa4e71b82e32f4cf1c8a9f (diff) |
Introduction of set of functions to manage generation of texture fetch shader code.
A new set of routines have been added to GrGLShaderBuilder to emit texture fetches, taking into consideration the format of the texture to be accessed, and the channel swizzle.
Review URL: https://codereview.appspot.com/6446072
git-svn-id: http://skia.googlecode.com/svn/trunk@4919 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/gl/GrGLShaderBuilder.h')
-rw-r--r-- | src/gpu/gl/GrGLShaderBuilder.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gpu/gl/GrGLShaderBuilder.h b/src/gpu/gl/GrGLShaderBuilder.h index f110628627..16a11e29a0 100644 --- a/src/gpu/gl/GrGLShaderBuilder.h +++ b/src/gpu/gl/GrGLShaderBuilder.h @@ -9,6 +9,7 @@ #define GrGLShaderBuilder_DEFINED #include "GrAllocator.h" +#include "GrCustomStage.h" #include "gl/GrGLShaderVar.h" #include "gl/GrGLSL.h" #include "gl/GrGLUniformManager.h" @@ -55,6 +56,22 @@ public: void emitDefaultFetch(const char* outColor, const char* samplerName); + /** Emits a texture lookup to the shader code with the form: + texture2D{Proj}(samplerName, coordName).swizzle + The routine selects the type of texturing based on samplerMode. + The generated swizzle state is built based on the format of the texture and the requested + swizzle access pattern. */ + void emitCustomTextureLookup(SamplerMode samplerMode, + const GrTextureAccess& textureAccess, + const char* samplerName, + const char* coordName); + + /** Generates a StageKey for the shader code based on the texture access parameters and the + capabilities of the GL context. This is useful for keying the shader programs that may + have multiple representations, based on the type/format of textures used. */ + static GrCustomStage::StageKey KeyForTextureAccess(const GrTextureAccess& access, + const GrGLCaps& caps); + /** Add a uniform variable to the current program, that has visibilty in one or more shaders. visibility is a bitfield of ShaderType values indicating from which shaders the uniform should be accessible. At least one bit must be set. Geometry shader uniforms are not |