blob: 5c8f8e93fa3d250e2d5bd83ab8c2fbacaf4f92a8 [file] [log] [blame]
Romain Guy5cbbce52010-06-27 22:59:20 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Romain Guy5b3b3522010-10-27 18:57:51 -070017#ifndef ANDROID_HWUI_PROGRAM_H
18#define ANDROID_HWUI_PROGRAM_H
Romain Guy5cbbce52010-06-27 22:59:20 -070019
Romain Guyf3a910b42011-12-12 20:35:21 -080020#include <utils/KeyedVector.h>
21
Romain Guy5cbbce52010-06-27 22:59:20 -070022#include <GLES2/gl2.h>
23#include <GLES2/gl2ext.h>
24
Mike Reedc2f31df2016-10-28 17:21:45 -040025#include <SkBlendMode.h>
Romain Guy5cbbce52010-06-27 22:59:20 -070026
Chris Craik096b8d92013-03-01 11:08:11 -080027#include "Debug.h"
Chris Craik0519c8102015-02-11 13:17:06 -080028#include "FloatColor.h"
Romain Guy0b9db912010-07-09 18:53:25 -070029#include "Matrix.h"
Romain Guyf3a910b42011-12-12 20:35:21 -080030#include "Properties.h"
Romain Guy0b9db912010-07-09 18:53:25 -070031
Romain Guy5cbbce52010-06-27 22:59:20 -070032namespace android {
33namespace uirenderer {
34
Romain Guyf3a910b42011-12-12 20:35:21 -080035///////////////////////////////////////////////////////////////////////////////
36// Defines
37///////////////////////////////////////////////////////////////////////////////
38
39// Debug
40#if DEBUG_PROGRAMS
Steve Block5baa3a62011-12-20 16:23:08 +000041 #define PROGRAM_LOGD(...) ALOGD(__VA_ARGS__)
Romain Guyf3a910b42011-12-12 20:35:21 -080042#else
43 #define PROGRAM_LOGD(...)
44#endif
45
Romain Guyf8773082012-07-12 18:01:00 -070046#define COLOR_COMPONENT_THRESHOLD 1.0f
47#define COLOR_COMPONENT_INV_THRESHOLD 0.0f
Romain Guyf3a910b42011-12-12 20:35:21 -080048
Chris Craikdeeda3d2014-05-05 19:09:33 -070049#define PROGRAM_KEY_TEXTURE 0x01
50#define PROGRAM_KEY_A8_TEXTURE 0x02
51#define PROGRAM_KEY_BITMAP 0x04
52#define PROGRAM_KEY_GRADIENT 0x08
53#define PROGRAM_KEY_BITMAP_FIRST 0x10
54#define PROGRAM_KEY_COLOR_MATRIX 0x20
55#define PROGRAM_KEY_COLOR_BLEND 0x40
56#define PROGRAM_KEY_BITMAP_NPOT 0x80
sergeyv9c97e482016-12-12 16:14:11 -080057#define PROGRAM_KEY_BITMAP_EXTERNAL 0x100
Romain Guyf3a910b42011-12-12 20:35:21 -080058
Chris Craikdeeda3d2014-05-05 19:09:33 -070059#define PROGRAM_KEY_SWAP_SRC_DST 0x2000
60
61#define PROGRAM_KEY_BITMAP_WRAPS_MASK 0x600
Romain Guyf3a910b42011-12-12 20:35:21 -080062#define PROGRAM_KEY_BITMAP_WRAPT_MASK 0x1800
63
64// Encode the xfermodes on 6 bits
65#define PROGRAM_MAX_XFERMODE 0x1f
66#define PROGRAM_XFERMODE_SHADER_SHIFT 26
67#define PROGRAM_XFERMODE_COLOR_OP_SHIFT 20
68#define PROGRAM_XFERMODE_FRAMEBUFFER_SHIFT 14
69
70#define PROGRAM_BITMAP_WRAPS_SHIFT 9
71#define PROGRAM_BITMAP_WRAPT_SHIFT 11
72
Chris Craik6d29c8d2013-05-08 18:35:44 -070073#define PROGRAM_GRADIENT_TYPE_SHIFT 33 // 2 bits for gradient type
Romain Guyf3a910b42011-12-12 20:35:21 -080074#define PROGRAM_MODULATE_SHIFT 35
75
Chris Craik91a8c7c2014-08-12 14:31:35 -070076#define PROGRAM_HAS_VERTEX_ALPHA_SHIFT 36
77#define PROGRAM_USE_SHADOW_ALPHA_INTERP_SHIFT 37
Romain Guyf3a910b42011-12-12 20:35:21 -080078
Chris Craikbf759452014-08-11 16:00:44 -070079#define PROGRAM_HAS_EXTERNAL_TEXTURE_SHIFT 38
80#define PROGRAM_HAS_TEXTURE_TRANSFORM_SHIFT 39
Romain Guyf3a910b42011-12-12 20:35:21 -080081
Chris Craik11718bc2015-09-22 11:50:13 -070082#define PROGRAM_IS_SIMPLE_GRADIENT 40
Romain Guyf3a910b42011-12-12 20:35:21 -080083
Chris Craik11718bc2015-09-22 11:50:13 -070084#define PROGRAM_HAS_COLORS 41
Romain Guy41210632012-07-16 17:04:24 -070085
Chris Craik11718bc2015-09-22 11:50:13 -070086#define PROGRAM_HAS_DEBUG_HIGHLIGHT 42
87#define PROGRAM_HAS_ROUND_RECT_CLIP 43
Romain Guy3ff0bfd2013-02-25 14:15:37 -080088
Romain Guy253f2c22016-09-28 17:34:42 -070089#define PROGRAM_HAS_GAMMA_CORRECTION 44
Romain Guy636afc12017-02-07 11:21:05 -080090#define PROGRAM_HAS_LINEAR_TEXTURE 45
Romain Guy253f2c22016-09-28 17:34:42 -070091
Romain Guyf3a910b42011-12-12 20:35:21 -080092///////////////////////////////////////////////////////////////////////////////
93// Types
94///////////////////////////////////////////////////////////////////////////////
95
96typedef uint64_t programid;
97
98///////////////////////////////////////////////////////////////////////////////
99// Program description
100///////////////////////////////////////////////////////////////////////////////
101
102/**
103 * Describe the features required for a given program. The features
104 * determine the generation of both the vertex and fragment shaders.
105 * A ProgramDescription must be used in conjunction with a ProgramCache.
106 */
107struct ProgramDescription {
Chris Craikb9ce116d2015-08-20 15:14:06 -0700108 enum class ColorFilterMode {
109 None = 0,
110 Matrix,
111 Blend
Romain Guyf3a910b42011-12-12 20:35:21 -0800112 };
113
114 enum Gradient {
Romain Guy42e1e0d2012-07-30 14:47:51 -0700115 kGradientLinear = 0,
Romain Guyf3a910b42011-12-12 20:35:21 -0800116 kGradientCircular,
117 kGradientSweep
118 };
119
120 ProgramDescription() {
121 reset();
122 }
123
124 // Texturing
125 bool hasTexture;
126 bool hasAlpha8Texture;
127 bool hasExternalTexture;
128 bool hasTextureTransform;
129
Romain Guyff316ec2013-02-13 18:39:43 -0800130 // Color attribute
131 bool hasColors;
132
Romain Guyf3a910b42011-12-12 20:35:21 -0800133 // Modulate, this should only be set when setColor() return true
134 bool modulate;
135
136 // Shaders
137 bool hasBitmap;
sergeyv9c97e482016-12-12 16:14:11 -0800138 bool isShaderBitmapExternal;
sergeyv554ffeb2016-11-15 18:01:21 -0800139 bool useShaderBasedWrap;
Romain Guyf3a910b42011-12-12 20:35:21 -0800140
Chris Craik91a8c7c2014-08-12 14:31:35 -0700141 bool hasVertexAlpha;
142 bool useShadowAlphaInterp;
Romain Guyf3a910b42011-12-12 20:35:21 -0800143
144 bool hasGradient;
145 Gradient gradientType;
Romain Guy42e1e0d2012-07-30 14:47:51 -0700146 bool isSimpleGradient;
Romain Guyf3a910b42011-12-12 20:35:21 -0800147
Mike Reedc2f31df2016-10-28 17:21:45 -0400148 SkBlendMode shadersMode;
Romain Guyf3a910b42011-12-12 20:35:21 -0800149
150 bool isBitmapFirst;
151 GLenum bitmapWrapS;
152 GLenum bitmapWrapT;
153
154 // Color operations
Chris Craik117bdbc2015-02-05 10:12:38 -0800155 ColorFilterMode colorOp;
Mike Reedc2f31df2016-10-28 17:21:45 -0400156 SkBlendMode colorMode;
Romain Guyf3a910b42011-12-12 20:35:21 -0800157
158 // Framebuffer blending (requires Extensions.hasFramebufferFetch())
Mike Reedc2f31df2016-10-28 17:21:45 -0400159 // Ignored for all values < SkBlendMode::kPlus
160 SkBlendMode framebufferMode;
Romain Guyf3a910b42011-12-12 20:35:21 -0800161 bool swapSrcDst;
162
Romain Guy3ff0bfd2013-02-25 14:15:37 -0800163 bool hasDebugHighlight;
Chris Craikdeeda3d2014-05-05 19:09:33 -0700164 bool hasRoundRectClip;
Romain Guy3ff0bfd2013-02-25 14:15:37 -0800165
Romain Guy636afc12017-02-07 11:21:05 -0800166 // Extra gamma correction used for text
Romain Guy253f2c22016-09-28 17:34:42 -0700167 bool hasGammaCorrection;
Romain Guy636afc12017-02-07 11:21:05 -0800168 // Set when sampling an image in linear space
169 bool hasLinearTexture;
Romain Guy253f2c22016-09-28 17:34:42 -0700170
Romain Guyf3a910b42011-12-12 20:35:21 -0800171 /**
172 * Resets this description. All fields are reset back to the default
173 * values they hold after building a new instance.
174 */
175 void reset() {
176 hasTexture = false;
177 hasAlpha8Texture = false;
178 hasExternalTexture = false;
179 hasTextureTransform = false;
180
Romain Guyff316ec2013-02-13 18:39:43 -0800181 hasColors = false;
182
Chris Craik91a8c7c2014-08-12 14:31:35 -0700183 hasVertexAlpha = false;
184 useShadowAlphaInterp = false;
Romain Guyf3a910b42011-12-12 20:35:21 -0800185
186 modulate = false;
187
188 hasBitmap = false;
sergeyv9c97e482016-12-12 16:14:11 -0800189 isShaderBitmapExternal = false;
sergeyv554ffeb2016-11-15 18:01:21 -0800190 useShaderBasedWrap = false;
Romain Guyf3a910b42011-12-12 20:35:21 -0800191
192 hasGradient = false;
193 gradientType = kGradientLinear;
Romain Guy42e1e0d2012-07-30 14:47:51 -0700194 isSimpleGradient = false;
Romain Guyf3a910b42011-12-12 20:35:21 -0800195
Mike Reedc2f31df2016-10-28 17:21:45 -0400196 shadersMode = SkBlendMode::kClear;
Romain Guyf3a910b42011-12-12 20:35:21 -0800197
198 isBitmapFirst = false;
199 bitmapWrapS = GL_CLAMP_TO_EDGE;
200 bitmapWrapT = GL_CLAMP_TO_EDGE;
201
Chris Craikb9ce116d2015-08-20 15:14:06 -0700202 colorOp = ColorFilterMode::None;
Mike Reedc2f31df2016-10-28 17:21:45 -0400203 colorMode = SkBlendMode::kClear;
Romain Guyf3a910b42011-12-12 20:35:21 -0800204
Mike Reedc2f31df2016-10-28 17:21:45 -0400205 framebufferMode = SkBlendMode::kClear;
Romain Guyf3a910b42011-12-12 20:35:21 -0800206 swapSrcDst = false;
207
Romain Guy3ff0bfd2013-02-25 14:15:37 -0800208 hasDebugHighlight = false;
Chris Craikdeeda3d2014-05-05 19:09:33 -0700209 hasRoundRectClip = false;
Romain Guy253f2c22016-09-28 17:34:42 -0700210
211 hasGammaCorrection = false;
Romain Guy636afc12017-02-07 11:21:05 -0800212 hasLinearTexture = false;
Romain Guyf3a910b42011-12-12 20:35:21 -0800213 }
214
215 /**
216 * Indicates, for a given color, whether color modulation is required in
217 * the fragment shader. When this method returns true, the program should
218 * be provided with a modulation color.
219 */
Chris Craike63f7c622013-10-17 10:30:55 -0700220 bool setColorModulate(const float a) {
Romain Guya938f562012-09-13 20:31:08 -0700221 modulate = a < COLOR_COMPONENT_THRESHOLD;
Romain Guyf3a910b42011-12-12 20:35:21 -0800222 return modulate;
223 }
224
225 /**
226 * Indicates, for a given color, whether color modulation is required in
227 * the fragment shader. When this method returns true, the program should
228 * be provided with a modulation color.
229 */
Chris Craike63f7c622013-10-17 10:30:55 -0700230 bool setAlpha8ColorModulate(const float r, const float g, const float b, const float a) {
Romain Guyf3a910b42011-12-12 20:35:21 -0800231 modulate = a < COLOR_COMPONENT_THRESHOLD || r > COLOR_COMPONENT_INV_THRESHOLD ||
232 g > COLOR_COMPONENT_INV_THRESHOLD || b > COLOR_COMPONENT_INV_THRESHOLD;
233 return modulate;
234 }
235
236 /**
237 * Computes the unique key identifying this program.
238 */
239 programid key() const {
240 programid key = 0;
241 if (hasTexture) key |= PROGRAM_KEY_TEXTURE;
242 if (hasAlpha8Texture) key |= PROGRAM_KEY_A8_TEXTURE;
243 if (hasBitmap) {
244 key |= PROGRAM_KEY_BITMAP;
sergeyv554ffeb2016-11-15 18:01:21 -0800245 if (useShaderBasedWrap) {
Romain Guyf3a910b42011-12-12 20:35:21 -0800246 key |= PROGRAM_KEY_BITMAP_NPOT;
247 key |= getEnumForWrap(bitmapWrapS) << PROGRAM_BITMAP_WRAPS_SHIFT;
248 key |= getEnumForWrap(bitmapWrapT) << PROGRAM_BITMAP_WRAPT_SHIFT;
249 }
sergeyv9c97e482016-12-12 16:14:11 -0800250 if (isShaderBitmapExternal) {
251 key |= PROGRAM_KEY_BITMAP_EXTERNAL;
252 }
Romain Guyf3a910b42011-12-12 20:35:21 -0800253 }
254 if (hasGradient) key |= PROGRAM_KEY_GRADIENT;
255 key |= programid(gradientType) << PROGRAM_GRADIENT_TYPE_SHIFT;
256 if (isBitmapFirst) key |= PROGRAM_KEY_BITMAP_FIRST;
257 if (hasBitmap && hasGradient) {
Mike Reedc2f31df2016-10-28 17:21:45 -0400258 key |= ((int)shadersMode & PROGRAM_MAX_XFERMODE) << PROGRAM_XFERMODE_SHADER_SHIFT;
Romain Guyf3a910b42011-12-12 20:35:21 -0800259 }
260 switch (colorOp) {
Chris Craikb9ce116d2015-08-20 15:14:06 -0700261 case ColorFilterMode::Matrix:
Romain Guyf3a910b42011-12-12 20:35:21 -0800262 key |= PROGRAM_KEY_COLOR_MATRIX;
263 break;
Chris Craikb9ce116d2015-08-20 15:14:06 -0700264 case ColorFilterMode::Blend:
Romain Guyf3a910b42011-12-12 20:35:21 -0800265 key |= PROGRAM_KEY_COLOR_BLEND;
Mike Reedc2f31df2016-10-28 17:21:45 -0400266 key |= ((int)colorMode & PROGRAM_MAX_XFERMODE) << PROGRAM_XFERMODE_COLOR_OP_SHIFT;
Romain Guyf3a910b42011-12-12 20:35:21 -0800267 break;
Chris Craikb9ce116d2015-08-20 15:14:06 -0700268 case ColorFilterMode::None:
Romain Guyf3a910b42011-12-12 20:35:21 -0800269 break;
270 }
Mike Reedc2f31df2016-10-28 17:21:45 -0400271 key |= ((int)framebufferMode & PROGRAM_MAX_XFERMODE) << PROGRAM_XFERMODE_FRAMEBUFFER_SHIFT;
Romain Guyf3a910b42011-12-12 20:35:21 -0800272 if (swapSrcDst) key |= PROGRAM_KEY_SWAP_SRC_DST;
273 if (modulate) key |= programid(0x1) << PROGRAM_MODULATE_SHIFT;
Chris Craik91a8c7c2014-08-12 14:31:35 -0700274 if (hasVertexAlpha) key |= programid(0x1) << PROGRAM_HAS_VERTEX_ALPHA_SHIFT;
275 if (useShadowAlphaInterp) key |= programid(0x1) << PROGRAM_USE_SHADOW_ALPHA_INTERP_SHIFT;
Romain Guyf3a910b42011-12-12 20:35:21 -0800276 if (hasExternalTexture) key |= programid(0x1) << PROGRAM_HAS_EXTERNAL_TEXTURE_SHIFT;
277 if (hasTextureTransform) key |= programid(0x1) << PROGRAM_HAS_TEXTURE_TRANSFORM_SHIFT;
Romain Guy42e1e0d2012-07-30 14:47:51 -0700278 if (isSimpleGradient) key |= programid(0x1) << PROGRAM_IS_SIMPLE_GRADIENT;
Romain Guyff316ec2013-02-13 18:39:43 -0800279 if (hasColors) key |= programid(0x1) << PROGRAM_HAS_COLORS;
Romain Guy3ff0bfd2013-02-25 14:15:37 -0800280 if (hasDebugHighlight) key |= programid(0x1) << PROGRAM_HAS_DEBUG_HIGHLIGHT;
Chris Craikdeeda3d2014-05-05 19:09:33 -0700281 if (hasRoundRectClip) key |= programid(0x1) << PROGRAM_HAS_ROUND_RECT_CLIP;
Romain Guy253f2c22016-09-28 17:34:42 -0700282 if (hasGammaCorrection) key |= programid(0x1) << PROGRAM_HAS_GAMMA_CORRECTION;
Romain Guy636afc12017-02-07 11:21:05 -0800283 if (hasLinearTexture) key |= programid(0x1) << PROGRAM_HAS_LINEAR_TEXTURE;
Romain Guyf3a910b42011-12-12 20:35:21 -0800284 return key;
285 }
286
287 /**
288 * Logs the specified message followed by the key identifying this program.
289 */
290 void log(const char* message) const {
291#if DEBUG_PROGRAMS
292 programid k = key();
293 PROGRAM_LOGD("%s (key = 0x%.8x%.8x)", message, uint32_t(k >> 32),
294 uint32_t(k & 0xffffffff));
295#endif
296 }
297
298private:
Romain Guy41210632012-07-16 17:04:24 -0700299 static inline uint32_t getEnumForWrap(GLenum wrap) {
Romain Guyf3a910b42011-12-12 20:35:21 -0800300 switch (wrap) {
301 case GL_CLAMP_TO_EDGE:
302 return 0;
303 case GL_REPEAT:
304 return 1;
305 case GL_MIRRORED_REPEAT:
306 return 2;
307 }
308 return 0;
309 }
310
311}; // struct ProgramDescription
312
Romain Guy5cbbce52010-06-27 22:59:20 -0700313/**
314 * A program holds a vertex and a fragment shader. It offers several utility
315 * methods to query attributes and uniforms.
316 */
Romain Guy889f8d12010-07-29 14:37:42 -0700317class Program {
Romain Guy5cbbce52010-06-27 22:59:20 -0700318public:
Romain Guy3e263fa2011-12-12 16:47:48 -0800319 enum ShaderBindings {
320 kBindingPosition,
321 kBindingTexCoords
322 };
323
Romain Guy5cbbce52010-06-27 22:59:20 -0700324 /**
325 * Creates a new program with the specified vertex and fragment
326 * shaders sources.
327 */
Romain Guyf3a910b42011-12-12 20:35:21 -0800328 Program(const ProgramDescription& description, const char* vertex, const char* fragment);
Romain Guy6926c722010-07-12 20:20:03 -0700329 virtual ~Program();
Romain Guy5cbbce52010-06-27 22:59:20 -0700330
331 /**
332 * Binds this program to the GL context.
333 */
Romain Guy6926c722010-07-12 20:20:03 -0700334 virtual void use();
Romain Guy5cbbce52010-06-27 22:59:20 -0700335
Romain Guy260e1022010-07-12 14:41:06 -0700336 /**
337 * Marks this program as unused. This will not unbind
338 * the program from the GL context.
339 */
Romain Guy6926c722010-07-12 20:20:03 -0700340 virtual void remove();
Romain Guy260e1022010-07-12 14:41:06 -0700341
342 /**
Romain Guyac670c02010-07-27 17:39:27 -0700343 * Returns the OpenGL name of the specified attribute.
344 */
345 int getAttrib(const char* name);
346
347 /**
348 * Returns the OpenGL name of the specified uniform.
349 */
350 int getUniform(const char* name);
351
352 /**
Romain Guy260e1022010-07-12 14:41:06 -0700353 * Indicates whether this program is currently in use with
354 * the GL context.
355 */
356 inline bool isInUse() const {
357 return mUse;
358 }
359
Romain Guy889f8d12010-07-29 14:37:42 -0700360 /**
Romain Guy67f27952010-12-07 20:09:23 -0800361 * Indicates whether this program was correctly compiled and linked.
362 */
363 inline bool isInitialized() const {
364 return mInitialized;
365 }
366
367 /**
Romain Guy889f8d12010-07-29 14:37:42 -0700368 * Binds the program with the specified projection, modelView and
369 * transform matrices.
370 */
371 void set(const mat4& projectionMatrix, const mat4& modelViewMatrix,
Chet Haase8a5cc922011-04-26 07:28:09 -0700372 const mat4& transformMatrix, bool offset = false);
Romain Guy889f8d12010-07-29 14:37:42 -0700373
374 /**
Romain Guy707b2f72010-10-11 16:34:59 -0700375 * Sets the color associated with this shader.
376 */
Chris Craik0519c8102015-02-11 13:17:06 -0800377 void setColor(FloatColor color);
Romain Guy707b2f72010-10-11 16:34:59 -0700378
379 /**
Chris Craik6c15ffa2015-02-02 13:50:55 -0800380 * Name of the texCoords attribute if it exists (kBindingTexCoords), -1 otherwise.
Romain Guyf3a910b42011-12-12 20:35:21 -0800381 */
382 int texCoords;
383
384 /**
Romain Guy889f8d12010-07-29 14:37:42 -0700385 * Name of the transform uniform.
386 */
387 int transform;
388
Romain Guy39284b72012-09-26 16:39:40 -0700389 /**
390 * Name of the projection uniform.
391 */
392 int projection;
393
Romain Guy5cbbce52010-06-27 22:59:20 -0700394protected:
395 /**
396 * Adds an attribute with the specified name.
397 *
398 * @return The OpenGL name of the attribute.
399 */
400 int addAttrib(const char* name);
Romain Guy5cbbce52010-06-27 22:59:20 -0700401
402 /**
Romain Guy3e263fa2011-12-12 16:47:48 -0800403 * Binds the specified attribute name to the specified slot.
404 */
405 int bindAttrib(const char* name, ShaderBindings bindingSlot);
406
407 /**
Romain Guy5cbbce52010-06-27 22:59:20 -0700408 * Adds a uniform with the specified name.
409 *
410 * @return The OpenGL name of the uniform.
411 */
412 int addUniform(const char* name);
Romain Guy5cbbce52010-06-27 22:59:20 -0700413
414private:
415 /**
416 * Compiles the specified shader of the specified type.
417 *
418 * @return The name of the compiled shader.
419 */
420 GLuint buildShader(const char* source, GLenum type);
421
Romain Guy3e263fa2011-12-12 16:47:48 -0800422 // Name of the OpenGL program and shaders
Romain Guy05bbde72011-12-09 12:55:37 -0800423 GLuint mProgramId;
Romain Guy3e263fa2011-12-12 16:47:48 -0800424 GLuint mVertexShader;
425 GLuint mFragmentShader;
Romain Guy5cbbce52010-06-27 22:59:20 -0700426
427 // Keeps track of attributes and uniforms slots
Romain Guy05bbde72011-12-09 12:55:37 -0800428 KeyedVector<const char*, int> mAttributes;
429 KeyedVector<const char*, int> mUniforms;
Romain Guy260e1022010-07-12 14:41:06 -0700430
431 bool mUse;
Romain Guy67f27952010-12-07 20:09:23 -0800432 bool mInitialized;
Romain Guy05bbde72011-12-09 12:55:37 -0800433
Romain Guy3b748a42013-04-17 18:54:38 -0700434 // Uniforms caching
Romain Guy05bbde72011-12-09 12:55:37 -0800435 bool mHasColorUniform;
436 int mColorUniform;
Romain Guy2d4fd362011-12-13 22:00:19 -0800437
438 bool mHasSampler;
Romain Guy3b748a42013-04-17 18:54:38 -0700439
440 mat4 mProjection;
Chris Craikd04a6b12014-01-29 13:00:33 -0800441 bool mOffset;
Romain Guy5cbbce52010-06-27 22:59:20 -0700442}; // class Program
443
Romain Guy5cbbce52010-06-27 22:59:20 -0700444}; // namespace uirenderer
445}; // namespace android
446
Romain Guy5b3b3522010-10-27 18:57:51 -0700447#endif // ANDROID_HWUI_PROGRAM_H