Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/d3d11/device.c | 5 +++++ dlls/d3d11/tests/d3d11.c | 9 +++++++-- dlls/wined3d/directx.c | 6 +++++- 3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 8f70d823247..098dbd449b7 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -3747,6 +3747,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 * flag_mapping[] = { {WINED3D_RTYPE_BUFFER, WINED3D_BIND_SHADER_RESOURCE, 0, D3D11_FORMAT_SUPPORT_BUFFER}, + {WINED3D_RTYPE_BUFFER, WINED3D_BIND_VERTEX_BUFFER, 0, D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER}, {WINED3D_RTYPE_TEXTURE_1D, WINED3D_BIND_SHADER_RESOURCE, 0, D3D11_FORMAT_SUPPORT_TEXTURE1D}, {WINED3D_RTYPE_TEXTURE_2D, WINED3D_BIND_SHADER_RESOURCE, 0, D3D11_FORMAT_SUPPORT_TEXTURE2D}, {WINED3D_RTYPE_TEXTURE_3D, WINED3D_BIND_SHADER_RESOURCE, 0, D3D11_FORMAT_SUPPORT_TEXTURE3D}, @@ -3794,7 +3795,11 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 * wined3d_mutex_unlock();
if (feature_level < D3D_FEATURE_LEVEL_10_0) + { *format_support &= ~D3D11_FORMAT_SUPPORT_BUFFER; + if (format == DXGI_FORMAT_R8G8_UINT || format == DXGI_FORMAT_R16_FLOAT) + *format_support &= ~D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER; + }
if (*format_support & (D3D11_FORMAT_SUPPORT_TEXTURE1D | D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_TEXTURE3D)) diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index f59e9e99f1f..a9373b6c624 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -20699,8 +20699,9 @@ static void check_format_support(const unsigned int *format_support, D3D_FEATURE
if (formats[i].fl_required <= feature_level) { - todo_wine ok(supported, "Format %#x - %s not supported, feature_level %#x, format support %#x.\n", - format, feature_name, feature_level, format_support[format]); + todo_wine_if (feature_flag != D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER) + ok(supported, "Format %#x - %s not supported, feature_level %#x, format support %#x.\n", + format, feature_name, feature_level, format_support[format]); continue; }
@@ -34163,6 +34164,10 @@ START_TEST(d3d11)
print_adapter_info();
+ queue_for_each_feature_level(test_format_support); + run_queued_tests(); + return; + queue_test(test_create_device); queue_for_each_feature_level(test_device_interfaces); queue_test(test_immediate_context); diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index b2925eb97e9..334a520072d 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1821,7 +1821,8 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d,
allowed_usage = WINED3DUSAGE_DYNAMIC; allowed_bind_flags = WINED3D_BIND_SHADER_RESOURCE - | WINED3D_BIND_UNORDERED_ACCESS; + | WINED3D_BIND_UNORDERED_ACCESS + | WINED3D_BIND_VERTEX_BUFFER; gl_type = gl_type_end = WINED3D_GL_RES_TYPE_BUFFER; break;
@@ -1853,6 +1854,9 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, format_flags |= WINED3DFMT_FLAG_DEPTH_STENCIL; if (bind_flags & WINED3D_BIND_UNORDERED_ACCESS) format_flags |= WINED3DFMT_FLAG_UNORDERED_ACCESS; + if (bind_flags & WINED3D_BIND_VERTEX_BUFFER) + format_flags |= WINED3DFMT_FLAG_VERTEX_ATTRIBUTE; + if (usage & WINED3DUSAGE_QUERY_FILTER) format_flags |= WINED3DFMT_FLAG_FILTERING; if (usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING)
This fixes a black screen in The Unfinished Swan.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/d3d11/device.c | 4 ++++ dlls/d3d11/tests/d3d11.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 098dbd449b7..c027c331bdc 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -3833,6 +3833,10 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 * | D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD; }
+ if (format == DXGI_FORMAT_R16_UINT + || (format == DXGI_FORMAT_R32_UINT && feature_level >= D3D_FEATURE_LEVEL_9_2)) + *format_support |= D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER; + return S_OK; }
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index a9373b6c624..484f09fad9e 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -20699,7 +20699,7 @@ static void check_format_support(const unsigned int *format_support, D3D_FEATURE
if (formats[i].fl_required <= feature_level) { - todo_wine_if (feature_flag != D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER) + todo_wine_if (feature_flag == D3D11_FORMAT_SUPPORT_DISPLAY) ok(supported, "Format %#x - %s not supported, feature_level %#x, format support %#x.\n", format, feature_name, feature_level, format_support[format]); continue;
On Thu, 9 Dec 2021 at 20:14, Zebediah Figura zfigura@codeweavers.com wrote:
@@ -3833,6 +3833,10 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 * | D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD; }
- if (format == DXGI_FORMAT_R16_UINT
|| (format == DXGI_FORMAT_R32_UINT && feature_level >= D3D_FEATURE_LEVEL_9_2))
*format_support |= D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER;
It seems tempting to introduce something like WINED3DFMT_FLAG_INDEX_TYPE, or at least to support WINED3D_BIND_INDEX_BUFFER in wined3d_check_device_format().
On 12/10/21 03:16, Henri Verbeet wrote:
On Thu, 9 Dec 2021 at 20:14, Zebediah Figura zfigura@codeweavers.com wrote:
@@ -3833,6 +3833,10 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 * | D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD; }
- if (format == DXGI_FORMAT_R16_UINT
|| (format == DXGI_FORMAT_R32_UINT && feature_level >= D3D_FEATURE_LEVEL_9_2))
*format_support |= D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER;
It seems tempting to introduce something like WINED3DFMT_FLAG_INDEX_TYPE, or at least to support WINED3D_BIND_INDEX_BUFFER in wined3d_check_device_format().
Indeed, and I guess we should be validating those formats when creating an index buffer.
On Fri, 10 Dec 2021 at 18:24, Zebediah Figura zfigura@codeweavers.com wrote:
Indeed, and I guess we should be validating those formats when creating an index buffer.
You'd think that, but buffer resources are created without a format. For index buffers the format is specified by IASetIndexBuffer().
On Thu, 9 Dec 2021 at 19:57, Zebediah Figura zfigura@codeweavers.com wrote:
@@ -3794,7 +3795,11 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 * wined3d_mutex_unlock();
if (feature_level < D3D_FEATURE_LEVEL_10_0)
- { *format_support &= ~D3D11_FORMAT_SUPPORT_BUFFER;
if (format == DXGI_FORMAT_R8G8_UINT || format == DXGI_FORMAT_R16_FLOAT)
*format_support &= ~D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER;
- }
That's an awfully specific set of formats... More broadly, if those formats can't/shouldn't be used for vertex attributes ("D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER" doesn't seem like a great name...), we shouldn't be setting WINED3DFMT_FLAG_VERTEX_ATTRIBUTE for them. In particular, the format flag is what we'll use to validate vertex declarations / input layouts, and we'd like the reported capabilities to be consistent with what actually works.
@@ -34163,6 +34164,10 @@ START_TEST(d3d11)
print_adapter_info();
- queue_for_each_feature_level(test_format_support);
- run_queued_tests();
- return;
That's going to skip quite a few tests...
On 12/10/21 03:16, Henri Verbeet wrote:
On Thu, 9 Dec 2021 at 19:57, Zebediah Figura zfigura@codeweavers.com wrote:
@@ -3794,7 +3795,11 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 * wined3d_mutex_unlock();
if (feature_level < D3D_FEATURE_LEVEL_10_0)
- { *format_support &= ~D3D11_FORMAT_SUPPORT_BUFFER;
if (format == DXGI_FORMAT_R8G8_UINT || format == DXGI_FORMAT_R16_FLOAT)
*format_support &= ~D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER;
- }
That's an awfully specific set of formats...
They're the formats that the tests check for :-/
I'll admit I'm really unsure what to do about that kind of thing. My gut says that applications seem to be so picky about what is and isn't supported that we should be proactively checking. But at the same time, being honest about what formats we support also sounds like a good thing, and finding out what formats really aren't supported, consistently, across drivers, seems hard to impossible.
(Nor is there any apparent pattern about what is and isn't supported before 10.0, such that we could say e.g. "all int formats are forbidden".)
More broadly, if those formats can't/shouldn't be used for vertex attributes ("D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER" doesn't seem like a great name...), we shouldn't be setting WINED3DFMT_FLAG_VERTEX_ATTRIBUTE for them. In particular, the format flag is what we'll use to validate vertex declarations / input layouts, and we'd like the reported capabilities to be consistent with what actually works.
Ah, of course.
@@ -34163,6 +34164,10 @@ START_TEST(d3d11)
print_adapter_info();
- queue_for_each_feature_level(test_format_support);
- run_queued_tests();
- return;
That's going to skip quite a few tests...
Oops ;-)