summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-05-02 16:41:04 +0200
committerMarek Olšák <[email protected]>2011-05-03 12:03:22 +0200
commit5ba2e7adf01aaa855e36a577a47de8f4ddace99c (patch)
tree74c3fe13b5fff0ff02d00911ce5f28b5e12591a3 /src/glsl
parent93754d8499934a4c38e9a934d0a934c1484b707c (diff)
mesa: implement AMD_shader_stencil_export
It's just an alias of the ARB variant with some GLSL compiler changes. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/glsl_parser_extras.cpp10
-rw-r--r--src/glsl/glsl_parser_extras.h2
-rw-r--r--src/glsl/ir_variable.cpp20
3 files changed, 32 insertions, 0 deletions
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 5bb3a6f25a3..18bff88deec 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -255,6 +255,16 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp,
state->AMD_conservative_depth_enable = (ext_mode != extension_disable);
state->AMD_conservative_depth_warn = (ext_mode == extension_warn);
unsupported = !state->extensions->AMD_conservative_depth;
+ } else if (strcmp(name, "GL_AMD_shader_stencil_export") == 0) {
+ state->AMD_shader_stencil_export_enable = (ext_mode != extension_disable);
+ state->AMD_shader_stencil_export_warn = (ext_mode == extension_warn);
+
+ /* This extension is only supported in fragment shaders.
+ * Both the ARB and AMD variants share the same ARB flag
+ * in gl_extensions.
+ */
+ unsupported = (state->target != fragment_shader)
+ || !state->extensions->ARB_shader_stencil_export;
} else if (strcmp(name, "GL_OES_texture_3D") == 0 && state->es_shader) {
state->OES_texture_3D_enable = (ext_mode != extension_disable);
state->OES_texture_3D_warn = (ext_mode == extension_warn);
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index 6df0e160ae3..f9147653f35 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -172,6 +172,8 @@ struct _mesa_glsl_parse_state {
unsigned ARB_shader_stencil_export_warn:1;
unsigned AMD_conservative_depth_enable:1;
unsigned AMD_conservative_depth_warn:1;
+ unsigned AMD_shader_stencil_export_enable:1;
+ unsigned AMD_shader_stencil_export_warn:1;
unsigned OES_texture_3D_enable:1;
unsigned OES_texture_3D_warn:1;
/*@}*/
diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp
index f3577175691..b8487694c51 100644
--- a/src/glsl/ir_variable.cpp
+++ b/src/glsl/ir_variable.cpp
@@ -767,6 +767,22 @@ generate_ARB_shader_stencil_export_variables(exec_list *instructions,
}
static void
+generate_AMD_shader_stencil_export_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state,
+ bool warn)
+{
+ /* gl_FragStencilRefAMD is only available in the fragment shader.
+ */
+ ir_variable *const fd =
+ add_variable(instructions, state->symbols,
+ "gl_FragStencilRefAMD", glsl_type::int_type,
+ ir_var_out, FRAG_RESULT_STENCIL);
+
+ if (warn)
+ fd->warn_extension = "GL_AMD_shader_stencil_export";
+}
+
+static void
generate_120_fs_variables(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
@@ -818,6 +834,10 @@ initialize_fs_variables(exec_list *instructions,
if (state->ARB_shader_stencil_export_enable)
generate_ARB_shader_stencil_export_variables(instructions, state,
state->ARB_shader_stencil_export_warn);
+
+ if (state->AMD_shader_stencil_export_enable)
+ generate_AMD_shader_stencil_export_variables(instructions, state,
+ state->AMD_shader_stencil_export_warn);
}
void