Fixes crashes running with a null driver.
From: Nikolay Sivov nsivov@codeweavers.com
Fixes crashes running with a null driver. --- dlls/d3dcompiler_43/tests/hlsl_d3d9.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c index eed96db7248..a6ecb6a37ee 100644 --- a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c +++ b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c @@ -134,7 +134,11 @@ static IDirect3DDevice9 *create_device(HWND window) HRESULT hr;
d3d = Direct3DCreate9(D3D_SDK_VERSION); - ok(!!d3d, "Failed to create a D3D object.\n"); + if (!d3d) + { + skip("Failed to create a D3D object.\n"); + return NULL; + }
hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window, D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device);
Should Direct3DCreate9() actually ever fail?
On Mon Nov 20 05:55:43 2023 +0000, Zebediah Figura wrote:
Should Direct3DCreate9() actually ever fail?
I don't know if it ever does on Windows, maybe in service session or something similar that can't create windows. For us, this is fixing test crashes. We already have the same check for d3d9 tests.
Hmm, okay. I assumed that CreateDevice() was the only function that would fail, but perhaps that was wrong.
This merge request was approved by Matteo Bruni.
On Tue Nov 21 08:21:22 2023 +0000, Zebediah Figura wrote:
Hmm, okay. I assumed that CreateDevice() was the only function that would fail, but perhaps that was wrong.
Yeah, it seems kind of suspicious to fail there, but we have plenty of instances of that check in the tests, so :shrug:
On Mon Nov 20 05:55:43 2023 +0000, Nikolay Sivov wrote:
I don't know if it ever does on Windows, maybe in service session or something similar that can't create windows. For us, this is fixing test crashes. We already have the same check for d3d9 tests.
It probably can't on modern Windows; D3D_SDK_VERSION is essentially fixed at this point, and you pretty much always have WARP. That wasn't always true though. I'm not completely sure what the behaviour is supposed to be on a system with 0 d3d9 adapters; it's possible Direct3DCreate9() fails in those cases, but I could also imagine e.g. IDirect3D9_EnumAdapterModes() just failing with D3DADAPTER_DEFAULT in those cases.
Note that in principle there's no reason D3D/GL/Vulkan couldn't work with the NULL driver though. For OpenGL in particular, EGL works without a running X server, and I imagine that's what we'll end up using for Wayland anyway.