summaryrefslogtreecommitdiff
path: root/ir_variable.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-06-21 11:42:57 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-06-23 10:56:03 -0700
commited0626ebc7201cab365572a1326a088c5678a054 (patch)
tree1f9fbe119f7f47b6a22e618c0469aed875f0c3e9 /ir_variable.cpp
parent69a079aee8f79104501faeb2a5092b643f956d33 (diff)
ir_variable: Set locations for shader built-in variables
Diffstat (limited to 'ir_variable.cpp')
-rw-r--r--ir_variable.cpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/ir_variable.cpp b/ir_variable.cpp
index 49d8e3dcfb..efebe9199f 100644
--- a/ir_variable.cpp
+++ b/ir_variable.cpp
@@ -31,7 +31,7 @@
#endif
static ir_variable *
-add_variable(const char *name, enum ir_variable_mode mode,
+add_variable(const char *name, enum ir_variable_mode mode, int slot,
const glsl_type *type, exec_list *instructions,
glsl_symbol_table *symtab)
{
@@ -59,6 +59,8 @@ add_variable(const char *name, enum ir_variable_mode mode,
break;
}
+ var->location = slot;
+
/* Once the variable is created an initialized, add it to the symbol table
* and add the declaration to the IR stream.
*/
@@ -80,7 +82,8 @@ add_builtin_variable(const builtin_variable *proto, exec_list *instructions,
assert(type != NULL);
- add_variable(proto->name, proto->mode, type, instructions, symtab);
+ add_variable(proto->name, proto->mode, proto->slot, type, instructions,
+ symtab);
}
@@ -103,7 +106,7 @@ generate_110_uniforms(exec_list *instructions,
const glsl_type *const mat4_array_type =
glsl_type::get_array_instance(glsl_type::mat4_type, 4);
- add_variable("gl_TextureMatrix", ir_var_uniform, mat4_array_type,
+ add_variable("gl_TextureMatrix", ir_var_uniform, -1, mat4_array_type,
instructions, symtab);
/* FINISHME: Add support for gl_DepthRangeParameters */
@@ -121,7 +124,7 @@ generate_110_uniforms(exec_list *instructions,
const glsl_type *const light_source_array_type =
glsl_type::get_array_instance(symtab->get_type("gl_LightSourceParameters"), 8);
- add_variable("gl_LightSource", ir_var_uniform, light_source_array_type,
+ add_variable("gl_LightSource", ir_var_uniform, -1, light_source_array_type,
instructions, symtab);
/* FINISHME: Add support for gl_LightModel */
@@ -156,8 +159,8 @@ generate_110_vs_variables(exec_list *instructions,
const glsl_type *const vec4_array_type =
glsl_type::get_array_instance(glsl_type::vec4_type, 4);
- add_variable("gl_TexCoord", ir_var_out, vec4_array_type, instructions,
- symtab);
+ add_variable("gl_TexCoord", ir_var_out, VERT_RESULT_TEX0, vec4_array_type,
+ instructions, symtab);
}
@@ -188,7 +191,9 @@ generate_130_vs_variables(exec_list *instructions,
*/
const glsl_type *const clip_distance_array_type =
glsl_type::get_array_instance(glsl_type::float_type, 8);
- add_variable("gl_ClipDistance", ir_var_out, clip_distance_array_type,
+
+ /* FINISHME: gl_ClipDistance needs a real location assigned. */
+ add_variable("gl_ClipDistance", ir_var_out, -1, clip_distance_array_type,
instructions, symtab);
}
@@ -237,8 +242,8 @@ generate_110_fs_variables(exec_list *instructions,
const glsl_type *const vec4_array_type =
glsl_type::get_array_instance(glsl_type::vec4_type, 4);
- add_variable("gl_TexCoord", ir_var_in, vec4_array_type, instructions,
- symtab);
+ add_variable("gl_TexCoord", ir_var_in, FRAG_ATTRIB_TEX0, vec4_array_type,
+ instructions, symtab);
}
@@ -254,8 +259,8 @@ generate_ARB_draw_buffers_fs_variables(exec_list *instructions,
glsl_type::get_array_instance(glsl_type::vec4_type, 1);
ir_variable *const fd =
- add_variable("gl_FragData", ir_var_out, vec4_array_type, instructions,
- symtab);
+ add_variable("gl_FragData", ir_var_out, FRAG_RESULT_DATA0,
+ vec4_array_type, instructions, symtab);
if (warn)
fd->warn_extension = "GL_ARB_draw_buffers";
@@ -281,7 +286,9 @@ generate_130_fs_variables(exec_list *instructions,
*/
const glsl_type *const clip_distance_array_type =
glsl_type::get_array_instance(glsl_type::float_type, 8);
- add_variable("gl_ClipDistance", ir_var_in, clip_distance_array_type,
+
+ /* FINISHME: gl_ClipDistance needs a real location assigned. */
+ add_variable("gl_ClipDistance", ir_var_in, -1, clip_distance_array_type,
instructions, symtab);
}