From d9671863eaae41ba28b6fe82e3e7d1dac12f514c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 6 Oct 2010 09:36:02 +1000 Subject: glsl: add support for shader stencil export This adds proper support for the GL_ARB_shader_stencil_export extension to the GLSL compiler. Thanks to Ian for pointing out where I need to add things. --- src/glsl/ir_variable.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/glsl/ir_variable.cpp') diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index ddc3bb0b9f..f2c900f718 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -422,6 +422,20 @@ generate_ARB_draw_buffers_variables(exec_list *instructions, } } +static void +generate_ARB_shader_stencil_export_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state, + bool warn) +{ + /* gl_FragStencilRefARB is only available in the fragment shader. + */ + ir_variable *const fd = + add_variable("gl_FragStencilRefARB", ir_var_out, FRAG_RESULT_STENCIL, + glsl_type::int_type, instructions, state->symbols); + + if (warn) + fd->warn_extension = "GL_ARB_shader_stencil_export"; +} static void generate_120_fs_variables(exec_list *instructions, @@ -471,6 +485,10 @@ initialize_fs_variables(exec_list *instructions, generate_130_fs_variables(instructions, state); break; } + + if (state->ARB_shader_stencil_export_enable) + generate_ARB_shader_stencil_export_variables(instructions, state, + state->ARB_shader_stencil_export_warn); } void -- cgit v1.2.3