Remove pf_swizzle_* internal macros.

This commit is contained in:
Michal Krol
2009-12-03 12:25:49 +01:00
parent 018f33a328
commit 72befaaae5
4 changed files with 19 additions and 14 deletions
+3 -1
View File
@@ -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);
@@ -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));
}
-5
View File
@@ -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 */
+7 -4
View File
@@ -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 {