diff options
author | Brian Paul <[email protected]> | 2008-12-15 16:57:37 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-01-06 09:13:30 -0700 |
commit | ceb800a107b42fe96cc68f02ab743be2b8a38299 (patch) | |
tree | 71eac39060ec2aa7e384f137f92bee91baa79894 | |
parent | 5b5b05c894bae7e82ef87eb06f63dc05ded9378a (diff) |
mesa: more comments, clean up
(cherry picked from commit a1229cc9e7c78c59cad8d0df30b1f28d9bc81faf)
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 5d647e7b4db..ace87d7cd84 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -2770,7 +2770,7 @@ _slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var, } if (var->array_len > 0) { - /* this is an array */ + /* this is an array, ex: float x[4]; */ /* round up the element size to a multiple of 4 */ GLint sz = (store->Size + 3) & ~3; /* total size = element size * array length */ @@ -3163,9 +3163,9 @@ _slang_assignment_compatible(slang_assemble_ctx *A, } - /** * Generate IR tree for a local variable declaration. + * Basically do some error checking and call _slang_gen_var_decl(). */ static slang_ir_node * _slang_gen_declaration(slang_assemble_ctx *A, slang_operation *oper) @@ -3219,25 +3219,27 @@ _slang_gen_declaration(slang_assemble_ctx *A, slang_operation *oper) return NULL; } } + else { + if (var->type.qualifier == SLANG_QUAL_CONST) { + slang_info_log_error(A->log, + "const-qualified variable '%s' requires initializer", + varName); + return NULL; + } + } /* Generate IR node */ varDecl = _slang_gen_var_decl(A, var, initializer); if (!varDecl) return NULL; - if (var->type.qualifier == SLANG_QUAL_CONST && !initializer) { - slang_info_log_error(A->log, - "const-qualified variable '%s' requires initializer", - varName); - return NULL; - } - return varDecl; } /** - * Generate IR tree for a variable (such as in an expression). + * Generate IR tree for a reference to a variable (such as in an expression). + * This is different from a variable declaration. */ static slang_ir_node * _slang_gen_variable(slang_assemble_ctx * A, slang_operation *oper) |