-- v2: d3d11: Implement D3D11_FEATURE_FORMAT_SUPPORT. d3d11: Always return E_FAIL for formats which have no support flags. d3d11/tests: Use winetest_push_context() to print explicit feature levels.
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/d3d11/tests/d3d11.c | 114 +++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 57 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 5ba6bb7ce14..81cae2f44a2 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -158,9 +158,15 @@ static void queue_test(void (*test)(void)) static void run_mt_test(const struct test_entry *t) { if (t->fl) + { + winetest_push_context("Feature level %#x", t->fl); t->u.test_fl(t->fl); + winetest_pop_context(); + } else + { t->u.test(); + } }
static DWORD WINAPI thread_func(void *ctx) @@ -2214,7 +2220,7 @@ static void test_device_interfaces(const D3D_FEATURE_LEVEL feature_level) device_desc.flags = 0; if (!(device = create_device(&device_desc))) { - skip("Failed to create device for feature level %#x.\n", feature_level); + skip("Failed to create device.\n"); return; }
@@ -2250,7 +2256,7 @@ static void test_device_interfaces(const D3D_FEATURE_LEVEL feature_level) device_desc.flags = D3D11_CREATE_DEVICE_DEBUG; if (!(device = create_device(&device_desc))) { - skip("Failed to create debug device for feature level %#x.\n", feature_level); + skip("Failed to create debug device.\n"); return; }
@@ -4913,21 +4919,21 @@ static void test_create_shader(const D3D_FEATURE_LEVEL feature_level) device_desc.flags = 0; if (!(device = create_device(&device_desc))) { - skip("Failed to create device for feature level %#x.\n", feature_level); + skip("Failed to create device.\n"); return; }
/* level_9 shaders */ hr = ID3D11Device_CreatePixelShader(device, ps_4_0_level_9_0, sizeof(ps_4_0_level_9_0), NULL, &ps); - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); ID3D11PixelShader_Release(ps);
hr = ID3D11Device_CreatePixelShader(device, ps_4_0_level_9_1, sizeof(ps_4_0_level_9_1), NULL, &ps); - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); ID3D11PixelShader_Release(ps);
hr = ID3D11Device_CreatePixelShader(device, ps_4_0_level_9_3, sizeof(ps_4_0_level_9_3), NULL, &ps); - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); ID3D11PixelShader_Release(ps);
ps = (void *)0xdeadbeef; @@ -4938,25 +4944,25 @@ static void test_create_shader(const D3D_FEATURE_LEVEL feature_level) /* vertex shader */ vs = (void *)0xdeadbeef; hr = ID3D11Device_CreateVertexShader(device, vs_2_0, sizeof(vs_2_0), NULL, &vs); - ok(hr == E_INVALIDARG, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); ok(!vs, "Unexpected pointer %p.\n", vs);
vs = (void *)0xdeadbeef; hr = ID3D11Device_CreateVertexShader(device, vs_3_0, sizeof(vs_3_0), NULL, &vs); - ok(hr == E_INVALIDARG, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); ok(!vs, "Unexpected pointer %p.\n", vs);
vs = (void *)0xdeadbeef; hr = ID3D11Device_CreateVertexShader(device, ps_4_0, sizeof(ps_4_0), NULL, &vs); - ok(hr == E_INVALIDARG, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); ok(!vs, "Unexpected pointer %p.\n", vs);
expected_refcount = get_refcount(device) + (feature_level >= D3D_FEATURE_LEVEL_10_0); hr = ID3D11Device_CreateVertexShader(device, vs_4_0, sizeof(vs_4_0), NULL, &vs); if (feature_level >= D3D_FEATURE_LEVEL_10_0) - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); else - ok(hr == E_INVALIDARG, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
refcount = get_refcount(device); ok(refcount >= expected_refcount, "Got unexpected refcount %lu, expected >= %lu.\n", @@ -4982,14 +4988,14 @@ static void test_create_shader(const D3D_FEATURE_LEVEL feature_level) hr = ID3D11Device_CreateVertexShader(device, vs_4_1, sizeof(vs_4_1), NULL, &vs); if (feature_level >= D3D_FEATURE_LEVEL_10_1) { - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); refcount = ID3D11VertexShader_Release(vs); ok(!refcount, "Vertex shader has %lu references left.\n", refcount); } else { todo_wine_if(feature_level >= D3D_FEATURE_LEVEL_10_0) - ok(hr == E_INVALIDARG, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); if (SUCCEEDED(hr)) ID3D11VertexShader_Release(vs); } @@ -4998,9 +5004,9 @@ static void test_create_shader(const D3D_FEATURE_LEVEL feature_level) expected_refcount = get_refcount(device) + (feature_level >= D3D_FEATURE_LEVEL_10_0); hr = ID3D11Device_CreatePixelShader(device, ps_4_0, sizeof(ps_4_0), NULL, &ps); if (feature_level >= D3D_FEATURE_LEVEL_10_0) - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); else - ok(hr == E_INVALIDARG, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
refcount = get_refcount(device); ok(refcount >= expected_refcount, "Got unexpected refcount %lu, expected >= %lu.\n", @@ -5026,14 +5032,14 @@ static void test_create_shader(const D3D_FEATURE_LEVEL feature_level) hr = ID3D11Device_CreatePixelShader(device, ps_4_1, sizeof(ps_4_1), NULL, &ps); if (feature_level >= D3D_FEATURE_LEVEL_10_1) { - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); refcount = ID3D11PixelShader_Release(ps); ok(!refcount, "Pixel shader has %lu references left.\n", refcount); } else { todo_wine_if(feature_level >= D3D_FEATURE_LEVEL_10_0) - ok(hr == E_INVALIDARG, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); if (SUCCEEDED(hr)) ID3D11PixelShader_Release(ps); } @@ -5042,9 +5048,9 @@ static void test_create_shader(const D3D_FEATURE_LEVEL feature_level) expected_refcount = get_refcount(device) + (feature_level >= D3D_FEATURE_LEVEL_10_0); hr = ID3D11Device_CreateGeometryShader(device, gs_4_0, sizeof(gs_4_0), NULL, &gs); if (feature_level >= D3D_FEATURE_LEVEL_10_0) - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); else - ok(hr == E_INVALIDARG, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
refcount = get_refcount(device); ok(refcount >= expected_refcount, "Got unexpected refcount %lu, expected >= %lu.\n", @@ -5070,14 +5076,14 @@ static void test_create_shader(const D3D_FEATURE_LEVEL feature_level) hr = ID3D11Device_CreateGeometryShader(device, gs_4_1, sizeof(gs_4_1), NULL, &gs); if (feature_level >= D3D_FEATURE_LEVEL_10_1) { - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); refcount = ID3D11GeometryShader_Release(gs); ok(!refcount, "Geometry shader has %lu references left.\n", refcount); } else { todo_wine_if(feature_level >= D3D_FEATURE_LEVEL_10_0) - ok(hr == E_INVALIDARG, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); if (SUCCEEDED(hr)) ID3D11GeometryShader_Release(gs); } @@ -6748,7 +6754,7 @@ static void test_state_refcounting(const D3D_FEATURE_LEVEL feature_level) device_desc.flags = 0; if (!(device = create_device(&device_desc))) { - skip("Failed to create device for feature level %#x.\n", feature_level); + skip("Failed to create device.\n"); return; }
@@ -15263,7 +15269,7 @@ static void test_resource_access(const D3D_FEATURE_LEVEL feature_level) device_desc.flags = 0; if (!(device = create_device(&device_desc))) { - skip("Failed to create device for feature level %#x.\n", feature_level); + skip("Failed to create device.\n"); return; } ID3D11Device_GetImmediateContext(device, &context); @@ -15574,7 +15580,7 @@ static void test_swapchain_formats(const D3D_FEATURE_LEVEL feature_level) device_desc.flags = 0; if (!(device = create_device(&device_desc))) { - skip("Failed to create device for feature level %#x.\n", feature_level); + skip("Failed to create device.\n"); return; }
@@ -15589,8 +15595,7 @@ static void test_swapchain_formats(const D3D_FEATURE_LEVEL feature_level)
swapchain_desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_TYPELESS; hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain); - todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#lx for typeless format (feature level %#x).\n", - hr, feature_level); + todo_wine ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); if (SUCCEEDED(hr)) IDXGISwapChain_Release(swapchain);
@@ -15621,8 +15626,8 @@ static void test_swapchain_formats(const D3D_FEATURE_LEVEL feature_level) hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain); todo_wine_if(todo) ok(hr == expected_hr || broken(hr == E_OUTOFMEMORY), - "Got hr %#lx, expected %#lx (feature level %#x, format %#x).\n", - hr, expected_hr, feature_level, format); + "Got hr %#lx, expected %#lx (format %#x).\n", + hr, expected_hr, format); if (FAILED(hr)) continue; refcount = IDXGISwapChain_Release(swapchain); @@ -20773,22 +20778,21 @@ static void check_format_support(ID3D11Device *device, const unsigned int *forma { todo_wine_if (feature_flag == D3D11_FORMAT_SUPPORT_DISPLAY) ok(supported || broken(is_warp_device(device)), - "Format %#x - %s not supported, feature_level %#x, format support %#x.\n", - format, feature_name, feature_level, format_support[format]); + "Format %#x - %s not supported, format support %#x.\n", + format, feature_name, format_support[format]); continue; }
if (formats[i].fl_optional && formats[i].fl_optional <= feature_level) { if (supported) - trace("Optional format %#x - %s supported, feature level %#x.\n", - format, feature_name, feature_level); + trace("Optional format %#x - %s supported.\n", format, feature_name); continue; }
todo_wine_if (feature_flag != D3D11_FORMAT_SUPPORT_DISPLAY) - ok(!supported, "Format %#x - %s supported, feature level %#x, format support %#x.\n", - format, feature_name, feature_level, format_support[format]); + ok(!supported, "Format %#x - %s supported, format support %#x.\n", + format, feature_name, format_support[format]); } }
@@ -20852,7 +20856,7 @@ static void test_format_support(const D3D_FEATURE_LEVEL feature_level) device_desc.flags = 0; if (!(device = create_device(&device_desc))) { - skip("Failed to create device for feature level %#x.\n", feature_level); + skip("Failed to create device.\n"); return; }
@@ -20881,20 +20885,16 @@ static void test_format_support(const D3D_FEATURE_LEVEL feature_level) { /* 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); + "Unexpected SHADER_SAMPLE_COMPARISON for format %#x.\n", format); ok(!(format_support[format] & D3D11_FORMAT_SUPPORT_BUFFER), - "Unexpected BUFFER for format %#x, feature level %#x.\n", - format, feature_level); + "Unexpected BUFFER for format %#x.\n", format); } 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); + "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, feature level %#x.\n", - format, feature_level); + "Unexpected SHADER_GATHER_COMPARISON for format %#x.\n", format); } }
@@ -21012,12 +21012,12 @@ static void test_fl9_draw(const D3D_FEATURE_LEVEL feature_level) resource_data.SysMemPitch = sizeof(texture_data); resource_data.SysMemSlicePitch = 0; hr = ID3D11Device_CreateTexture2D(device, &texture_desc, &resource_data, &texture); - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)texture, NULL, &srv); - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = ID3D11Device_CreatePixelShader(device, ps_code, sizeof(ps_code), NULL, &ps); - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); ID3D11DeviceContext_PSSetShader(context, ps, NULL, 0); draw_quad(&test_context); check_texture_color(test_context.backbuffer, 0x7f0000ff, 1); @@ -21027,7 +21027,7 @@ static void test_fl9_draw(const D3D_FEATURE_LEVEL feature_level) todo_wine check_texture_color(test_context.backbuffer, 0xff004c33, 1);
hr = ID3D11Device_CreatePixelShader(device, ps_texture_code, sizeof(ps_texture_code), NULL, &ps); - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); ID3D11DeviceContext_PSSetShader(context, ps, NULL, 0); ID3D11DeviceContext_PSSetShaderResources(context, 0, 1, &srv); draw_quad(&test_context); @@ -24469,7 +24469,7 @@ static void test_unaligned_raw_buffer_access(const D3D_FEATURE_LEVEL feature_lev if (feature_level < D3D_FEATURE_LEVEL_11_0 && !check_compute_shaders_via_sm4_support(device)) { hr = ID3D11Device_CreatePixelShader(device, ps_code, sizeof(ps_code), NULL, &ps); - todo_wine ok(hr == E_INVALIDARG, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + todo_wine ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); if (SUCCEEDED(hr)) ID3D11PixelShader_Release(ps); skip("Raw buffers are not supported.\n"); @@ -24488,7 +24488,7 @@ static void test_unaligned_raw_buffer_access(const D3D_FEATURE_LEVEL feature_lev }
hr = ID3D11Device_CreatePixelShader(device, ps_code, sizeof(ps_code), NULL, &ps); - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr);
memset(&offset, 0, sizeof(offset)); cb = create_buffer(device, D3D11_BIND_CONSTANT_BUFFER, sizeof(offset), &offset.x); @@ -24496,9 +24496,9 @@ static void test_unaligned_raw_buffer_access(const D3D_FEATURE_LEVEL feature_lev ID3D11Texture2D_GetDesc(test_context.backbuffer, &texture_desc); texture_desc.Format = DXGI_FORMAT_R32_UINT; hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, &texture); - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); hr = ID3D11Device_CreateRenderTargetView(device, (ID3D11Resource *)texture, NULL, &rtv); - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr);
ID3D11DeviceContext_OMSetRenderTargets(context, 1, &rtv, NULL);
@@ -24511,7 +24511,7 @@ static void test_unaligned_raw_buffer_access(const D3D_FEATURE_LEVEL feature_lev resource_data.SysMemPitch = 0; resource_data.SysMemSlicePitch = 0; hr = ID3D11Device_CreateBuffer(device, &buffer_desc, &resource_data, &raw_buffer); - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr);
srv_desc.Format = DXGI_FORMAT_R32_TYPELESS; srv_desc.ViewDimension = D3D11_SRV_DIMENSION_BUFFEREX; @@ -24519,7 +24519,7 @@ static void test_unaligned_raw_buffer_access(const D3D_FEATURE_LEVEL feature_lev U(srv_desc).BufferEx.NumElements = buffer_desc.ByteWidth / sizeof(unsigned int); U(srv_desc).BufferEx.Flags = D3D11_BUFFEREX_SRV_FLAG_RAW; hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)raw_buffer, &srv_desc, &srv); - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr);
ID3D11DeviceContext_PSSetShader(context, ps, NULL, 0); ID3D11DeviceContext_PSSetConstantBuffers(context, 0, 1, &cb); @@ -24572,7 +24572,7 @@ static void test_unaligned_raw_buffer_access(const D3D_FEATURE_LEVEL feature_lev ID3D11Buffer_Release(raw_buffer); buffer_desc.BindFlags = D3D11_BIND_UNORDERED_ACCESS; hr = ID3D11Device_CreateBuffer(device, &buffer_desc, NULL, &raw_buffer); - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr);
uav_desc.Format = DXGI_FORMAT_R32_TYPELESS; uav_desc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER; @@ -24580,10 +24580,10 @@ static void test_unaligned_raw_buffer_access(const D3D_FEATURE_LEVEL feature_lev U(uav_desc).Buffer.NumElements = buffer_desc.ByteWidth / sizeof(unsigned int); U(uav_desc).Buffer.Flags = D3D11_BUFFER_UAV_FLAG_RAW; hr = ID3D11Device_CreateUnorderedAccessView(device, (ID3D11Resource *)raw_buffer, &uav_desc, &uav); - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = ID3D11Device_CreateComputeShader(device, cs_code, sizeof(cs_code), NULL, &cs); - ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr);
ID3D11DeviceContext_CSSetShader(context, cs, NULL, 0); ID3D11DeviceContext_CSSetConstantBuffers(context, 0, 1, &cb); @@ -29041,7 +29041,7 @@ static void test_compressed_format_compatibility(const D3D_FEATURE_LEVEL feature
if (!(device = create_device(&device_desc))) { - skip("Failed to create device for feature level %#x.\n", feature_level); + skip("Failed to create device.\n"); return; } ID3D11Device_GetImmediateContext(device, &context);
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/d3d11/device.c | 2 +- dlls/d3d11/tests/d3d11.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 0ae695901da..79b972df671 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -3959,7 +3959,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 * | D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD; }
- return S_OK; + return *format_support ? S_OK : E_FAIL; }
static HRESULT STDMETHODCALLTYPE d3d11_device_CheckMultisampleQualityLevels(ID3D11Device2 *iface, diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 81cae2f44a2..5752ff9f88a 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -20868,15 +20868,18 @@ static void test_format_support(const D3D_FEATURE_LEVEL feature_level) memset(format_support, 0, sizeof(format_support)); for (format = DXGI_FORMAT_UNKNOWN; format <= DXGI_FORMAT_B4G4R4A4_UNORM; ++format) { + winetest_push_context("format %#x", format); + hr = ID3D11Device_CheckFormatSupport(device, format, &format_support[format]); - ok(hr == S_OK || (hr == E_FAIL && !format_support[format]), - "Got unexpected result for format %#x: hr %#lx, format_support %#x.\n", - format, hr, format_support[format]); + ok((hr == S_OK && format_support[format]) || (hr == E_FAIL && !format_support[format]), + "Got unexpected hr %#lx, format_support %#x.\n", hr, format_support[format]); if (format_support[format] & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN) { ok(format_support[format] & D3D11_FORMAT_SUPPORT_TEXTURE2D, - "Got unexpected format support %#x for format %#x", format_support[format], format); + "Got unexpected format support %#x", format); } + + winetest_pop_context(); }
for (format = DXGI_FORMAT_UNKNOWN; format <= DXGI_FORMAT_B4G4R4A4_UNORM; ++format)
From: Zebediah Figura zfigura@codeweavers.com
This allows Guild Wars 2 to start. --- dlls/d3d11/device.c | 12 ++++++++++++ dlls/d3d11/tests/d3d11.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 79b972df671..65706a414d8 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -4198,6 +4198,18 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFeatureSupport(ID3D11Device2 return S_OK; }
+ case D3D11_FEATURE_FORMAT_SUPPORT: + { + D3D11_FEATURE_DATA_FORMAT_SUPPORT *data = feature_support_data; + if (feature_support_data_size != sizeof(*data)) + { + WARN("Invalid size %u for D3D11_FEATURE_FORMAT_SUPPORT.\n", feature_support_data_size); + return E_INVALIDARG; + } + + return d3d11_device_CheckFormatSupport(iface, data->InFormat, &data->OutFormatSupport); + } + default: FIXME("Unhandled feature %#x.\n", feature); return E_NOTIMPL; diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 5752ff9f88a..a79c3cf7bba 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -20799,6 +20799,7 @@ static void check_format_support(ID3D11Device *device, const unsigned int *forma static void test_format_support(const D3D_FEATURE_LEVEL feature_level) { unsigned int format_support[DXGI_FORMAT_B4G4R4A4_UNORM + 1]; + D3D11_FEATURE_DATA_FORMAT_SUPPORT feature_data; struct device_desc device_desc; ID3D11Device *device; DXGI_FORMAT format; @@ -20860,11 +20861,32 @@ static void test_format_support(const D3D_FEATURE_LEVEL feature_level) return; }
+ feature_data.InFormat = DXGI_FORMAT_R8G8B8A8_UNORM; + + hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_FORMAT_SUPPORT, NULL, 0); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_FORMAT_SUPPORT, &feature_data, 0); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_FORMAT_SUPPORT, &feature_data, sizeof(feature_data) - 1); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_FORMAT_SUPPORT, &feature_data, sizeof(feature_data) / 2); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_FORMAT_SUPPORT, &feature_data, sizeof(feature_data) + 1); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_FORMAT_SUPPORT, &feature_data, sizeof(feature_data) * 2); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + support = 0xdeadbeef; hr = ID3D11Device_CheckFormatSupport(device, ~0u, &support); ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); ok(!support, "Got unexpected format support %#x.\n", support);
+ feature_data.InFormat = ~0u; + feature_data.OutFormatSupport = 0xdeadbeef; + hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_FORMAT_SUPPORT, &feature_data, sizeof(feature_data)); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); + ok(!feature_data.OutFormatSupport, "Got unexpected format support %#x.\n", feature_data.OutFormatSupport); + memset(format_support, 0, sizeof(format_support)); for (format = DXGI_FORMAT_UNKNOWN; format <= DXGI_FORMAT_B4G4R4A4_UNORM; ++format) { @@ -20879,6 +20901,14 @@ static void test_format_support(const D3D_FEATURE_LEVEL feature_level) "Got unexpected format support %#x", format); }
+ feature_data.InFormat = format; + hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_FORMAT_SUPPORT, + &feature_data, sizeof(feature_data)); + ok((hr == S_OK && feature_data.OutFormatSupport) || (hr == E_FAIL && !feature_data.OutFormatSupport), + "Got unexpected hr %#lx, format_support %#x.\n", hr, feature_data.OutFormatSupport); + ok(feature_data.OutFormatSupport == format_support[format], "Expected format support %#x, got %#x.\n", + format_support[format], feature_data.OutFormatSupport); + winetest_pop_context(); }
This merge request was approved by Jan Sikorski.