diff options
author | Paul Berry <[email protected]> | 2014-01-06 20:06:05 -0800 |
---|---|---|
committer | Paul Berry <[email protected]> | 2014-02-05 09:00:34 -0800 |
commit | c61ec8d8e34e9bf30b3c4c84afa08f0a5b66b932 (patch) | |
tree | f660a11f655b3f456e40e0374c7048f105718197 /src/glsl | |
parent | 28e526d5580739e8b4098cd08c644b9157fdc94c (diff) |
mesa/cs: Add a MESA_SHADER_COMPUTE stage and update switch statements.
This patch adds MESA_SHADER_COMPUTE to the gl_shader_stage enum.
Also, where it is trivial to do so, it adds a compute shader case to
switch statements that switch based on the type of shader. This
avoids "unhandled switch case" compiler warnings.
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 9 | ||||
-rw-r--r-- | src/glsl/builtin_variables.cpp | 17 | ||||
-rw-r--r-- | src/glsl/standalone_scaffolding.h | 2 |
3 files changed, 28 insertions, 0 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 8d096ad0428..fc28703ddc3 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2155,6 +2155,12 @@ validate_explicit_location(const struct ast_type_qualifier *qual, fail = true; break; + + case MESA_SHADER_COMPUTE: + _mesa_glsl_error(loc, state, + "compute shader variables cannot be given " + "explicit locations"); + return; }; if (fail) { @@ -2337,6 +2343,9 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, if (var->data.mode == ir_var_shader_in) var->data.invariant = true; break; + case MESA_SHADER_COMPUTE: + /* Invariance isn't meaningful in compute shaders. */ + break; } } diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp index d6bc3c07316..df560fbbf65 100644 --- a/src/glsl/builtin_variables.cpp +++ b/src/glsl/builtin_variables.cpp @@ -356,6 +356,7 @@ public: void generate_vs_special_vars(); void generate_gs_special_vars(); void generate_fs_special_vars(); + void generate_cs_special_vars(); void generate_varyings(); private: @@ -868,6 +869,16 @@ builtin_variable_generator::generate_fs_special_vars() /** + * Generate variables which only exist in compute shaders. + */ +void +builtin_variable_generator::generate_cs_special_vars() +{ + /* TODO: finish this. */ +} + + +/** * Add a single "varying" variable. The variable's type and direction (input * or output) are adjusted as appropriate for the type of shader being * compiled. For geometry shaders using {ARB,EXT}_geometry_shader4, @@ -888,6 +899,9 @@ builtin_variable_generator::add_varying(int slot, const glsl_type *type, case MESA_SHADER_FRAGMENT: add_input(slot, type, name); break; + case MESA_SHADER_COMPUTE: + /* Compute shaders don't have varyings. */ + break; } } @@ -975,5 +989,8 @@ _mesa_glsl_initialize_variables(exec_list *instructions, case MESA_SHADER_FRAGMENT: gen.generate_fs_special_vars(); break; + case MESA_SHADER_COMPUTE: + gen.generate_cs_special_vars(); + break; } } diff --git a/src/glsl/standalone_scaffolding.h b/src/glsl/standalone_scaffolding.h index 327fef2df15..df783afdb44 100644 --- a/src/glsl/standalone_scaffolding.h +++ b/src/glsl/standalone_scaffolding.h @@ -58,6 +58,8 @@ _mesa_shader_enum_to_shader_stage(GLenum v) return MESA_SHADER_FRAGMENT; case GL_GEOMETRY_SHADER: return MESA_SHADER_GEOMETRY; + case GL_COMPUTE_SHADER: + return MESA_SHADER_COMPUTE; default: assert(!"bad value in _mesa_shader_enum_to_shader_stage()"); return MESA_SHADER_VERTEX; |