glsl: Eliminate ambiguity between function ins/outs and shader ins/outs
This patch replaces the three ir_variable_mode enums: - ir_var_in - ir_var_out - ir_var_inout with the following five: - ir_var_shader_in - ir_var_shader_out - ir_var_function_in - ir_var_function_out - ir_var_function_inout This eliminates a frustrating ambiguity: it used to be impossible to tell whether an ir_var_{in,out} variable was a shader in/out or a function in/out without seeing where the variable was declared in the IR. This complicated some optimization and lowering passes, and would have become a problem for implementing varying structs. In the lisp-style serialization of GLSL IR to strings performed by ir_print_visitor.cpp and ir_reader.cpp, I've retained the names "in", "out", and "inout" for function parameters, to avoid introducing code churn to the src/glsl/builtins/ir/ directory. Note: a couple of comments in the code seemed to indicate that we were planning for a possible future in which geometry shaders could have shader-scope inout variables. Our GLSL grammar rejects shader-scope inout variables, and I've been unable to find any evidence in the GLSL standards documents (or extensions) that this will ever be allowed, so I've eliminated these comments. Reviewed-by: Carl Worth <cworth@cworth.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
@@ -106,7 +106,7 @@ _mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index,
|
||||
const ir_variable *const var = ((ir_instruction *) node)->as_variable();
|
||||
|
||||
if (var == NULL
|
||||
|| var->mode != ir_var_in
|
||||
|| var->mode != ir_var_shader_in
|
||||
|| var->location == -1)
|
||||
continue;
|
||||
|
||||
@@ -169,7 +169,7 @@ _mesa_GetAttribLocation(GLhandleARB program, const GLcharARB * name)
|
||||
* attribute, or if an error occurs, -1 will be returned."
|
||||
*/
|
||||
if (var == NULL
|
||||
|| var->mode != ir_var_in
|
||||
|| var->mode != ir_var_shader_in
|
||||
|| var->location == -1
|
||||
|| var->location < VERT_ATTRIB_GENERIC0)
|
||||
continue;
|
||||
@@ -197,7 +197,7 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg)
|
||||
const ir_variable *const var = ((ir_instruction *) node)->as_variable();
|
||||
|
||||
if (var == NULL
|
||||
|| var->mode != ir_var_in
|
||||
|| var->mode != ir_var_shader_in
|
||||
|| var->location == -1)
|
||||
continue;
|
||||
|
||||
@@ -223,7 +223,7 @@ _mesa_longest_attribute_name_length(struct gl_shader_program *shProg)
|
||||
const ir_variable *const var = ((ir_instruction *) node)->as_variable();
|
||||
|
||||
if (var == NULL
|
||||
|| var->mode != ir_var_in
|
||||
|| var->mode != ir_var_shader_in
|
||||
|| var->location == -1)
|
||||
continue;
|
||||
|
||||
@@ -333,7 +333,7 @@ _mesa_GetFragDataIndex(GLuint program, const GLchar *name)
|
||||
* attribute, or if an error occurs, -1 will be returned."
|
||||
*/
|
||||
if (var == NULL
|
||||
|| var->mode != ir_var_out
|
||||
|| var->mode != ir_var_shader_out
|
||||
|| var->location == -1
|
||||
|| var->location < FRAG_RESULT_DATA0)
|
||||
continue;
|
||||
@@ -389,7 +389,7 @@ _mesa_GetFragDataLocation(GLuint program, const GLchar *name)
|
||||
* attribute, or if an error occurs, -1 will be returned."
|
||||
*/
|
||||
if (var == NULL
|
||||
|| var->mode != ir_var_out
|
||||
|| var->mode != ir_var_shader_out
|
||||
|| var->location == -1
|
||||
|| var->location < FRAG_RESULT_DATA0)
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user