mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 09:41:41 +00:00
wined3d: Use a string channel desc to initialize typed formats.
Avoid the need for manually set type attributes, and initialize the component count for all such formats. This fixes use of R11G11B10_FLOAT as a vertex attribute format with the GL backend. Since it has no corresponding typeless format, prior to this commit the component count was uninitialized and hence use of the format would result in a GL error. This fixes a GL error with Dark Souls Remastered. I did not immediately observe any corresponding rendering errors, however.
This commit is contained in:
parent
941e685a5b
commit
bb82bc78f4
|
@ -19611,7 +19611,6 @@ static void test_vertex_formats(void)
|
|||
ID3D10Device_PSSetShader(device, test_context.ps);
|
||||
ID3D10Device_Draw(device, 4, 0);
|
||||
|
||||
todo_wine_if (tests[i].format == DXGI_FORMAT_R11G11B10_FLOAT)
|
||||
check_texture_vec4(rt, &tests[i].expect, 1);
|
||||
|
||||
ID3D10InputLayout_Release(input_layout);
|
||||
|
|
|
@ -34903,7 +34903,6 @@ static void test_vertex_formats(void)
|
|||
ID3D11DeviceContext_PSSetShader(context, test_context.ps, NULL, 0);
|
||||
ID3D11DeviceContext_Draw(context, 4, 0);
|
||||
|
||||
todo_wine_if (tests[i].format == DXGI_FORMAT_R11G11B10_FLOAT)
|
||||
check_texture_vec4(rt, &tests[i].expect, 1);
|
||||
|
||||
ID3D11InputLayout_Release(input_layout);
|
||||
|
|
|
@ -74,12 +74,13 @@ struct wined3d_format_channels
|
|||
DWORD red_offset, green_offset, blue_offset, alpha_offset;
|
||||
UINT bpp;
|
||||
BYTE depth_size, stencil_size;
|
||||
const char *channels;
|
||||
};
|
||||
|
||||
static const struct wined3d_format_channels formats[] =
|
||||
{
|
||||
/* size offset
|
||||
* format id r g b a r g b a bpp depth stencil */
|
||||
* format id r g b a r g b a bpp z s channels */
|
||||
{WINED3DFMT_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
/* FourCC formats */
|
||||
{WINED3DFMT_UYVY, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
|
||||
|
@ -96,22 +97,22 @@ static const struct wined3d_format_channels formats[] =
|
|||
{WINED3DFMT_R8G8_B8G8, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
|
||||
/* Hmm? */
|
||||
{WINED3DFMT_R8G8_SNORM_Cx, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
|
||||
{WINED3DFMT_R11G11B10_FLOAT, 11, 11, 10, 0, 0, 11, 22, 0, 4, 0, 0},
|
||||
{WINED3DFMT_R11G11B10_FLOAT, 11, 11, 10, 0, 0, 11, 22, 0, 4, 0, 0, "FFF"},
|
||||
/* Palettized formats */
|
||||
{WINED3DFMT_P8_UINT_A8_UNORM, 0, 0, 0, 8, 0, 0, 0, 8, 2, 0, 0},
|
||||
{WINED3DFMT_P8_UINT, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
|
||||
/* Standard ARGB formats. */
|
||||
{WINED3DFMT_B8G8R8_UNORM, 8, 8, 8, 0, 16, 8, 0, 0, 3, 0, 0},
|
||||
{WINED3DFMT_B5G6R5_UNORM, 5, 6, 5, 0, 11, 5, 0, 0, 2, 0, 0},
|
||||
{WINED3DFMT_B5G5R5X1_UNORM, 5, 5, 5, 0, 10, 5, 0, 0, 2, 0, 0},
|
||||
{WINED3DFMT_B5G5R5A1_UNORM, 5, 5, 5, 1, 10, 5, 0, 15, 2, 0, 0},
|
||||
{WINED3DFMT_B4G4R4A4_UNORM, 4, 4, 4, 4, 8, 4, 0, 12, 2, 0, 0},
|
||||
{WINED3DFMT_B2G3R3_UNORM, 3, 3, 2, 0, 5, 2, 0, 0, 1, 0, 0},
|
||||
{WINED3DFMT_A8_UNORM, 0, 0, 0, 8, 0, 0, 0, 0, 1, 0, 0},
|
||||
{WINED3DFMT_B2G3R3A8_UNORM, 3, 3, 2, 8, 5, 2, 0, 8, 2, 0, 0},
|
||||
{WINED3DFMT_B4G4R4X4_UNORM, 4, 4, 4, 0, 8, 4, 0, 0, 2, 0, 0},
|
||||
{WINED3DFMT_R8G8B8X8_UNORM, 8, 8, 8, 0, 0, 8, 16, 0, 4, 0, 0},
|
||||
{WINED3DFMT_B10G10R10A2_UNORM, 10, 10, 10, 2, 20, 10, 0, 30, 4, 0, 0},
|
||||
{WINED3DFMT_B8G8R8_UNORM, 8, 8, 8, 0, 16, 8, 0, 0, 3, 0, 0, "uuu"},
|
||||
{WINED3DFMT_B5G6R5_UNORM, 5, 6, 5, 0, 11, 5, 0, 0, 2, 0, 0, "uuu"},
|
||||
{WINED3DFMT_B5G5R5X1_UNORM, 5, 5, 5, 0, 10, 5, 0, 0, 2, 0, 0, "uuuX"},
|
||||
{WINED3DFMT_B5G5R5A1_UNORM, 5, 5, 5, 1, 10, 5, 0, 15, 2, 0, 0, "uuuu"},
|
||||
{WINED3DFMT_B4G4R4A4_UNORM, 4, 4, 4, 4, 8, 4, 0, 12, 2, 0, 0, "uuuu"},
|
||||
{WINED3DFMT_B2G3R3_UNORM, 3, 3, 2, 0, 5, 2, 0, 0, 1, 0, 0, "uuu"},
|
||||
{WINED3DFMT_A8_UNORM, 0, 0, 0, 8, 0, 0, 0, 0, 1, 0, 0, "u"},
|
||||
{WINED3DFMT_B2G3R3A8_UNORM, 3, 3, 2, 8, 5, 2, 0, 8, 2, 0, 0, "uuuu"},
|
||||
{WINED3DFMT_B4G4R4X4_UNORM, 4, 4, 4, 0, 8, 4, 0, 0, 2, 0, 0, "uuuX"},
|
||||
{WINED3DFMT_R8G8B8X8_UNORM, 8, 8, 8, 0, 0, 8, 16, 0, 4, 0, 0, "uuuX"},
|
||||
{WINED3DFMT_B10G10R10A2_UNORM, 10, 10, 10, 2, 20, 10, 0, 30, 4, 0, 0, "uuuu"},
|
||||
/* Luminance */
|
||||
{WINED3DFMT_L8_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
|
||||
{WINED3DFMT_L8A8_UNORM, 0, 0, 0, 8, 0, 0, 0, 8, 2, 0, 0},
|
||||
|
@ -120,15 +121,15 @@ static const struct wined3d_format_channels formats[] =
|
|||
/* Bump mapping stuff */
|
||||
{WINED3DFMT_R5G5_SNORM_L6_UNORM, 5, 5, 0, 0, 0, 5, 0, 0, 2, 0, 0},
|
||||
{WINED3DFMT_R8G8_SNORM_L8X8_UNORM, 8, 8, 0, 0, 0, 8, 0, 0, 4, 0, 0},
|
||||
{WINED3DFMT_R10G11B11_SNORM, 10, 11, 11, 0, 0, 10, 21, 0, 4, 0, 0},
|
||||
{WINED3DFMT_R10G10B10_SNORM_A2_UNORM, 10, 10, 10, 2, 0, 10, 20, 30, 4, 0, 0},
|
||||
{WINED3DFMT_R10G11B11_SNORM, 10, 11, 11, 0, 0, 10, 21, 0, 4, 0, 0, "iii"},
|
||||
{WINED3DFMT_R10G10B10_SNORM_A2_UNORM, 10, 10, 10, 2, 0, 10, 20, 30, 4, 0, 0, "iiiu"},
|
||||
/* Depth stencil formats */
|
||||
{WINED3DFMT_D16_LOCKABLE, 0, 0, 0, 0, 0, 0, 0, 0, 2, 16, 0},
|
||||
{WINED3DFMT_D32_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 4, 32, 0},
|
||||
{WINED3DFMT_S1_UINT_D15_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 2, 15, 1},
|
||||
{WINED3DFMT_X8D24_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 0},
|
||||
{WINED3DFMT_S4X4_UINT_D24_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 4},
|
||||
{WINED3DFMT_S8_UINT_D24_FLOAT, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 8},
|
||||
{WINED3DFMT_D16_LOCKABLE, 0, 0, 0, 0, 0, 0, 0, 0, 2, 16, 0, "D"},
|
||||
{WINED3DFMT_D32_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 4, 32, 0, "D"},
|
||||
{WINED3DFMT_S1_UINT_D15_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 2, 15, 1, "SD"},
|
||||
{WINED3DFMT_X8D24_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 0, "XD"},
|
||||
{WINED3DFMT_S4X4_UINT_D24_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 4, "SXD"},
|
||||
{WINED3DFMT_S8_UINT_D24_FLOAT, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 8, "SD"},
|
||||
/* Vendor-specific formats */
|
||||
{WINED3DFMT_ATI1N, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
|
||||
{WINED3DFMT_ATI2N, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
|
||||
|
@ -319,7 +320,6 @@ static const struct wined3d_format_base_flags format_base_flags[] =
|
|||
{WINED3DFMT_ATI2N, WINED3D_FORMAT_ATTR_MAPPABLE | WINED3D_FORMAT_ATTR_BROKEN_PITCH},
|
||||
{WINED3DFMT_D16_LOCKABLE, WINED3D_FORMAT_ATTR_MAPPABLE},
|
||||
{WINED3DFMT_INTZ, WINED3D_FORMAT_ATTR_MAPPABLE},
|
||||
{WINED3DFMT_R11G11B10_FLOAT, WINED3D_FORMAT_ATTR_FLOAT},
|
||||
{WINED3DFMT_D32_FLOAT, WINED3D_FORMAT_ATTR_FLOAT},
|
||||
{WINED3DFMT_S8_UINT_D24_FLOAT, WINED3D_FORMAT_ATTR_FLOAT},
|
||||
{WINED3DFMT_D32_FLOAT_S8X24_UINT, WINED3D_FORMAT_ATTR_FLOAT},
|
||||
|
@ -349,16 +349,6 @@ static const struct wined3d_format_base_flags format_base_flags[] =
|
|||
{WINED3DFMT_R32_SINT, WINED3D_FORMAT_ATTR_CAST_TO_BLOCK},
|
||||
{WINED3DFMT_R16_UINT, 0,
|
||||
WINED3D_FORMAT_CAP_INDEX_BUFFER},
|
||||
{WINED3DFMT_A8_UNORM, WINED3D_FORMAT_ATTR_NORMALISED},
|
||||
{WINED3DFMT_B10G10R10A2_UNORM, WINED3D_FORMAT_ATTR_NORMALISED},
|
||||
{WINED3DFMT_B2G3R3_UNORM, WINED3D_FORMAT_ATTR_NORMALISED},
|
||||
{WINED3DFMT_B4G4R4A4_UNORM, WINED3D_FORMAT_ATTR_NORMALISED},
|
||||
{WINED3DFMT_B4G4R4X4_UNORM, WINED3D_FORMAT_ATTR_NORMALISED},
|
||||
{WINED3DFMT_B5G5R5A1_UNORM, WINED3D_FORMAT_ATTR_NORMALISED},
|
||||
{WINED3DFMT_B5G5R5X1_UNORM, WINED3D_FORMAT_ATTR_NORMALISED},
|
||||
{WINED3DFMT_B5G6R5_UNORM, WINED3D_FORMAT_ATTR_NORMALISED},
|
||||
{WINED3DFMT_B8G8R8_UNORM, WINED3D_FORMAT_ATTR_NORMALISED},
|
||||
{WINED3DFMT_R10G10B10A2_UNORM, WINED3D_FORMAT_ATTR_NORMALISED},
|
||||
{WINED3DFMT_R8G8_SNORM, WINED3D_FORMAT_ATTR_BUMPMAP},
|
||||
{WINED3DFMT_R5G5_SNORM_L6_UNORM, WINED3D_FORMAT_ATTR_BUMPMAP},
|
||||
{WINED3DFMT_R8G8_SNORM_L8X8_UNORM, WINED3D_FORMAT_ATTR_BUMPMAP},
|
||||
|
@ -2109,6 +2099,9 @@ static BOOL init_format_base_info(struct wined3d_adapter *adapter)
|
|||
format->block_width = 1;
|
||||
format->block_height = 1;
|
||||
format->block_byte_count = formats[i].bpp;
|
||||
|
||||
if (formats[i].channels)
|
||||
parse_channel_desc(format, formats[i].channels);
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(typed_formats); ++i)
|
||||
|
|
Loading…
Reference in a new issue