From 3c3c1ff5cd19af23033e080d8f0b9b5ae8363f2e Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Tue, 12 Feb 2008 23:08:42 -0500 Subject: stop generate llvm entry points entrypoints are useless because we use the same paths as all other code. also simplify llvm swizzling code --- src/mesa/pipe/llvm/gallivm_p.h | 54 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'src/mesa/pipe/llvm/gallivm_p.h') diff --git a/src/mesa/pipe/llvm/gallivm_p.h b/src/mesa/pipe/llvm/gallivm_p.h index 2c6e5e8f5f..cfe7b1901b 100644 --- a/src/mesa/pipe/llvm/gallivm_p.h +++ b/src/mesa/pipe/llvm/gallivm_p.h @@ -3,6 +3,10 @@ #ifdef MESA_LLVM +#include "gallivm.h" +#include "pipe/p_shader_tokens.h" +#include "pipe/p_compiler.h" + namespace llvm { class Module; } @@ -47,6 +51,56 @@ struct gallivm_prog { int num_interp; }; +static INLINE void gallivm_swizzle_components(int swizzle, + int *xc, int *yc, + int *zc, int *wc) +{ + int x = swizzle / 1000; swizzle -= x * 1000; + int y = swizzle / 100; swizzle -= y * 100; + int z = swizzle / 10; swizzle -= z * 10; + int w = swizzle; + + if (xc) *xc = x; + if (yc) *yc = y; + if (zc) *zc = z; + if (wc) *wc = w; +} + +static INLINE boolean gallivm_is_swizzle(int swizzle) +{ + const int NO_SWIZZLE = TGSI_SWIZZLE_X * 1000 + TGSI_SWIZZLE_Y * 100 + + TGSI_SWIZZLE_Z * 10 + TGSI_SWIZZLE_W; + return swizzle != NO_SWIZZLE; +} + +static INLINE int gallivm_x_swizzle(int swizzle) +{ + int x; + gallivm_swizzle_components(swizzle, &x, 0, 0, 0); + return x; +} + +static INLINE int gallivm_y_swizzle(int swizzle) +{ + int y; + gallivm_swizzle_components(swizzle, 0, &y, 0, 0); + return y; +} + +static INLINE int gallivm_z_swizzle(int swizzle) +{ + int z; + gallivm_swizzle_components(swizzle, 0, 0, &z, 0); + return z; +} + +static INLINE int gallivm_w_swizzle(int swizzle) +{ + int w; + gallivm_swizzle_components(swizzle, 0, 0, 0, &w); + return w; +} + #endif /* MESA_LLVM */ #if defined __cplusplus -- cgit v1.2.3