summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/slang_vartable.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-07-18 14:44:01 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-07-18 14:46:42 -0600
commit7218626cf5ecc00fc7ef994253c20c9a2df35cc2 (patch)
treeeaae6494ed8de6a058aa968bc8c2e33ba2b08efb /src/mesa/shader/slang/slang_vartable.c
parenta4fd90e3255ea531f2fe0693f00f342f4610cae3 (diff)
mesa: rework array/struct addressing code.
The slang_ir_storage type now has a pointer to parent storage to represent storage of an array element within an array, or a field within a struct. This fixes some problems related to addressing of fields/elements in non- trivial cases. More work to follow.
Diffstat (limited to 'src/mesa/shader/slang/slang_vartable.c')
-rw-r--r--src/mesa/shader/slang/slang_vartable.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/mesa/shader/slang/slang_vartable.c b/src/mesa/shader/slang/slang_vartable.c
index 7bc92ea297..68b4e00be0 100644
--- a/src/mesa/shader/slang/slang_vartable.c
+++ b/src/mesa/shader/slang/slang_vartable.c
@@ -1,6 +1,7 @@
#include "main/imports.h"
-#include "shader/prog_instruction.h"
+#include "shader/program.h"
+#include "shader/prog_print.h"
#include "slang_compile.h"
#include "slang_compile_variable.h"
#include "slang_mem.h"
@@ -247,14 +248,25 @@ _slang_alloc_var(slang_var_table *vt, slang_ir_storage *store)
if (store->Size == 1) {
const GLuint comp = i % 4;
store->Swizzle = MAKE_SWIZZLE4(comp, comp, comp, comp);
- if (dbg) printf("Alloc var sz %d at %d.%c (level %d)\n",
- store->Size, store->Index, "xyzw"[comp], t->Level);
+ }
+ else if (store->Size == 2) {
+ store->Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y,
+ SWIZZLE_NIL, SWIZZLE_NIL);
+ }
+ else if (store->Size == 3) {
+ store->Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y,
+ SWIZZLE_Z, SWIZZLE_NIL);
}
else {
store->Swizzle = SWIZZLE_NOOP;
- if (dbg) printf("Alloc var sz %d at %d.xyzw (level %d)\n",
- store->Size, store->Index, t->Level);
}
+
+ if (dbg)
+ printf("Alloc var sz %d at %d.%s (level %d)\n",
+ store->Size, store->Index,
+ _mesa_swizzle_string(store->Swizzle, 0, 0),
+ t->Level);
+
return GL_TRUE;
}
@@ -279,6 +291,7 @@ _slang_alloc_temp(slang_var_table *vt, slang_ir_storage *store)
store->Size, store->Index, "xyzw"[comp], t->Level);
}
else {
+ /* XXX improve swizzled for size=2/3, use for writemask... */
store->Swizzle = SWIZZLE_NOOP;
if (dbg) printf("Alloc temp sz %d at %d.xyzw (level %d)\n",
store->Size, store->Index, t->Level);