diff options
author | Brian <brian@yutani.localnet.net> | 2006-12-20 17:19:16 -0700 |
---|---|---|
committer | Brian <brian@yutani.localnet.net> | 2006-12-20 17:19:16 -0700 |
commit | 3a8e2776a626c971bc02cd2ee3e576cb8b4267e9 (patch) | |
tree | a1ad86bb2a490da2efb44429776e4132fd00a2fa /src/mesa/shader/slang/slang_emit.c | |
parent | 83ca3ff384ac09524ff6946134cded4174590d92 (diff) |
Uniform matrix support.
Implement _mesa_uniform_matrix()
Support for program parameters/uniforms with more than 4 elements.
Store 4x4 matrices in column-major order in registers.
Update mat mul built-in functions accordingly.
Diffstat (limited to 'src/mesa/shader/slang/slang_emit.c')
-rw-r--r-- | src/mesa/shader/slang/slang_emit.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index d7c224541a..39f470046b 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -191,7 +191,7 @@ storage_string(const slang_ir_storage *st) sprintf(s, "%s[%d..%d]", files[st->File], st->Index, st->Index + st->Size - 1); #endif - sprintf(s, "%s", files[st->File]); + sprintf(s, "%s[%d]", files[st->File], st->Index); return s; } @@ -533,15 +533,15 @@ slang_lookup_statevar(const char *name, GLint index, }; static const struct state_info state[] = { { "gl_ModelViewMatrix", 4, SWIZZLE_NOOP, - { STATE_MATRIX, STATE_MODELVIEW, 0, 0, 0, STATE_MATRIX_TRANSPOSE } }, + { STATE_MATRIX, STATE_MODELVIEW, 0, 0, 0, 0 } }, { "gl_NormalMatrix", 3, SWIZZLE_NOOP, - { STATE_MATRIX, STATE_MODELVIEW, 0, 0, 0, STATE_MATRIX_INVTRANS } }, + { STATE_MATRIX, STATE_MODELVIEW, 0, 0, 0, 0 } }, { "gl_ProjectionMatrix", 4, SWIZZLE_NOOP, - { STATE_MATRIX, STATE_PROJECTION, 0, 0, 0, STATE_MATRIX_TRANSPOSE } }, + { STATE_MATRIX, STATE_PROJECTION, 0, 0, 0, 0 } }, { "gl_ModelViewProjectionMatrix", 4, SWIZZLE_NOOP, - { STATE_MATRIX, STATE_MVP, 0, 0, 0, STATE_MATRIX_TRANSPOSE } }, + { STATE_MATRIX, STATE_MVP, 0, 0, 0, 0 } }, { "gl_TextureMatrix", 4, SWIZZLE_NOOP, - { STATE_MATRIX, STATE_TEXTURE, 0, 0, 0, STATE_MATRIX_TRANSPOSE } }, + { STATE_MATRIX, STATE_TEXTURE, 0, 0, 0, 0 } }, { NULL, 0, 0, {0, 0, 0, 0, 0, 0} } }; GLuint i; @@ -580,9 +580,9 @@ slang_lookup_statevar(const char *name, GLint index, static GLint -slang_alloc_uniform(struct gl_program *prog, const char *name) +slang_alloc_uniform(struct gl_program *prog, const char *name, GLuint size) { - GLint i = _mesa_add_uniform(prog->Parameters, name, 4); + GLint i = _mesa_add_uniform(prog->Parameters, name, size); return i; } @@ -736,7 +736,9 @@ slang_resolve_storage(slang_gen_context *gc, slang_ir_node *n, /* probably a uniform or varying */ if (n->Var->type.qualifier == slang_qual_uniform) { - i = slang_alloc_uniform(prog, (char *) n->Var->a_name); + GLint size = n->Store->Size; + assert(size > 0); + i = slang_alloc_uniform(prog, (char *) n->Var->a_name, size); if (i >= 0) { n->Store->File = PROGRAM_UNIFORM; n->Store->Index = i; |