From: Zebediah Figura z.figura12@gmail.com
This patch was written by "naur". Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=18490
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/context.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 6a7aafc96251..bd8a324fc57d 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -1961,10 +1961,16 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl, struct wi
context_gl->tid = GetCurrentThreadId(); context_gl->window = context->swapchain->win_handle; - if (!(context_gl->dc = GetDCEx(context_gl->window, 0, DCX_USESTYLE | DCX_CACHE))) + if (context_gl->window == GetDesktopWindow()) { + TRACE("Swapchain is created on the desktop window, trying backup device context.\n"); + context_gl->dc = NULL; + } + else if (!(context_gl->dc = GetDCEx(context_gl->window, 0, DCX_USESTYLE | DCX_CACHE))) WARN("Failed to retrieve device context, trying swapchain backup.\n");
+ if (!context_gl->dc) + { if (!(context_gl->dc = swapchain_get_backup_dc(context->swapchain))) { ERR("Failed to retrieve a device context.\n");
From: Zebediah Figura z.figura12@gmail.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d11/tests/d3d11.c | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index e8c2f649f80b..ad7060412c8e 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -29290,6 +29290,47 @@ static void test_standard_pattern(void) release_test_context(&test_context); }
+static void test_desktop_window(void) +{ + ID3D11RenderTargetView *backbuffer_rtv; + ID3D11DeviceContext *context; + ID3D11Texture2D *backbuffer; + IDXGISwapChain *swapchain; + ID3D11Device *device; + ULONG refcount; + HRESULT hr; + + static const float red[] = {1.0f, 0.0f, 0.0f, 1.0f}; + + if (!(device = create_device(NULL))) + { + skip("Failed to create device.\n"); + return; + } + + swapchain = create_swapchain(device, GetDesktopWindow(), NULL); + hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_ID3D11Texture2D, (void **)&backbuffer); + ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr); + + hr = ID3D11Device_CreateRenderTargetView(device, (ID3D11Resource *)backbuffer, NULL, &backbuffer_rtv); + ok(SUCCEEDED(hr), "Failed to create rendertarget view, hr %#x.\n", hr); + + ID3D11Device_GetImmediateContext(device, &context); + + ID3D11DeviceContext_ClearRenderTargetView(context, backbuffer_rtv, red); + check_texture_color(backbuffer, 0xff0000ff, 1); + + hr = IDXGISwapChain_Present(swapchain, 0, 0); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + ID3D11RenderTargetView_Release(backbuffer_rtv); + ID3D11Texture2D_Release(backbuffer); + IDXGISwapChain_Release(swapchain); + ID3D11DeviceContext_Release(context); + refcount = ID3D11Device_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +} + START_TEST(d3d11) { unsigned int argc, i; @@ -29449,5 +29490,7 @@ START_TEST(d3d11) queue_test(test_render_a8); queue_test(test_standard_pattern);
+ test_desktop_window(); + run_queued_tests(); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=53931
Your paranoid android.
=== wvistau64 (32 bit report) ===
d3d11: d3d11.c:1599: Test failed: Failed to create swapchain, hr 0x887a0001. 0890:d3d11: unhandled exception c0000005 at 0044D8D4
=== wvistau64_zh_CN (32 bit report) ===
d3d11: d3d11.c:1599: Test failed: Failed to create swapchain, hr 0x887a0001. 0bb8:d3d11: unhandled exception c0000005 at 0044D8D4
=== wvistau64_fr (32 bit report) ===
d3d11: d3d11.c:1599: Test failed: Failed to create swapchain, hr 0x887a0001. 06a8:d3d11: unhandled exception c0000005 at 0044D8D4
=== wvistau64_he (32 bit report) ===
d3d11: d3d11.c:1599: Test failed: Failed to create swapchain, hr 0x887a0001. 0bd8:d3d11: unhandled exception c0000005 at 0044D8D4
=== w2008s64 (32 bit report) ===
d3d11: d3d11.c:1599: Test failed: Failed to create swapchain, hr 0x887a0001. 01a8:d3d11: unhandled exception c0000005 at 0044D8D4
=== w1064v1809 (32 bit report) ===
d3d11: d3d11.c:5768: Test failed: Got unexpected IAVertices count: 0. d3d11.c:5769: Test failed: Got unexpected IAPrimitives count: 0. d3d11.c:5770: Test failed: Got unexpected VSInvocations count: 0. d3d11.c:5773: Test failed: Got unexpected CInvocations count: 0. d3d11.c:5774: Test failed: Got unexpected CPrimitives count: 0.
=== wvistau64 (64 bit report) ===
d3d11: d3d11.c:1599: Test failed: Failed to create swapchain, hr 0x887a0001. 0890:d3d11: unhandled exception c0000005 at 0000000000447351
=== w2008s64 (64 bit report) ===
d3d11: d3d11.c:1599: Test failed: Failed to create swapchain, hr 0x887a0001. 0460:d3d11: unhandled exception c0000005 at 0000000000447351
=== debian9 (32 bit report) ===
d3d11: d3d11.c:6101: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0. d3d11.c:6111: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0. d3d11.c:17012: d3d11.c:16849: Test failed: Got {-1.00003052e+000, 0.00000000e+000, 1.00000000e+000, 0.00000000e+000}, expected {-1.00000000e+000, 0.00000000e+000, 1.00000000e+000, 0.00000000e+000} at (0, 0), sub-resource 0.
=== debian9 (32 bit Japanese:Japan report) ===
d3d11: d3d11.c:6101: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0. d3d11.c:6111: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0. d3d11.c:17933: Test failed: Got {0x00000001, 0xffffffff, 0x00000000, 0x00000000}, expected {0x00000001, 0x00000000, 0x00000000, 0x00000000} at (0, 0), sub-resource 0.
=== debian9 (32 bit Chinese:China report) ===
d3d11: d3d11.c:6111: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0.
=== debian9 (32 bit WoW report) ===
d3d11: d3d11.c:6101: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0. d3d11.c:6111: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0.
=== debian9 (64 bit WoW report) ===
d3d11: d3d11.c:16849: Test failed: Got {-1.00787401e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001}, expected {-1.00000000e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001} at (0, 0), sub-resource 0.
From: Zebediah Figura z.figura12@gmail.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d10core/tests/d3d10core.c | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c index ecf1f3814726..1403ef5d9abd 100644 --- a/dlls/d3d10core/tests/d3d10core.c +++ b/dlls/d3d10core/tests/d3d10core.c @@ -17981,6 +17981,43 @@ static void test_render_a8(void) release_test_context(&test_context); }
+static void test_desktop_window(void) +{ + ID3D10RenderTargetView *backbuffer_rtv; + ID3D10Texture2D *backbuffer; + IDXGISwapChain *swapchain; + ID3D10Device *device; + ULONG refcount; + HRESULT hr; + + static const float red[] = {1.0f, 0.0f, 0.0f, 1.0f}; + + if (!(device = create_device())) + { + skip("Failed to create device.\n"); + return; + } + + swapchain = create_swapchain(device, GetDesktopWindow(), NULL); + hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_ID3D10Texture2D, (void **)&backbuffer); + ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr); + + hr = ID3D10Device_CreateRenderTargetView(device, (ID3D10Resource *)backbuffer, NULL, &backbuffer_rtv); + ok(SUCCEEDED(hr), "Failed to create rendertarget view, hr %#x.\n", hr); + + ID3D10Device_ClearRenderTargetView(device, backbuffer_rtv, red); + check_texture_color(backbuffer, 0xff0000ff, 1); + + hr = IDXGISwapChain_Present(swapchain, 0, 0); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + ID3D10RenderTargetView_Release(backbuffer_rtv); + ID3D10Texture2D_Release(backbuffer); + IDXGISwapChain_Release(swapchain); + refcount = ID3D10Device_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +} + START_TEST(d3d10core) { unsigned int argc, i; @@ -18099,6 +18136,8 @@ START_TEST(d3d10core) queue_test(test_staging_buffers); queue_test(test_render_a8);
+ test_desktop_window(); + run_queued_tests();
/* There should be no reason this test can't be run in parallel with the
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=53932
Your paranoid android.
=== wvistau64 (32 bit report) ===
d3d10core: d3d10core.c:1323: Test failed: Failed to create swapchain, hr 0x887a0001. 073c:d3d10core: unhandled exception c0000005 at 0042F43C
=== wvistau64_zh_CN (32 bit report) ===
d3d10core: d3d10core.c:1323: Test failed: Failed to create swapchain, hr 0x887a0001. 0bb8:d3d10core: unhandled exception c0000005 at 0042F43C
=== wvistau64_fr (32 bit report) ===
d3d10core: d3d10core.c:1323: Test failed: Failed to create swapchain, hr 0x887a0001. 072c:d3d10core: unhandled exception c0000005 at 0042F43C
=== wvistau64_he (32 bit report) ===
d3d10core: d3d10core.c:1323: Test failed: Failed to create swapchain, hr 0x887a0001. 0bd8:d3d10core: unhandled exception c0000005 at 0042F43C
=== w2008s64 (32 bit report) ===
d3d10core: d3d10core.c:1323: Test failed: Failed to create swapchain, hr 0x887a0001. 0460:d3d10core: unhandled exception c0000005 at 0042F43C
=== wvistau64 (64 bit report) ===
d3d10core: d3d10core.c:1323: Test failed: Failed to create swapchain, hr 0x887a0001. 073c:d3d10core: unhandled exception c0000005 at 000000000042B9EE
=== w2008s64 (64 bit report) ===
d3d10core: d3d10core.c:1323: Test failed: Failed to create swapchain, hr 0x887a0001. 0460:d3d10core: unhandled exception c0000005 at 000000000042B9EE
=== debian9 (32 bit report) ===
d3d10core: d3d10core.c:12590: Test failed: Got {-1.00787401e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001}, expected {-1.00000000e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001} at (0, 0), sub-resource 0.
=== debian9 (32 bit Chinese:China report) ===
d3d10core: d3d10core.c:4972: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0.
=== debian9 (32 bit WoW report) ===
d3d10core: d3d10core.c:4779: Test failed: Got unexpected CPrimitives count: 3. d3d10core.c:4962: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0.
From: Zebediah Figura z.figura12@gmail.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d9/tests/visual.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 053636dd6c2c..5ba07a36dd75 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -25790,6 +25790,45 @@ static void test_nrm_instruction(void) DestroyWindow(window); }
+static void test_desktop_window(void) +{ + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + D3DCOLOR color; + ULONG refcount; + HWND window; + HRESULT hr; + + window = create_window(); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + IDirect3D9_Release(d3d); + DestroyWindow(window); + return; + } + IDirect3DDevice9_Release(device); + DestroyWindow(window); + + device = create_device(d3d, GetDesktopWindow(), GetDesktopWindow(), TRUE); + ok(!!device, "Failed to create a D3D device.\n"); + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff0000, 1.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + color = getPixelColor(device, 1, 1); + ok(color == 0x00ff0000, "Got unexpected color 0x%08x.\n", color); + + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); + + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + + IDirect3D9_Release(d3d); +} + START_TEST(visual) { D3DADAPTER_IDENTIFIER9 identifier; @@ -25932,4 +25971,5 @@ START_TEST(visual) test_color_vertex(); test_sysmem_draw(); test_nrm_instruction(); + test_desktop_window(); }
From: Zebediah Figura z.figura12@gmail.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d8/tests/visual.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 474dc69ff2c5..fc7c3cc29320 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -11001,6 +11001,45 @@ done: DestroyWindow(window); }
+static void test_desktop_window(void) +{ + IDirect3DDevice8 *device; + IDirect3D8 *d3d; + D3DCOLOR color; + ULONG refcount; + HWND window; + HRESULT hr; + + window = create_window(); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + IDirect3D8_Release(d3d); + DestroyWindow(window); + return; + } + IDirect3DDevice8_Release(device); + DestroyWindow(window); + + device = create_device(d3d, GetDesktopWindow(), GetDesktopWindow(), TRUE); + ok(!!device, "Failed to create a D3D device.\n"); + + hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff0000, 1.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + color = getPixelColor(device, 1, 1); + ok(color == 0x00ff0000, "Got unexpected color 0x%08x.\n", color); + + hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); + + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + + IDirect3D8_Release(d3d); +} + START_TEST(visual) { D3DADAPTER_IDENTIFIER8 identifier; @@ -11077,4 +11116,5 @@ START_TEST(visual) test_color_vertex(); test_sysmem_draw(); test_alphatest(); + test_desktop_window(); }