diff options
author | Alan Hourihane <[email protected]> | 2009-03-19 22:06:10 +0000 |
---|---|---|
committer | Alan Hourihane <[email protected]> | 2009-03-19 22:06:53 +0000 |
commit | e3aedec86808490fbb5a966b1e4dc15bff046f13 (patch) | |
tree | 2c555449ed4f087dab8ad97f82a93b86623ff330 /src/mesa/shader | |
parent | c9a318a7c607e96dc100926cbd2d78d94e41eb52 (diff) |
slang: support uniform arrays
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 13a801c18a2..8263aae3343 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -4354,13 +4354,25 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var, if (prog) { /* user-defined uniform */ if (datatype == GL_NONE) { - if (var->type.specifier.type == SLANG_SPEC_STRUCT) { + if ((var->type.specifier.type == SLANG_SPEC_ARRAY && + var->type.specifier._array->type == SLANG_SPEC_STRUCT) || + (var->type.specifier.type == SLANG_SPEC_STRUCT)) { /* temporary work-around */ GLenum datatype = GL_FLOAT; GLint uniformLoc = _mesa_add_uniform(prog->Parameters, varName, totalSize, datatype, NULL); store = _slang_new_ir_storage_swz(PROGRAM_UNIFORM, uniformLoc, totalSize, swizzle); + + if (arrayLen > 0) { + GLint a = arrayLen - 1; + GLint i; + for (i = 0; i < a; i++) { + GLfloat value = (GLfloat)(i + uniformLoc + 1); + (void) _mesa_add_parameter(prog->Parameters, PROGRAM_UNIFORM, + varName, 1, datatype, &value, NULL, 0x0); + } + } /* XXX what we need to do is unroll the struct into its * basic types, creating a uniform variable for each. |