7 #include "pipe/p_shader_tokens.h"
8 #include "pipe/p_compiler.h"
14 #if defined __cplusplus
18 enum gallivm_shader_type
;
19 enum gallivm_vector_layout
;
21 struct gallivm_interpolate
{
30 enum gallivm_shader_type type
;
31 enum gallivm_vector_layout layout
;
35 /* FIXME: this might not be enough for some shaders */
36 struct gallivm_interpolate interpolators
[32*4];
45 enum gallivm_shader_type type
;
49 /* FIXME: this might not be enough for some shaders */
50 struct gallivm_interpolate interpolators
[32*4];
54 static INLINE
void gallivm_swizzle_components(int swizzle
,
58 int x
= swizzle
/ 1000; swizzle
-= x
* 1000;
59 int y
= swizzle
/ 100; swizzle
-= y
* 100;
60 int z
= swizzle
/ 10; swizzle
-= z
* 10;
69 static INLINE boolean
gallivm_is_swizzle(int swizzle
)
71 const int NO_SWIZZLE
= TGSI_SWIZZLE_X
* 1000 + TGSI_SWIZZLE_Y
* 100 +
72 TGSI_SWIZZLE_Z
* 10 + TGSI_SWIZZLE_W
;
73 return swizzle
!= NO_SWIZZLE
;
76 static INLINE
int gallivm_x_swizzle(int swizzle
)
79 gallivm_swizzle_components(swizzle
, &x
, 0, 0, 0);
83 static INLINE
int gallivm_y_swizzle(int swizzle
)
86 gallivm_swizzle_components(swizzle
, 0, &y
, 0, 0);
90 static INLINE
int gallivm_z_swizzle(int swizzle
)
93 gallivm_swizzle_components(swizzle
, 0, 0, &z
, 0);
97 static INLINE
int gallivm_w_swizzle(int swizzle
)
100 gallivm_swizzle_components(swizzle
, 0, 0, 0, &w
);
104 #if defined __cplusplus
108 #endif /* MESA_LLVM */