mesa: Remove all mention of MESA_FORMAT_CI8
Nothing in Mesa supports color-index textures, and most of the other infrastructure that could allow such support has already been removed. This puts the final nail in the coffin. Also clean out some GL_COLOR_INDEX comments in formats.c. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
@@ -1310,7 +1310,6 @@ gl_format _dri_texformat_argb4444 = MESA_FORMAT_NONE;
|
||||
gl_format _dri_texformat_argb1555 = MESA_FORMAT_NONE;
|
||||
gl_format _dri_texformat_al88 = MESA_FORMAT_NONE;
|
||||
gl_format _dri_texformat_a8 = MESA_FORMAT_A8;
|
||||
gl_format _dri_texformat_ci8 = MESA_FORMAT_CI8;
|
||||
gl_format _dri_texformat_i8 = MESA_FORMAT_I8;
|
||||
gl_format _dri_texformat_l8 = MESA_FORMAT_L8;
|
||||
/*@}*/
|
||||
|
@@ -97,7 +97,6 @@ static const struct tx_table tx_table_be[] =
|
||||
_ALPHA(A8),
|
||||
_COLOR(L8),
|
||||
_ALPHA(I8),
|
||||
_INVALID(CI8),
|
||||
_YUV(YCBCR),
|
||||
_YUV(YCBCR_REV),
|
||||
_INVALID(RGB_FXT1),
|
||||
@@ -126,7 +125,6 @@ static const struct tx_table tx_table_le[] =
|
||||
_ALPHA(A8),
|
||||
_COLOR(L8),
|
||||
_ALPHA(I8),
|
||||
_INVALID(CI8),
|
||||
_YUV(YCBCR),
|
||||
_YUV(YCBCR_REV),
|
||||
_INVALID(RGB_FXT1),
|
||||
|
@@ -101,7 +101,6 @@ static const struct tx_table tx_table[] =
|
||||
_ALPHA(A8),
|
||||
_COLOR(L8),
|
||||
_ALPHA(I8),
|
||||
_INVALID(CI8),
|
||||
_YUV(YCBCR),
|
||||
_YUV(YCBCR_REV),
|
||||
_INVALID(RGB_FXT1),
|
||||
|
@@ -588,7 +588,6 @@ _mesa_print_texture(struct gl_context *ctx, struct gl_texture_image *img)
|
||||
case MESA_FORMAT_A8:
|
||||
case MESA_FORMAT_L8:
|
||||
case MESA_FORMAT_I8:
|
||||
case MESA_FORMAT_CI8:
|
||||
c = 1;
|
||||
break;
|
||||
case MESA_FORMAT_AL88:
|
||||
|
@@ -2321,7 +2321,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
|
||||
}
|
||||
else {
|
||||
gl_format format = att->Renderbuffer->Format;
|
||||
if (format == MESA_FORMAT_CI8 || format == MESA_FORMAT_S8) {
|
||||
if (format == MESA_FORMAT_S8) {
|
||||
/* special cases */
|
||||
*params = GL_INDEX;
|
||||
}
|
||||
|
@@ -42,8 +42,7 @@ struct gl_format_info
|
||||
/**
|
||||
* Base format is one of GL_RED, GL_RG, GL_RGB, GL_RGBA, GL_ALPHA,
|
||||
* GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_INTENSITY, GL_YCBCR_MESA,
|
||||
* GL_COLOR_INDEX, GL_DEPTH_COMPONENT, GL_STENCIL_INDEX,
|
||||
* GL_DEPTH_STENCIL, GL_DUDV_ATI.
|
||||
* GL_DEPTH_COMPONENT, GL_STENCIL_INDEX, GL_DEPTH_STENCIL, GL_DUDV_ATI.
|
||||
*/
|
||||
GLenum BaseFormat;
|
||||
|
||||
@@ -330,15 +329,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
|
||||
0, 16, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
|
||||
1, 1, 2 /* BlockWidth/Height,Bytes */
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_CI8, /* Name */
|
||||
"MESA_FORMAT_CI8", /* StrName */
|
||||
GL_COLOR_INDEX, /* BaseFormat */
|
||||
GL_UNSIGNED_INT, /* DataType */
|
||||
0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
|
||||
0, 0, 8, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
|
||||
1, 1, 1 /* BlockWidth/Height,Bytes */
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_YCBCR, /* Name */
|
||||
"MESA_FORMAT_YCBCR", /* StrName */
|
||||
@@ -1223,10 +1213,9 @@ _mesa_get_format_datatype(gl_format format)
|
||||
|
||||
|
||||
/**
|
||||
* Return the basic format for the given type. The result will be
|
||||
* one of GL_RGB, GL_RGBA, GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA,
|
||||
* GL_INTENSITY, GL_YCBCR_MESA, GL_COLOR_INDEX, GL_DEPTH_COMPONENT,
|
||||
* GL_STENCIL_INDEX, GL_DEPTH_STENCIL.
|
||||
* Return the basic format for the given type. The result will be one of
|
||||
* GL_RGB, GL_RGBA, GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_INTENSITY,
|
||||
* GL_YCBCR_MESA, GL_DEPTH_COMPONENT, GL_STENCIL_INDEX, GL_DEPTH_STENCIL.
|
||||
*/
|
||||
GLenum
|
||||
_mesa_get_format_base_format(gl_format format)
|
||||
@@ -1632,7 +1621,6 @@ _mesa_format_to_type_and_comps(gl_format format,
|
||||
case MESA_FORMAT_A8:
|
||||
case MESA_FORMAT_L8:
|
||||
case MESA_FORMAT_I8:
|
||||
case MESA_FORMAT_CI8:
|
||||
case MESA_FORMAT_R8:
|
||||
case MESA_FORMAT_S8:
|
||||
*datatype = GL_UNSIGNED_BYTE;
|
||||
|
@@ -80,7 +80,6 @@ typedef enum
|
||||
MESA_FORMAT_L16, /* LLLL LLLL LLLL LLLL */
|
||||
MESA_FORMAT_I8, /* IIII IIII */
|
||||
MESA_FORMAT_I16, /* IIII IIII IIII IIII */
|
||||
MESA_FORMAT_CI8, /* CCCC CCCC */
|
||||
MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */
|
||||
MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */
|
||||
MESA_FORMAT_R8, /* RRRR RRRR */
|
||||
|
@@ -324,13 +324,6 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
|
||||
fetch_texel_3d_f_i16,
|
||||
store_texel_i16
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_CI8,
|
||||
fetch_texel_1d_f_ci8,
|
||||
fetch_texel_2d_f_ci8,
|
||||
fetch_texel_3d_f_ci8,
|
||||
store_texel_ci8
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_YCBCR,
|
||||
fetch_texel_1d_f_ycbcr,
|
||||
|
@@ -1379,88 +1379,6 @@ static void store_texel_i16(struct gl_texture_image *texImage,
|
||||
#endif
|
||||
|
||||
|
||||
/* MESA_FORMAT_CI8 ***********************************************************/
|
||||
|
||||
/* Fetch CI texel from 1D, 2D or 3D ci8 texture, lookup the index in a
|
||||
* color table, and return 4 GLchans.
|
||||
*/
|
||||
static void FETCH(f_ci8)( const struct gl_texture_image *texImage,
|
||||
GLint i, GLint j, GLint k, GLfloat *texel )
|
||||
{
|
||||
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
|
||||
const struct gl_color_table *palette;
|
||||
GLuint index;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
if (ctx->Texture.SharedPalette) {
|
||||
palette = &ctx->Texture.Palette;
|
||||
}
|
||||
else {
|
||||
palette = &texImage->TexObject->Palette;
|
||||
}
|
||||
if (palette->Size == 0)
|
||||
return; /* undefined results */
|
||||
|
||||
/* Mask the index against size of palette to avoid going out of bounds */
|
||||
index = (*src) & (palette->Size - 1);
|
||||
|
||||
{
|
||||
const GLfloat *table = palette->TableF;
|
||||
switch (palette->_BaseFormat) {
|
||||
case GL_ALPHA:
|
||||
texel[RCOMP] =
|
||||
texel[GCOMP] =
|
||||
texel[BCOMP] = 0.0F;
|
||||
texel[ACOMP] = table[index];
|
||||
break;
|
||||
case GL_LUMINANCE:
|
||||
texel[RCOMP] =
|
||||
texel[GCOMP] =
|
||||
texel[BCOMP] = table[index];
|
||||
texel[ACOMP] = 1.0F;
|
||||
break;
|
||||
case GL_INTENSITY:
|
||||
texel[RCOMP] =
|
||||
texel[GCOMP] =
|
||||
texel[BCOMP] =
|
||||
texel[ACOMP] = table[index];
|
||||
break;
|
||||
case GL_LUMINANCE_ALPHA:
|
||||
texel[RCOMP] =
|
||||
texel[GCOMP] =
|
||||
texel[BCOMP] = table[index * 2 + 0];
|
||||
texel[ACOMP] = table[index * 2 + 1];
|
||||
break;
|
||||
case GL_RGB:
|
||||
texel[RCOMP] = table[index * 3 + 0];
|
||||
texel[GCOMP] = table[index * 3 + 1];
|
||||
texel[BCOMP] = table[index * 3 + 2];
|
||||
texel[ACOMP] = 1.0F;
|
||||
break;
|
||||
case GL_RGBA:
|
||||
texel[RCOMP] = table[index * 4 + 0];
|
||||
texel[GCOMP] = table[index * 4 + 1];
|
||||
texel[BCOMP] = table[index * 4 + 2];
|
||||
texel[ACOMP] = table[index * 4 + 3];
|
||||
break;
|
||||
default:
|
||||
_mesa_problem(ctx, "Bad palette format in fetch_texel_ci8");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if DIM == 3
|
||||
static void store_texel_ci8(struct gl_texture_image *texImage,
|
||||
GLint i, GLint j, GLint k, const void *texel)
|
||||
{
|
||||
const GLubyte *index = (const GLubyte *) texel;
|
||||
GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
|
||||
*dst = *index;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Fetch texel from 1D, 2D or 3D srgb8 texture, return 4 GLfloats */
|
||||
/* Note: component order is same as for MESA_FORMAT_RGB888 */
|
||||
static void FETCH(srgb8)(const struct gl_texture_image *texImage,
|
||||
|
@@ -204,9 +204,6 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
|
||||
case GL_COLOR_INDEX12_EXT:
|
||||
case GL_COLOR_INDEX16_EXT:
|
||||
case GL_COLOR_INDEX8_EXT:
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_CI8);
|
||||
break;
|
||||
|
||||
default:
|
||||
; /* fallthrough */
|
||||
}
|
||||
|
@@ -2724,50 +2724,6 @@ _mesa_texstore_unorm8(TEXSTORE_PARAMS)
|
||||
|
||||
|
||||
|
||||
static GLboolean
|
||||
_mesa_texstore_ci8(TEXSTORE_PARAMS)
|
||||
{
|
||||
const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
|
||||
|
||||
(void) dims; (void) baseInternalFormat;
|
||||
ASSERT(dstFormat == MESA_FORMAT_CI8);
|
||||
ASSERT(texelBytes == 1);
|
||||
ASSERT(baseInternalFormat == GL_COLOR_INDEX);
|
||||
|
||||
if (!ctx->_ImageTransferState &&
|
||||
!srcPacking->SwapBytes &&
|
||||
srcFormat == GL_COLOR_INDEX &&
|
||||
srcType == GL_UNSIGNED_BYTE) {
|
||||
/* simple memcpy path */
|
||||
memcpy_texture(ctx, dims,
|
||||
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
|
||||
dstRowStride,
|
||||
dstImageOffsets,
|
||||
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
|
||||
srcAddr, srcPacking);
|
||||
}
|
||||
else {
|
||||
/* general path */
|
||||
GLint img, row;
|
||||
for (img = 0; img < srcDepth; img++) {
|
||||
GLubyte *dstRow = (GLubyte *) dstAddr
|
||||
+ dstImageOffsets[dstZoffset + img] * texelBytes
|
||||
+ dstYoffset * dstRowStride
|
||||
+ dstXoffset * texelBytes;
|
||||
for (row = 0; row < srcHeight; row++) {
|
||||
const GLvoid *src = _mesa_image_address(dims, srcPacking,
|
||||
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
|
||||
_mesa_unpack_index_span(ctx, srcWidth, GL_UNSIGNED_BYTE, dstRow,
|
||||
srcType, src, srcPacking,
|
||||
ctx->_ImageTransferState);
|
||||
dstRow += dstRowStride;
|
||||
}
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Texstore for _mesa_texformat_ycbcr or _mesa_texformat_ycbcr_REV.
|
||||
*/
|
||||
@@ -4392,7 +4348,6 @@ texstore_funcs[MESA_FORMAT_COUNT] =
|
||||
{ MESA_FORMAT_L16, _mesa_texstore_unorm16 },
|
||||
{ MESA_FORMAT_I8, _mesa_texstore_unorm8 },
|
||||
{ MESA_FORMAT_I16, _mesa_texstore_unorm16 },
|
||||
{ MESA_FORMAT_CI8, _mesa_texstore_ci8 },
|
||||
{ MESA_FORMAT_YCBCR, _mesa_texstore_ycbcr },
|
||||
{ MESA_FORMAT_YCBCR_REV, _mesa_texstore_ycbcr },
|
||||
{ MESA_FORMAT_R8, _mesa_texstore_unorm8 },
|
||||
|
Reference in New Issue
Block a user