#include "pipe/p_state.h"
#include "pipe/p_inlines.h"
+#include "util/u_format.h"
+
#include "nv50_context.h"
static boolean
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);
#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. */
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",
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));
}
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 */
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
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 {