intel_is_format_supported(struct softpipe_winsys *sws, uint format)
{
switch(format) {
- case PIPE_FORMAT_U_A8_R8_G8_B8:
- case PIPE_FORMAT_U_R5_G6_B5:
- case PIPE_FORMAT_S8_Z24:
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
+ case PIPE_FORMAT_R5G6B5_UNORM:
+ case PIPE_FORMAT_S8Z24_UNORM:
return TRUE;
default:
return FALSE;
attrib[0] = (float) ((int *) ptr)[0];
break;
- case PIPE_FORMAT_U_A8_R8_G8_B8:
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
attrib[0] = (float) ((unsigned char *) ptr)[2] / 255.0f;
attrib[1] = (float) ((unsigned char *) ptr)[1] / 255.0f;
attrib[2] = (float) ((unsigned char *) ptr)[0] / 255.0f;
#if 0
/* XXX: This is broken -- rewrite if still needed. */
static const unsigned tex_supported[] = {
- PIPE_FORMAT_U_R8_G8_B8_A8,
- PIPE_FORMAT_U_A8_R8_G8_B8,
- PIPE_FORMAT_U_R5_G6_B5,
+ PIPE_FORMAT_R8G8B8A8_UNORM,
+ PIPE_FORMAT_A8R8G8B8_UNORM,
+ PIPE_FORMAT_R5G6B5_UNORM,
PIPE_FORMAT_U_L8,
PIPE_FORMAT_U_A8,
PIPE_FORMAT_U_I8,
PIPE_FORMAT_U_L8_A8,
PIPE_FORMAT_YCBCR,
PIPE_FORMAT_YCBCR_REV,
- PIPE_FORMAT_S8_Z24,
+ PIPE_FORMAT_S8Z24_UNORM,
};
/* Actually a lot more than this - add later:
*/
static const unsigned render_supported[] = {
- PIPE_FORMAT_U_A8_R8_G8_B8,
- PIPE_FORMAT_U_R5_G6_B5,
+ PIPE_FORMAT_A8R8G8B8_UNORM,
+ PIPE_FORMAT_R5G6B5_UNORM,
};
/*
*/
static const unsigned z_stencil_supported[] = {
- PIPE_FORMAT_U_Z16,
- PIPE_FORMAT_U_Z32,
- PIPE_FORMAT_S8_Z24,
+ PIPE_FORMAT_Z16_UNORM,
+ PIPE_FORMAT_Z32_UNORM,
+ PIPE_FORMAT_S8Z24_UNORM,
};
switch (type) {
}
#else
switch( format ) {
- case PIPE_FORMAT_U_A8_R8_G8_B8:
- case PIPE_FORMAT_U_R5_G6_B5:
- case PIPE_FORMAT_S8_Z24:
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
+ case PIPE_FORMAT_R5G6B5_UNORM:
+ case PIPE_FORMAT_S8Z24_UNORM:
return TRUE;
};
return FALSE;
static unsigned translate_format( unsigned format )
{
switch (format) {
- case PIPE_FORMAT_U_A8_R8_G8_B8:
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
return COLOR_BUF_ARGB8888;
- case PIPE_FORMAT_U_R5_G6_B5:
+ case PIPE_FORMAT_R5G6B5_UNORM:
return COLOR_BUF_RGB565;
default:
assert(0);
static unsigned translate_depth_format( unsigned zformat )
{
switch (zformat) {
- case PIPE_FORMAT_S8_Z24:
+ case PIPE_FORMAT_S8Z24_UNORM:
return DEPTH_FRMT_24_FIXED_8_OTHER;
- case PIPE_FORMAT_U_Z16:
+ case PIPE_FORMAT_Z16_UNORM:
return DEPTH_FRMT_16_FIXED;
default:
assert(0);
if (cbuf_surface)
cformat = cbuf_surface->format;
else
- cformat = PIPE_FORMAT_U_A8_R8_G8_B8; /* arbitrary */
+ cformat = PIPE_FORMAT_A8R8G8B8_UNORM; /* arbitrary */
cformat = translate_format(cformat);
if (depth_surface)
return MAPSURF_8BIT | MT_8BIT_A8;
case PIPE_FORMAT_U_A8_L8:
return MAPSURF_16BIT | MT_16BIT_AY88;
- case PIPE_FORMAT_U_R5_G6_B5:
+ case PIPE_FORMAT_R5G6B5_UNORM:
return MAPSURF_16BIT | MT_16BIT_RGB565;
- case PIPE_FORMAT_U_A1_R5_G5_B5:
+ case PIPE_FORMAT_A1R5G5B5_UNORM:
return MAPSURF_16BIT | MT_16BIT_ARGB1555;
- case PIPE_FORMAT_U_A4_R4_G4_B4:
+ case PIPE_FORMAT_A4R4G4B4_UNORM:
return MAPSURF_16BIT | MT_16BIT_ARGB4444;
- case PIPE_FORMAT_U_A8_R8_G8_B8:
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
return MAPSURF_32BIT | MT_32BIT_ARGB8888;
case PIPE_FORMAT_YCBCR_REV:
return (MAPSURF_422 | MT_422_YCRCB_NORMAL);
case PIPE_FORMAT_RGBA_FXT1:
return (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1);
#endif
- case PIPE_FORMAT_U_Z16:
+ case PIPE_FORMAT_Z16_UNORM:
return (MAPSURF_16BIT | MT_16BIT_L16);
#if 0
case PIPE_FORMAT_RGBA_DXT1:
case PIPE_FORMAT_RGBA_DXT5:
return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
#endif
- case PIPE_FORMAT_S8_Z24:
+ case PIPE_FORMAT_S8Z24_UNORM:
return (MAPSURF_32BIT | MT_32BIT_xL824);
default:
fprintf(stderr, "i915: translate_texture_format() bad image format %x\n",
CLIP_TILE;
switch (ps->format) {
- case PIPE_FORMAT_U_A8_R8_G8_B8:
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
for (i = 0; i < h; i++) {
float *pRow = p;
for (j = 0; j < w; j++) {
p += w0 * 4;
}
break;
- case PIPE_FORMAT_S8_Z24:
+ case PIPE_FORMAT_S8Z24_UNORM:
{
const float scale = 1.0f / (float) 0xffffff;
for (i = 0; i < h; i++) {
/**
* Duplicated formats:
*/
-#define PIPE_FORMAT_U_A8_R8_G8_B8 PIPE_FORMAT_A8R8G8B8_UNORM
-#define PIPE_FORMAT_U_B8_G8_R8_A8 PIPE_FORMAT_B8G8R8A8_UNORM
-#define PIPE_FORMAT_U_A1_R5_G5_B5 PIPE_FORMAT_A1R5G5B5_UNORM
-#define PIPE_FORMAT_U_A4_R4_G4_B4 PIPE_FORMAT_A4R4G4B4_UNORM
-#define PIPE_FORMAT_U_R8_G8_B8_A8 PIPE_FORMAT_R8G8B8A8_UNORM
-#define PIPE_FORMAT_U_R5_G6_B5 PIPE_FORMAT_R5G6B5_UNORM
-#define PIPE_FORMAT_S_R16_G16_B16_A16 PIPE_FORMAT_R16G16B16A16_SNORM
-#define PIPE_FORMAT_U_Z16 PIPE_FORMAT_Z16_UNORM
-#define PIPE_FORMAT_U_Z32 PIPE_FORMAT_Z32_UNORM
-#define PIPE_FORMAT_F_Z32 PIPE_FORMAT_Z32_FLOAT
-#define PIPE_FORMAT_S8_Z24 PIPE_FORMAT_S8Z24_UNORM
-#define PIPE_FORMAT_Z24_S8 PIPE_FORMAT_Z24S8_UNORM
#define PIPE_FORMAT_U_S8 PIPE_FORMAT_S8_UNORM
/**
*/
uint r, g, b, a;
switch (ps->format) {
- case PIPE_FORMAT_U_R8_G8_B8_A8:
+ case PIPE_FORMAT_R8G8B8A8_UNORM:
r = (clearValue >> 24) & 0xff;
g = (clearValue >> 16) & 0xff;
g = (clearValue >> 8) & 0xff;
a = (clearValue ) & 0xff;
break;
- case PIPE_FORMAT_U_A8_R8_G8_B8:
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
r = (clearValue >> 16) & 0xff;
g = (clearValue >> 8) & 0xff;
b = (clearValue ) & 0xff;
a = (clearValue >> 24) & 0xff;
break;
- case PIPE_FORMAT_U_B8_G8_R8_A8:
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
r = (clearValue >> 8) & 0xff;
g = (clearValue >> 16) & 0xff;
b = (clearValue >> 24) & 0xff;
* Also, get the zbuffer values (bzzzz) from the cached tile.
*/
switch (format) {
- case PIPE_FORMAT_U_Z16:
+ case PIPE_FORMAT_Z16_UNORM:
{
float scale = 65535.0;
}
}
break;
- case PIPE_FORMAT_U_Z32:
+ case PIPE_FORMAT_Z32_UNORM:
{
double scale = (double) (uint) ~0UL;
}
}
break;
- case PIPE_FORMAT_S8_Z24:
+ case PIPE_FORMAT_S8Z24_UNORM:
{
float scale = (float) ((1 << 24) - 1);
}
}
break;
- case PIPE_FORMAT_Z24_S8:
+ case PIPE_FORMAT_Z24S8_UNORM:
{
float scale = (float) ((1 << 24) - 1);
/* put updated Z values back into cached tile */
switch (format) {
- case PIPE_FORMAT_U_Z16:
+ case PIPE_FORMAT_Z16_UNORM:
for (j = 0; j < QUAD_SIZE; j++) {
int x = quad->x0 % TILE_SIZE + (j & 1);
int y = quad->y0 % TILE_SIZE + (j >> 1);
tile->data.depth16[y][x] = (ushort) bzzzz[j];
}
break;
- case PIPE_FORMAT_U_Z32:
+ case PIPE_FORMAT_Z32_UNORM:
for (j = 0; j < QUAD_SIZE; j++) {
int x = quad->x0 % TILE_SIZE + (j & 1);
int y = quad->y0 % TILE_SIZE + (j >> 1);
tile->data.depth32[y][x] = bzzzz[j];
}
break;
- case PIPE_FORMAT_S8_Z24:
+ case PIPE_FORMAT_S8Z24_UNORM:
for (j = 0; j < QUAD_SIZE; j++) {
int x = quad->x0 % TILE_SIZE + (j & 1);
int y = quad->y0 % TILE_SIZE + (j >> 1);
tile->data.depth32[y][x] = s8z24;
}
break;
- case PIPE_FORMAT_Z24_S8:
+ case PIPE_FORMAT_Z24S8_UNORM:
for (j = 0; j < QUAD_SIZE; j++) {
int x = quad->x0 % TILE_SIZE + (j & 1);
int y = quad->y0 % TILE_SIZE + (j >> 1);
/* get stencil values from cached tile */
switch (ps->format) {
- case PIPE_FORMAT_S8_Z24:
+ case PIPE_FORMAT_S8Z24_UNORM:
for (j = 0; j < QUAD_SIZE; j++) {
int x = quad->x0 % TILE_SIZE + (j & 1);
int y = quad->y0 % TILE_SIZE + (j >> 1);
stencilVals[j] = tile->data.depth32[y][x] >> 24;
}
break;
- case PIPE_FORMAT_Z24_S8:
+ case PIPE_FORMAT_Z24S8_UNORM:
for (j = 0; j < QUAD_SIZE; j++) {
int x = quad->x0 % TILE_SIZE + (j & 1);
int y = quad->y0 % TILE_SIZE + (j >> 1);
/* put new stencil values into cached tile */
switch (ps->format) {
- case PIPE_FORMAT_S8_Z24:
+ case PIPE_FORMAT_S8Z24_UNORM:
for (j = 0; j < QUAD_SIZE; j++) {
int x = quad->x0 % TILE_SIZE + (j & 1);
int y = quad->y0 % TILE_SIZE + (j >> 1);
tile->data.depth32[y][x] = s8z24;
}
break;
- case PIPE_FORMAT_Z24_S8:
+ case PIPE_FORMAT_Z24S8_UNORM:
for (j = 0; j < QUAD_SIZE; j++) {
int x = quad->x0 % TILE_SIZE + (j & 1);
int y = quad->y0 % TILE_SIZE + (j >> 1);
#endif
-/*** PIPE_FORMAT_U_A8_R8_G8_B8 ***/
+/*** PIPE_FORMAT_A8R8G8B8_UNORM ***/
static void
a8r8g8b8_get_tile(struct pipe_surface *ps,
unsigned i, j;
unsigned w0 = w;
- assert(ps->format == PIPE_FORMAT_U_A8_R8_G8_B8);
+ assert(ps->format == PIPE_FORMAT_A8R8G8B8_UNORM);
CLIP_TILE;
unsigned i, j;
unsigned w0 = w;
- assert(ps->format == PIPE_FORMAT_U_A8_R8_G8_B8);
+ assert(ps->format == PIPE_FORMAT_A8R8G8B8_UNORM);
CLIP_TILE;
}
-/*** PIPE_FORMAT_U_B8_G8_R8_A8 ***/
+/*** PIPE_FORMAT_B8G8R8A8_UNORM ***/
static void
b8g8r8a8_get_tile(struct pipe_surface *ps,
unsigned i, j;
unsigned w0 = w;
- assert(ps->format == PIPE_FORMAT_U_B8_G8_R8_A8);
+ assert(ps->format == PIPE_FORMAT_B8G8R8A8_UNORM);
CLIP_TILE;
unsigned i, j;
unsigned w0 = w;
- assert(ps->format == PIPE_FORMAT_U_B8_G8_R8_A8);
+ assert(ps->format == PIPE_FORMAT_B8G8R8A8_UNORM);
CLIP_TILE;
}
-/*** PIPE_FORMAT_U_A1_R5_G5_B5 ***/
+/*** PIPE_FORMAT_A1R5G5B5_UNORM ***/
static void
a1r5g5b5_get_tile(struct pipe_surface *ps,
+ y * ps->pitch + x;
unsigned i, j;
- assert(ps->format == PIPE_FORMAT_U_A1_R5_G5_B5);
+ assert(ps->format == PIPE_FORMAT_A1R5G5B5_UNORM);
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
-/*** PIPE_FORMAT_U_Z16 ***/
+/*** PIPE_FORMAT_Z16_UNORM ***/
/**
* Return each Z value as four floats in [0,1].
unsigned i, j;
unsigned w0 = w;
- assert(ps->format == PIPE_FORMAT_U_Z16);
+ assert(ps->format == PIPE_FORMAT_Z16_UNORM);
CLIP_TILE;
}
-/*** PIPE_FORMAT_S_R16_G16_B16_A16 ***/
+/*** PIPE_FORMAT_R16G16B16A16_SNORM ***/
static void
r16g16b16a16_get_tile(struct pipe_surface *ps,
unsigned i, j;
unsigned w0 = w;
- assert(ps->format == PIPE_FORMAT_S_R16_G16_B16_A16);
+ assert(ps->format == PIPE_FORMAT_R16G16B16A16_SNORM);
CLIP_TILE;
unsigned i, j;
unsigned w0 = w;
- assert(ps->format == PIPE_FORMAT_S_R16_G16_B16_A16);
+ assert(ps->format == PIPE_FORMAT_R16G16B16A16_SNORM);
CLIP_TILE;
-/*** PIPE_FORMAT_U_Z32 ***/
+/*** PIPE_FORMAT_Z32_UNORM ***/
/**
* Return each Z value as four floats in [0,1].
unsigned i, j;
unsigned w0 = w;
- assert(ps->format == PIPE_FORMAT_U_Z16);
+ assert(ps->format == PIPE_FORMAT_Z16_UNORM);
CLIP_TILE;
}
-/*** PIPE_FORMAT_S8_Z24 ***/
+/*** PIPE_FORMAT_S8Z24_UNORM ***/
/**
* Return Z component as four float in [0,1]. Stencil part ignored.
unsigned i, j;
unsigned w0 = w;
- assert(ps->format == PIPE_FORMAT_S8_Z24);
+ assert(ps->format == PIPE_FORMAT_S8Z24_UNORM);
CLIP_TILE;
}
-/*** PIPE_FORMAT_Z24_S8 ***/
+/*** PIPE_FORMAT_Z24S8_UNORM ***/
/**
* Return Z component as four float in [0,1]. Stencil part ignored.
unsigned i, j;
unsigned w0 = w;
- assert(ps->format == PIPE_FORMAT_Z24_S8);
+ assert(ps->format == PIPE_FORMAT_Z24S8_UNORM);
CLIP_TILE;
float *p)
{
switch (ps->format) {
- case PIPE_FORMAT_U_A8_R8_G8_B8:
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
a8r8g8b8_get_tile(ps, x, y, w, h, p);
break;
- case PIPE_FORMAT_U_B8_G8_R8_A8:
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
b8g8r8a8_get_tile(ps, x, y, w, h, p);
break;
- case PIPE_FORMAT_U_A1_R5_G5_B5:
+ case PIPE_FORMAT_A1R5G5B5_UNORM:
a1r5g5b5_get_tile(ps, x, y, w, h, p);
break;
case PIPE_FORMAT_U_L8:
case PIPE_FORMAT_U_A8_L8:
a8_l8_get_tile(ps, x, y, w, h, p);
break;
- case PIPE_FORMAT_S_R16_G16_B16_A16:
+ case PIPE_FORMAT_R16G16B16A16_SNORM:
r16g16b16a16_get_tile(ps, x, y, w, h, p);
break;
- case PIPE_FORMAT_U_Z16:
+ case PIPE_FORMAT_Z16_UNORM:
z16_get_tile(ps, x, y, w, h, p);
break;
- case PIPE_FORMAT_U_Z32:
+ case PIPE_FORMAT_Z32_UNORM:
z32_get_tile(ps, x, y, w, h, p);
break;
- case PIPE_FORMAT_S8_Z24:
+ case PIPE_FORMAT_S8Z24_UNORM:
s8z24_get_tile(ps, x, y, w, h, p);
break;
- case PIPE_FORMAT_Z24_S8:
+ case PIPE_FORMAT_Z24S8_UNORM:
z24s8_get_tile(ps, x, y, w, h, p);
break;
default:
const float *p)
{
switch (ps->format) {
- case PIPE_FORMAT_U_A8_R8_G8_B8:
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
a8r8g8b8_put_tile(ps, x, y, w, h, p);
break;
- case PIPE_FORMAT_U_B8_G8_R8_A8:
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
b8g8r8a8_put_tile(ps, x, y, w, h, p);
break;
- case PIPE_FORMAT_U_A1_R5_G5_B5:
+ case PIPE_FORMAT_A1R5G5B5_UNORM:
/*a1r5g5b5_put_tile(ps, x, y, w, h, p);*/
break;
case PIPE_FORMAT_U_L8:
case PIPE_FORMAT_U_A8_L8:
/*a8_l8_put_tile(ps, x, y, w, h, p);*/
break;
- case PIPE_FORMAT_S_R16_G16_B16_A16:
+ case PIPE_FORMAT_R16G16B16A16_SNORM:
r16g16b16a16_put_tile(ps, x, y, w, h, p);
break;
- case PIPE_FORMAT_U_Z16:
+ case PIPE_FORMAT_Z16_UNORM:
/*z16_put_tile(ps, x, y, w, h, p);*/
break;
- case PIPE_FORMAT_U_Z32:
+ case PIPE_FORMAT_Z32_UNORM:
/*z32_put_tile(ps, x, y, w, h, p);*/
break;
- case PIPE_FORMAT_S8_Z24:
+ case PIPE_FORMAT_S8Z24_UNORM:
/*s8z24_put_tile(ps, x, y, w, h, p);*/
break;
- case PIPE_FORMAT_Z24_S8:
+ case PIPE_FORMAT_Z24S8_UNORM:
/*z24s8_put_tile(ps, x, y, w, h, p);*/
break;
default:
is_depth_stencil_surface(struct pipe_surface *ps)
{
return (ps &&
- (ps->format == PIPE_FORMAT_S8_Z24 ||
- ps->format == PIPE_FORMAT_U_Z16 ||
- ps->format == PIPE_FORMAT_U_Z32 ||
+ (ps->format == PIPE_FORMAT_S8Z24_UNORM ||
+ ps->format == PIPE_FORMAT_Z16_UNORM ||
+ ps->format == PIPE_FORMAT_Z32_UNORM ||
ps->format == PIPE_FORMAT_U_S8));
}
uint i, j;
switch (format) {
- case PIPE_FORMAT_U_Z16:
+ case PIPE_FORMAT_Z16_UNORM:
{
ushort clear_val = (ushort) (clear_value[0] * 0xffff);
for (i = 0; i < TILE_SIZE; i++) {
}
}
break;
- case PIPE_FORMAT_U_Z32:
+ case PIPE_FORMAT_Z32_UNORM:
{
uint clear_val = (uint) (clear_value[0] * 0xffffffff);
for (i = 0; i < TILE_SIZE; i++) {
}
}
break;
- case PIPE_FORMAT_S8_Z24:
+ case PIPE_FORMAT_S8Z24_UNORM:
{
uint clear_val = (uint) (clear_value[0] * 0xffffff);
clear_val |= ((uint) clear_value[1]) << 24;
return 0 /* PIXEL_FORMAT_U_A8_B8_G8_R8 */;
}
else {
- return PIPE_FORMAT_U_R8_G8_B8_A8;
+ return PIPE_FORMAT_R8G8B8A8_UNORM;
}
}
else if ( GET_REDMASK(v) == 0xff0000
&& v->BitsPerPixel == 32) {
if (CHECK_BYTE_ORDER(v)) {
/* no byteswapping needed */
- return PIPE_FORMAT_U_A8_R8_G8_B8;
+ return PIPE_FORMAT_A8R8G8B8_UNORM;
}
else {
- return PIPE_FORMAT_U_B8_G8_R8_A8;
+ return PIPE_FORMAT_B8G8R8A8_UNORM;
}
}
else if ( GET_REDMASK(v) == 0xf800
&& CHECK_BYTE_ORDER(v)
&& v->BitsPerPixel == 16) {
/* 5-6-5 RGB */
- return PIPE_FORMAT_U_R5_G6_B5;
+ return PIPE_FORMAT_R5G6B5_UNORM;
}
assert(0);
else {
/* non-color / window surface format */
switch (format) {
- case PIPE_FORMAT_S_R16_G16_B16_A16:
- case PIPE_FORMAT_S8_Z24:
+ case PIPE_FORMAT_R16G16B16A16_SNORM:
+ case PIPE_FORMAT_S8Z24_UNORM:
case PIPE_FORMAT_U_S8:
- case PIPE_FORMAT_U_Z16:
- case PIPE_FORMAT_U_Z32:
+ case PIPE_FORMAT_Z16_UNORM:
+ case PIPE_FORMAT_Z32_UNORM:
return TRUE;
default:
return FALSE;