aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2011-10-31 14:43:27 -0700
committerIan Romanick <[email protected]>2011-11-03 13:36:00 -0700
commitd3b39194dc60fa933f5e8df30bcd8d1cb64dbc4c (patch)
tree70b7148d9b0fea72e19787cbfb9897f22dd4ce19 /src/glsl
parent22af08b410f47227ea27b06cce097ccbe0130540 (diff)
glsl: Refactor generate_ARB_draw_buffers_variables to use add_builtin_constant
v2: Remove int cast based on feedback from Ken. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Acked-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ir_variable.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp
index 1ee84d21977..8fbcf1da8cb 100644
--- a/src/glsl/ir_variable.cpp
+++ b/src/glsl/ir_variable.cpp
@@ -400,7 +400,7 @@ add_builtin_variable(exec_list *instructions, glsl_symbol_table *symtab,
}
}
-static void
+static ir_variable *
add_builtin_constant(exec_list *instructions, glsl_symbol_table *symtab,
const char *name, int value)
{
@@ -408,6 +408,7 @@ add_builtin_constant(exec_list *instructions, glsl_symbol_table *symtab,
name, glsl_type::int_type,
ir_var_auto, -1);
var->constant_value = new(var) ir_constant(value);
+ return var;
}
/* Several constants in GLSL ES have different names than normal desktop GLSL.
@@ -749,16 +750,12 @@ generate_ARB_draw_buffers_variables(exec_list *instructions,
/* gl_MaxDrawBuffers is available in all shader stages.
*/
ir_variable *const mdb =
- add_variable(instructions, state->symbols,
- "gl_MaxDrawBuffers", glsl_type::int_type, ir_var_auto, -1);
+ add_builtin_constant(instructions, state->symbols, "gl_MaxDrawBuffers",
+ state->Const.MaxDrawBuffers);
if (warn)
mdb->warn_extension = "GL_ARB_draw_buffers";
- mdb->constant_value = new(mdb)
- ir_constant(int(state->Const.MaxDrawBuffers));
-
-
/* gl_FragData is only available in the fragment shader.
*/
if (target == fragment_shader) {