Module: Mesa Branch: master Commit: 285b500bb7710b17e39754ef253ac2df718c2db7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=285b500bb7710b17e39754ef253ac2df718c2db7
Author: Brian Paul <[email protected]> Date: Wed Feb 4 17:40:51 2009 -0700 glsl: use _slang_var_swizzle() in a few places to simplify the code. --- src/mesa/shader/slang/slang_vartable.c | 32 +++----------------------------- 1 files changed, 3 insertions(+), 29 deletions(-) diff --git a/src/mesa/shader/slang/slang_vartable.c b/src/mesa/shader/slang/slang_vartable.c index 3649bdf..a4ebacc 100644 --- a/src/mesa/shader/slang/slang_vartable.c +++ b/src/mesa/shader/slang/slang_vartable.c @@ -4,6 +4,7 @@ #include "shader/prog_print.h" #include "slang_compile.h" #include "slang_compile_variable.h" +#include "slang_emit.h" #include "slang_mem.h" #include "slang_vartable.h" #include "slang_ir.h" @@ -266,21 +267,7 @@ _slang_alloc_var(slang_var_table *vt, slang_ir_storage *store) return GL_FALSE; store->Index = i / 4; - if (store->Size == 1) { - const GLuint comp = i % 4; - store->Swizzle = MAKE_SWIZZLE4(comp, comp, comp, comp); - } - 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; - } + store->Swizzle = _slang_var_swizzle(store->Size, i % 4); if (dbg) printf("Alloc var storage sz %d at %d.%s (level %d) store %p\n", @@ -308,20 +295,7 @@ _slang_alloc_temp(slang_var_table *vt, slang_ir_storage *store) assert(store->Index < 0); store->Index = i / 4; - if (store->Size == 1) { - const GLuint comp = i % 4; - store->Swizzle = MAKE_SWIZZLE4(comp, comp, comp, comp); - } - else { - /* XXX improve swizzled for size=2/3, use for writemask... */ -#if 1 - if (store->Size == 2) { - store->Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, - SWIZZLE_NIL, SWIZZLE_NIL); - } -#endif - store->Swizzle = SWIZZLE_NOOP; - } + store->Swizzle = _slang_var_swizzle(store->Size, i % 4); if (dbg) printf("Alloc temp sz %d at %d.%s (level %d) store %p\n", store->Size, store->Index, _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
