Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/utils.c | 103 +++++++++++++++++++++++---------------------------- 1 file changed, 47 insertions(+), 56 deletions(-)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 17aa8c077323..2ae9b944d375 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -571,29 +571,30 @@ struct wined3d_format_block_info UINT block_height; UINT block_byte_count; BOOL verify; + BOOL compressed; };
static const struct wined3d_format_block_info format_block_info[] = { - {WINED3DFMT_DXT1, 4, 4, 8, TRUE}, - {WINED3DFMT_DXT2, 4, 4, 16, TRUE}, - {WINED3DFMT_DXT3, 4, 4, 16, TRUE}, - {WINED3DFMT_DXT4, 4, 4, 16, TRUE}, - {WINED3DFMT_DXT5, 4, 4, 16, TRUE}, - {WINED3DFMT_BC1_UNORM, 4, 4, 8, TRUE}, - {WINED3DFMT_BC2_UNORM, 4, 4, 16, TRUE}, - {WINED3DFMT_BC3_UNORM, 4, 4, 16, TRUE}, - {WINED3DFMT_BC4_UNORM, 4, 4, 8, TRUE}, - {WINED3DFMT_BC4_SNORM, 4, 4, 8, TRUE}, - {WINED3DFMT_BC5_UNORM, 4, 4, 16, TRUE}, - {WINED3DFMT_BC5_SNORM, 4, 4, 16, TRUE}, - {WINED3DFMT_BC6H_UF16, 4, 4, 16, TRUE}, - {WINED3DFMT_BC6H_SF16, 4, 4, 16, TRUE}, - {WINED3DFMT_BC7_UNORM, 4, 4, 16, TRUE}, - {WINED3DFMT_ATI1N, 4, 4, 8, FALSE}, - {WINED3DFMT_ATI2N, 4, 4, 16, FALSE}, - {WINED3DFMT_YUY2, 2, 1, 4, FALSE}, - {WINED3DFMT_UYVY, 2, 1, 4, FALSE}, + {WINED3DFMT_DXT1, 4, 4, 8, TRUE, TRUE}, + {WINED3DFMT_DXT2, 4, 4, 16, TRUE, TRUE}, + {WINED3DFMT_DXT3, 4, 4, 16, TRUE, TRUE}, + {WINED3DFMT_DXT4, 4, 4, 16, TRUE, TRUE}, + {WINED3DFMT_DXT5, 4, 4, 16, TRUE, TRUE}, + {WINED3DFMT_BC1_UNORM, 4, 4, 8, TRUE, TRUE}, + {WINED3DFMT_BC2_UNORM, 4, 4, 16, TRUE, TRUE}, + {WINED3DFMT_BC3_UNORM, 4, 4, 16, TRUE, TRUE}, + {WINED3DFMT_BC4_UNORM, 4, 4, 8, TRUE, TRUE}, + {WINED3DFMT_BC4_SNORM, 4, 4, 8, TRUE, TRUE}, + {WINED3DFMT_BC5_UNORM, 4, 4, 16, TRUE, TRUE}, + {WINED3DFMT_BC5_SNORM, 4, 4, 16, TRUE, TRUE}, + {WINED3DFMT_BC6H_UF16, 4, 4, 16, TRUE, TRUE}, + {WINED3DFMT_BC6H_SF16, 4, 4, 16, TRUE, TRUE}, + {WINED3DFMT_BC7_UNORM, 4, 4, 16, TRUE, TRUE}, + {WINED3DFMT_ATI1N, 4, 4, 8, FALSE, TRUE}, + {WINED3DFMT_ATI2N, 4, 4, 16, FALSE, TRUE}, + {WINED3DFMT_YUY2, 2, 1, 4, FALSE, FALSE}, + {WINED3DFMT_UYVY, 2, 1, 4, FALSE, FALSE}, };
struct wined3d_format_vertex_info @@ -1346,77 +1347,67 @@ static const struct wined3d_format_texture_info format_texture_info[] = {WINED3DFMT_DXT1, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_COMPRESSED, + | WINED3DFMT_FLAG_SRGB_READ, EXT_TEXTURE_COMPRESSION_S3TC, NULL}, {WINED3DFMT_DXT2, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_COMPRESSED, + | WINED3DFMT_FLAG_SRGB_READ, EXT_TEXTURE_COMPRESSION_S3TC, NULL}, {WINED3DFMT_DXT3, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_COMPRESSED, + | WINED3DFMT_FLAG_SRGB_READ, EXT_TEXTURE_COMPRESSION_S3TC, NULL}, {WINED3DFMT_DXT4, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_COMPRESSED, + | WINED3DFMT_FLAG_SRGB_READ, EXT_TEXTURE_COMPRESSION_S3TC, NULL}, {WINED3DFMT_DXT5, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_COMPRESSED, + | WINED3DFMT_FLAG_SRGB_READ, EXT_TEXTURE_COMPRESSION_S3TC, NULL}, {WINED3DFMT_BC1_UNORM, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, EXT_TEXTURE_COMPRESSION_S3TC, NULL}, {WINED3DFMT_BC2_UNORM, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, EXT_TEXTURE_COMPRESSION_S3TC, NULL}, {WINED3DFMT_BC3_UNORM, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, EXT_TEXTURE_COMPRESSION_S3TC, NULL}, {WINED3DFMT_BC4_UNORM, GL_COMPRESSED_RED_RGTC1, GL_COMPRESSED_RED_RGTC1, 0, GL_RED, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, ARB_TEXTURE_COMPRESSION_RGTC, NULL}, {WINED3DFMT_BC4_SNORM, GL_COMPRESSED_SIGNED_RED_RGTC1, GL_COMPRESSED_SIGNED_RED_RGTC1, 0, GL_RED, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, ARB_TEXTURE_COMPRESSION_RGTC, NULL}, {WINED3DFMT_BC5_UNORM, GL_COMPRESSED_RG_RGTC2, GL_COMPRESSED_RG_RGTC2, 0, GL_RG, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, ARB_TEXTURE_COMPRESSION_RGTC, NULL}, {WINED3DFMT_BC5_SNORM, GL_COMPRESSED_SIGNED_RG_RGTC2, GL_COMPRESSED_SIGNED_RG_RGTC2, 0, GL_RG, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, ARB_TEXTURE_COMPRESSION_RGTC, NULL}, {WINED3DFMT_BC6H_UF16, GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB, GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB, 0, GL_RGB, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, ARB_TEXTURE_COMPRESSION_BPTC, NULL}, {WINED3DFMT_BC6H_SF16, GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB, GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB, 0, GL_RGB, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, ARB_TEXTURE_COMPRESSION_BPTC, NULL}, {WINED3DFMT_BC7_UNORM, GL_COMPRESSED_RGBA_BPTC_UNORM_ARB, GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, ARB_TEXTURE_COMPRESSION_BPTC, NULL}, /* IEEE formats */ {WINED3DFMT_R32_FLOAT, GL_RGB32F_ARB, GL_RGB32F_ARB, 0, @@ -1867,23 +1858,19 @@ static const struct wined3d_format_texture_info format_texture_info[] = /* Vendor-specific formats */ {WINED3DFMT_ATI1N, GL_COMPRESSED_RED_RGTC1, GL_COMPRESSED_RED_RGTC1, 0, GL_RED, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, ARB_TEXTURE_COMPRESSION_RGTC, NULL}, {WINED3DFMT_ATI2N, GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI, GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, ATI_TEXTURE_COMPRESSION_3DC, NULL}, {WINED3DFMT_ATI2N, GL_COMPRESSED_RG_RGTC2, GL_COMPRESSED_RG_RGTC2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, EXT_TEXTURE_COMPRESSION_RGTC, NULL}, {WINED3DFMT_ATI2N, GL_COMPRESSED_RG_RGTC2, GL_COMPRESSED_RG_RGTC2, 0, GL_RG, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, ARB_TEXTURE_COMPRESSION_RGTC, NULL}, {WINED3DFMT_INTZ, GL_DEPTH24_STENCIL8_EXT, GL_DEPTH24_STENCIL8_EXT, 0, GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, 0, @@ -2116,19 +2103,23 @@ fail: static BOOL init_format_block_info(struct wined3d_adapter *adapter) { struct wined3d_format *format; - unsigned int i; + unsigned int flags, i;
for (i = 0; i < ARRAY_SIZE(format_block_info); ++i) { if (!(format = get_format_internal(adapter, format_block_info[i].id))) return FALSE;
+ flags = WINED3DFMT_FLAG_BLOCKS; + if (!format_block_info[i].verify) + flags |= WINED3DFMT_FLAG_BLOCKS_NO_VERIFY; + if (format_block_info[i].compressed) + flags |= WINED3DFMT_FLAG_COMPRESSED; + format->block_width = format_block_info[i].block_width; format->block_height = format_block_info[i].block_height; format->block_byte_count = format_block_info[i].block_byte_count; - format_set_flag(format, WINED3DFMT_FLAG_BLOCKS); - if (!format_block_info[i].verify) - format_set_flag(format, WINED3DFMT_FLAG_BLOCKS_NO_VERIFY); + format_set_flag(format, flags); }
return TRUE;