Zebediah Figura : d3d11: Implement D3D11_FEATURE_FORMAT_SUPPORT.
Alexandre Julliard
julliard at winehq.org
Tue Aug 16 16:01:00 CDT 2022
Module: wine
Branch: master
Commit: b34b5da644d2dc039c3956a073131bf56713f459
URL: https://gitlab.winehq.org/wine/wine/-/commit/b34b5da644d2dc039c3956a073131bf56713f459
Author: Zebediah Figura <zfigura at codeweavers.com>
Date: Wed Aug 10 12:18:22 2022 -0500
d3d11: Implement D3D11_FEATURE_FORMAT_SUPPORT.
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 034b5e4320f..5e00bc7a336 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -20993,6 +20993,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;
@@ -21054,11 +21055,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)
{
@@ -21073,6 +21095,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();
}
More information about the wine-cvs
mailing list