summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-08-06 11:58:52 -0600
committerBrian Paul <[email protected]>2008-08-06 11:58:52 -0600
commitac553c6ce4718aa1e90f49c910c14e13d0d5de39 (patch)
tree0be9def2581182af448eacf7f5d3cd9e82154595 /src
parentacb81d0268bf96efd35196c619ca269ffbe6c0d3 (diff)
mesa: glsl: disallow initializers for varying vars
Diffstat (limited to 'src')
-rw-r--r--src/mesa/shader/slang/slang_codegen.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 13cad6a412b..e36b689b704 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -3647,7 +3647,7 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
const GLuint swizzle = _slang_var_swizzle(totalSize, 0);
if (var->initializer) {
- slang_info_log_error(A->log, "illegal assignment to '%s'", varName);
+ slang_info_log_error(A->log, "illegal initializer for uniform '%s'", varName);
return GL_FALSE;
}
@@ -3695,13 +3695,21 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
if (dbg) printf("UNIFORM (sz %d) ", totalSize);
}
else if (var->type.qualifier == SLANG_QUAL_VARYING) {
- if (!_slang_type_is_float_vec_mat(var->type.specifier.type)) {
+ /* varyings must be float, vec or mat */
+ if (!_slang_type_is_float_vec_mat(var->type.specifier.type) &&
+ var->type.specifier.type != SLANG_SPEC_ARRAY) {
slang_info_log_error(A->log,
"varying '%s' must be float/vector/matrix",
varName);
return GL_FALSE;
}
+ if (var->initializer) {
+ slang_info_log_error(A->log, "illegal initializer for varying '%s'",
+ varName);
+ return GL_FALSE;
+ }
+
if (prog) {
/* user-defined varying */
GLint varyingLoc = _mesa_add_varying(prog->Varying, varName, size);