UNCLAMPED_FLOAT_TO_UBYTE(a, color[3]);
switch (pipeFormat) {
- case PIPE_FORMAT_U_R8_G8_B8_A8:
+ case PIPE_FORMAT_R8G8B8A8_UNORM:
return (r << 24) | (g << 16) | (b << 8) | a;
- case PIPE_FORMAT_U_A8_R8_G8_B8:
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
return (a << 24) | (r << 16) | (g << 8) | b;
- case PIPE_FORMAT_U_B8_G8_R8_A8:
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
return (b << 24) | (g << 16) | (r << 8) | a;
- case PIPE_FORMAT_U_R5_G6_B5:
+ case PIPE_FORMAT_R5G6B5_UNORM:
return ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3);
default:
assert(0);
depth_value(GLuint pipeFormat, GLfloat value)
{
switch (pipeFormat) {
- case PIPE_FORMAT_U_Z16:
+ case PIPE_FORMAT_Z16_UNORM:
return (uint) (value * 0xffff);
- case PIPE_FORMAT_U_Z32:
+ case PIPE_FORMAT_Z32_UNORM:
/* special-case to avoid overflow */
if (value == 1.0)
return 0xffffffff;
else
return (uint) (value * 0xffffffff);
- case PIPE_FORMAT_S8_Z24:
+ case PIPE_FORMAT_S8Z24_UNORM:
return (uint) (value * 0xffffff);
- case PIPE_FORMAT_Z24_S8:
+ case PIPE_FORMAT_Z24S8_UNORM:
return ((uint) (value * 0xffffff)) << 8;
default:
assert(0);
is_depth_stencil_format(GLuint pipeFormat)
{
switch (pipeFormat) {
- case PIPE_FORMAT_S8_Z24:
- case PIPE_FORMAT_Z24_S8:
+ case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_Z24S8_UNORM:
return GL_TRUE;
default:
return GL_FALSE;
GLuint clearValue = depth_value(strb->surface->format, ctx->Depth.Clear);
switch (strb->surface->format) {
- case PIPE_FORMAT_S8_Z24:
+ case PIPE_FORMAT_S8Z24_UNORM:
clearValue |= ctx->Stencil.Clear << 24;
break;
- case PIPE_FORMAT_Z24_S8:
+ case PIPE_FORMAT_Z24S8_UNORM:
clearValue |= clearValue | ctx->Stencil.Clear;
break;
default:
static const GLuint one = 1;
GLubyte littleEndian = *((GLubyte *) &one);
- if (pipeFormat == PIPE_FORMAT_U_R8_G8_B8_A8 &&
+ if (pipeFormat == PIPE_FORMAT_R8G8B8A8_UNORM &&
format == GL_RGBA &&
type == GL_UNSIGNED_BYTE &&
!littleEndian) {
return GL_TRUE;
}
- else if (pipeFormat == PIPE_FORMAT_U_R8_G8_B8_A8 &&
+ else if (pipeFormat == PIPE_FORMAT_R8G8B8A8_UNORM &&
format == GL_ABGR_EXT &&
type == GL_UNSIGNED_BYTE &&
littleEndian) {
return GL_TRUE;
}
- else if (pipeFormat == PIPE_FORMAT_U_A8_R8_G8_B8 &&
+ else if (pipeFormat == PIPE_FORMAT_A8R8G8B8_UNORM &&
format == GL_BGRA &&
type == GL_UNSIGNED_BYTE &&
littleEndian) {
return GL_TRUE;
}
- else if (pipeFormat == PIPE_FORMAT_U_R5_G6_B5 &&
+ else if (pipeFormat == PIPE_FORMAT_R5G6B5_UNORM &&
format == GL_RGB &&
type == GL_UNSIGNED_SHORT_5_6_5) {
/* endian don't care */
return GL_TRUE;
}
- else if (pipeFormat == PIPE_FORMAT_U_R5_G6_B5 &&
+ else if (pipeFormat == PIPE_FORMAT_R5G6B5_UNORM &&
format == GL_BGR &&
type == GL_UNSIGNED_SHORT_5_6_5_REV) {
/* endian don't care */
return GL_TRUE;
}
- else if (pipeFormat == PIPE_FORMAT_U_S8 &&
+ else if (pipeFormat == PIPE_FORMAT_S8_UNORM &&
format == GL_STENCIL_INDEX &&
type == GL_UNSIGNED_BYTE) {
return GL_TRUE;
}
- else if (pipeFormat == PIPE_FORMAT_U_Z32 &&
+ else if (pipeFormat == PIPE_FORMAT_Z32_UNORM &&
format == GL_DEPTH_COMPONENT &&
type == GL_UNSIGNED_INT) {
return GL_TRUE;
memcpy(dest, values, spanWidth);
}
break;
- case PIPE_FORMAT_S8_Z24:
+ case PIPE_FORMAT_S8Z24_UNORM:
{
uint *dest = (uint *) stmap + spanY * ps->pitch + spanX;
GLint k;
cpp = 1;
comp = 0;
}
- else if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_A8_R8_G8_B8 )) {
- format = PIPE_FORMAT_U_A8_R8_G8_B8;
+ else if (pipe->is_format_supported( pipe, PIPE_FORMAT_A8R8G8B8_UNORM )) {
+ format = PIPE_FORMAT_A8R8G8B8_UNORM;
internal_format = GL_RGBA8;
cpp = 4;
comp = 3; /* alpha channel */ /*XXX little-endian dependency */
src = buffer + i * width;
switch (psDraw->format) {
- case PIPE_FORMAT_S8_Z24:
+ case PIPE_FORMAT_S8Z24_UNORM:
{
uint *dst4 = (uint *) dst;
int j;
#endif
/* Data type */
- if (format == PIPE_FORMAT_U_A1_R5_G5_B5 || format == PIPE_FORMAT_U_R5_G6_B5) {
+ if (format == PIPE_FORMAT_A1R5G5B5_UNORM || format == PIPE_FORMAT_R5G6B5_UNORM) {
pinfo->datatype = GL_UNSIGNED_SHORT;
}
else {
/* fix this */
case MESA_FORMAT_ARGB8888_REV:
case MESA_FORMAT_ARGB8888:
- return PIPE_FORMAT_U_A8_R8_G8_B8;
+ return PIPE_FORMAT_A8R8G8B8_UNORM;
case MESA_FORMAT_ARGB4444:
- return PIPE_FORMAT_U_A4_R4_G4_B4;
+ return PIPE_FORMAT_A4R4G4B4_UNORM;
case MESA_FORMAT_AL88:
return PIPE_FORMAT_U_A8_L8;
case MESA_FORMAT_A8:
case MESA_FORMAT_I8:
return PIPE_FORMAT_U_I8;
case MESA_FORMAT_Z16:
- return PIPE_FORMAT_U_Z16;
+ return PIPE_FORMAT_Z16_UNORM;
default:
assert(0);
return 0;
struct pipe_context *pipe )
{
static const uint colorFormats[] = {
- PIPE_FORMAT_U_R8_G8_B8_A8,
- PIPE_FORMAT_U_A8_R8_G8_B8,
- PIPE_FORMAT_U_B8_G8_R8_A8,
- PIPE_FORMAT_U_R5_G6_B5
+ PIPE_FORMAT_R8G8B8A8_UNORM,
+ PIPE_FORMAT_A8R8G8B8_UNORM,
+ PIPE_FORMAT_B8G8R8A8_UNORM,
+ PIPE_FORMAT_R5G6B5_UNORM
};
uint i;
for (i = 0; i < Elements(colorFormats); i++) {
default_deep_rgba_format(
struct pipe_context *pipe )
{
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_S_R16_G16_B16_A16 )) {
- return PIPE_FORMAT_S_R16_G16_B16_A16;
+ if (pipe->is_format_supported( pipe, PIPE_FORMAT_R16G16B16A16_SNORM )) {
+ return PIPE_FORMAT_R16G16B16A16_SNORM;
}
return PIPE_FORMAT_NONE;
}
struct pipe_context *pipe )
{
static const uint zFormats[] = {
- PIPE_FORMAT_U_Z16,
- PIPE_FORMAT_U_Z32,
- PIPE_FORMAT_S8_Z24,
- PIPE_FORMAT_Z24_S8
+ PIPE_FORMAT_Z16_UNORM,
+ PIPE_FORMAT_Z32_UNORM,
+ PIPE_FORMAT_S8Z24_UNORM,
+ PIPE_FORMAT_Z24S8_UNORM
};
uint i;
for (i = 0; i < Elements(zFormats); i++) {
case GL_COMPRESSED_RGBA:
if (format == GL_BGRA) {
if (type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_INT_8_8_8_8_REV) {
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_A8_R8_G8_B8 ))
- return PIPE_FORMAT_U_A8_R8_G8_B8;
+ if (pipe->is_format_supported( pipe, PIPE_FORMAT_A8R8G8B8_UNORM ))
+ return PIPE_FORMAT_A8R8G8B8_UNORM;
}
else if (type == GL_UNSIGNED_SHORT_4_4_4_4_REV) {
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_A4_R4_G4_B4 ))
- return PIPE_FORMAT_U_A4_R4_G4_B4;
+ if (pipe->is_format_supported( pipe, PIPE_FORMAT_A4R4G4B4_UNORM ))
+ return PIPE_FORMAT_A4R4G4B4_UNORM;
}
else if (type == GL_UNSIGNED_SHORT_1_5_5_5_REV) {
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_A1_R5_G5_B5 ))
- return PIPE_FORMAT_U_A1_R5_G5_B5;
+ if (pipe->is_format_supported( pipe, PIPE_FORMAT_A1R5G5B5_UNORM ))
+ return PIPE_FORMAT_A1R5G5B5_UNORM;
}
}
return default_rgba_format( pipe );
case GL_RGB:
case GL_COMPRESSED_RGB:
if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) {
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_R5_G6_B5 ))
- return PIPE_FORMAT_U_R5_G6_B5;
+ if (pipe->is_format_supported( pipe, PIPE_FORMAT_R5G6B5_UNORM ))
+ return PIPE_FORMAT_R5G6B5_UNORM;
}
return default_rgba_format( pipe );
case GL_RGBA4:
case GL_RGBA2:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_A4_R4_G4_B4 ))
- return PIPE_FORMAT_U_A4_R4_G4_B4;
+ if (pipe->is_format_supported( pipe, PIPE_FORMAT_A4R4G4B4_UNORM ))
+ return PIPE_FORMAT_A4R4G4B4_UNORM;
return default_rgba_format( pipe );
case GL_RGB5_A1:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_A1_R5_G5_B5 ))
- return PIPE_FORMAT_U_A1_R5_G5_B5;
+ if (pipe->is_format_supported( pipe, PIPE_FORMAT_A1R5G5B5_UNORM ))
+ return PIPE_FORMAT_A1R5G5B5_UNORM;
return default_rgba_format( pipe );
case GL_RGB8:
case GL_RGB5:
case GL_RGB4:
case GL_R3_G3_B2:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_A1_R5_G5_B5 ))
- return PIPE_FORMAT_U_A1_R5_G5_B5;
+ if (pipe->is_format_supported( pipe, PIPE_FORMAT_A1R5G5B5_UNORM ))
+ return PIPE_FORMAT_A1R5G5B5_UNORM;
return default_rgba_format( pipe );
case GL_ALPHA:
#endif
case GL_DEPTH_COMPONENT16:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_Z16 ))
- return PIPE_FORMAT_U_Z16;
+ if (pipe->is_format_supported( pipe, PIPE_FORMAT_Z16_UNORM ))
+ return PIPE_FORMAT_Z16_UNORM;
/* fall-through */
case GL_DEPTH_COMPONENT24:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_S8_Z24 ))
- return PIPE_FORMAT_S8_Z24;
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_Z24_S8 ))
- return PIPE_FORMAT_Z24_S8;
+ if (pipe->is_format_supported( pipe, PIPE_FORMAT_S8Z24_UNORM ))
+ return PIPE_FORMAT_S8Z24_UNORM;
+ if (pipe->is_format_supported( pipe, PIPE_FORMAT_Z24S8_UNORM ))
+ return PIPE_FORMAT_Z24S8_UNORM;
/* fall-through */
case GL_DEPTH_COMPONENT32:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_Z32 ))
- return PIPE_FORMAT_U_Z32;
+ if (pipe->is_format_supported( pipe, PIPE_FORMAT_Z32_UNORM ))
+ return PIPE_FORMAT_Z32_UNORM;
/* fall-through */
case GL_DEPTH_COMPONENT:
return default_depth_format( pipe );
case GL_STENCIL_INDEX16_EXT:
if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_S8 ))
return PIPE_FORMAT_U_S8;
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_S8_Z24 ))
- return PIPE_FORMAT_S8_Z24;
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_Z24_S8 ))
- return PIPE_FORMAT_Z24_S8;
+ if (pipe->is_format_supported( pipe, PIPE_FORMAT_S8Z24_UNORM ))
+ return PIPE_FORMAT_S8Z24_UNORM;
+ if (pipe->is_format_supported( pipe, PIPE_FORMAT_Z24S8_UNORM ))
+ return PIPE_FORMAT_Z24S8_UNORM;
return PIPE_FORMAT_NONE;
case GL_DEPTH_STENCIL_EXT:
case GL_DEPTH24_STENCIL8_EXT:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_S8_Z24 ))
- return PIPE_FORMAT_S8_Z24;
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_Z24_S8 ))
- return PIPE_FORMAT_Z24_S8;
+ if (pipe->is_format_supported( pipe, PIPE_FORMAT_S8Z24_UNORM ))
+ return PIPE_FORMAT_S8Z24_UNORM;
+ if (pipe->is_format_supported( pipe, PIPE_FORMAT_Z24S8_UNORM ))
+ return PIPE_FORMAT_Z24S8_UNORM;
return PIPE_FORMAT_NONE;
default: