From 3a8e2776a626c971bc02cd2ee3e576cb8b4267e9 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 20 Dec 2006 17:19:16 -0700 Subject: 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. --- src/mesa/shader/slang/slang_emit.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/mesa/shader/slang/slang_emit.c') 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; -- cgit v1.2.3