summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal Krol <michal@vmware.com>2009-12-03 12:25:49 +0100
committerMichal Krol <michal@vmware.com>2009-12-03 12:25:49 +0100
commit72befaaae5fd9555e1f6ccbd6a74c0d640fc2929 (patch)
tree7644f87ee46ff0adf58c81e3d8082d544579cce1 /src
parent018f33a328a05bd7a2094103eb7bbafc8595e6b1 (diff)
Remove pf_swizzle_* internal macros.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/nv50/nv50_vbo.c4
-rw-r--r--src/gallium/drivers/r300/r300_state_inlines.h13
-rw-r--r--src/gallium/include/pipe/p_format.h5
-rw-r--r--src/mesa/state_tracker/st_format.c11
4 files changed, 19 insertions, 14 deletions
diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c
index db54380241f..4b8783899e6 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -24,6 +24,8 @@
#include "pipe/p_state.h"
#include "pipe/p_inlines.h"
+#include "util/u_format.h"
+
#include "nv50_context.h"
static boolean
@@ -131,7 +133,7 @@ nv50_vbo_vtxelt_to_hw(struct pipe_vertex_element *ve)
return 0x24e80000;
}
- if (pf_swizzle_x(pf) == 2) /* BGRA */
+ if (util_format_description(pf)->swizzle[0] == UTIL_FORMAT_SWIZZLE_Z) /* BGRA */
hw_size |= (1 << 31); /* no real swizzle bits :-( */
return (hw_type | hw_size);
diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h
index e6c1cb54dac..ab720f366dd 100644
--- a/src/gallium/drivers/r300/r300_state_inlines.h
+++ b/src/gallium/drivers/r300/r300_state_inlines.h
@@ -28,6 +28,8 @@
#include "pipe/p_format.h"
+#include "util/u_format.h"
+
#include "r300_reg.h"
/* Some maths. These should probably find their way to u_math, if needed. */
@@ -534,6 +536,9 @@ r300_translate_vertex_data_type(enum pipe_format format) {
static INLINE uint16_t
r300_translate_vertex_data_swizzle(enum pipe_format format) {
+ const struct util_format_description *desc = util_format_description(format);
+
+ assert(format);
if (pf_layout(format) != PIPE_FORMAT_LAYOUT_RGBAZS) {
debug_printf("r300: Bad format %s in %s:%d\n",
@@ -541,10 +546,10 @@ r300_translate_vertex_data_swizzle(enum pipe_format format) {
return 0;
}
- return ((pf_swizzle_x(format) << R300_SWIZZLE_SELECT_X_SHIFT) |
- (pf_swizzle_y(format) << R300_SWIZZLE_SELECT_Y_SHIFT) |
- (pf_swizzle_z(format) << R300_SWIZZLE_SELECT_Z_SHIFT) |
- (pf_swizzle_w(format) << R300_SWIZZLE_SELECT_W_SHIFT) |
+ return ((desc->swizzle[0] << R300_SWIZZLE_SELECT_X_SHIFT) |
+ (desc->swizzle[1] << R300_SWIZZLE_SELECT_Y_SHIFT) |
+ (desc->swizzle[2] << R300_SWIZZLE_SELECT_Z_SHIFT) |
+ (desc->swizzle[3] << R300_SWIZZLE_SELECT_W_SHIFT) |
(0xf << R300_WRITE_ENA_SHIFT));
}
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index 52fdab45703..cc7a8ab8dff 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -112,11 +112,6 @@ static INLINE uint pf_get(pipe_format_rgbazs_t f, uint shift, uint mask)
return (f >> shift) & mask;
}
-#define pf_swizzle_x(f) pf_get(f, 2, 0x7) /**< PIPE_FORMAT_COMP_ */
-#define pf_swizzle_y(f) pf_get(f, 5, 0x7) /**< PIPE_FORMAT_COMP_ */
-#define pf_swizzle_z(f) pf_get(f, 8, 0x7) /**< PIPE_FORMAT_COMP_ */
-#define pf_swizzle_w(f) pf_get(f, 11, 0x7) /**< PIPE_FORMAT_COMP_ */
-#define pf_swizzle_xyzw(f,i) pf_get(f, 2+((i)*3), 0x7)
#define pf_size_x(f) pf_get(f, 14, 0x7) /**< Size of X */
#define pf_size_y(f) pf_get(f, 17, 0x7) /**< Size of Y */
#define pf_size_z(f) pf_get(f, 20, 0x7) /**< Size of Z */
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index c492d77530b..c9f020c40f8 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -81,8 +81,11 @@ GLboolean
st_get_format_info(enum pipe_format format, struct pipe_format_info *pinfo)
{
if (pf_layout(format) == PIPE_FORMAT_LAYOUT_RGBAZS) {
+ const struct util_format_description *desc = util_format_description(format);
pipe_format_rgbazs_t info;
+ assert(desc);
+
info = format;
#if 0
@@ -133,10 +136,10 @@ st_get_format_info(enum pipe_format format, struct pipe_format_info *pinfo)
pinfo->size = format_size( info ) / 8;
/* Luminance & Intensity bits */
- if( pf_swizzle_x(info) == PIPE_FORMAT_COMP_R &&
- pf_swizzle_y(info) == PIPE_FORMAT_COMP_R &&
- pf_swizzle_z(info) == PIPE_FORMAT_COMP_R ) {
- if( pf_swizzle_w(info) == PIPE_FORMAT_COMP_R ) {
+ if (desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_X &&
+ desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_X &&
+ desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_X) {
+ if (desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_X) {
pinfo->intensity_bits = pinfo->red_bits;
}
else {