From a5e65ec434fed44dc616e4f64950b835b541181b Mon Sep 17 00:00:00 2001 From: "twiz@google.com" Date: Thu, 2 Aug 2012 15:15:16 +0000 Subject: 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 --- src/gpu/gl/GrGLShaderBuilder.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/gpu/gl/GrGLShaderBuilder.h') 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 -- cgit v1.2.3