summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-07-26 11:39:37 -0600
committerBrian <[email protected]>2007-07-26 11:39:37 -0600
commita57c5a417be1d6b5dd8ce972327e022efea24810 (patch)
tree84f1bc7a4f119043035cd31e2959b93388e38573 /src/mesa
parentff1a28de17a0d8f43723350c29103ff3af69a73f (diff)
generate error upon writing to varying var in fragment program (bug 11733)
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/shader/slang/slang_codegen.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 94cb6b38a46..31b8d52847b 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -2236,7 +2236,9 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper)
}
if (var->type.qualifier == SLANG_QUAL_CONST ||
var->type.qualifier == SLANG_QUAL_ATTRIBUTE ||
- var->type.qualifier == SLANG_QUAL_UNIFORM) {
+ var->type.qualifier == SLANG_QUAL_UNIFORM ||
+ (var->type.qualifier == SLANG_QUAL_VARYING &&
+ A->program->Target == GL_FRAGMENT_PROGRAM_ARB)) {
slang_info_log_error(A->log,
"illegal assignment to read-only variable '%s'",
(char *) oper->children[0].a_id);
@@ -2264,10 +2266,11 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper)
lhs = _slang_gen_operation(A, &oper->children[0]);
if (lhs) {
- if (lhs->Store->File != PROGRAM_OUTPUT &&
- lhs->Store->File != PROGRAM_TEMPORARY &&
- lhs->Store->File != PROGRAM_VARYING &&
- lhs->Store->File != PROGRAM_UNDEFINED) {
+ if (!(lhs->Store->File == PROGRAM_OUTPUT ||
+ lhs->Store->File == PROGRAM_TEMPORARY ||
+ (lhs->Store->File == PROGRAM_VARYING &&
+ A->program->Target == GL_VERTEX_PROGRAM_ARB) ||
+ lhs->Store->File == PROGRAM_UNDEFINED)) {
slang_info_log_error(A->log,
"illegal assignment to read-only l-value");
return NULL;