Commit 735b5ebd authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

d3d11: Report format support more accurately based on feature level.

Our partial stub for CheckFormatSupport() is still quite inaccurate. For example, we might report SHADER_SAMPLE support for UINT formats. In the long term, wined3d should probably return the format support flags directly. Unfortunately, the current wined3d interface shared with d3d9 isn't well suited for returning fine-grained format support flags. Signed-off-by: 's avatarJózef Kucia <jkucia@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 446a2422
......@@ -13390,7 +13390,7 @@ static void check_format_support(const unsigned int *format_support,
}
}
static void test_required_format_support(void)
static void test_format_support(void)
{
unsigned int format_support[DXGI_FORMAT_B4G4R4A4_UNORM + 1];
ID3D10Device *device;
......@@ -13425,6 +13425,22 @@ static void test_required_format_support(void)
format, hr, format_support[format]);
}
for (format = DXGI_FORMAT_UNKNOWN; format <= DXGI_FORMAT_B4G4R4A4_UNORM; ++format)
{
ok(!(format_support[format] & D3D10_FORMAT_SUPPORT_SHADER_GATHER),
"Unexpected SHADER_GATHER for format %#x.\n", format);
ok(!(format_support[format] & D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON),
"Unexpected SHADER_GATHER_COMPARISON for format %#x.\n", format);
}
ok(format_support[DXGI_FORMAT_R8G8B8A8_UNORM] & D3D10_FORMAT_SUPPORT_SHADER_SAMPLE,
"SHADER_SAMPLE is not supported for R8G8B8A8_UNORM.\n");
todo_wine
ok(!(format_support[DXGI_FORMAT_R32G32B32A32_UINT] & D3D10_FORMAT_SUPPORT_SHADER_SAMPLE),
"SHADER_SAMPLE is supported for R32G32B32A32_UINT.\n");
ok(format_support[DXGI_FORMAT_R32G32B32A32_UINT] & D3D10_FORMAT_SUPPORT_SHADER_LOAD,
"SHADER_LOAD is not supported for R32G32B32A32_UINT.\n");
check_format_support(format_support, index_buffers, ARRAY_SIZE(index_buffers),
D3D10_FORMAT_SUPPORT_IA_INDEX_BUFFER, "index buffer");
......@@ -18057,7 +18073,7 @@ START_TEST(d3d10core)
queue_test(test_index_buffer_offset);
queue_test(test_face_culling);
queue_test(test_line_antialiasing_blending);
queue_test(test_required_format_support);
queue_test(test_format_support);
queue_test(test_ddy);
queue_test(test_shader_input_registers_limits);
queue_test(test_unbind_shader_resource_view);
......
......@@ -3378,6 +3378,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 *
struct d3d_device *device = impl_from_ID3D11Device2(iface);
struct wined3d_device_creation_parameters params;
enum wined3d_format_id wined3d_format;
D3D_FEATURE_LEVEL feature_level;
struct wined3d *wined3d;
unsigned int i;
......@@ -3410,6 +3411,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 *
*format_support = 0;
wined3d_mutex_lock();
feature_level = device->feature_level;
wined3d = wined3d_device_get_wined3d(device->wined3d_device);
wined3d_device_get_creation_parameters(device->wined3d_device, &params);
for (i = 0; i < ARRAY_SIZE(flag_mapping); ++i)
......@@ -3434,12 +3436,17 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 *
{
*format_support |= D3D11_FORMAT_SUPPORT_SHADER_LOAD;
*format_support |= D3D11_FORMAT_SUPPORT_SHADER_SAMPLE;
*format_support |= D3D11_FORMAT_SUPPORT_SHADER_GATHER;
if (feature_level >= D3D_FEATURE_LEVEL_10_1)
*format_support |= D3D11_FORMAT_SUPPORT_SHADER_GATHER;
if (*format_support & D3D11_FORMAT_SUPPORT_DEPTH_STENCIL)
{
*format_support |= D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON;
*format_support |= D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON;
if (feature_level >= D3D_FEATURE_LEVEL_10_0)
*format_support |= D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON;
if (feature_level >= D3D_FEATURE_LEVEL_10_1)
*format_support |= D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON;
}
}
......
......@@ -18425,7 +18425,7 @@ static void check_format_support(const unsigned int *format_support, D3D_FEATURE
}
}
static void test_required_format_support(const D3D_FEATURE_LEVEL feature_level)
static void test_format_support(const D3D_FEATURE_LEVEL feature_level)
{
unsigned int format_support[DXGI_FORMAT_B4G4R4A4_UNORM + 1];
struct device_desc device_desc;
......@@ -18463,6 +18463,37 @@ static void test_required_format_support(const D3D_FEATURE_LEVEL feature_level)
format, hr, format_support[format]);
}
for (format = DXGI_FORMAT_UNKNOWN; format <= DXGI_FORMAT_B4G4R4A4_UNORM; ++format)
{
if (feature_level < D3D_FEATURE_LEVEL_10_0)
{
/* SHADER_SAMPLE_COMPARISON is never advertised as supported on feature level 9. */
ok(!(format_support[format] & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON),
"Unexpected SHADER_SAMPLE_COMPARISON for format %#x, feature level %#x.\n",
format, feature_level);
}
if (feature_level < D3D_FEATURE_LEVEL_10_1)
{
ok(!(format_support[format] & D3D11_FORMAT_SUPPORT_SHADER_GATHER),
"Unexpected SHADER_GATHER for format %#x, feature level %#x.\n",
format, feature_level);
ok(!(format_support[format] & D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON),
"Unexpected SHADER_GATHER_COMPARISON for format %#x, feature level %#x.\n",
format, feature_level);
}
}
ok(format_support[DXGI_FORMAT_R8G8B8A8_UNORM] & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE,
"SHADER_SAMPLE is not supported for R8G8B8A8_UNORM.\n");
todo_wine
ok(!(format_support[DXGI_FORMAT_R32G32B32A32_UINT] & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE),
"SHADER_SAMPLE is supported for R32G32B32A32_UINT.\n");
if (feature_level >= D3D_FEATURE_LEVEL_10_0)
{
ok(format_support[DXGI_FORMAT_R32G32B32A32_UINT] & D3D11_FORMAT_SUPPORT_SHADER_LOAD,
"SHADER_LOAD is not supported for R32G32B32A32_UINT.\n");
}
check_format_support(format_support, feature_level,
index_buffers, ARRAY_SIZE(index_buffers),
D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER, "index buffer");
......@@ -29365,7 +29396,7 @@ START_TEST(d3d11)
queue_test(test_index_buffer_offset);
queue_test(test_face_culling);
queue_test(test_line_antialiasing_blending);
queue_for_each_feature_level(test_required_format_support);
queue_for_each_feature_level(test_format_support);
queue_for_each_9_x_feature_level(test_fl9_draw);
queue_test(test_ddy);
queue_test(test_shader_input_registers_limits);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment