summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-03-08 10:40:25 -0700
committerBrian <brian@yutani.localnet.net>2007-03-08 10:40:25 -0700
commitbf86ddaa2018d58c894da27d7a7a7b5449d1338e (patch)
tree448a6d9f2c3b8cd062783b5ece4e82b49901c313
parentde8172673e23bad1186553b91a7c22e65d93692a (diff)
check for attempted writes to read-only vars
-rw-r--r--src/mesa/shader/slang/slang_codegen.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 1c037d4304b..b1b4616f638 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -2007,6 +2007,12 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper)
else {
slang_ir_node *n, *lhs, *rhs;
lhs = _slang_gen_operation(A, &oper->children[0]);
+ if (lhs->Store->File != PROGRAM_OUTPUT &&
+ lhs->Store->File != PROGRAM_TEMPORARY) {
+ slang_info_log_error(A->log, "Assignment to read-only variable");
+ return NULL;
+ }
+
rhs = _slang_gen_operation(A, &oper->children[1]);
if (lhs && rhs) {
/* convert lhs swizzle into writemask */