summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/llvm/gallivm_p.h
diff options
context:
space:
mode:
authorZack Rusin <zack@tungstengraphics.com>2008-02-12 23:08:42 -0500
committerZack Rusin <zack@tungstengraphics.com>2008-02-12 23:11:05 -0500
commit3c3c1ff5cd19af23033e080d8f0b9b5ae8363f2e (patch)
treede5cfa513de1fd1fd73403fdb2f1cc7c3a13befd /src/mesa/pipe/llvm/gallivm_p.h
parentcad7bc74d69ee053452aa4bd20740dc79ad6eab6 (diff)
stop generate llvm entry points
entrypoints are useless because we use the same paths as all other code. also simplify llvm swizzling code
Diffstat (limited to 'src/mesa/pipe/llvm/gallivm_p.h')
-rw-r--r--src/mesa/pipe/llvm/gallivm_p.h54
1 files changed, 54 insertions, 0 deletions
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