diff options
author | Romain Guy <romainguy@google.com> | 2010-07-29 14:37:42 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2010-07-29 14:37:42 -0700 |
commit | 889f8d1403761d5668115ced6cbb3f767cfe966d (patch) | |
tree | 8620d3453e3811dce152630f1b17e0f5f42601c6 /libs/hwui/Program.h | |
parent | 85d8daa889db113b51c5d98929245e80f7277388 (diff) | |
download | frameworks_base-889f8d1403761d5668115ced6cbb3f767cfe966d.zip frameworks_base-889f8d1403761d5668115ced6cbb3f767cfe966d.tar.gz frameworks_base-889f8d1403761d5668115ced6cbb3f767cfe966d.tar.bz2 |
Moved all the rendering code to the new shader generator.
The generator supports features that are not yet implement in the
renderer: color matrix, lighting, porterduff color blending and
composite shaders.
This change also adds support for repeated/mirrored non-power of 2
bitmap shaders.
Change-Id: I903a11a070c0eb9cc8850a60ef305751e5b47234
Diffstat (limited to 'libs/hwui/Program.h')
-rw-r--r-- | libs/hwui/Program.h | 165 |
1 files changed, 23 insertions, 142 deletions
diff --git a/libs/hwui/Program.h b/libs/hwui/Program.h index 2cdd905..6531c74 100644 --- a/libs/hwui/Program.h +++ b/libs/hwui/Program.h @@ -21,7 +21,6 @@ #include <GLES2/gl2ext.h> #include <utils/KeyedVector.h> -#include <utils/RefBase.h> #include "Matrix.h" @@ -32,7 +31,7 @@ namespace uirenderer { * A program holds a vertex and a fragment shader. It offers several utility * methods to query attributes and uniforms. */ -class Program: public LightRefBase<Program> { +class Program { public: /** * Creates a new program with the specified vertex and fragment @@ -70,6 +69,28 @@ public: return mUse; } + /** + * Binds the program with the specified projection, modelView and + * transform matrices. + */ + void set(const mat4& projectionMatrix, const mat4& modelViewMatrix, + const mat4& transformMatrix); + + /** + * Name of the position attribute. + */ + int position; + + /** + * Name of the color uniform. + */ + int color; + + /** + * Name of the transform uniform. + */ + int transform; + protected: /** * Adds an attribute with the specified name. @@ -107,146 +128,6 @@ private: bool mUse; }; // class Program -/** - * Program used to draw vertices with a simple color. The shaders must - * specify the following attributes: - * vec4 position, position of the vertex - * vec4 color, RGBA color of the vertex - * - * And the following uniforms: - * mat4 projection, the projection matrix - * mat4 modelView, the modelView matrix - * mat4 transform, an extra transformation matrix - */ -class DrawColorProgram: public Program { -public: - DrawColorProgram(); - DrawColorProgram(const char* vertex, const char* fragment); - - /** - * Binds the program with the specified projection, modelView and - * transform matrices. - */ - void set(const mat4& projectionMatrix, const mat4& modelViewMatrix, - const mat4& transformMatrix); - - /** - * Binds this program to the GL context. - */ - virtual void use(); - - /** - * Marks this program as unused. This will not unbind - * the program from the GL context. - */ - virtual void remove(); - - /** - * Name of the position attribute. - */ - int position; - - /** - * Name of the texture coordinates attribute. - */ - int texCoords; - - /** - * Name of the color uniform. - */ - int color; - - /** - * Name of the transform uniform. - */ - int transform; - -protected: - void getAttribsAndUniforms(); -}; - -/** - * Program used to draw textured vertices. In addition to everything that the - * DrawColorProgram supports, the following two attributes must be specified: - * sampler2D sampler, the texture sampler - * vec2 texCoords, the texture coordinates of the vertex - */ -class DrawTextureProgram: public DrawColorProgram { -public: - DrawTextureProgram(); - DrawTextureProgram(const char* vertex, const char* fragment); - - /** - * Binds this program to the GL context. - */ - virtual void use(); - - /** - * Marks this program as unused. This will not unbind - * the program from the GL context. - */ - virtual void remove(); - - /** - * Name of the texture sampler uniform. - */ - int sampler; -}; - -class DrawTextProgram: public DrawTextureProgram { -public: - DrawTextProgram(); -}; - -/** - * Program used to draw linear gradients. In addition to everything that the - * DrawColorProgram supports, the following two attributes must be specified: - * vec2 gradient, the vector describing the linear gradient - * float gradientLength, the invert of the magnitude of the gradient vector - * sampler2D sampler, the texture sampler - */ -class DrawLinearGradientProgram: public DrawColorProgram { -public: - DrawLinearGradientProgram(); - - /** - * Binds this program to the GL context. - */ - virtual void use(); - - /** - * Marks this program as unused. This will not unbind - * the program from the GL context. - */ - virtual void remove(); - - /** - * Name of the matrix used to compute the screen space coordinates - * of the vertices. - */ - int screenSpace; - - /** - * Name of the linear gradient start point. - */ - int start; - - /** - * Name of the linear gradient vector. - */ - int gradient; - - /** - * Name of the inverse of linear gradient vector's magnitude. - */ - int gradientLength; - - /** - * Name of the texture sampler uniform. - */ - int sampler; -}; - }; // namespace uirenderer }; // namespace android |