diff options
author | Jordan Justen <[email protected]> | 2013-03-27 13:58:04 -0700 |
---|---|---|
committer | Jordan Justen <[email protected]> | 2013-05-13 13:57:52 -0700 |
commit | 220f70667dacc37f0e5cb871f6054214519d191f (patch) | |
tree | 751aa2ded7889556a8e223ec8d486ce7f470e83a /src/glsl/builtin_variables.cpp | |
parent | c9e981b8fb815cc14094ca09719819017e43024d (diff) |
glsl: add AMD_vertex_shader_layer support
This GLSL extension requires that AMD_vertex_shader_layer be
enabled by the driver.
Signed-off-by: Jordan Justen <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glsl/builtin_variables.cpp')
-rw-r--r-- | src/glsl/builtin_variables.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp index 15f5bf318db..4bb361c2e45 100644 --- a/src/glsl/builtin_variables.cpp +++ b/src/glsl/builtin_variables.cpp @@ -39,6 +39,12 @@ generate_ARB_draw_instanced_variables(exec_list *, struct _mesa_glsl_parse_state *, bool, _mesa_glsl_parser_targets); +static void +generate_AMD_vertex_shader_layer_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state, + bool warn, + _mesa_glsl_parser_targets target); + struct builtin_variable { enum ir_variable_mode mode; int slot; @@ -818,6 +824,8 @@ generate_130_vs_variables(exec_list *instructions, "gl_ClipDistance", clip_distance_array_type, ir_var_shader_out, VARYING_SLOT_CLIP_DIST0); + generate_AMD_vertex_shader_layer_variables(instructions, state, false, + vertex_shader); } @@ -1020,6 +1028,29 @@ generate_ARB_draw_instanced_variables(exec_list *instructions, } } +static void +generate_AMD_vertex_shader_layer_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state, + bool warn, + _mesa_glsl_parser_targets target) +{ + /* gl_Layer is only available in the vertex shader for the + * AMD_vertex_shader_layer extension. It will also be available in the + * geometry shader when GLSL 1.50 is supported. + */ + if (target != vertex_shader) + return; + + if (state->AMD_vertex_shader_layer_enable) { + ir_variable *inst = + add_variable(instructions, state->symbols, + "gl_Layer", glsl_type::int_type, + ir_var_shader_out, VARYING_SLOT_LAYER); + + if (warn) + inst->warn_extension = "GL_AMD_vertex_shader_layer"; + } +} static void generate_ARB_shader_stencil_export_variables(exec_list *instructions, |