mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 04:50:11 +01:00
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 <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Paul Berry <stereotype441@gmail.com>
This commit is contained in:
parent
22af08b410
commit
d3b39194dc
1 changed files with 4 additions and 7 deletions
|
|
@ -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,
|
add_builtin_constant(exec_list *instructions, glsl_symbol_table *symtab,
|
||||||
const char *name, int value)
|
const char *name, int value)
|
||||||
{
|
{
|
||||||
|
|
@ -408,6 +408,7 @@ add_builtin_constant(exec_list *instructions, glsl_symbol_table *symtab,
|
||||||
name, glsl_type::int_type,
|
name, glsl_type::int_type,
|
||||||
ir_var_auto, -1);
|
ir_var_auto, -1);
|
||||||
var->constant_value = new(var) ir_constant(value);
|
var->constant_value = new(var) ir_constant(value);
|
||||||
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Several constants in GLSL ES have different names than normal desktop GLSL.
|
/* 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.
|
/* gl_MaxDrawBuffers is available in all shader stages.
|
||||||
*/
|
*/
|
||||||
ir_variable *const mdb =
|
ir_variable *const mdb =
|
||||||
add_variable(instructions, state->symbols,
|
add_builtin_constant(instructions, state->symbols, "gl_MaxDrawBuffers",
|
||||||
"gl_MaxDrawBuffers", glsl_type::int_type, ir_var_auto, -1);
|
state->Const.MaxDrawBuffers);
|
||||||
|
|
||||||
if (warn)
|
if (warn)
|
||||||
mdb->warn_extension = "GL_ARB_draw_buffers";
|
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.
|
/* gl_FragData is only available in the fragment shader.
|
||||||
*/
|
*/
|
||||||
if (target == fragment_shader) {
|
if (target == fragment_shader) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue