浏览代码

st/mesa: add fallback pipe formats for (compressed) R, RG formats

If we don't find an exact PIPE_FORMAT_x for a GL_(COMPRESSED)_RED/RG format,
try uncompressed formats.  We were already doing this for the RGB(A) formats.

Fixes piglit arb_texture_compression-internal-format-query test.

NOTE: This is a candidate for the stable branches.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
tags/i965-primitive-restart-v2
Brian Paul 13 年前
父节点
当前提交
75f37ddba7
共有 1 个文件被更改,包括 22 次插入12 次删除
  1. 22
    12
      src/mesa/state_tracker/st_format.c

+ 22
- 12
src/mesa/state_tracker/st_format.c 查看文件

@@ -839,6 +839,15 @@ struct format_mapping
PIPE_FORMAT_S8_UINT_Z24_UNORM, \
0

#define DEFAULT_SNORM8_RGBA_FORMATS \
PIPE_FORMAT_R8G8B8A8_SNORM, \
0

#define DEFAULT_UNORM16_RGBA_FORMATS \
PIPE_FORMAT_R16G16B16A16_UNORM, \
DEFAULT_RGBA_FORMATS


/**
* This table maps OpenGL texture format enums to Gallium pipe_format enums.
* Multiple GL enums might map to multiple pipe_formats.
@@ -1145,54 +1154,55 @@ static const struct format_mapping format_map[] = {
/* R, RG formats */
{
{ GL_RED, GL_R8, 0 },
{ PIPE_FORMAT_R8_UNORM, 0 }
{ PIPE_FORMAT_R8_UNORM, PIPE_FORMAT_R8G8_UNORM, DEFAULT_RGBA_FORMATS }
},
{
{ GL_RG, GL_RG8, 0 },
{ PIPE_FORMAT_R8G8_UNORM, 0 }
{ PIPE_FORMAT_R8G8_UNORM, DEFAULT_RGBA_FORMATS }
},
{
{ GL_R16, 0 },
{ PIPE_FORMAT_R16_UNORM, 0 }
{ PIPE_FORMAT_R16_UNORM, PIPE_FORMAT_R16G16_UNORM,
DEFAULT_UNORM16_RGBA_FORMATS }
},
{
{ GL_RG16, 0 },
{ PIPE_FORMAT_R16G16_UNORM, 0 }
{ PIPE_FORMAT_R16G16_UNORM, DEFAULT_UNORM16_RGBA_FORMATS }
},

/* compressed R, RG formats */
{
{ GL_COMPRESSED_RED, GL_COMPRESSED_RED_RGTC1, 0 },
{ PIPE_FORMAT_RGTC1_UNORM, PIPE_FORMAT_R8_UNORM, 0 }
{ PIPE_FORMAT_RGTC1_UNORM, PIPE_FORMAT_R8_UNORM, DEFAULT_RGBA_FORMATS }
},
{
{ GL_COMPRESSED_SIGNED_RED_RGTC1, 0 },
{ PIPE_FORMAT_RGTC1_SNORM, 0 }
{ PIPE_FORMAT_RGTC1_SNORM, DEFAULT_SNORM8_RGBA_FORMATS }
},
{
{ GL_COMPRESSED_RG, GL_COMPRESSED_RG_RGTC2, 0 },
{ PIPE_FORMAT_RGTC2_UNORM, PIPE_FORMAT_R8G8_UNORM, 0 }
{ PIPE_FORMAT_RGTC2_UNORM, PIPE_FORMAT_R8G8_UNORM, DEFAULT_RGBA_FORMATS }
},
{
{ GL_COMPRESSED_SIGNED_RG_RGTC2, 0 },
{ PIPE_FORMAT_RGTC2_SNORM, 0 }
{ PIPE_FORMAT_RGTC2_SNORM, DEFAULT_SNORM8_RGBA_FORMATS }
},
{
{ GL_COMPRESSED_LUMINANCE, GL_COMPRESSED_LUMINANCE_LATC1_EXT, 0 },
{ PIPE_FORMAT_LATC1_UNORM, PIPE_FORMAT_L8_UNORM, 0 }
{ PIPE_FORMAT_LATC1_UNORM, PIPE_FORMAT_L8_UNORM, DEFAULT_RGBA_FORMATS }
},
{
{ GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT, 0 },
{ PIPE_FORMAT_LATC1_SNORM, 0 }
{ PIPE_FORMAT_LATC1_SNORM, DEFAULT_SNORM8_RGBA_FORMATS }
},
{
{ GL_COMPRESSED_LUMINANCE_ALPHA, GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT,
GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI, 0 },
{ PIPE_FORMAT_LATC2_UNORM, PIPE_FORMAT_L8A8_UNORM, 0 }
{ PIPE_FORMAT_LATC2_UNORM, PIPE_FORMAT_L8A8_UNORM, DEFAULT_RGBA_FORMATS }
},
{
{ GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT, 0 },
{ PIPE_FORMAT_LATC2_SNORM, 0 }
{ PIPE_FORMAT_LATC2_SNORM, DEFAULT_SNORM8_RGBA_FORMATS }
},

/* ETC1 */

正在加载...
取消
保存