summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-12-15 16:49:32 -0700
committerBrian Paul <brianp@vmware.com>2009-01-06 09:13:10 -0700
commit5b5b05c894bae7e82ef87eb06f63dc05ded9378a (patch)
tree2fc7a7e5e47cd7a7e15ab44a709ffd2d28318de9 /src
parentbe620a66eb7b9b0512c31d9a026fa6f8a7ab05a6 (diff)
mesa: added comments, remove unused code
(cherry picked from commit a66ff046cc169c6479b00b1e7fc5d87b93ad60ed)
Diffstat (limited to 'src')
-rw-r--r--src/mesa/shader/slang/slang_codegen.c41
1 files changed, 9 insertions, 32 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index f3e56bb860..5d647e7b4d 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -2707,7 +2707,15 @@ make_constant_array(slang_assemble_ctx *A,
/**
- * Generate IR node for allocating/declaring a variable.
+ * Generate IR node for allocating/declaring a variable (either a local or
+ * a global).
+ * Generally, this involves allocating slang_ir_storage for the variable,
+ * choosing a register file (temporary, constant, etc). For ordinary
+ * variables we do not yet allocate storage though. We do that when we
+ * find the first actual use of the variable to avoid allocating temp regs
+ * that will never get used.
+ * At this time, uniforms are always allocated space in this function.
+ *
* \param initializer Optional initializer expression for the variable.
*/
static slang_ir_node *
@@ -4056,40 +4064,9 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
}
else {
/* non-struct uniform */
-#if 01
if (!_slang_gen_var_decl(A, var, var->initializer))
return GL_FALSE;
store = var->store;
-#else
- GLint uniformLoc;
- const GLfloat *initialValues = NULL;
-#if 0
- /* this code needs some work yet */
- if (make_constant_array(A, var, var->initializer)) {
- /* OK */
- }
- else
-#endif
- if (var->initializer) {
- _slang_simplify(var->initializer, &A->space, A->atoms);
- if (var->initializer->type == SLANG_OPER_LITERAL_FLOAT ||
- var->initializer->type == SLANG_OPER_LITERAL_INT) {
- /* simple float/vector initializer */
- initialValues = var->initializer->literal;
- }
- else {
- /* complex initializer */
- slang_info_log_error(A->log,
- "unsupported initializer for uniform '%s'", varName);
- return GL_FALSE;
- }
- }
-
- uniformLoc = _mesa_add_uniform(prog->Parameters, varName,
- totalSize, datatype, initialValues);
- store = _slang_new_ir_storage_swz(PROGRAM_UNIFORM, uniformLoc,
- totalSize, swizzle);
-#endif
}
}
else {