diff --git a/patches/d3d11-ID3D11Texture1D/0019-d3d11-tests-Prepare-test_texture-for-non-2d-textures.patch b/patches/d3d11-ID3D11Texture1D/0019-d3d11-tests-Prepare-test_texture-for-non-2d-textures.patch index 61f19c12..09f63c33 100644 --- a/patches/d3d11-ID3D11Texture1D/0019-d3d11-tests-Prepare-test_texture-for-non-2d-textures.patch +++ b/patches/d3d11-ID3D11Texture1D/0019-d3d11-tests-Prepare-test_texture-for-non-2d-textures.patch @@ -1,17 +1,17 @@ -From 6a2fdc55c5d480b3bd0a26d3aaed1b31e4a7f8bb Mon Sep 17 00:00:00 2001 +From a30b83149208635d5e114f553c98ea8af569cbeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Thu, 25 Aug 2016 20:06:28 +0200 Subject: d3d11/tests: Prepare test_texture for non 2d textures. --- - dlls/d3d11/tests/d3d11.c | 131 +++++++++++++++++++++++++++++------------------ - 1 file changed, 81 insertions(+), 50 deletions(-) + dlls/d3d11/tests/d3d11.c | 137 +++++++++++++++++++++++++++++------------------ + 1 file changed, 85 insertions(+), 52 deletions(-) diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c -index 0dd286d..7768cdb 100644 +index 21c5627b862..1a3adee346f 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c -@@ -5671,6 +5671,7 @@ static void test_texture(void) +@@ -5955,6 +5955,7 @@ static void test_texture(void) }; struct texture { @@ -19,7 +19,7 @@ index 0dd286d..7768cdb 100644 UINT width; UINT height; UINT miplevel_count; -@@ -5682,7 +5683,7 @@ static void test_texture(void) +@@ -5966,7 +5967,7 @@ static void test_texture(void) D3D11_SHADER_RESOURCE_VIEW_DESC srv_desc; struct d3d11_test_context test_context; const struct texture *current_texture; @@ -28,7 +28,7 @@ index 0dd286d..7768cdb 100644 D3D11_SAMPLER_DESC sampler_desc; const struct shader *current_ps; D3D_FEATURE_LEVEL feature_level; -@@ -5690,7 +5691,7 @@ static void test_texture(void) +@@ -5974,7 +5975,7 @@ static void test_texture(void) ID3D11DeviceContext *context; ID3D11SamplerState *sampler; struct resource_readback rb; @@ -37,7 +37,7 @@ index 0dd286d..7768cdb 100644 struct vec4 ps_constant; ID3D11PixelShader *ps; ID3D11Device *device; -@@ -6030,6 +6031,7 @@ static void test_texture(void) +@@ -6328,6 +6329,7 @@ static void test_texture(void) }; static const struct texture rgba_texture = { @@ -45,7 +45,7 @@ index 0dd286d..7768cdb 100644 4, 4, 3, 1, DXGI_FORMAT_R8G8B8A8_UNORM, { {rgba_level_0, 4 * sizeof(*rgba_level_0), 0}, -@@ -6037,33 +6039,51 @@ static void test_texture(void) +@@ -6335,33 +6337,51 @@ static void test_texture(void) {rgba_level_2, sizeof(*rgba_level_2), 0}, } }; @@ -120,7 +120,21 @@ index 0dd286d..7768cdb 100644 4, 4, 1, 3, DXGI_FORMAT_R8G8B8A8_UNORM, { {red_data, 6 * sizeof(*red_data)}, -@@ -6338,12 +6358,12 @@ static void test_texture(void) +@@ -6369,9 +6389,11 @@ static void test_texture(void) + {blue_data, 5 * sizeof(*blue_data)}, + } + }; +- static const struct texture r32f_typeless = {4, 4, 1, 1, DXGI_FORMAT_R32_TYPELESS, ++ static const struct texture r32f_typeless = {D3D11_RESOURCE_DIMENSION_TEXTURE2D, ++ 4, 4, 1, 1, DXGI_FORMAT_R32_TYPELESS, + {{r32_float, 4 * sizeof(*r32_float)}}}; +- static const struct texture r32u_typeless = {4, 4, 1, 1, DXGI_FORMAT_R32_TYPELESS, ++ static const struct texture r32u_typeless = {D3D11_RESOURCE_DIMENSION_TEXTURE2D, ++ 4, 4, 1, 1, DXGI_FORMAT_R32_TYPELESS, + {{r32_uint, 4 * sizeof(*r32_uint)}}}; + static const DWORD red_colors[] = + { +@@ -6660,12 +6682,12 @@ static void test_texture(void) ID3D11DeviceContext_PSSetConstantBuffers(context, 0, 1, &cb); @@ -139,7 +153,7 @@ index 0dd286d..7768cdb 100644 sampler_desc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT; sampler_desc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; -@@ -6401,7 +6421,7 @@ static void test_texture(void) +@@ -6723,7 +6745,7 @@ static void test_texture(void) if (current_texture != test->texture) { if (texture) @@ -148,7 +162,7 @@ index 0dd286d..7768cdb 100644 if (srv) ID3D11ShaderResourceView_Release(srv); -@@ -6409,16 +6429,23 @@ static void test_texture(void) +@@ -6731,16 +6753,23 @@ static void test_texture(void) if (current_texture) { @@ -166,21 +180,21 @@ index 0dd286d..7768cdb 100644 + texture2d_desc.MipLevels = current_texture->miplevel_count; + texture2d_desc.ArraySize = current_texture->array_size; + texture2d_desc.Format = current_texture->format; -+ + +- hr = ID3D11Device_CreateTexture2D(device, &texture_desc, current_texture->data, &texture); +- ok(SUCCEEDED(hr), "Test %u: Failed to create 2d texture, hr %#x.\n", i, hr); + hr = ID3D11Device_CreateTexture2D(device, &texture2d_desc, current_texture->data, &texture2d); + ok(SUCCEEDED(hr), "Test %u: Failed to create 2d texture, hr %#x.\n", i, hr); + texture = (ID3D11Resource *)texture2d; + } -- hr = ID3D11Device_CreateTexture2D(device, &texture_desc, current_texture->data, &texture); -- ok(SUCCEEDED(hr), "Test %u: Failed to create 2d texture, hr %#x.\n", i, hr); - - hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)texture, NULL, &srv); ++ + hr = ID3D11Device_CreateShaderResourceView(device, texture, NULL, &srv); ok(SUCCEEDED(hr), "Test %u: Failed to create shader resource view, hr %#x.\n", i, hr); } else -@@ -6472,7 +6499,7 @@ static void test_texture(void) +@@ -6794,7 +6823,7 @@ static void test_texture(void) ID3D11ShaderResourceView_Release(srv); ID3D11SamplerState_Release(sampler); if (texture) @@ -189,7 +203,7 @@ index 0dd286d..7768cdb 100644 ID3D11PixelShader_Release(ps); if (is_warp_device(device) && feature_level < D3D_FEATURE_LEVEL_10_1) -@@ -6517,26 +6544,30 @@ static void test_texture(void) +@@ -6839,26 +6868,30 @@ static void test_texture(void) if (current_texture != test->texture) { @@ -228,7 +242,7 @@ index 0dd286d..7768cdb 100644 ok(SUCCEEDED(hr), "Test %u: Failed to create shader resource view, hr %#x.\n", i, hr); ID3D11DeviceContext_PSSetShaderResources(context, 0, 1, &srv); -@@ -6561,7 +6592,7 @@ static void test_texture(void) +@@ -6883,7 +6916,7 @@ static void test_texture(void) release_resource_readback(&rb); } ID3D11PixelShader_Release(ps); @@ -238,5 +252,5 @@ index 0dd286d..7768cdb 100644 ID3D11SamplerState_Release(sampler); -- -2.8.1 +2.11.0 diff --git a/patches/d3d11-ID3D11Texture1D/0021-d3d11-tests-Add-some-basic-1d-texture-tests-in-test_.patch b/patches/d3d11-ID3D11Texture1D/0021-d3d11-tests-Add-some-basic-1d-texture-tests-in-test_.patch index 864c0e35..6423073c 100644 --- a/patches/d3d11-ID3D11Texture1D/0021-d3d11-tests-Add-some-basic-1d-texture-tests-in-test_.patch +++ b/patches/d3d11-ID3D11Texture1D/0021-d3d11-tests-Add-some-basic-1d-texture-tests-in-test_.patch @@ -1,4 +1,4 @@ -From 90cf55bb0be99d5e1244e4c5ec2ff0b7aecb39ef Mon Sep 17 00:00:00 2001 +From b2cf9ce61714a32e5f1727711b349a42b372bf10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Thu, 25 Aug 2016 20:15:54 +0200 Subject: d3d11/tests: Add some basic 1d texture tests in test_texture. @@ -8,13 +8,13 @@ Subject: d3d11/tests: Add some basic 1d texture tests in test_texture. 1 file changed, 109 insertions(+) diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c -index 50dc3b9..f5279ea 100644 +index 268ba4cc77d..28802d3ea8f 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c -@@ -5732,6 +5732,37 @@ static void test_texture(void) - 0x00000000, 0x00100e46, 0x00000000, 0x0700002d, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, +@@ -6017,6 +6017,38 @@ static void test_texture(void) 0x00107e46, 0x00000000, 0x0100003e, }; + static const struct shader ps_ld = {ps_ld_code, sizeof(ps_ld_code)}; + static const DWORD ps_ld_1d_code[] = + { +#if 0 @@ -46,13 +46,14 @@ index 50dc3b9..f5279ea 100644 + 0x00000000, 0x00100e46, 0x00000000, 0x0700002d, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, + 0x00107e46, 0x00000000, 0x0100003e, + }; ++ static const struct shader ps_ld_1d = {ps_ld_1d_code, sizeof(ps_ld_1d_code)}; static const DWORD ps_ld_sint8_code[] = { #if 0 -@@ -5916,13 +5947,46 @@ static void test_texture(void) - 0x0020800a, 0x00000000, 0x00000000, 0x09000045, 0x001020f2, 0x00000000, 0x00100246, 0x00000000, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0100003e, +@@ -6175,6 +6207,38 @@ static void test_texture(void) + 0x0020800a, 0x00000000, 0x00000000, 0x0100003e, }; + static const struct shader ps_sample_l = {ps_sample_l_code, sizeof(ps_sample_l_code)}; + static const DWORD ps_sample_1d_array_code[] = + { +#if 0 @@ -84,19 +85,11 @@ index 50dc3b9..f5279ea 100644 + 0x09000045, 0x001020f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x0100003e, + }; - static const struct shader ps_ld = {ps_ld_code, sizeof(ps_ld_code)}; -+ static const struct shader ps_ld_1d = {ps_ld_1d_code, sizeof(ps_ld_1d_code)}; - static const struct shader ps_ld_sint8 = {ps_ld_sint8_code, sizeof(ps_ld_sint8_code)}; - static const struct shader ps_ld_uint8 = {ps_ld_uint8_code, sizeof(ps_ld_uint8_code)}; - static const struct shader ps_sample = {ps_sample_code, sizeof(ps_sample_code)}; - static const struct shader ps_sample_b = {ps_sample_b_code, sizeof(ps_sample_b_code)}; - static const struct shader ps_sample_l = {ps_sample_l_code, sizeof(ps_sample_l_code)}; - static const struct shader ps_sample_2d_array = {ps_sample_2d_array_code, sizeof(ps_sample_2d_array_code)}; + static const struct shader ps_sample_1d_array = {ps_sample_1d_array_code, sizeof(ps_sample_1d_array_code)}; - static const DWORD red_data[] = + static const DWORD ps_sample_2d_array_code[] = { - 0xff0000ff, 0xff0000ff, 0xff0000ff, 0xff0000ff, 0x00000000, 0x00000000, -@@ -6040,8 +6104,20 @@ static void test_texture(void) + #if 0 +@@ -6338,8 +6402,20 @@ static void test_texture(void) {rgba_level_2, sizeof(*rgba_level_2), 0}, } }; @@ -117,7 +110,7 @@ index 50dc3b9..f5279ea 100644 static const struct texture srgb_typeless = {D3D11_RESOURCE_DIMENSION_TEXTURE2D, 4, 4, 1, 1, DXGI_FORMAT_R8G8B8A8_TYPELESS, {{srgb_data, 4 * sizeof(*srgb_data)}}}; static const struct texture a8_texture = {D3D11_RESOURCE_DIMENSION_TEXTURE2D, -@@ -6092,6 +6168,16 @@ static void test_texture(void) +@@ -6390,6 +6466,16 @@ static void test_texture(void) {blue_data, 5 * sizeof(*blue_data)}, } }; @@ -131,10 +124,10 @@ index 50dc3b9..f5279ea 100644 + {blue_data, 0}, + } + }; - static const DWORD red_colors[] = - { - 0xff0000ff, 0xff0000ff, 0xff0000ff, 0xff0000ff, -@@ -6195,6 +6281,11 @@ static void test_texture(void) + static const struct texture r32f_typeless = {D3D11_RESOURCE_DIMENSION_TEXTURE2D, + 4, 4, 1, 1, DXGI_FORMAT_R32_TYPELESS, + {{r32_float, 4 * sizeof(*r32_float)}}}; +@@ -6513,6 +6599,11 @@ static void test_texture(void) #define POINT D3D11_FILTER_MIN_MAG_MIP_POINT #define POINT_LINEAR D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR #define MIP_MAX D3D11_FLOAT32_MAX @@ -146,7 +139,7 @@ index 50dc3b9..f5279ea 100644 {&ps_ld, &rgba_texture, POINT, 0.0f, 0.0f, 0.0f, 0.0f, rgba_level_0}, {&ps_ld, &rgba_texture, POINT, 0.0f, 0.0f, 0.0f, 1.0f, level_1_colors}, {&ps_ld, &rgba_texture, POINT, 0.0f, 0.0f, 0.0f, 2.0f, level_2_colors}, -@@ -6280,6 +6371,24 @@ static void test_texture(void) +@@ -6598,6 +6689,24 @@ static void test_texture(void) {&ps_sample_l, NULL, POINT, 2.0f, 2.0f, 0.0f, 1.0f, zero_colors}, {&ps_sample_l, NULL, POINT, 2.0f, 2.0f, MIP_MAX, 0.0f, zero_colors}, {&ps_sample_l, NULL, POINT, 2.0f, 2.0f, MIP_MAX, 1.0f, zero_colors}, @@ -172,5 +165,5 @@ index 50dc3b9..f5279ea 100644 {&ps_sample_2d_array, &array_2d_texture, POINT, 0.0f, 0.0f, MIP_MAX, -1.0f, red_colors}, {&ps_sample_2d_array, &array_2d_texture, POINT, 0.0f, 0.0f, MIP_MAX, 0.0f, red_colors}, -- -2.8.1 +2.11.0 diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index c4313aa5..c6c78917 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "8af23cb93e4e1cd3686984399cb50d755f5171e3" + echo "d00f7315e0cec0c2fe34ba5ab2b55cf5718860dd" } # Show version information @@ -8413,7 +8413,6 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Get rid of the end_scene flush and finish.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Send update_texture calls through the CS.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Send update_sub_resource calls through the command stream.", 1 },'; - printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Unload resources through the CS in uninit_3d.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Unload resources through the CS in device_reset.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Send getdc and releasedc through the command stream.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Create dummy textures through the CS.", 1 },'; @@ -8432,7 +8431,6 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Move the framebuffer into wined3d_state.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Don'\''t access device state in clears.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Delete GL contexts through the CS in reset.", 1 },'; - printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Delete GL contexts through the CS in uninit_3d.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Add swapchain waits.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Avoid destroying views in color and depth fills.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Run the cs asynchronously.", 1 },'; diff --git a/patches/wined3d-Accounting/0001-wined3d-Use-real-values-for-memory-accounting-on-NVI.patch b/patches/wined3d-Accounting/0001-wined3d-Use-real-values-for-memory-accounting-on-NVI.patch index d8e5b517..15d908df 100644 --- a/patches/wined3d-Accounting/0001-wined3d-Use-real-values-for-memory-accounting-on-NVI.patch +++ b/patches/wined3d-Accounting/0001-wined3d-Use-real-values-for-memory-accounting-on-NVI.patch @@ -1,4 +1,4 @@ -From 17b9cfdf3a6e5823b9cfa3df256e4bd892943762 Mon Sep 17 00:00:00 2001 +From 2a8c68c26efe1070dec94a6a5ccba281311756b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 6 Jun 2015 06:53:34 +0200 Subject: wined3d: Use real values for memory accounting on NVIDIA cards. @@ -11,10 +11,10 @@ Subject: wined3d: Use real values for memory accounting on NVIDIA cards. 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c -index 8860bce..b345d1f 100644 +index 5aba575cc38..894b3324f90 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c -@@ -8857,10 +8857,13 @@ static void test_vidmem_accounting(void) +@@ -9063,10 +9063,13 @@ static void test_vidmem_accounting(void) } vidmem_end = IDirect3DDevice9_GetAvailableTextureMem(device); @@ -33,10 +33,10 @@ index 8860bce..b345d1f 100644 for (i = 0; i < sizeof(textures) / sizeof(*textures); i++) { diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index d1f77ca..312c8c1 100644 +index a7ee5bc099d..5b74a2b7b6c 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -1278,8 +1278,31 @@ void CDECL wined3d_device_set_multithreaded(struct wined3d_device *device) +@@ -1258,8 +1258,31 @@ void CDECL wined3d_device_set_multithreaded(struct wined3d_device *device) UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device *device) { @@ -51,7 +51,7 @@ index d1f77ca..312c8c1 100644 + GLint vram_free_kb; + UINT64 vram_free; + -+ struct wined3d_context *context = context_acquire(device, NULL); ++ struct wined3d_context *context = context_acquire(device, NULL, 0); + gl_info->gl_ops.gl.p_glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &vram_free_kb); + vram_free = (UINT64)vram_free_kb * 1024; + context_release(context); @@ -69,10 +69,10 @@ index d1f77ca..312c8c1 100644 wine_dbgstr_longlong(device->adapter->vram_bytes), wine_dbgstr_longlong(device->adapter->vram_bytes_used), diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c -index 43208b6f..8b26472 100644 +index 0f44e09e839..a213e2a5327 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c -@@ -228,6 +228,7 @@ static const struct wined3d_extension_map gl_extension_map[] = +@@ -250,6 +250,7 @@ static const struct wined3d_extension_map gl_extension_map[] = {"GL_NV_vertex_program2", NV_VERTEX_PROGRAM2 }, {"GL_NV_vertex_program2_option", NV_VERTEX_PROGRAM2_OPTION }, {"GL_NV_vertex_program3", NV_VERTEX_PROGRAM3 }, @@ -80,7 +80,7 @@ index 43208b6f..8b26472 100644 /* SGI */ {"GL_SGIS_generate_mipmap", SGIS_GENERATE_MIPMAP }, -@@ -1444,6 +1445,15 @@ static const struct gpu_description *query_gpu_description(const struct wined3d_ +@@ -1516,6 +1517,15 @@ static const struct gpu_description *query_gpu_description(const struct wined3d_ TRACE("Card reports vendor PCI ID 0x%04x, device PCI ID 0x%04x, 0x%s bytes of video memory.\n", vendor, device, wine_dbgstr_longlong(*vram_bytes)); } @@ -97,10 +97,10 @@ index 43208b6f..8b26472 100644 if (wined3d_settings.pci_vendor_id != PCI_VENDOR_NONE) { diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h -index 356ee7c..2fb21ff 100644 +index e500df65635..06252d5711f 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h -@@ -161,6 +161,7 @@ enum wined3d_gl_extension +@@ -180,6 +180,7 @@ enum wined3d_gl_extension NV_VERTEX_PROGRAM2, NV_VERTEX_PROGRAM2_OPTION, NV_VERTEX_PROGRAM3, @@ -109,5 +109,5 @@ index 356ee7c..2fb21ff 100644 SGIS_GENERATE_MIPMAP, /* WGL extensions */ -- -2.8.0 +2.11.0 diff --git a/patches/wined3d-CSMT_Main/0002-wined3d-Hackily-introduce-a-multithreaded-command-st.patch b/patches/wined3d-CSMT_Main/0002-wined3d-Hackily-introduce-a-multithreaded-command-st.patch index 3924fc78..36e28751 100644 --- a/patches/wined3d-CSMT_Main/0002-wined3d-Hackily-introduce-a-multithreaded-command-st.patch +++ b/patches/wined3d-CSMT_Main/0002-wined3d-Hackily-introduce-a-multithreaded-command-st.patch @@ -1,4 +1,4 @@ -From b79fac0cba54644719f1993f48550212666185ee Mon Sep 17 00:00:00 2001 +From 821cc7c5d0922b0e3eea0e2ce8d5dcc37ecca6d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 1 Oct 2013 14:31:56 +0200 Subject: wined3d: Hackily introduce a multithreaded command stream @@ -14,7 +14,7 @@ Subject: wined3d: Hackily introduce a multithreaded command stream 7 files changed, 517 insertions(+), 67 deletions(-) diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c -index 8cb90b796b8..b1b57a261a3 100644 +index dc9f77f302e..6197ea2ce8a 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -3772,7 +3772,7 @@ static void test_occlusion_query(void) @@ -27,10 +27,10 @@ index 8cb90b796b8..b1b57a261a3 100644 memset(&data, 0xff, sizeof(data)); hr = ID3D10Asynchronous_GetData(query, &data, sizeof(DWORD), 0); diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c -index e477f220817..380224e2de7 100644 +index ab3fa83a103..be7ef5b3b1a 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c -@@ -5255,7 +5255,7 @@ static void test_occlusion_query(void) +@@ -5271,7 +5271,7 @@ static void test_occlusion_query(void) memset(&data, 0xff, sizeof(data)); hr = ID3D11DeviceContext_GetData(context, query, &data, sizeof(data), 0); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); @@ -39,7 +39,7 @@ index e477f220817..380224e2de7 100644 memset(&data, 0xff, sizeof(data)); hr = ID3D11DeviceContext_GetData(context, query, &data, sizeof(DWORD), 0); -@@ -9543,7 +9543,7 @@ static void test_draw_uav_only(void) +@@ -9606,7 +9606,7 @@ static void test_draw_uav_only(void) draw_quad(&test_context); draw_quad(&test_context); draw_quad(&test_context); @@ -48,7 +48,7 @@ index e477f220817..380224e2de7 100644 ID3D11PixelShader_Release(ps); ID3D11Texture2D_Release(texture); -@@ -13215,12 +13215,12 @@ static void test_cs_uav_store(void) +@@ -13278,12 +13278,12 @@ static void test_cs_uav_store(void) ID3D11DeviceContext_CSSetShader(context, cs, NULL, 0); ID3D11DeviceContext_Dispatch(context, 1, 1, 1); @@ -63,7 +63,7 @@ index e477f220817..380224e2de7 100644 ID3D11ComputeShader_Release(cs); -@@ -13228,19 +13228,19 @@ static void test_cs_uav_store(void) +@@ -13291,19 +13291,19 @@ static void test_cs_uav_store(void) ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &input, 0, 0); ID3D11DeviceContext_CSSetShader(context, NULL, NULL, 0); ID3D11DeviceContext_Dispatch(context, 1, 1, 1); @@ -86,7 +86,7 @@ index e477f220817..380224e2de7 100644 ID3D11ComputeShader_Release(cs); -@@ -13251,17 +13251,17 @@ static void test_cs_uav_store(void) +@@ -13314,17 +13314,17 @@ static void test_cs_uav_store(void) input.x = 1.0f; ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &input, 0, 0); ID3D11DeviceContext_Dispatch(context, texture_desc.Width, texture_desc.Height, 1); @@ -108,7 +108,7 @@ index e477f220817..380224e2de7 100644 ID3D11ComputeShader_Release(cs); -@@ -13273,16 +13273,16 @@ static void test_cs_uav_store(void) +@@ -13336,16 +13336,16 @@ static void test_cs_uav_store(void) ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &input, 0, 0); ID3D11DeviceContext_Dispatch(context, 15, 15, 1); SetRect(&rect, 0, 0, 60, 60); @@ -129,7 +129,7 @@ index e477f220817..380224e2de7 100644 ID3D11ComputeShader_Release(cs); -@@ -13293,12 +13293,12 @@ static void test_cs_uav_store(void) +@@ -13356,12 +13356,12 @@ static void test_cs_uav_store(void) input.x = 0.3f; ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &input, 0, 0); ID3D11DeviceContext_Dispatch(context, 1, 1, 1); @@ -144,7 +144,7 @@ index e477f220817..380224e2de7 100644 ID3D11ComputeShader_Release(cs); -@@ -13451,10 +13451,10 @@ static void test_ps_cs_uav_binding(void) +@@ -13514,10 +13514,10 @@ static void test_ps_cs_uav_binding(void) ID3D11DeviceContext_PSSetShader(context, ps, NULL, 0); ID3D11DeviceContext_Dispatch(context, 1, 1, 1); @@ -157,7 +157,7 @@ index e477f220817..380224e2de7 100644 check_texture_float(ps_texture, 1.0f, 2); input.x = 0.5f; -@@ -13473,10 +13473,10 @@ static void test_ps_cs_uav_binding(void) +@@ -13536,10 +13536,10 @@ static void test_ps_cs_uav_binding(void) input.x = 4.0f; ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)ps_cb, 0, NULL, &input, 0, 0); ID3D11DeviceContext_Dispatch(context, 1, 1, 1); @@ -171,7 +171,7 @@ index e477f220817..380224e2de7 100644 ID3D11ComputeShader_Release(cs); diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c -index 778cd4679ff..d3b8c24f511 100644 +index b73c992d854..8483a28283f 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -1353,6 +1353,9 @@ void context_release(struct wined3d_context *context) @@ -184,9 +184,9 @@ index 778cd4679ff..d3b8c24f511 100644 if (!--context->level) { if (context_restore_pixel_format(context)) -@@ -3692,6 +3695,13 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str +@@ -3702,6 +3705,13 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, - TRACE("device %p, target %p.\n", device, target); + TRACE("device %p, texture %p, sub_resource_idx %u.\n", device, texture, sub_resource_idx); + if (wined3d_settings.cs_multithreaded && device->cs->thread_id != GetCurrentThreadId()) + { @@ -1231,10 +1231,10 @@ index 3a46a3c9a30..aabcb675044 100644 HeapFree(GetProcessHeap(), 0, cs->data); HeapFree(GetProcessHeap(), 0, cs); diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c -index 3bdba105105..abb4a664c1a 100644 +index 880f82f12ce..90208e607f3 100644 --- a/dlls/wined3d/query.c +++ b/dlls/wined3d/query.c -@@ -347,7 +347,7 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query, +@@ -350,7 +350,7 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query, return WINED3DERR_INVALIDCALL; } @@ -1274,7 +1274,7 @@ index e7962465279..a8409cfd4b8 100644 if (hkey) RegCloseKey( hkey ); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 0931d6aea95..684a04716dd 100644 +index 02e9d949db9..9d969287efc 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -306,6 +306,7 @@ struct wined3d_settings diff --git a/patches/wined3d-CSMT_Main/0009-wined3d-Wait-for-the-cs-to-finish-before-destroying-.patch b/patches/wined3d-CSMT_Main/0009-wined3d-Wait-for-the-cs-to-finish-before-destroying-.patch index ec5a15fc..d0bf67da 100644 --- a/patches/wined3d-CSMT_Main/0009-wined3d-Wait-for-the-cs-to-finish-before-destroying-.patch +++ b/patches/wined3d-CSMT_Main/0009-wined3d-Wait-for-the-cs-to-finish-before-destroying-.patch @@ -1,4 +1,4 @@ -From 04ea21a9ee8a73a1c463118a26f315cbe83d5fbf Mon Sep 17 00:00:00 2001 +From ff5e660a852ffa512b61f5bf3f8755376fec0370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 10 Apr 2013 20:09:55 +0200 Subject: wined3d: Wait for the cs to finish before destroying the device @@ -8,19 +8,19 @@ Subject: wined3d: Wait for the cs to finish before destroying the device 1 file changed, 3 insertions(+) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index d20906e7cc5..71701a816da 100644 +index b1ecc73f9f3..a410e7e2be5 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -1130,6 +1130,9 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1192,6 +1192,9 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) if (!device->d3d_initialized) return WINED3DERR_INVALIDCALL; + if (wined3d_settings.cs_multithreaded) + device->cs->ops->submit_and_wait(device->cs); + - /* I don't think that the interface guarantees that the device is destroyed from the same thread - * it was created. Thus make sure a context is active for the glDelete* calls - */ + if (device->logo_texture) + wined3d_texture_decref(device->logo_texture); + if (device->cursor_texture) -- 2.11.0 diff --git a/patches/wined3d-CSMT_Main/0012-wined3d-Get-rid-of-the-end_scene-flush-and-finish.patch b/patches/wined3d-CSMT_Main/0012-wined3d-Get-rid-of-the-end_scene-flush-and-finish.patch index 8d26d06d..a9e72a58 100644 --- a/patches/wined3d-CSMT_Main/0012-wined3d-Get-rid-of-the-end_scene-flush-and-finish.patch +++ b/patches/wined3d-CSMT_Main/0012-wined3d-Get-rid-of-the-end_scene-flush-and-finish.patch @@ -27,7 +27,7 @@ index 4fcc496bb2d..e236edd97f2 100644 return WINED3DERR_INVALIDCALL; } -- context = context_acquire(device, NULL); +- context = context_acquire(device, NULL, 0); - /* We only have to do this if we need to read the, swapbuffers performs a flush for us */ - context->gl_info->gl_ops.gl.p_glFlush(); - /* No checkGLcall here to avoid locking the lock just for checking a call that hardly ever diff --git a/patches/wined3d-CSMT_Main/0013-wined3d-Send-update_texture-calls-through-the-CS.patch b/patches/wined3d-CSMT_Main/0013-wined3d-Send-update_texture-calls-through-the-CS.patch index e8e51864..ebcdd939 100644 --- a/patches/wined3d-CSMT_Main/0013-wined3d-Send-update_texture-calls-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0013-wined3d-Send-update_texture-calls-through-the-CS.patch @@ -44,7 +44,7 @@ index 3747197a26e..9f7f8455a01 100644 + const struct wined3d_cs_update_texture *op = data; + struct wined3d_context *context; + -+ context = context_acquire(cs->device, NULL); ++ context = context_acquire(cs->device, NULL, 0); + device_exec_update_texture(context, op->src, op->dst); + context_release(context); + @@ -118,7 +118,7 @@ index e236edd97f2..f712113e86e 100644 - return WINED3DERR_INVALIDCALL; - } - -- context = context_acquire(device, NULL); +- context = context_acquire(device, NULL, 0); + TRACE("context %p, src_texture %p, src_level %u, dst_texture %p, level_count %u.\n", + context, src_texture, src_level, dst_texture, level_count); @@ -251,7 +251,7 @@ index e236edd97f2..f712113e86e 100644 } - /* Make sure that the destination texture is loaded. */ -- context = context_acquire(device, NULL); +- context = context_acquire(device, NULL, 0); - wined3d_texture_load(dst_texture, context, FALSE); - context_release(context); - diff --git a/patches/wined3d-CSMT_Main/0014-wined3d-Send-update_sub_resource-calls-through-the-c.patch b/patches/wined3d-CSMT_Main/0014-wined3d-Send-update_sub_resource-calls-through-the-c.patch index 93ba8f4b..d5e5b6ec 100644 --- a/patches/wined3d-CSMT_Main/0014-wined3d-Send-update_sub_resource-calls-through-the-c.patch +++ b/patches/wined3d-CSMT_Main/0014-wined3d-Send-update_sub_resource-calls-through-the-c.patch @@ -60,7 +60,7 @@ index 9f7f8455a01..f021b9320e5 100644 + addr.buffer_object = 0; + addr.addr = op->data; + -+ context = context_acquire(texture->resource.device, NULL); ++ context = context_acquire(texture->resource.device, NULL, 0); + + /* Only load the sub-resource for partial updates. */ + if (!op->box || (!op->box->left && !op->box->top && !op->box->front @@ -131,7 +131,7 @@ index 4f4221c1223..a6b2996f112 100644 - addr.buffer_object = 0; - addr.addr = data; - -- context = context_acquire(resource->device, NULL); +- context = context_acquire(resource->device, NULL, 0); - - /* Only load the sub-resource for partial updates. */ - if (!box || (!box->left && !box->top && !box->front diff --git a/patches/wined3d-CSMT_Main/0015-wined3d-Unload-resources-through-the-CS-in-uninit_3d.patch b/patches/wined3d-CSMT_Main/0015-wined3d-Unload-resources-through-the-CS-in-uninit_3d.patch deleted file mode 100644 index ae40cc2f..00000000 --- a/patches/wined3d-CSMT_Main/0015-wined3d-Unload-resources-through-the-CS-in-uninit_3d.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 2fb94b8d1c47c38586073f1fb8a7355c827e4082 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Stefan=20D=C3=B6singer?= -Date: Wed, 2 Oct 2013 23:28:56 +0200 -Subject: wined3d: Unload resources through the CS in uninit_3d. - ---- - dlls/wined3d/device.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 6395aaea6be..082489c295e 100644 ---- a/dlls/wined3d/device.c -+++ b/dlls/wined3d/device.c -@@ -1153,6 +1153,9 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) - wined3d_cs_emit_unload_resource(device->cs, resource); - } - -+ if (wined3d_settings.cs_multithreaded) -+ device->cs->ops->submit_and_wait(device->cs); -+ - wine_rb_clear(&device->samplers, device_free_sampler, NULL); - - /* Destroy the depth blt resources, they will be invalid after the reset. Also free shader --- -2.11.0 - diff --git a/patches/wined3d-CSMT_Main/0017-wined3d-Send-getdc-and-releasedc-through-the-command.patch b/patches/wined3d-CSMT_Main/0017-wined3d-Send-getdc-and-releasedc-through-the-command.patch index 10ed29b6..96d10059 100644 --- a/patches/wined3d-CSMT_Main/0017-wined3d-Send-getdc-and-releasedc-through-the-command.patch +++ b/patches/wined3d-CSMT_Main/0017-wined3d-Send-getdc-and-releasedc-through-the-command.patch @@ -123,7 +123,7 @@ index 1b4fa46b55e..e9641b95099 100644 + HRESULT hr = WINED3D_OK; + + if (device->d3d_initialized) -+ context = context_acquire(device, NULL); ++ context = context_acquire(device, NULL, 0); + + wined3d_texture_load_location(texture, sub_resource_idx, context, texture->resource.map_binding); + wined3d_texture_invalidate_location(texture, sub_resource_idx, ~texture->resource.map_binding); @@ -159,7 +159,7 @@ index 1b4fa46b55e..e9641b95099 100644 return WINED3DERR_INVALIDCALL; - if (device->d3d_initialized) -- context = context_acquire(device, NULL); +- context = context_acquire(device, NULL, 0); - - wined3d_texture_load_location(texture, sub_resource_idx, context, texture->resource.map_binding); - wined3d_texture_invalidate_location(texture, sub_resource_idx, ~texture->resource.map_binding); diff --git a/patches/wined3d-CSMT_Main/0018-wined3d-Create-dummy-textures-through-the-CS.patch b/patches/wined3d-CSMT_Main/0018-wined3d-Create-dummy-textures-through-the-CS.patch index 42aafc25..82329a0b 100644 --- a/patches/wined3d-CSMT_Main/0018-wined3d-Create-dummy-textures-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0018-wined3d-Create-dummy-textures-through-the-CS.patch @@ -1,4 +1,4 @@ -From b8980974b1117ed0b1b792118e64265d2de984ff Mon Sep 17 00:00:00 2001 +From c3cc04eaa9c6274fdc189d39d995e2cfccab489a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 10 Oct 2013 16:29:42 +0200 Subject: wined3d: Create dummy textures through the CS. @@ -13,10 +13,10 @@ crash. 4 files changed, 51 insertions(+), 23 deletions(-) diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c -index 045e2fa54f2..2e67b720f56 100644 +index 507496cace1..ab3fa83a103 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c -@@ -13205,12 +13205,12 @@ static void test_cs_uav_store(void) +@@ -13278,12 +13278,12 @@ static void test_cs_uav_store(void) ID3D11DeviceContext_CSSetShader(context, cs, NULL, 0); ID3D11DeviceContext_Dispatch(context, 1, 1, 1); @@ -31,7 +31,7 @@ index 045e2fa54f2..2e67b720f56 100644 ID3D11ComputeShader_Release(cs); -@@ -13218,19 +13218,19 @@ static void test_cs_uav_store(void) +@@ -13291,19 +13291,19 @@ static void test_cs_uav_store(void) ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &input, 0, 0); ID3D11DeviceContext_CSSetShader(context, NULL, NULL, 0); ID3D11DeviceContext_Dispatch(context, 1, 1, 1); @@ -54,7 +54,7 @@ index 045e2fa54f2..2e67b720f56 100644 ID3D11ComputeShader_Release(cs); -@@ -13241,17 +13241,17 @@ static void test_cs_uav_store(void) +@@ -13314,17 +13314,17 @@ static void test_cs_uav_store(void) input.x = 1.0f; ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &input, 0, 0); ID3D11DeviceContext_Dispatch(context, texture_desc.Width, texture_desc.Height, 1); @@ -76,7 +76,7 @@ index 045e2fa54f2..2e67b720f56 100644 ID3D11ComputeShader_Release(cs); -@@ -13263,16 +13263,16 @@ static void test_cs_uav_store(void) +@@ -13336,16 +13336,16 @@ static void test_cs_uav_store(void) ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &input, 0, 0); ID3D11DeviceContext_Dispatch(context, 15, 15, 1); SetRect(&rect, 0, 0, 60, 60); @@ -97,7 +97,7 @@ index 045e2fa54f2..2e67b720f56 100644 ID3D11ComputeShader_Release(cs); -@@ -13283,12 +13283,12 @@ static void test_cs_uav_store(void) +@@ -13356,12 +13356,12 @@ static void test_cs_uav_store(void) input.x = 0.3f; ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &input, 0, 0); ID3D11DeviceContext_Dispatch(context, 1, 1, 1); @@ -112,7 +112,7 @@ index 045e2fa54f2..2e67b720f56 100644 ID3D11ComputeShader_Release(cs); -@@ -13441,10 +13441,10 @@ static void test_ps_cs_uav_binding(void) +@@ -13514,10 +13514,10 @@ static void test_ps_cs_uav_binding(void) ID3D11DeviceContext_PSSetShader(context, ps, NULL, 0); ID3D11DeviceContext_Dispatch(context, 1, 1, 1); @@ -126,7 +126,7 @@ index 045e2fa54f2..2e67b720f56 100644 input.x = 0.5f; diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 9b267871a37..3a6bfe4d38a 100644 +index 7f5339599d8..bf6adf4be71 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -85,6 +85,7 @@ enum wined3d_cs_op @@ -149,14 +149,14 @@ index 9b267871a37..3a6bfe4d38a 100644 static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block); static void wined3d_cs_mt_submit(struct wined3d_cs *cs); -@@ -2323,6 +2329,27 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture +@@ -2331,6 +2337,27 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture return hr; } +static UINT wined3d_cs_exec_create_dummy_textures(struct wined3d_cs *cs, const void *data) +{ + const struct wined3d_cs_create_dummy_textures *op = data; -+ struct wined3d_context *context = context_acquire(cs->device, NULL); ++ struct wined3d_context *context = context_acquire(cs->device, NULL, 0); + + device_create_dummy_textures(cs->device, context); + @@ -177,7 +177,7 @@ index 9b267871a37..3a6bfe4d38a 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence, -@@ -2373,6 +2400,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2381,6 +2408,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, /* WINED3D_CS_OP_GET_DC */ wined3d_cs_exec_get_dc, /* WINED3D_CS_OP_RELEASE_DC */ wined3d_cs_exec_release_dc, @@ -186,10 +186,10 @@ index 9b267871a37..3a6bfe4d38a 100644 static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index b62d3ba473f..4f5a45c1f60 100644 +index 9c69d04c3f0..008be8ae010 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -607,7 +607,7 @@ out: +@@ -610,7 +610,7 @@ out: } /* Context activation is done by the caller. */ @@ -198,12 +198,21 @@ index b62d3ba473f..4f5a45c1f60 100644 { const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; -@@ -1038,17 +1038,15 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, +@@ -1029,7 +1029,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru + + target = swapchain->back_buffers ? swapchain->back_buffers[0] : swapchain->front_buffer; + context = context_acquire(device, target, 0); +- create_dummy_textures(device, context); ++ device_create_dummy_textures(device, context); + create_default_samplers(device, context); + context_release(context); + +@@ -1106,17 +1106,15 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, device->swapchains[0] = swapchain; device_init_swapchain_state(device, swapchain); + wined3d_cs_emit_create_dummy_textures(device->cs); - context = context_acquire(device, NULL); + context = context_acquire(device, NULL, 0); - - create_dummy_textures(device, context); create_default_samplers(device, context); @@ -218,17 +227,8 @@ index b62d3ba473f..4f5a45c1f60 100644 /* Clear the screen */ if (swapchain->back_buffers && swapchain->back_buffers[0]) clear_flags |= WINED3DCLEAR_TARGET; -@@ -4758,7 +4756,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru - - swapchain->context[0] = context; - swapchain->num_contexts = 1; -- create_dummy_textures(device, context); -+ device_create_dummy_textures(device, context); - create_default_samplers(device, context); - context_release(context); - diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 1ccb02544ce..e6d349b8186 100644 +index 2d0a97f706c..efd4a4dfd6d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2672,6 +2672,7 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso diff --git a/patches/wined3d-CSMT_Main/0020-wined3d-Recreate-ctx-and-dummy-textures-through-the-.patch b/patches/wined3d-CSMT_Main/0020-wined3d-Recreate-ctx-and-dummy-textures-through-the-.patch index a036eb66..dd801200 100644 --- a/patches/wined3d-CSMT_Main/0020-wined3d-Recreate-ctx-and-dummy-textures-through-the-.patch +++ b/patches/wined3d-CSMT_Main/0020-wined3d-Recreate-ctx-and-dummy-textures-through-the-.patch @@ -1,17 +1,17 @@ -From dd497359d661b8ca14cdeb83140f569bab3632e1 Mon Sep 17 00:00:00 2001 +From 716641434adb8c9e8c9dc940d5a3a1f82c147de2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 10 Oct 2013 18:40:04 +0200 Subject: wined3d: Recreate ctx and dummy textures through the CS after resets. --- - dlls/wined3d/device.c | 23 +++++------------------ - 1 file changed, 5 insertions(+), 18 deletions(-) + dlls/wined3d/device.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index f3b74bb5a45..fe9c524d36c 100644 +index 008be8ae010..1427e4c85ef 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -4711,7 +4711,6 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d +@@ -1010,7 +1010,6 @@ static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device) static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain) { struct wined3d_context *context; @@ -19,38 +19,24 @@ index f3b74bb5a45..fe9c524d36c 100644 HRESULT hr; if (FAILED(hr = device->shader_backend->shader_alloc_private(device, -@@ -4728,29 +4727,17 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru +@@ -1027,9 +1026,17 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru return hr; } -- /* Recreate the primary swapchain's context */ -- swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(*swapchain->context)); -- if (!swapchain->context) -- { -- ERR("Failed to allocate memory for swapchain context array.\n"); -- device->blitter->free_private(device); -- device->shader_backend->shader_free_private(device); -- return E_OUTOFMEMORY; -- } -- - target = swapchain->back_buffers ? swapchain->back_buffers[0] : swapchain->front_buffer; -- if (!(context = context_create(swapchain, target, swapchain->ds_format))) +- context = context_acquire(device, target, 0); +- device_create_dummy_textures(device, context); + hr = wined3d_cs_emit_create_swapchain_context(device->cs, swapchain); + if (FAILED(hr)) - { - WARN("Failed to create context.\n"); - device->blitter->free_private(device); - device->shader_backend->shader_free_private(device); -- HeapFree(GetProcessHeap(), 0, swapchain->context); -- return E_FAIL; ++ { ++ WARN("Failed to create context.\n"); ++ device->blitter->free_private(device); ++ device->shader_backend->shader_free_private(device); + return hr; - } - -- swapchain->context[0] = context; -- swapchain->num_contexts = 1; -- device_create_dummy_textures(device, context); ++ } ++ + wined3d_cs_emit_create_dummy_textures(device->cs); -+ context = context_acquire(device, NULL); ++ context = context_acquire(device, NULL, 0); create_default_samplers(device, context); context_release(context); diff --git a/patches/wined3d-CSMT_Main/0021-wined3d-Call-create_default_sampler-from-create_dumm.patch b/patches/wined3d-CSMT_Main/0021-wined3d-Call-create_default_sampler-from-create_dumm.patch index 101855e6..3761d968 100644 --- a/patches/wined3d-CSMT_Main/0021-wined3d-Call-create_default_sampler-from-create_dumm.patch +++ b/patches/wined3d-CSMT_Main/0021-wined3d-Call-create_default_sampler-from-create_dumm.patch @@ -1,4 +1,4 @@ -From aa4fb9f42031758a65fc644884ab638799bb2264 Mon Sep 17 00:00:00 2001 +From 0c7a163631a32c68e50a24a4353665edf19c8f4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 7 May 2016 21:16:47 +0100 Subject: wined3d: Call create_default_sampler from create_dummy_textures. @@ -9,10 +9,10 @@ I should really rename it, don't feel like it now. 1 file changed, 34 insertions(+), 41 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index fe9c524d36c..33955e3f3f4 100644 +index 1427e4c85ef..7bb9895f90d 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -607,6 +607,39 @@ out: +@@ -610,6 +610,39 @@ out: } /* Context activation is done by the caller. */ @@ -52,7 +52,7 @@ index fe9c524d36c..33955e3f3f4 100644 void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context) { const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info; -@@ -741,6 +774,7 @@ void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_ +@@ -744,6 +777,7 @@ void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_ } context_bind_dummy_textures(device, context); @@ -60,7 +60,7 @@ index fe9c524d36c..33955e3f3f4 100644 } /* Context activation is done by the caller. */ -@@ -775,39 +809,6 @@ static void destroy_dummy_textures(struct wined3d_device *device, struct wined3d +@@ -778,39 +812,6 @@ static void destroy_dummy_textures(struct wined3d_device *device, struct wined3d } /* Context activation is done by the caller. */ @@ -100,25 +100,7 @@ index fe9c524d36c..33955e3f3f4 100644 static void destroy_default_samplers(struct wined3d_device *device, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; -@@ -974,7 +975,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, - static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f}; - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; - struct wined3d_swapchain *swapchain = NULL; -- struct wined3d_context *context; - DWORD clear_flags = 0; - HRESULT hr; - -@@ -1039,9 +1039,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, - device_init_swapchain_state(device, swapchain); - - wined3d_cs_emit_create_dummy_textures(device->cs); -- context = context_acquire(device, NULL); -- create_default_samplers(device, context); -- context_release(context); - - device->contexts[0]->last_was_rhw = 0; - -@@ -4710,7 +4707,6 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d +@@ -1009,7 +1010,6 @@ static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device) static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain) { @@ -126,16 +108,34 @@ index fe9c524d36c..33955e3f3f4 100644 HRESULT hr; if (FAILED(hr = device->shader_backend->shader_alloc_private(device, -@@ -4737,9 +4733,6 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru +@@ -1036,9 +1036,6 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru } wined3d_cs_emit_create_dummy_textures(device->cs); -- context = context_acquire(device, NULL); +- context = context_acquire(device, NULL, 0); - create_default_samplers(device, context); - context_release(context); return WINED3D_OK; } +@@ -1049,7 +1046,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, + static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f}; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + struct wined3d_swapchain *swapchain = NULL; +- struct wined3d_context *context; + DWORD clear_flags = 0; + HRESULT hr; + +@@ -1114,9 +1110,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, + device_init_swapchain_state(device, swapchain); + + wined3d_cs_emit_create_dummy_textures(device->cs); +- context = context_acquire(device, NULL, 0); +- create_default_samplers(device, context); +- context_release(context); + + device->contexts[0]->last_was_rhw = 0; + -- 2.11.0 diff --git a/patches/wined3d-CSMT_Main/0023-wined3d-Do-the-sampler-GL-init-through-the-CS.patch b/patches/wined3d-CSMT_Main/0023-wined3d-Do-the-sampler-GL-init-through-the-CS.patch index bf3e3e0f..e558ba17 100644 --- a/patches/wined3d-CSMT_Main/0023-wined3d-Do-the-sampler-GL-init-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0023-wined3d-Do-the-sampler-GL-init-through-the-CS.patch @@ -90,8 +90,8 @@ index 5902feb88fa..93730acb906 100644 - sampler->parent = parent; - sampler->desc = *desc; - -- context = context_acquire(device, NULL); -+ context = context_acquire(sampler->device, NULL); +- context = context_acquire(device, NULL, 0); ++ context = context_acquire(sampler->device, NULL, 0); gl_info = context->gl_info; GL_EXTCALL(glGenSamplers(1, &sampler->name)); diff --git a/patches/wined3d-CSMT_Main/0026-wined3d-Fix-context_acquire-not-being-called-from-th.patch b/patches/wined3d-CSMT_Main/0026-wined3d-Fix-context_acquire-not-being-called-from-th.patch index 480e95a7..50b1f65f 100644 --- a/patches/wined3d-CSMT_Main/0026-wined3d-Fix-context_acquire-not-being-called-from-th.patch +++ b/patches/wined3d-CSMT_Main/0026-wined3d-Fix-context_acquire-not-being-called-from-th.patch @@ -46,7 +46,7 @@ index 3e385ddf736..cdd11e41c91 100644 + struct wined3d_texture *texture = op->texture; + struct wined3d_context *context; + -+ context = context_acquire(cs->device, NULL); ++ context = context_acquire(cs->device, NULL, 0); + if (!wined3d_texture_load_location(texture, op->sub_resource_idx, context, texture->resource.map_binding)) + { + ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding)); @@ -111,7 +111,7 @@ index b62fff8c503..1ff9cbb87c3 100644 - if (dirty_region) - WARN("Ignoring dirty_region %s.\n", debug_box(dirty_region)); - -- context = context_acquire(texture->resource.device, NULL); +- context = context_acquire(texture->resource.device, NULL, 0); - if (!wined3d_texture_load_location(texture, sub_resource_idx, context, texture->resource.map_binding)) - { - ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding)); diff --git a/patches/wined3d-CSMT_Main/0027-wined3d-Wrap-GL-BOs-in-a-structure.patch b/patches/wined3d-CSMT_Main/0027-wined3d-Wrap-GL-BOs-in-a-structure.patch index 42f7a5b5..4a5c7d9d 100644 --- a/patches/wined3d-CSMT_Main/0027-wined3d-Wrap-GL-BOs-in-a-structure.patch +++ b/patches/wined3d-CSMT_Main/0027-wined3d-Wrap-GL-BOs-in-a-structure.patch @@ -157,7 +157,7 @@ index 1ff9cbb87c3..02119dee645 100644 * general, but if a buffer object was previously created we can. */ if (!context) - { - context = context_acquire(device, NULL); + context = context_acquire(device, NULL, 0); - gl_info = context->gl_info; - } diff --git a/patches/wined3d-CSMT_Main/0031-wined3d-Move-the-framebuffer-into-wined3d_state.patch b/patches/wined3d-CSMT_Main/0031-wined3d-Move-the-framebuffer-into-wined3d_state.patch index 5ebf9f35..93444c20 100644 --- a/patches/wined3d-CSMT_Main/0031-wined3d-Move-the-framebuffer-into-wined3d_state.patch +++ b/patches/wined3d-CSMT_Main/0031-wined3d-Move-the-framebuffer-into-wined3d_state.patch @@ -1,13 +1,13 @@ -From 089e84881f1704b8280ee66ec74a06d641b07450 Mon Sep 17 00:00:00 2001 +From 83e81d1ca0c1a14e31f42253596859920f44ccb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 20 Dec 2012 13:09:17 +0100 Subject: wined3d: Move the framebuffer into wined3d_state --- dlls/wined3d/arb_program_shader.c | 4 +- - dlls/wined3d/context.c | 19 +++++-- - dlls/wined3d/cs.c | 52 ++++++++++--------- - dlls/wined3d/device.c | 102 +++++++++++++++++--------------------- + dlls/wined3d/context.c | 19 ++++++-- + dlls/wined3d/cs.c | 52 ++++++++++---------- + dlls/wined3d/device.c | 100 +++++++++++++++++--------------------- dlls/wined3d/drawprim.c | 2 +- dlls/wined3d/glsl_shader.c | 2 +- dlls/wined3d/shader.c | 2 +- @@ -15,11 +15,11 @@ Subject: wined3d: Move the framebuffer into wined3d_state dlls/wined3d/stateblock.c | 47 ++++++++++++++++-- dlls/wined3d/surface.c | 2 +- dlls/wined3d/utils.c | 4 +- - dlls/wined3d/wined3d_private.h | 46 ++++++++++++----- - 12 files changed, 183 insertions(+), 127 deletions(-) + dlls/wined3d/wined3d_private.h | 46 +++++++++++++----- + 12 files changed, 182 insertions(+), 126 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c -index 85ed462c78d..1191a6d5873 100644 +index 7ed83f4b609..86627090d29 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -701,7 +701,7 @@ static void shader_arb_load_constants_internal(struct shader_arb_priv *priv, @@ -41,10 +41,10 @@ index 85ed462c78d..1191a6d5873 100644 } diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c -index 31725b27c88..c1cbaa677a0 100644 +index 8483a28283f..71e1191649e 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c -@@ -1726,6 +1726,11 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, +@@ -1723,6 +1723,11 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, goto out; } @@ -56,7 +56,7 @@ index 31725b27c88..c1cbaa677a0 100644 /* Initialize the texture unit mapping to a 1:1 mapping */ for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s) { -@@ -2047,6 +2052,7 @@ out: +@@ -2031,6 +2036,7 @@ out: if (hdc) wined3d_release_dc(swapchain->win_handle, hdc); device->shader_backend->shader_free_context_data(ret); device->adapter->fragment_pipe->free_context_data(ret); @@ -64,7 +64,7 @@ index 31725b27c88..c1cbaa677a0 100644 HeapFree(GetProcessHeap(), 0, ret->free_event_queries); HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries); HeapFree(GetProcessHeap(), 0, ret->free_timestamp_queries); -@@ -2094,6 +2100,7 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont +@@ -2078,6 +2084,7 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont device->shader_backend->shader_free_context_data(context); device->adapter->fragment_pipe->free_context_data(context); HeapFree(GetProcessHeap(), 0, context->fbo_key); @@ -72,7 +72,7 @@ index 31725b27c88..c1cbaa677a0 100644 HeapFree(GetProcessHeap(), 0, context->draw_buffers); HeapFree(GetProcessHeap(), 0, context->blit_targets); device_context_remove(device, context); -@@ -2652,7 +2659,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2640,7 +2647,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win DWORD rt_mask = 0, *cur_mask; UINT i; @@ -81,7 +81,7 @@ index 31725b27c88..c1cbaa677a0 100644 || rt_count != gl_info->limits.buffers) { if (!context_validate_rt_config(rt_count, rts, dsv)) -@@ -2697,6 +2704,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2685,6 +2692,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win rt_mask = context_generate_rt_mask_no_fbo(context, rt_count ? wined3d_rendertarget_view_get_surface(rts[0])->container : NULL); } @@ -90,7 +90,7 @@ index 31725b27c88..c1cbaa677a0 100644 } else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO && (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource))) -@@ -2753,7 +2762,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2741,7 +2750,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const struct wined3d_state *state) { @@ -99,7 +99,7 @@ index 31725b27c88..c1cbaa677a0 100644 struct wined3d_shader *ps = state->shader[WINED3D_SHADER_TYPE_PIXEL]; DWORD rt_mask, rt_mask_bits; unsigned int i; -@@ -2783,7 +2792,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const +@@ -2771,7 +2780,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const void context_state_fb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { DWORD rt_mask = find_draw_buffers_mask(context, state); @@ -108,7 +108,7 @@ index 31725b27c88..c1cbaa677a0 100644 DWORD *cur_mask; if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) -@@ -3072,6 +3081,8 @@ void context_state_drawbuf(struct wined3d_context *context, const struct wined3d +@@ -3060,6 +3069,8 @@ void context_state_drawbuf(struct wined3d_context *context, const struct wined3d context_apply_draw_buffers(context, rt_mask); *cur_mask = rt_mask; } @@ -117,7 +117,7 @@ index 31725b27c88..c1cbaa677a0 100644 } static BOOL fixed_get_input(BYTE usage, BYTE usage_idx, unsigned int *regnum) -@@ -3506,7 +3517,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context, +@@ -3504,7 +3515,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context, const struct wined3d_device *device, const struct wined3d_state *state) { const struct StateEntry *state_table = context->state_table; @@ -127,10 +127,10 @@ index 31725b27c88..c1cbaa677a0 100644 WORD map; diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 4778b73b0dc..6d1ab033b4d 100644 +index c9626180db1..55c175ef093 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -622,7 +622,7 @@ static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) +@@ -624,7 +624,7 @@ static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) wined3d_swapchain_set_window(swapchain, op->dst_window_override); swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags, @@ -139,7 +139,7 @@ index 4778b73b0dc..6d1ab033b4d 100644 InterlockedDecrement(&cs->pending_presents); -@@ -685,19 +685,19 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) +@@ -687,19 +687,19 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) state = &cs->state; wined3d_get_draw_rect(state, &draw_rect); device_clear_render_targets(device, device->adapter->gl_info.limits.buffers, @@ -163,7 +163,7 @@ index 4778b73b0dc..6d1ab033b4d 100644 return size; } -@@ -722,12 +722,12 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -724,12 +724,12 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * { for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -179,7 +179,7 @@ index 4778b73b0dc..6d1ab033b4d 100644 cs->ops->submit(cs); } -@@ -902,11 +902,11 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -904,11 +904,11 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) } for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -195,7 +195,7 @@ index 4778b73b0dc..6d1ab033b4d 100644 release_shader_resources(state, ~(1u << WINED3D_SHADER_TYPE_COMPUTE)); release_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_PIXEL], state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]); -@@ -944,11 +944,11 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -946,11 +946,11 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i } for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -211,7 +211,7 @@ index 4778b73b0dc..6d1ab033b4d 100644 acquire_shader_resources(state, ~(1u << WINED3D_SHADER_TYPE_COMPUTE)); acquire_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_PIXEL], state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]); -@@ -1024,7 +1024,7 @@ static UINT wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const v +@@ -1026,7 +1026,7 @@ static UINT wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const v { const struct wined3d_cs_set_rendertarget_view *op = data; @@ -220,7 +220,7 @@ index 4778b73b0dc..6d1ab033b4d 100644 device_invalidate_state(cs->device, STATE_FRAMEBUFFER); return sizeof(*op); -@@ -1049,7 +1049,7 @@ static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -1051,7 +1051,7 @@ static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const struct wined3d_device *device = cs->device; struct wined3d_rendertarget_view *prev; @@ -229,7 +229,7 @@ index 4778b73b0dc..6d1ab033b4d 100644 { struct wined3d_surface *prev_surface = wined3d_rendertarget_view_get_surface(prev); -@@ -1061,7 +1061,7 @@ static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -1063,7 +1063,7 @@ static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const } } @@ -238,7 +238,7 @@ index 4778b73b0dc..6d1ab033b4d 100644 if (!prev != !op->view) { -@@ -1721,11 +1721,13 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1731,11 +1731,13 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma static UINT wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) { struct wined3d_adapter *adapter = cs->device->adapter; @@ -254,7 +254,7 @@ index 4778b73b0dc..6d1ab033b4d 100644 return sizeof(struct wined3d_cs_reset_state); } -@@ -2815,15 +2817,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -2831,15 +2833,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) return NULL; cs->tls_idx = TLS_OUT_OF_INDEXES; @@ -272,7 +272,7 @@ index 4778b73b0dc..6d1ab033b4d 100644 cs->ops = &wined3d_cs_st_ops; cs->device = device; -@@ -2856,7 +2856,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -2872,7 +2872,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) err: state_cleanup(&cs->state); if (cs->tls_idx != TLS_OUT_OF_INDEXES) TlsFree(cs->tls_idx); @@ -280,7 +280,7 @@ index 4778b73b0dc..6d1ab033b4d 100644 HeapFree(GetProcessHeap(), 0, cs->data); HeapFree(GetProcessHeap(), 0, cs); return NULL; -@@ -2885,7 +2884,6 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) +@@ -2901,7 +2900,6 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) } TlsFree(cs->tls_idx); @@ -289,10 +289,10 @@ index 4778b73b0dc..6d1ab033b4d 100644 HeapFree(GetProcessHeap(), 0, cs); } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index c0f6f0421bb..c643b111aa2 100644 +index ec0f7d98ab7..3b619a37fee 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -955,7 +955,7 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi +@@ -958,7 +958,7 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi BOOL ds_enable = !!swapchain->desc.enable_auto_depth_stencil; unsigned int i; @@ -301,7 +301,7 @@ index c0f6f0421bb..c643b111aa2 100644 { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -973,7 +973,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, +@@ -1044,7 +1044,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc) { static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -309,7 +309,7 @@ index c0f6f0421bb..c643b111aa2 100644 struct wined3d_swapchain *swapchain = NULL; DWORD clear_flags = 0; HRESULT hr; -@@ -985,9 +984,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, +@@ -1056,9 +1055,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, if (device->wined3d->flags & WINED3D_NO3D) return WINED3DERR_INVALIDCALL; @@ -319,7 +319,7 @@ index c0f6f0421bb..c643b111aa2 100644 if (FAILED(hr = device->shader_backend->shader_alloc_private(device, device->adapter->vertex_pipe, device->adapter->fragment_pipe))) { -@@ -1059,7 +1055,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, +@@ -1130,7 +1126,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, return WINED3D_OK; err_out: @@ -327,23 +327,14 @@ index c0f6f0421bb..c643b111aa2 100644 HeapFree(GetProcessHeap(), 0, device->swapchains); device->swapchain_count = 0; if (device->back_buffer_view) -@@ -1141,6 +1136,12 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1203,33 +1198,16 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) state_unbind_resources(&device->state); -+ if (device->auto_depth_stencil_view) -+ { -+ wined3d_rendertarget_view_decref(device->auto_depth_stencil_view); -+ device->auto_depth_stencil_view = NULL; -+ } -+ - /* Unload resources */ - LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) - { -@@ -1170,29 +1171,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) - - context_release(context); - +- wine_rb_clear(&device->samplers, device_free_sampler, NULL); +- +- wined3d_device_delete_opengl_contexts(device); +- - if (device->fb.depth_stencil) - { - struct wined3d_rendertarget_view *view = device->fb.depth_stencil; @@ -354,23 +345,28 @@ index c0f6f0421bb..c643b111aa2 100644 - wined3d_rendertarget_view_decref(view); - } - -- if (device->auto_depth_stencil_view) -- { + if (device->auto_depth_stencil_view) + { - struct wined3d_rendertarget_view *view = device->auto_depth_stencil_view; - -- device->auto_depth_stencil_view = NULL; ++ wined3d_rendertarget_view_decref(device->auto_depth_stencil_view); + device->auto_depth_stencil_view = NULL; - if (wined3d_rendertarget_view_decref(view)) - ERR("Something's still holding the auto depth/stencil view (%p).\n", view); -- } -- -- for (i = 0; i < gl_info->limits.buffers; ++i) + } + +- for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) - { - wined3d_device_set_rendertarget_view(device, i, NULL, FALSE); - } ++ wine_rb_clear(&device->samplers, device_free_sampler, NULL); ++ ++ wined3d_device_delete_opengl_contexts(device); ++ if (device->back_buffer_view) { wined3d_rendertarget_view_decref(device->back_buffer_view); -@@ -1210,9 +1188,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1247,9 +1225,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) device->swapchains = NULL; device->swapchain_count = 0; @@ -380,7 +376,7 @@ index c0f6f0421bb..c643b111aa2 100644 device->d3d_initialized = FALSE; return WINED3D_OK; -@@ -2015,7 +1990,7 @@ static void resolve_depth_buffer(struct wined3d_state *state) +@@ -2052,7 +2027,7 @@ static void resolve_depth_buffer(struct wined3d_state *state) || !(dst_texture->resource.format_flags & WINED3DFMT_FLAG_DEPTH)) return; @@ -389,7 +385,7 @@ index c0f6f0421bb..c643b111aa2 100644 return; if (src_view->resource->type == WINED3D_RTYPE_BUFFER) { -@@ -3537,6 +3512,8 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3574,6 +3549,8 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) { @@ -398,7 +394,7 @@ index c0f6f0421bb..c643b111aa2 100644 TRACE("device %p, rect_count %u, rects %p, flags %#x, color %s, depth %.8e, stencil %u.\n", device, rect_count, rects, flags, debug_color(color), depth, stencil); -@@ -3548,7 +3525,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3585,7 +3562,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) { @@ -407,7 +403,7 @@ index c0f6f0421bb..c643b111aa2 100644 if (!ds) { WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n"); -@@ -3557,8 +3534,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3594,8 +3571,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou } else if (flags & WINED3DCLEAR_TARGET) { @@ -418,7 +414,7 @@ index c0f6f0421bb..c643b111aa2 100644 { WARN("Silently ignoring depth and target clear with mismatching sizes\n"); return WINED3D_OK; -@@ -3908,8 +3885,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device +@@ -3945,8 +3922,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_STENCILENABLE]) { @@ -429,7 +425,7 @@ index c0f6f0421bb..c643b111aa2 100644 if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -4344,20 +4321,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co +@@ -4381,20 +4358,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co return NULL; } @@ -453,7 +449,7 @@ index c0f6f0421bb..c643b111aa2 100644 TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n", device, view_idx, view, set_viewport); -@@ -4394,13 +4372,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4431,13 +4409,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device } @@ -469,7 +465,7 @@ index c0f6f0421bb..c643b111aa2 100644 wined3d_cs_emit_set_rendertarget_view(device->cs, view_idx, view); /* Release after the assignment, to prevent device_resource_released() * from seeing the surface as still in use. */ -@@ -4412,18 +4390,19 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4449,18 +4427,19 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view) { @@ -491,7 +487,7 @@ index c0f6f0421bb..c643b111aa2 100644 wined3d_rendertarget_view_incref(view); wined3d_cs_emit_set_depth_stencil_view(device->cs, view); if (prev) -@@ -4770,10 +4749,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4726,10 +4705,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, wined3d_texture_decref(device->cursor_texture); device->cursor_texture = NULL; } @@ -503,7 +499,7 @@ index c0f6f0421bb..c643b111aa2 100644 { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4784,6 +4762,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4740,6 +4718,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (reset_state) { @@ -515,9 +511,9 @@ index c0f6f0421bb..c643b111aa2 100644 LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) { TRACE("Enumerating resource %p.\n", resource); -@@ -4952,27 +4935,28 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4911,27 +4894,28 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (device->d3d_initialized) - delete_opengl_contexts(device, swapchain); + wined3d_device_delete_opengl_contexts(device); - state_init(&device->state, &device->fb, &device->adapter->gl_info, - &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT); @@ -551,7 +547,7 @@ index c0f6f0421bb..c643b111aa2 100644 wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -5064,11 +5048,11 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso +@@ -5023,11 +5007,11 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { @@ -565,7 +561,7 @@ index c0f6f0421bb..c643b111aa2 100644 ERR("Resource %p is still in use as depth/stencil buffer.\n", resource); } -@@ -5194,8 +5178,12 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, +@@ -5153,8 +5137,12 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, device->blitter = adapter->blitter; @@ -581,7 +577,7 @@ index c0f6f0421bb..c643b111aa2 100644 if (!(device->cs = wined3d_cs_create(device))) diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c -index 49804131efb..28b4c5a48da 100644 +index 48421ef545e..d8f2ad17f2e 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -411,7 +411,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s @@ -594,10 +590,10 @@ index 49804131efb..28b4c5a48da 100644 struct wined3d_event_query *ib_query = NULL; struct wined3d_rendertarget_view *dsv, *rtv; diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c -index 82e9fb7ea30..88dc4ee9cc6 100644 +index de2c0006ae1..8e902aae935 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c -@@ -1629,7 +1629,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context +@@ -1630,7 +1630,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context const struct wined3d_vec4 correction_params = { /* Position is relative to the framebuffer, not the viewport. */ @@ -607,10 +603,10 @@ index 82e9fb7ea30..88dc4ee9cc6 100644 0.0f, 0.0f, diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c -index 814da178862..09ebbfa53c6 100644 +index 450e7913771..faf48a5126b 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c -@@ -3231,7 +3231,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 +@@ -3265,7 +3265,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 UINT i; memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */ @@ -824,10 +820,10 @@ index 8221b99977d..3c7b4b8a664 100644 if (type == WINED3D_SBT_RECORDED) return WINED3D_OK; diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index e65630fafc8..c5ad5bd8475 100644 +index 15657ace57f..2753de76707 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -2514,7 +2514,7 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE +@@ -2518,7 +2518,7 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE { struct wined3d_texture *dst_texture = dst_surface->container; struct wined3d_device *device = dst_texture->resource.device; @@ -837,10 +833,10 @@ index e65630fafc8..c5ad5bd8475 100644 struct wined3d_texture *src_texture; diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c -index dde75a36be5..718808861bc 100644 +index 48879bcd6a0..4b737ade91b 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c -@@ -4651,7 +4651,7 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w +@@ -4640,7 +4640,7 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w float y_offset = flip ? (center_offset - (2.0f * y) - h) / h : (center_offset - (2.0f * y) - h) / -h; @@ -849,7 +845,7 @@ index dde75a36be5..718808861bc 100644 state->render_states[WINED3D_RS_ZENABLE] : WINED3D_ZB_FALSE; float z_scale = zenable ? clip_control ? 1.0f : 2.0f : 0.0f; float z_offset = zenable ? clip_control ? 0.0f : -1.0f : 0.0f; -@@ -5450,7 +5450,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d +@@ -5439,7 +5439,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d break; } } @@ -859,10 +855,10 @@ index dde75a36be5..718808861bc 100644 || !state->render_states[WINED3D_RS_CLIPPLANEENABLE]) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index ad8a3516ac7..8fc67581cf2 100644 +index f3116d2fb33..019dc1ddf07 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -1552,6 +1552,36 @@ struct wined3d_timestamp_query +@@ -1554,6 +1554,36 @@ struct wined3d_timestamp_query void context_alloc_timestamp_query(struct wined3d_context *context, struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN; void context_free_timestamp_query(struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN; @@ -899,7 +895,7 @@ index ad8a3516ac7..8fc67581cf2 100644 struct wined3d_context { const struct wined3d_gl_info *gl_info; -@@ -1567,6 +1597,7 @@ struct wined3d_context +@@ -1569,6 +1599,7 @@ struct wined3d_context DWORD numDirtyEntries; DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */ unsigned int dirty_compute_states[STATE_COMPUTE_COUNT / (sizeof(unsigned int) * CHAR_BIT) + 1]; @@ -907,7 +903,7 @@ index ad8a3516ac7..8fc67581cf2 100644 struct wined3d_device *device; struct wined3d_swapchain *swapchain; -@@ -1680,12 +1711,6 @@ struct wined3d_context +@@ -1682,12 +1713,6 @@ struct wined3d_context GLuint dummy_arbfp_prog; }; @@ -920,7 +916,7 @@ index ad8a3516ac7..8fc67581cf2 100644 typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id); struct StateEntry -@@ -2508,7 +2533,7 @@ struct wined3d_stream_state +@@ -2511,7 +2536,7 @@ struct wined3d_stream_state struct wined3d_state { DWORD flags; @@ -929,14 +925,14 @@ index ad8a3516ac7..8fc67581cf2 100644 struct wined3d_vertex_declaration *vertex_declaration; struct wined3d_stream_output stream_output[MAX_STREAM_OUT]; -@@ -2622,7 +2647,6 @@ struct wined3d_device +@@ -2625,7 +2650,6 @@ struct wined3d_device struct wine_rb_tree samplers; /* Render Target Support */ - struct wined3d_fb_state fb; struct wined3d_rendertarget_view *auto_depth_stencil_view; - /* For rendering to a texture using glCopyTexImage */ + /* Cursor management */ @@ -3164,9 +3188,8 @@ struct wined3d_stateblock void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0033-wined3d-Delete-GL-contexts-through-the-CS-in-reset.patch b/patches/wined3d-CSMT_Main/0033-wined3d-Delete-GL-contexts-through-the-CS-in-reset.patch index 5f5f116f..0433b891 100644 --- a/patches/wined3d-CSMT_Main/0033-wined3d-Delete-GL-contexts-through-the-CS-in-reset.patch +++ b/patches/wined3d-CSMT_Main/0033-wined3d-Delete-GL-contexts-through-the-CS-in-reset.patch @@ -1,17 +1,17 @@ -From 7888d0d12d9182cf9d5801cfe3b884f3f7a2708c Mon Sep 17 00:00:00 2001 +From 6473e74391c83d4035556251a0ff2e0c6904d6be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 11 Oct 2013 10:11:13 +0200 Subject: wined3d: Delete GL contexts through the CS in reset. Let's see if this fixes the remaining fglrx crashes... --- - dlls/wined3d/cs.c | 29 ++++++++++++++++++++++++++++- + dlls/wined3d/cs.c | 27 ++++++++++++++++++++++++++- dlls/wined3d/device.c | 25 ++++++++++++++----------- - dlls/wined3d/wined3d_private.h | 4 ++++ - 3 files changed, 46 insertions(+), 12 deletions(-) + dlls/wined3d/wined3d_private.h | 2 ++ + 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index d65276072d4..1d7d6b9cd94 100644 +index 55c175ef093..cf59192bc4f 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -93,6 +93,7 @@ enum wined3d_cs_op @@ -22,20 +22,19 @@ index d65276072d4..1d7d6b9cd94 100644 WINED3D_CS_OP_STOP, }; -@@ -521,6 +522,12 @@ struct wined3d_cs_create_texture_view +@@ -521,6 +522,11 @@ struct wined3d_cs_create_texture_view const struct wined3d_format *view_format; }; +struct wined3d_cs_delete_gl_contexts +{ + enum wined3d_cs_op opcode; -+ struct wined3d_swapchain *swapchain; +}; + static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block); static void wined3d_cs_mt_submit(struct wined3d_cs *cs); -@@ -2628,6 +2635,26 @@ void wined3d_cs_emit_create_texture_view(struct wined3d_cs *cs, struct wined3d_g +@@ -2628,6 +2634,25 @@ void wined3d_cs_emit_create_texture_view(struct wined3d_cs *cs, struct wined3d_g cs->ops->submit_and_wait(cs); } @@ -43,18 +42,17 @@ index d65276072d4..1d7d6b9cd94 100644 +{ + const struct wined3d_cs_delete_gl_contexts *op = data; + -+ device_delete_opengl_contexts_cs(cs->device, op->swapchain); ++ device_delete_opengl_contexts_cs(cs->device); + + return sizeof(*op); +} + -+void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain) ++void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs) +{ + struct wined3d_cs_delete_gl_contexts *op; + + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_DELETE_GL_CONTEXTS; -+ op->swapchain = swapchain; + + cs->ops->submit_and_wait(cs); +} @@ -62,7 +60,7 @@ index d65276072d4..1d7d6b9cd94 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence, -@@ -2686,7 +2713,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2686,7 +2711,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_BUFFER_COPY */ wined3d_cs_exec_buffer_copy, /* WINED3D_CS_OP_CREATE_BUFFER_VIEW */ wined3d_cs_exec_create_buffer_view, /* WINED3D_CS_OP_CREATE_TEXTURE_VIEW */ wined3d_cs_exec_create_texture_view, @@ -72,18 +70,17 @@ index d65276072d4..1d7d6b9cd94 100644 static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 3f5fd7988d4..880e6c002ac 100644 +index adcd8dd2486..b95c7837139 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -4635,22 +4635,12 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) - } +@@ -971,21 +971,11 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi + wined3d_device_set_render_state(device, WINED3D_RS_ZENABLE, ds_enable); } --static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d_swapchain *swapchain) -+void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wined3d_swapchain *swapchain) +-static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device) ++void device_delete_opengl_contexts_cs(struct wined3d_device *device) { - struct wined3d_resource *resource, *cursor; - const struct wined3d_gl_info *gl_info; struct wined3d_context *context; struct wined3d_shader *shader; @@ -99,11 +96,11 @@ index 3f5fd7988d4..880e6c002ac 100644 LIST_FOR_EACH_ENTRY(shader, &device->shaders, struct wined3d_shader, shader_list_entry) { device->shader_backend->shader_destroy(shader); -@@ -4684,6 +4674,19 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d - swapchain->context = NULL; +@@ -1007,6 +997,19 @@ static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device) + } } -+static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d_swapchain *swapchain) ++static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device) +{ + struct wined3d_resource *resource, *cursor; + @@ -113,31 +110,29 @@ index 3f5fd7988d4..880e6c002ac 100644 + wined3d_cs_emit_unload_resource(device->cs, resource); + } + -+ wined3d_cs_emit_delete_opengl_contexts(device->cs, swapchain); ++ wined3d_cs_emit_delete_opengl_contexts(device->cs); +} + static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain) { HRESULT hr; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 454a64eb2ff..2eb5bbeca29 100644 +index dad79e97ae2..abb4ce0ec52 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2708,6 +2708,8 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state) D +@@ -2705,6 +2705,7 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state) D void device_exec_update_texture(struct wined3d_context *context, struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture) DECLSPEC_HIDDEN; void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN; -+void device_delete_opengl_contexts_cs(struct wined3d_device *device, -+ struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; ++void device_delete_opengl_contexts_cs(struct wined3d_device *device) DECLSPEC_HIDDEN; struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT size, GLenum gl_usage, GLenum type_hint, struct wined3d_context *context) DECLSPEC_HIDDEN; void wined3d_device_release_bo(struct wined3d_device *device, struct wined3d_gl_bo *bo, -@@ -3270,6 +3272,8 @@ HRESULT wined3d_cs_emit_create_buffer_view(struct wined3d_cs *cs, struct wined3d +@@ -3267,6 +3268,7 @@ HRESULT wined3d_cs_emit_create_buffer_view(struct wined3d_cs *cs, struct wined3d void wined3d_cs_emit_create_dummy_textures(struct wined3d_cs *cs) DECLSPEC_HIDDEN; HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs, -+ struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; ++void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_emit_create_texture_view(struct wined3d_cs *cs, struct wined3d_gl_view *view, GLenum view_target, const struct wined3d_view_desc *desc, struct wined3d_texture *texture, const struct wined3d_format *view_format) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0034-wined3d-Delete-GL-contexts-through-the-CS-in-uninit_.patch b/patches/wined3d-CSMT_Main/0034-wined3d-Delete-GL-contexts-through-the-CS-in-uninit_.patch deleted file mode 100644 index d55b0d93..00000000 --- a/patches/wined3d-CSMT_Main/0034-wined3d-Delete-GL-contexts-through-the-CS-in-uninit_.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 7e94bce422efd1634e69cc8b9729cf0744672e4c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Stefan=20D=C3=B6singer?= -Date: Fri, 11 Oct 2013 10:17:42 +0200 -Subject: wined3d: Delete GL contexts through the CS in uninit_3d. - ---- - dlls/wined3d/device.c | 30 +++--------------------------- - 1 file changed, 3 insertions(+), 27 deletions(-) - -diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 762ab2747c2..b990682a921 100644 ---- a/dlls/wined3d/device.c -+++ b/dlls/wined3d/device.c -@@ -1110,8 +1110,6 @@ static void device_free_sampler(struct wine_rb_entry *entry, void *context) - HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) - { - struct wined3d_resource *resource, *cursor; -- const struct wined3d_gl_info *gl_info; -- struct wined3d_context *context; - UINT i; - - TRACE("device %p.\n", device); -@@ -1122,12 +1120,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) - if (wined3d_settings.cs_multithreaded) - device->cs->ops->submit_and_wait(device->cs); - -- /* I don't think that the interface guarantees that the device is destroyed from the same thread -- * it was created. Thus make sure a context is active for the glDelete* calls -- */ -- context = context_acquire(device, NULL); -- gl_info = context->gl_info; -- - if (device->logo_texture) - wined3d_texture_decref(device->logo_texture); - if (device->cursor_texture) -@@ -1148,27 +1140,10 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) - wined3d_cs_emit_unload_resource(device->cs, resource); - } - -- if (wined3d_settings.cs_multithreaded) -- device->cs->ops->submit_and_wait(device->cs); -- - wine_rb_clear(&device->samplers, device_free_sampler, NULL); - -- /* Destroy the depth blt resources, they will be invalid after the reset. Also free shader -- * private data, it might contain opengl pointers -- */ -- if (device->depth_blt_texture) -- { -- gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->depth_blt_texture); -- device->depth_blt_texture = 0; -- } -- -- /* Destroy the shader backend. Note that this has to happen after all shaders are destroyed. */ -- device->blitter->free_private(device); -- device->shader_backend->shader_free_private(device); -- destroy_dummy_textures(device, context); -- destroy_default_samplers(device, context); -- -- context_release(context); -+ /* FIXME: Is this in the right place??? */ -+ wined3d_cs_emit_delete_opengl_contexts(device->cs, device->swapchains[0]); - - if (device->back_buffer_view) - { -@@ -4658,6 +4633,7 @@ void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wine - - HeapFree(GetProcessHeap(), 0, swapchain->context); - swapchain->context = NULL; -+ swapchain->num_contexts = 0; - } - - static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d_swapchain *swapchain) --- -2.11.0 - diff --git a/patches/wined3d-CSMT_Main/0038-wined3d-Map-vertex-buffers-through-cs.patch b/patches/wined3d-CSMT_Main/0038-wined3d-Map-vertex-buffers-through-cs.patch index 5fe79a3f..66b92c3f 100644 --- a/patches/wined3d-CSMT_Main/0038-wined3d-Map-vertex-buffers-through-cs.patch +++ b/patches/wined3d-CSMT_Main/0038-wined3d-Map-vertex-buffers-through-cs.patch @@ -1,4 +1,4 @@ -From 0c368a9fa4e1417a0f5114769fa0b9f44d35ebde Mon Sep 17 00:00:00 2001 +From 4f06f7af54f1be5fee2c40c9a8d79d6f3d393a4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Tue, 7 Feb 2017 22:37:58 +0100 Subject: wined3d: Map vertex buffers through cs. @@ -10,7 +10,7 @@ Subject: wined3d: Map vertex buffers through cs. 3 files changed, 76 insertions(+), 44 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 42779efe69d..42ce9bafb80 100644 +index c71019b06bf..bd1ea2594b6 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -94,6 +94,7 @@ enum wined3d_cs_op @@ -21,8 +21,8 @@ index 42779efe69d..42ce9bafb80 100644 WINED3D_CS_OP_STOP, }; -@@ -528,6 +529,13 @@ struct wined3d_cs_delete_gl_contexts - struct wined3d_swapchain *swapchain; +@@ -527,6 +528,13 @@ struct wined3d_cs_delete_gl_contexts + enum wined3d_cs_op opcode; }; +struct wined3d_cs_map_vertex_buffers @@ -35,7 +35,7 @@ index 42779efe69d..42ce9bafb80 100644 static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block); static void wined3d_cs_mt_submit(struct wined3d_cs *cs); -@@ -2655,6 +2663,70 @@ void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs, struct wined3 +@@ -2653,6 +2661,70 @@ void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs) cs->ops->submit_and_wait(cs); } @@ -50,7 +50,7 @@ index 42779efe69d..42ce9bafb80 100644 + WORD map; + + /* Need any context to write to the vbo. */ -+ context = context_acquire(cs->device, NULL); ++ context = context_acquire(cs->device, NULL, 0); + gl_info = context->gl_info; + + vs = state->shader[WINED3D_SHADER_TYPE_VERTEX]; @@ -106,7 +106,7 @@ index 42779efe69d..42ce9bafb80 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence, -@@ -2714,6 +2786,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2712,6 +2784,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_CREATE_BUFFER_VIEW */ wined3d_cs_exec_create_buffer_view, /* WINED3D_CS_OP_CREATE_TEXTURE_VIEW */ wined3d_cs_exec_create_texture_view, /* WINED3D_CS_OP_DELETE_GL_CONTEXTS */ wined3d_cs_exec_delete_gl_contexts, @@ -115,10 +115,10 @@ index 42779efe69d..42ce9bafb80 100644 static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index ccfaa7f19e6..369fc47c097 100644 +index 9752912b1b0..5ef2886df06 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -2851,7 +2851,6 @@ void CDECL wined3d_device_set_unordered_access_view(struct wined3d_device *devic +@@ -2916,7 +2916,6 @@ void CDECL wined3d_device_set_unordered_access_view(struct wined3d_device *devic wined3d_device_set_pipeline_unordered_access_view(device, WINED3D_PIPELINE_GRAPHICS, idx, uav); } @@ -126,7 +126,7 @@ index ccfaa7f19e6..369fc47c097 100644 #define copy_and_next(dest, src, size) memcpy(dest, src, size); dest += (size) static HRESULT process_vertices_strided(const struct wined3d_device *device, DWORD dwDestIndex, DWORD dwCount, const struct wined3d_stream_info *stream_info, struct wined3d_buffer *dest, DWORD flags, -@@ -3127,14 +3126,8 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, +@@ -3192,14 +3191,8 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, UINT src_start_idx, UINT dst_idx, UINT vertex_count, struct wined3d_buffer *dst_buffer, const struct wined3d_vertex_declaration *declaration, DWORD flags, DWORD dst_fvf) { @@ -141,12 +141,12 @@ index ccfaa7f19e6..369fc47c097 100644 TRACE("device %p, src_start_idx %u, dst_idx %u, vertex_count %u, " "dst_buffer %p, declaration %p, flags %#x, dst_fvf %#x.\n", -@@ -3144,47 +3137,11 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, +@@ -3209,47 +3202,11 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, if (declaration) FIXME("Output vertex declaration not implemented yet.\n"); - /* Need any context to write to the vbo. */ -- context = context_acquire(device, NULL); +- context = context_acquire(device, NULL, 0); - gl_info = context->gl_info; - - vs = state->shader[WINED3D_SHADER_TYPE_VERTEX]; @@ -191,10 +191,10 @@ index ccfaa7f19e6..369fc47c097 100644 } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index c1200b127c5..a6a3eca0da2 100644 +index 6d8495f1993..aa54fc3a3e6 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3359,6 +3359,8 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, +@@ -3354,6 +3354,8 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags) DECLSPEC_HIDDEN; HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0040-wined3d-Introduce-a-separate-priority-queue.patch b/patches/wined3d-CSMT_Main/0040-wined3d-Introduce-a-separate-priority-queue.patch index 7ea1e995..5f46fa63 100644 --- a/patches/wined3d-CSMT_Main/0040-wined3d-Introduce-a-separate-priority-queue.patch +++ b/patches/wined3d-CSMT_Main/0040-wined3d-Introduce-a-separate-priority-queue.patch @@ -1,4 +1,4 @@ -From b9a43f545bf226e61be143012930f623b2d35140 Mon Sep 17 00:00:00 2001 +From 8082e2c1c4e3f605716f8b1b124e224b321f03e4 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 8 Feb 2017 00:12:31 +0100 Subject: wined3d: Introduce a separate priority queue. @@ -9,10 +9,10 @@ Subject: wined3d: Introduce a separate priority queue. 2 files changed, 79 insertions(+), 68 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index a94bc4a0f42..ca2aa81c276 100644 +index 42f57a1b91a..9ba97650a15 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -566,14 +566,16 @@ static struct wined3d_cs_block *wined3d_cs_list_dequeue(struct wined3d_cs_list * +@@ -565,14 +565,16 @@ static struct wined3d_cs_block *wined3d_cs_list_dequeue(struct wined3d_cs_list * return LIST_ENTRY(head, struct wined3d_cs_block, entry); } @@ -31,7 +31,7 @@ index a94bc4a0f42..ca2aa81c276 100644 return block; } } -@@ -594,7 +596,7 @@ static void wined3d_cs_set_thread_block(const struct wined3d_cs *cs, struct wine +@@ -593,7 +595,7 @@ static void wined3d_cs_set_thread_block(const struct wined3d_cs *cs, struct wine ERR("Failed to set thread block.\n"); } @@ -40,7 +40,7 @@ index a94bc4a0f42..ca2aa81c276 100644 { struct wined3d_cs_block *block; -@@ -608,6 +610,7 @@ static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs) +@@ -607,6 +609,7 @@ static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs) } block->pos = 0; @@ -48,7 +48,7 @@ index a94bc4a0f42..ca2aa81c276 100644 return block; } -@@ -627,7 +630,7 @@ static void wined3d_cs_emit_fence(struct wined3d_cs *cs, BOOL *signalled) +@@ -626,7 +629,7 @@ static void wined3d_cs_emit_fence(struct wined3d_cs *cs, BOOL *signalled) *signalled = FALSE; @@ -57,7 +57,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_FENCE; op->signalled = signalled; } -@@ -662,7 +665,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -661,7 +664,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw unsigned int i; LONG pending; @@ -66,7 +66,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_PRESENT; op->dst_window_override = dst_window_override; op->swapchain = swapchain; -@@ -729,7 +732,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -728,7 +731,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * struct wined3d_cs_clear *op; unsigned int i; @@ -75,7 +75,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_CLEAR; op->flags = flags; op->color = *color; -@@ -879,7 +882,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, +@@ -878,7 +881,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, const struct wined3d_state *state = &cs->device->state; struct wined3d_cs_dispatch *op; @@ -84,7 +84,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_DISPATCH; op->group_count_x = group_count_x; op->group_count_y = group_count_y; -@@ -941,7 +944,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -940,7 +943,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i struct wined3d_cs_draw *op; unsigned int i; @@ -93,7 +93,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_DRAW; op->base_vertex_idx = base_vertex_idx; op->start_idx = start_idx; -@@ -990,7 +993,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query +@@ -989,7 +992,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query { struct wined3d_cs_set_predication *op; @@ -102,7 +102,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_PREDICATION; op->predicate = predicate; op->value = value; -@@ -1012,7 +1015,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi +@@ -1011,7 +1014,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi { struct wined3d_cs_set_viewport *op; @@ -111,7 +111,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_VIEWPORT; op->viewport = *viewport; -@@ -1033,7 +1036,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) +@@ -1032,7 +1035,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) { struct wined3d_cs_set_scissor_rect *op; @@ -120,7 +120,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT; op->rect = *rect; -@@ -1055,7 +1058,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v +@@ -1054,7 +1057,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v { struct wined3d_cs_set_rendertarget_view *op; @@ -129,7 +129,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_RENDERTARGET_VIEW; op->view_idx = view_idx; op->view = view; -@@ -1106,7 +1109,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 +@@ -1105,7 +1108,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 { struct wined3d_cs_set_depth_stencil_view *op; @@ -138,7 +138,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW; op->view = view; -@@ -1127,7 +1130,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 +@@ -1126,7 +1129,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 { struct wined3d_cs_set_vertex_declaration *op; @@ -147,7 +147,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION; op->declaration = declaration; -@@ -1161,7 +1164,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -1160,7 +1163,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, { struct wined3d_cs_set_stream_source *op; @@ -156,7 +156,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_STREAM_SOURCE; op->stream_idx = stream_idx; op->buffer = buffer; -@@ -1189,7 +1192,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i +@@ -1188,7 +1191,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i { struct wined3d_cs_set_stream_source_freq *op; @@ -165,7 +165,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_STREAM_SOURCE_FREQ; op->stream_idx = stream_idx; op->frequency = frequency; -@@ -1222,7 +1225,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -1221,7 +1224,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, { struct wined3d_cs_set_stream_output *op; @@ -174,7 +174,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_STREAM_OUTPUT; op->stream_idx = stream_idx; op->buffer = buffer; -@@ -1256,7 +1259,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff +@@ -1255,7 +1258,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff { struct wined3d_cs_set_index_buffer *op; @@ -183,7 +183,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_INDEX_BUFFER; op->buffer = buffer; op->format_id = format_id; -@@ -1287,7 +1290,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha +@@ -1286,7 +1289,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha { struct wined3d_cs_set_constant_buffer *op; @@ -192,7 +192,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_CONSTANT_BUFFER; op->type = type; op->cb_idx = cb_idx; -@@ -1381,7 +1384,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -1380,7 +1383,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined { struct wined3d_cs_set_texture *op; @@ -201,7 +201,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_TEXTURE; op->stage = stage; op->texture = texture; -@@ -1413,7 +1416,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 +@@ -1412,7 +1415,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 { struct wined3d_cs_set_shader_resource_view *op; @@ -210,7 +210,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_SHADER_RESOURCE_VIEW; op->type = type; op->view_idx = view_idx; -@@ -1445,7 +1448,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined +@@ -1444,7 +1447,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined { struct wined3d_cs_set_unordered_access_view *op; @@ -219,7 +219,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_UNORDERED_ACCESS_VIEW; op->pipeline = pipeline; op->view_idx = view_idx; -@@ -1469,7 +1472,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1468,7 +1471,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type { struct wined3d_cs_set_sampler *op; @@ -228,7 +228,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_SAMPLER; op->type = type; op->sampler_idx = sampler_idx; -@@ -1494,7 +1497,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1493,7 +1496,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type { struct wined3d_cs_set_shader *op; @@ -237,7 +237,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_SHADER; op->type = type; op->shader = shader; -@@ -1517,7 +1520,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, +@@ -1516,7 +1519,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, { struct wined3d_cs_set_rasterizer_state *op; @@ -246,7 +246,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_RASTERIZER_STATE; op->state = rasterizer_state; -@@ -1538,7 +1541,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render +@@ -1537,7 +1540,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render { struct wined3d_cs_set_render_state *op; @@ -255,7 +255,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_RENDER_STATE; op->state = state; op->value = value; -@@ -1561,7 +1564,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, +@@ -1560,7 +1563,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, { struct wined3d_cs_set_texture_state *op; @@ -264,7 +264,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_TEXTURE_STATE; op->stage = stage; op->state = state; -@@ -1585,7 +1588,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, +@@ -1584,7 +1587,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, { struct wined3d_cs_set_sampler_state *op; @@ -273,7 +273,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_SAMPLER_STATE; op->sampler_idx = sampler_idx; op->state = state; -@@ -1610,7 +1613,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -1609,7 +1612,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform { struct wined3d_cs_set_transform *op; @@ -282,7 +282,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_TRANSFORM; op->state = state; op->matrix = *matrix; -@@ -1632,7 +1635,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const +@@ -1631,7 +1634,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const { struct wined3d_cs_set_clip_plane *op; @@ -291,7 +291,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_CLIP_PLANE; op->plane_idx = plane_idx; op->plane = *plane; -@@ -1710,7 +1713,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -1709,7 +1712,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture { struct wined3d_cs_set_color_key *op; @@ -300,7 +300,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_COLOR_KEY; op->texture = texture; op->flags = flags; -@@ -1739,7 +1742,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1738,7 +1741,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma { struct wined3d_cs_set_material *op; @@ -309,7 +309,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_MATERIAL; op->material = *material; -@@ -1764,7 +1767,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1763,7 +1766,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) { struct wined3d_cs_reset_state *op; @@ -318,7 +318,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_RESET_STATE; cs->ops->submit(cs); -@@ -1783,7 +1786,7 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void +@@ -1782,7 +1785,7 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void { struct wined3d_cs_destroy_object *op; @@ -327,7 +327,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_DESTROY_OBJECT; op->callback = callback; op->object = object; -@@ -1805,7 +1808,7 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu +@@ -1804,7 +1807,7 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu { struct wined3d_cs_query_issue *op; @@ -336,7 +336,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_QUERY_ISSUE; op->query = query; op->flags = flags; -@@ -1828,7 +1831,7 @@ BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *que +@@ -1827,7 +1830,7 @@ BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *que struct wined3d_cs_query_poll *op; BOOL ret; @@ -345,7 +345,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_QUERY_POLL; op->query = query; op->flags = flags; -@@ -1854,7 +1857,7 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso +@@ -1853,7 +1856,7 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso { struct wined3d_cs_preload_resource *op; @@ -354,7 +354,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_PRELOAD_RESOURCE; op->resource = resource; -@@ -1878,7 +1881,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou +@@ -1877,7 +1880,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou { struct wined3d_cs_unload_resource *op; @@ -363,7 +363,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_UNLOAD_RESOURCE; op->resource = resource; -@@ -1904,7 +1907,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, +@@ -1903,7 +1906,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, struct wined3d_cs_map *op; HRESULT hr; @@ -372,7 +372,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_MAP; op->resource = resource; op->sub_resource_idx = sub_resource_idx; -@@ -1933,7 +1936,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc +@@ -1932,7 +1935,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc struct wined3d_cs_unmap *op; HRESULT hr; @@ -381,7 +381,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_UNMAP; op->resource = resource; op->sub_resource_idx = sub_resource_idx; -@@ -1959,7 +1962,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) +@@ -1958,7 +1961,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) { struct wined3d_cs_finish *op; @@ -390,7 +390,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_GLFINISH; cs->ops->submit(cs); -@@ -2016,7 +2019,7 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con +@@ -2015,7 +2018,7 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con { struct wined3d_cs_push_constants *op; @@ -399,7 +399,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_PUSH_CONSTANTS; op->p = p; op->start_idx = start_idx; -@@ -2045,7 +2048,7 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_ +@@ -2044,7 +2047,7 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_ { struct wined3d_cs_set_primitive_type *op; @@ -408,7 +408,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_PRIMITIVE_TYPE; op->gl_primitive_type = primitive_type; -@@ -2105,7 +2108,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light +@@ -2104,7 +2107,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light { struct wined3d_cs_set_light *op; @@ -417,7 +417,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_LIGHT; op->light = *light; -@@ -2194,7 +2197,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab +@@ -2193,7 +2196,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab { struct wined3d_cs_set_light_enable *op; @@ -426,7 +426,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SET_LIGHT_ENABLE; op->idx = idx; op->enable = enable; -@@ -2224,7 +2227,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf +@@ -2223,7 +2226,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf { struct wined3d_cs_blt *op; @@ -435,7 +435,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_BLT; op->dst_surface = dst_surface; op->dst_rect = *dst_rect; -@@ -2263,7 +2266,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge +@@ -2262,7 +2265,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge { struct wined3d_cs_clear_rtv *op; @@ -444,7 +444,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_CLEAR_RTV; op->view = view; op->rect = *rect; -@@ -2299,7 +2302,7 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur +@@ -2298,7 +2301,7 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur { struct wined3d_cs_update_texture *op; @@ -453,7 +453,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_UPDATE_TEXTURE; op->src = src; op->dst = dst; -@@ -2365,7 +2368,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r +@@ -2364,7 +2367,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r { struct wined3d_cs_update_sub_resource *op; @@ -462,7 +462,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE; op->resource = resource; op->sub_resource_idx = sub_resource_idx; -@@ -2394,7 +2397,7 @@ HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *te +@@ -2393,7 +2396,7 @@ HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *te struct wined3d_cs_get_release_dc *op; HRESULT hr; @@ -471,7 +471,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_GET_DC; op->texture = texture; op->sub_resource_idx = sub_resource_idx; -@@ -2420,7 +2423,7 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture +@@ -2419,7 +2422,7 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture struct wined3d_cs_get_release_dc *op; HRESULT hr; @@ -480,7 +480,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_RELEASE_DC; op->texture = texture; op->sub_resource_idx = sub_resource_idx; -@@ -2446,7 +2449,7 @@ void wined3d_cs_emit_create_dummy_textures(struct wined3d_cs *cs) +@@ -2445,7 +2448,7 @@ void wined3d_cs_emit_create_dummy_textures(struct wined3d_cs *cs) { struct wined3d_cs_create_dummy_textures *op; @@ -489,7 +489,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_CREATE_DUMMY_TEXTURES; cs->ops->submit_and_wait(cs); -@@ -2466,7 +2469,7 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, struct w +@@ -2465,7 +2468,7 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, struct w struct wined3d_cs_create_swapchain_context *op; HRESULT hr; @@ -498,7 +498,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT; op->swapchain = swapchain; op->hr = &hr; -@@ -2489,7 +2492,7 @@ void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_ +@@ -2488,7 +2491,7 @@ void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_ { struct wined3d_cs_update_swap_interval *op; @@ -507,7 +507,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_UPDATE_SWAP_INTERVAL; op->swapchain = swapchain; -@@ -2509,7 +2512,7 @@ void wined3d_cs_emit_sampler_init(struct wined3d_cs *cs, struct wined3d_sampler +@@ -2508,7 +2511,7 @@ void wined3d_cs_emit_sampler_init(struct wined3d_cs *cs, struct wined3d_sampler { struct wined3d_cs_sampler_init *op; @@ -516,7 +516,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_SAMPLER_INIT; op->sampler = sampler; -@@ -2547,7 +2550,7 @@ void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs, +@@ -2546,7 +2549,7 @@ void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs, if (dirty_region) WARN("Ignoring dirty_region %s.\n", debug_box(dirty_region)); @@ -525,7 +525,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION; op->texture = texture; op->sub_resource_idx = sub_resource_idx; -@@ -2577,7 +2580,7 @@ void wined3d_cs_emit_buffer_copy(struct wined3d_cs *cs, struct wined3d_buffer *d +@@ -2576,7 +2579,7 @@ void wined3d_cs_emit_buffer_copy(struct wined3d_cs *cs, struct wined3d_buffer *d { struct wined3d_cs_buffer_copy *op; @@ -534,7 +534,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_BUFFER_COPY; op->dst_buffer = dst_buffer; op->dst_offset = dst_offset; -@@ -2607,7 +2610,7 @@ HRESULT wined3d_cs_emit_create_buffer_view(struct wined3d_cs *cs, struct wined3d +@@ -2606,7 +2609,7 @@ HRESULT wined3d_cs_emit_create_buffer_view(struct wined3d_cs *cs, struct wined3d struct wined3d_cs_create_buffer_view *op; HRESULT hr; @@ -543,7 +543,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_CREATE_BUFFER_VIEW; op->view = view; op->desc = desc; -@@ -2635,7 +2638,7 @@ void wined3d_cs_emit_create_texture_view(struct wined3d_cs *cs, struct wined3d_g +@@ -2634,7 +2637,7 @@ void wined3d_cs_emit_create_texture_view(struct wined3d_cs *cs, struct wined3d_g { struct wined3d_cs_create_texture_view *op; @@ -552,16 +552,16 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_CREATE_TEXTURE_VIEW; op->view = view; op->view_target = view_target; -@@ -2659,7 +2662,7 @@ void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs, struct wined3 +@@ -2658,7 +2661,7 @@ void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs) { struct wined3d_cs_delete_gl_contexts *op; - op = cs->ops->require_space(cs, sizeof(*op)); + op = cs->ops->require_space(cs, sizeof(*op), 0); op->opcode = WINED3D_CS_OP_DELETE_GL_CONTEXTS; - op->swapchain = swapchain; -@@ -2722,7 +2725,7 @@ void wined3d_cs_emit_map_vertex_buffers(struct wined3d_cs *cs, UINT src_start_id + cs->ops->submit_and_wait(cs); +@@ -2720,7 +2723,7 @@ void wined3d_cs_emit_map_vertex_buffers(struct wined3d_cs *cs, UINT src_start_id { struct wined3d_cs_map_vertex_buffers *op; @@ -570,7 +570,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_MAP_vertex_buffers; op->src_start_idx = src_start_idx; op->stream_info = stream_info; -@@ -2792,7 +2795,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2790,7 +2793,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_MAP_vertex_buffers */ wined3d_cs_exec_map_vertex_buffers, }; @@ -579,7 +579,7 @@ index a94bc4a0f42..ca2aa81c276 100644 { if (size > cs->data_size) { -@@ -2823,9 +2826,10 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops = +@@ -2821,9 +2824,10 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops = wined3d_cs_st_submit, }; @@ -591,7 +591,7 @@ index a94bc4a0f42..ca2aa81c276 100644 void *data; assert(size <= sizeof(block->data)); -@@ -2833,8 +2837,11 @@ static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size) +@@ -2831,8 +2835,11 @@ static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size) if (!block || block->pos + size > sizeof(block->data)) { if (block) @@ -604,7 +604,7 @@ index a94bc4a0f42..ca2aa81c276 100644 wined3d_cs_set_thread_block(cs, block); } -@@ -2852,7 +2859,7 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs) +@@ -2850,7 +2857,7 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs) if (cs->thread_id == GetCurrentThreadId()) wined3d_cs_process_block(cs, block); else @@ -613,7 +613,7 @@ index a94bc4a0f42..ca2aa81c276 100644 } static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs) -@@ -2882,7 +2889,7 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs) +@@ -2880,7 +2887,7 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs) assert(cs->thread_id != GetCurrentThreadId()); @@ -622,7 +622,7 @@ index a94bc4a0f42..ca2aa81c276 100644 op->opcode = WINED3D_CS_OP_STOP; wined3d_cs_mt_submit(cs); -@@ -2918,7 +2925,7 @@ static DWORD WINAPI wined3d_cs_run(void *thread_param) +@@ -2916,7 +2923,7 @@ static DWORD WINAPI wined3d_cs_run(void *thread_param) for (;;) { struct wined3d_cs_block *block; @@ -631,7 +631,7 @@ index a94bc4a0f42..ca2aa81c276 100644 if (!wined3d_cs_process_block(cs, block)) break; } -@@ -2962,6 +2969,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -2960,6 +2967,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) wined3d_cs_list_init(&cs->free_list); wined3d_cs_list_init(&cs->exec_list); @@ -639,7 +639,7 @@ index a94bc4a0f42..ca2aa81c276 100644 if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, &cs->thread_id))) { -@@ -2997,6 +3005,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) +@@ -2995,6 +3003,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) /* FIXME: Cleanup the block lists on thread exit. */ #if 0 @@ -648,10 +648,10 @@ index a94bc4a0f42..ca2aa81c276 100644 wined3d_cs_list_cleanup(&cs->free_list); #endif diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index f12d64474ea..751fd61de05 100644 +index 831375b1efd..2d888a51f61 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3218,12 +3218,13 @@ struct wined3d_cs_block +@@ -3214,12 +3214,13 @@ struct wined3d_cs_block { struct list entry; UINT pos; @@ -666,7 +666,7 @@ index f12d64474ea..751fd61de05 100644 void (*submit)(struct wined3d_cs *cs); void (*submit_and_wait)(struct wined3d_cs *cs); }; -@@ -3241,6 +3242,7 @@ struct wined3d_cs +@@ -3237,6 +3238,7 @@ struct wined3d_cs struct wined3d_cs_list free_list; struct wined3d_cs_list exec_list; diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index 560c4c73..7a756721 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -21,7 +21,7 @@ diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c ok(compare_color(color, test_data[i].expected, 1), "Got unexpected color 0x%08x for index %d.\n", color, test_data[i].index); } -@@ -9928,6 +9931,9 @@ static void test_line_antialiasing_blending(void) +@@ -9927,6 +9930,9 @@ static void test_line_antialiasing_blending(void) ID3D10Device_ClearRenderTargetView(device, test_context.backbuffer_rtv, &green.x); draw_color_quad(&test_context, &red); @@ -34,7 +34,7 @@ diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c -@@ -9092,6 +9092,9 @@ float4 main(const ps_in v) : SV_TARGET +@@ -9130,6 +9130,9 @@ float4 main(const ps_in v) : SV_TARGET ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)index_cb, 0, NULL, &index, 0, 0); draw_quad(&test_context); @@ -44,7 +44,7 @@ diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c check_texture_color(test_context.backbuffer, test_data[i].expected, 1); } -@@ -11345,6 +11348,9 @@ static void test_line_antialiasing_blending(void) +@@ -11381,6 +11384,9 @@ static void test_line_antialiasing_blending(void) ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, &green.x); draw_color_quad(&test_context, &red); @@ -114,7 +114,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c if (!--context->level) { if (context_restore_pixel_format(context)) -@@ -1719,6 +1727,13 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, +@@ -1720,6 +1728,13 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, goto out; } @@ -128,7 +128,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c /* Initialize the texture unit mapping to a 1:1 mapping */ for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s) { -@@ -2027,6 +2042,9 @@ out: +@@ -2028,6 +2043,9 @@ out: if (hdc) wined3d_release_dc(swapchain->win_handle, hdc); device->shader_backend->shader_free_context_data(ret); device->adapter->fragment_pipe->free_context_data(ret); @@ -138,7 +138,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c HeapFree(GetProcessHeap(), 0, ret->free_event_queries); HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries); HeapFree(GetProcessHeap(), 0, ret->free_timestamp_queries); -@@ -2074,6 +2092,9 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont +@@ -2075,6 +2093,9 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont device->shader_backend->shader_free_context_data(context); device->adapter->fragment_pipe->free_context_data(context); HeapFree(GetProcessHeap(), 0, context->fbo_key); @@ -148,7 +148,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c HeapFree(GetProcessHeap(), 0, context->draw_buffers); HeapFree(GetProcessHeap(), 0, context->blit_targets); device_context_remove(device, context); -@@ -2627,7 +2648,11 @@ static BOOL context_validate_rt_config(UINT rt_count, struct wined3d_rendertarge +@@ -2628,7 +2649,11 @@ static BOOL context_validate_rt_config(UINT rt_count, struct wined3d_rendertarge } /* Context activation is done by the caller. */ @@ -160,7 +160,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c UINT rt_count, const struct wined3d_fb_state *fb) { struct wined3d_rendertarget_view **rts = fb->render_targets; -@@ -2636,7 +2661,11 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2637,7 +2662,11 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win DWORD rt_mask = 0, *cur_mask; UINT i; @@ -172,7 +172,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c || rt_count != gl_info->limits.buffers) { if (!context_validate_rt_config(rt_count, rts, dsv)) -@@ -2681,6 +2710,10 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2682,6 +2711,10 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win rt_mask = context_generate_rt_mask_no_fbo(context, rt_count ? wined3d_rendertarget_view_get_surface(rts[0])->container : NULL); } @@ -183,7 +183,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO && (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource))) -@@ -2720,7 +2753,12 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2721,7 +2754,12 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win gl_info->gl_ops.gl.p_glEnable(GL_SCISSOR_TEST); if (rt_count && gl_info->supported[ARB_FRAMEBUFFER_SRGB]) { @@ -196,7 +196,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB); else gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB); -@@ -2737,7 +2775,11 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2738,7 +2776,11 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const struct wined3d_state *state) { @@ -208,7 +208,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c struct wined3d_shader *ps = state->shader[WINED3D_SHADER_TYPE_PIXEL]; DWORD rt_mask, rt_mask_bits; unsigned int i; -@@ -2767,7 +2809,11 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const +@@ -2768,7 +2810,11 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const void context_state_fb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { DWORD rt_mask = find_draw_buffers_mask(context, state); @@ -220,7 +220,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c DWORD *cur_mask; if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) -@@ -3056,6 +3102,10 @@ void context_state_drawbuf(struct wined3d_context *context, const struct wined3d +@@ -3057,6 +3103,10 @@ void context_state_drawbuf(struct wined3d_context *context, const struct wined3d context_apply_draw_buffers(context, rt_mask); *cur_mask = rt_mask; } @@ -231,7 +231,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } static BOOL fixed_get_input(BYTE usage, BYTE usage_idx, unsigned int *regnum) -@@ -3500,7 +3550,11 @@ BOOL context_apply_draw_state(struct wined3d_context *context, +@@ -3501,7 +3551,11 @@ BOOL context_apply_draw_state(struct wined3d_context *context, const struct wined3d_device *device, const struct wined3d_state *state) { const struct StateEntry *state_table = context->state_table; @@ -243,9 +243,9 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c unsigned int i; WORD map; -@@ -3702,6 +3756,15 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str +@@ -3702,6 +3756,15 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, - TRACE("device %p, target %p.\n", device, target); + TRACE("device %p, texture %p, sub_resource_idx %u.\n", device, texture, sub_resource_idx); +#if defined(STAGING_CSMT) + if (wined3d_settings.cs_multithreaded && device->cs->thread_id != GetCurrentThreadId()) @@ -337,7 +337,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c struct wined3d_cs_preload_resource { enum wined3d_cs_op opcode; -@@ -328,7 +371,307 @@ struct wined3d_cs_unmap +@@ -328,7 +371,306 @@ struct wined3d_cs_unmap HRESULT *hr; }; @@ -498,7 +498,6 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c +struct wined3d_cs_delete_gl_contexts +{ + enum wined3d_cs_op opcode; -+ struct wined3d_swapchain *swapchain; +}; + +struct wined3d_cs_map_vertex_buffers @@ -645,7 +644,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_present *op = data; struct wined3d_swapchain *swapchain; -@@ -337,13 +680,24 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) +@@ -337,13 +679,24 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) swapchain = op->swapchain; wined3d_swapchain_set_window(swapchain, op->dst_window_override); @@ -670,7 +669,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, -@@ -351,8 +705,14 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -351,8 +704,14 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw { struct wined3d_cs_present *op; unsigned int i; @@ -685,7 +684,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_PRESENT; op->dst_window_override = dst_window_override; op->swapchain = swapchain; -@@ -366,34 +726,75 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -366,34 +725,75 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw wined3d_resource_acquire(&swapchain->back_buffers[i]->resource); } @@ -761,7 +760,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, -@@ -403,7 +804,11 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -403,7 +803,11 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * struct wined3d_cs_clear *op; unsigned int i; @@ -773,7 +772,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_CLEAR; op->flags = flags; op->color = *color; -@@ -416,12 +821,21 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -416,12 +820,21 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * { for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -795,7 +794,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs); } -@@ -532,9 +946,15 @@ static void release_unordered_access_resources(const struct wined3d_shader *shad +@@ -532,9 +945,15 @@ static void release_unordered_access_resources(const struct wined3d_shader *shad } } @@ -811,7 +810,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c const struct wined3d_cs_dispatch *op = data; dispatch_compute(cs->device, state, -@@ -543,6 +963,10 @@ static void wined3d_cs_exec_dispatch(struct wined3d_cs *cs, const void *data) +@@ -543,6 +962,10 @@ static void wined3d_cs_exec_dispatch(struct wined3d_cs *cs, const void *data) release_shader_resources(state, 1u << WINED3D_SHADER_TYPE_COMPUTE); release_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_COMPUTE], state->unordered_access_view[WINED3D_PIPELINE_COMPUTE]); @@ -822,7 +821,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, -@@ -551,7 +975,11 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, +@@ -551,7 +974,11 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, const struct wined3d_state *state = &cs->device->state; struct wined3d_cs_dispatch *op; @@ -834,7 +833,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_DISPATCH; op->group_count_x = group_count_x; op->group_count_y = group_count_y; -@@ -564,9 +992,15 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, +@@ -564,9 +991,15 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, cs->ops->submit(cs); } @@ -850,7 +849,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c const struct wined3d_cs_draw *op = data; unsigned int i; -@@ -594,14 +1028,26 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -594,14 +1027,26 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) } for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -877,7 +876,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx, -@@ -611,7 +1057,11 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -611,7 +1056,11 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i struct wined3d_cs_draw *op; unsigned int i; @@ -889,7 +888,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_DRAW; op->base_vertex_idx = base_vertex_idx; op->start_idx = start_idx; -@@ -634,11 +1084,19 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -634,11 +1083,19 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i } for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -909,7 +908,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c acquire_shader_resources(state, ~(1u << WINED3D_SHADER_TYPE_COMPUTE)); acquire_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_PIXEL], state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]); -@@ -646,38 +1104,61 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -646,38 +1103,61 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i cs->ops->submit(cs); } @@ -971,7 +970,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_SET_VIEWPORT; op->viewport = *viewport; -@@ -686,17 +1167,30 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi +@@ -686,17 +1166,30 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi } static void wined3d_cs_exec_set_scissor_rect(struct wined3d_cs *cs, const void *data) @@ -1002,7 +1001,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT; op->rect = *rect; -@@ -705,11 +1199,26 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) +@@ -705,11 +1198,26 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) } static void wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const void *data) @@ -1029,7 +1028,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx, -@@ -717,21 +1226,35 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v +@@ -717,21 +1225,35 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v { struct wined3d_cs_set_rendertarget_view *op; @@ -1065,7 +1064,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { struct wined3d_surface *prev_surface = wined3d_rendertarget_view_get_surface(prev); -@@ -743,7 +1266,11 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -743,7 +1265,11 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const } } @@ -1077,7 +1076,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (!prev != !op->view) { -@@ -760,12 +1287,17 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -760,12 +1286,17 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const } device_invalidate_state(device, STATE_FRAMEBUFFER); @@ -1095,7 +1094,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW; op->view = view; -@@ -774,17 +1306,30 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 +@@ -774,17 +1305,30 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 } static void wined3d_cs_exec_set_vertex_declaration(struct wined3d_cs *cs, const void *data) @@ -1126,7 +1125,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION; op->declaration = declaration; -@@ -793,6 +1338,14 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 +@@ -793,6 +1337,14 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 } static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void *data) @@ -1141,7 +1140,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_stream_source *op = data; struct wined3d_stream_state *stream; -@@ -810,6 +1363,10 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void +@@ -810,6 +1362,10 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -1152,7 +1151,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, -@@ -817,17 +1374,27 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -817,17 +1373,27 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, { struct wined3d_cs_set_stream_source *op; @@ -1180,7 +1179,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_stream_source_freq *op = data; struct wined3d_stream_state *stream; -@@ -837,22 +1404,36 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const +@@ -837,22 +1403,36 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const stream->flags = op->flags; device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -1217,7 +1216,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_stream_output *op = data; struct wined3d_stream_output *stream; -@@ -867,6 +1448,10 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void +@@ -867,6 +1447,10 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void InterlockedIncrement(&op->buffer->resource.bind_count); if (prev) InterlockedDecrement(&prev->resource.bind_count); @@ -1228,7 +1227,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, -@@ -874,16 +1459,26 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -874,16 +1458,26 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, { struct wined3d_cs_set_stream_output *op; @@ -1255,7 +1254,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_index_buffer *op = data; struct wined3d_buffer *prev; -@@ -899,6 +1494,10 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * +@@ -899,6 +1493,10 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_INDEXBUFFER); @@ -1266,7 +1265,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, -@@ -906,16 +1505,26 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff +@@ -906,16 +1504,26 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff { struct wined3d_cs_set_index_buffer *op; @@ -1293,7 +1292,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_constant_buffer *op = data; struct wined3d_buffer *prev; -@@ -929,6 +1538,9 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi +@@ -929,6 +1537,9 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type)); @@ -1303,7 +1302,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -936,16 +1548,26 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha +@@ -936,16 +1547,26 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha { struct wined3d_cs_set_constant_buffer *op; @@ -1330,7 +1329,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info; const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info; -@@ -1022,21 +1644,35 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) +@@ -1022,21 +1643,35 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) if (new_use_color_key) device_invalidate_state(cs->device, STATE_COLOR_KEY); @@ -1366,7 +1365,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_shader_resource_view *op = data; struct wined3d_shader_resource_view *prev; -@@ -1051,6 +1687,10 @@ static void wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, cons +@@ -1051,6 +1686,10 @@ static void wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, cons if (op->type != WINED3D_SHADER_TYPE_COMPUTE) device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); @@ -1377,7 +1376,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -1058,16 +1698,26 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 +@@ -1058,16 +1697,26 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 { struct wined3d_cs_set_shader_resource_view *op; @@ -1404,7 +1403,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_unordered_access_view *op = data; struct wined3d_unordered_access_view *prev; -@@ -1081,6 +1731,10 @@ static void wined3d_cs_exec_set_unordered_access_view(struct wined3d_cs *cs, con +@@ -1081,6 +1730,10 @@ static void wined3d_cs_exec_set_unordered_access_view(struct wined3d_cs *cs, con InterlockedDecrement(&prev->resource->bind_count); device_invalidate_state(cs->device, STATE_UNORDERED_ACCESS_VIEW_BINDING(op->pipeline)); @@ -1415,7 +1414,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined3d_pipeline pipeline, -@@ -1088,21 +1742,35 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined +@@ -1088,21 +1741,35 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined { struct wined3d_cs_set_unordered_access_view *op; @@ -1451,7 +1450,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -1110,16 +1778,26 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1110,16 +1777,26 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type { struct wined3d_cs_set_sampler *op; @@ -1478,7 +1477,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_shader *op = data; -@@ -1127,26 +1805,44 @@ static void wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data) +@@ -1127,26 +1804,44 @@ static void wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data) device_invalidate_state(cs->device, STATE_SHADER(op->type)); if (op->type != WINED3D_SHADER_TYPE_COMPUTE) device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); @@ -1523,7 +1522,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, -@@ -1154,6 +1850,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, +@@ -1154,6 +1849,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, { struct wined3d_cs_set_rasterizer_state *op; @@ -1531,7 +1530,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_SET_RASTERIZER_STATE; op->state = rasterizer_state; -@@ -1162,31 +1859,57 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, +@@ -1162,31 +1858,57 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, } static void wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data) @@ -1589,7 +1588,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, -@@ -1194,21 +1917,35 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, +@@ -1194,21 +1916,35 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, { struct wined3d_cs_set_texture_state *op; @@ -1625,7 +1624,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, -@@ -1216,22 +1953,36 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, +@@ -1216,22 +1952,36 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, { struct wined3d_cs_set_sampler_state *op; @@ -1662,7 +1661,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state, -@@ -1239,35 +1990,59 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -1239,35 +1989,59 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform { struct wined3d_cs_set_transform *op; @@ -1722,7 +1721,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_color_key *op = data; struct wined3d_texture *texture = op->texture; -@@ -1328,6 +2103,10 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat +@@ -1328,6 +2102,10 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat break; } } @@ -1733,7 +1732,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, -@@ -1335,7 +2114,11 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -1335,7 +2113,11 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture { struct wined3d_cs_set_color_key *op; @@ -1745,7 +1744,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_SET_COLOR_KEY; op->texture = texture; op->flags = flags; -@@ -1346,22 +2129,33 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -1346,22 +2128,33 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture } else op->set = 0; @@ -1779,7 +1778,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_SET_MATERIAL; op->material = *material; -@@ -1372,17 +2166,37 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1372,17 +2165,37 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) { struct wined3d_adapter *adapter = cs->device->adapter; @@ -1817,7 +1816,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_RESET_STATE; -@@ -1390,17 +2204,32 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1390,17 +2203,32 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) } static void wined3d_cs_exec_destroy_object(struct wined3d_cs *cs, const void *data) @@ -1850,7 +1849,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_DESTROY_OBJECT; op->callback = callback; op->object = object; -@@ -1408,40 +2237,96 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void +@@ -1408,40 +2236,96 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void cs->ops->submit(cs); } @@ -1947,7 +1946,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_PRELOAD_RESOURCE; op->resource = resource; -@@ -1450,20 +2335,32 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso +@@ -1450,20 +2334,32 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso cs->ops->submit(cs); } @@ -1980,7 +1979,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_UNLOAD_RESOURCE; op->resource = resource; -@@ -1472,13 +2369,21 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou +@@ -1472,13 +2368,21 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou cs->ops->submit(cs); } @@ -2002,7 +2001,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx, -@@ -1487,7 +2392,11 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, +@@ -1487,7 +2391,11 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, struct wined3d_cs_map *op; HRESULT hr; @@ -2014,7 +2013,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_MAP; op->resource = resource; op->sub_resource_idx = sub_resource_idx; -@@ -1496,17 +2405,29 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, +@@ -1496,17 +2404,29 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, op->flags = flags; op->hr = &hr; @@ -2044,7 +2043,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx) -@@ -1514,19 +2435,811 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc +@@ -1514,19 +2434,810 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc struct wined3d_cs_unmap *op; HRESULT hr; @@ -2353,7 +2352,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + if (src_surface && src_surface != dst_surface) + wined3d_resource_acquire(&src_surface->container->resource); + - cs->ops->submit(cs); ++ cs->ops->submit(cs); +} + +static UINT wined3d_cs_exec_clear_rtv(struct wined3d_cs *cs, const void *data) @@ -2398,7 +2397,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + const struct wined3d_cs_update_texture *op = data; + struct wined3d_context *context; + -+ context = context_acquire(cs->device, NULL); ++ context = context_acquire(cs->device, NULL, 0); + device_exec_update_texture(context, op->src, op->dst); + context_release(context); + @@ -2453,7 +2452,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + addr.buffer_object = 0; + addr.addr = op->data; + -+ context = context_acquire(texture->resource.device, NULL); ++ context = context_acquire(texture->resource.device, NULL, 0); + + /* Only load the sub-resource for partial updates. */ + if (!op->box || (!op->box->left && !op->box->top && !op->box->front @@ -2515,15 +2514,10 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + op->hr = &hr; + + cs->ops->submit_and_wait(cs); -+#endif /* STAGING_CSMT */ - - return hr; - } - -+#if !defined(STAGING_CSMT) - static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = - { -+#else /* STAGING_CSMT */ ++ ++ return hr; ++} ++ +static UINT wined3d_cs_exec_release_dc(struct wined3d_cs *cs, const void *data) +{ + const struct wined3d_cs_get_release_dc *op = data; @@ -2553,7 +2547,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c +static UINT wined3d_cs_exec_create_dummy_textures(struct wined3d_cs *cs, const void *data) +{ + const struct wined3d_cs_create_dummy_textures *op = data; -+ struct wined3d_context *context = context_acquire(cs->device, NULL); ++ struct wined3d_context *context = context_acquire(cs->device, NULL, 0); + + device_create_dummy_textures(cs->device, context); + @@ -2641,7 +2635,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + struct wined3d_texture *texture = op->texture; + struct wined3d_context *context; + -+ context = context_acquire(cs->device, NULL); ++ context = context_acquire(cs->device, NULL, 0); + if (!wined3d_texture_load_location(texture, op->sub_resource_idx, context, texture->resource.map_binding)) + { + ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding)); @@ -2707,7 +2701,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + wined3d_resource_acquire(&dst_buffer->resource); + wined3d_resource_acquire(&src_buffer->resource); + -+ cs->ops->submit(cs); + cs->ops->submit(cs); +} + +static UINT wined3d_cs_exec_create_buffer_view(struct wined3d_cs *cs, const void *data) @@ -2735,10 +2729,15 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + op->hr = &hr; + + cs->ops->submit_and_wait(cs); -+ -+ return hr; -+} -+ ++#endif /* STAGING_CSMT */ + + return hr; + } + ++#if !defined(STAGING_CSMT) + static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = + { ++#else /* STAGING_CSMT */ +static UINT wined3d_cs_exec_create_texture_view(struct wined3d_cs *cs, const void *data) +{ + const struct wined3d_cs_create_texture_view *op = data; @@ -2769,18 +2768,17 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c +{ + const struct wined3d_cs_delete_gl_contexts *op = data; + -+ device_delete_opengl_contexts_cs(cs->device, op->swapchain); ++ device_delete_opengl_contexts_cs(cs->device); + + return sizeof(*op); +} + -+void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain) ++void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs) +{ + struct wined3d_cs_delete_gl_contexts *op; + + op = cs->ops->require_space(cs, sizeof(*op), 0); + op->opcode = WINED3D_CS_OP_DELETE_GL_CONTEXTS; -+ op->swapchain = swapchain; + + cs->ops->submit_and_wait(cs); +} @@ -2796,7 +2794,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + WORD map; + + /* Need any context to write to the vbo. */ -+ context = context_acquire(cs->device, NULL); ++ context = context_acquire(cs->device, NULL, 0); + gl_info = context->gl_info; + + vs = state->shader[WINED3D_SHADER_TYPE_VERTEX]; @@ -2856,7 +2854,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c /* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present, /* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear, /* WINED3D_CS_OP_DISPATCH */ wined3d_cs_exec_dispatch, -@@ -1558,13 +3271,43 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1558,13 +3269,43 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state, /* WINED3D_CS_OP_DESTROY_OBJECT */ wined3d_cs_exec_destroy_object, /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, @@ -2900,7 +2898,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { if (size > cs->data_size) { -@@ -1588,6 +3331,7 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs) +@@ -1588,6 +3329,7 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs) wined3d_cs_op_handlers[opcode](cs, cs->data); } @@ -2908,7 +2906,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p, unsigned int start_idx, unsigned int count, const void *constants) { -@@ -1628,15 +3372,161 @@ static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_pus +@@ -1628,15 +3370,161 @@ static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_pus for (i = 0, context_count = device->context_count; i < context_count; ++i) { device->contexts[i]->constant_update_mask |= push_constant_info[p].mask; @@ -3070,7 +3068,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) { -@@ -1646,34 +3536,97 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1646,34 +3534,97 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs)))) return NULL; @@ -3181,7 +3179,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c const struct wined3d_gl_info *gl_info; UINT drawable_width, drawable_height; struct wined3d_color corrected_color; -@@ -290,7 +292,11 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c +@@ -293,7 +295,11 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c dsv->sub_resource_idx, context, location); } @@ -3193,7 +3191,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { context_release(context); WARN("Failed to apply clear state, skipping clear.\n"); -@@ -347,7 +353,11 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c +@@ -350,7 +356,11 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c wined3d_texture_invalidate_location(texture, rtv->sub_resource_idx, ~rtv->resource->draw_binding); } @@ -3205,7 +3203,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { if (rt_count > 1) WARN("Clearing multiple sRGB render targets with no GL_ARB_framebuffer_sRGB " -@@ -607,7 +617,44 @@ out: +@@ -610,7 +620,44 @@ out: } /* Context activation is done by the caller. */ @@ -3250,7 +3248,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; -@@ -741,6 +788,9 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_ +@@ -744,6 +791,9 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_ } context_bind_dummy_textures(device, context); @@ -3260,7 +3258,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } /* Context activation is done by the caller. */ -@@ -775,6 +825,7 @@ static void destroy_dummy_textures(struct wined3d_device *device, struct wined3d +@@ -778,6 +828,7 @@ static void destroy_dummy_textures(struct wined3d_device *device, struct wined3d } /* Context activation is done by the caller. */ @@ -3268,7 +3266,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c static void create_default_samplers(struct wined3d_device *device, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; -@@ -808,6 +859,7 @@ static void create_default_samplers(struct wined3d_device *device, struct wined3 +@@ -811,6 +862,7 @@ static void create_default_samplers(struct wined3d_device *device, struct wined3 } /* Context activation is done by the caller. */ @@ -3276,7 +3274,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c static void destroy_default_samplers(struct wined3d_device *device, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; -@@ -954,7 +1006,11 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi +@@ -957,7 +1009,11 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi BOOL ds_enable = !!swapchain->desc.enable_auto_depth_stencil; unsigned int i; @@ -3288,7 +3286,87 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -972,9 +1028,13 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, +@@ -971,18 +1027,25 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi + wined3d_device_set_render_state(device, WINED3D_RS_ZENABLE, ds_enable); + } + ++#if !defined(STAGING_CSMT) + static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device) + { + struct wined3d_resource *resource, *cursor; ++#else /* STAGING_CSMT */ ++void device_delete_opengl_contexts_cs(struct wined3d_device *device) ++{ ++#endif /* STAGING_CSMT */ + struct wined3d_context *context; + struct wined3d_shader *shader; + ++#if !defined(STAGING_CSMT) + LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) + { + TRACE("Unloading resource %p.\n", resource); + wined3d_cs_emit_unload_resource(device->cs, resource); + } + ++#endif /* STAGING_CSMT */ + LIST_FOR_EACH_ENTRY(shader, &device->shaders, struct wined3d_shader, shader_list_entry) + { + device->shader_backend->shader_destroy(shader); +@@ -1004,10 +1067,28 @@ static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device) + } + } + ++#if !defined(STAGING_CSMT) + static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain) + { + struct wined3d_context *context; + struct wined3d_texture *target; ++#else /* STAGING_CSMT */ ++static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device) ++{ ++ struct wined3d_resource *resource, *cursor; ++ ++ LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) ++ { ++ TRACE("Unloading resource %p.\n", resource); ++ wined3d_cs_emit_unload_resource(device->cs, resource); ++ } ++ ++ wined3d_cs_emit_delete_opengl_contexts(device->cs); ++} ++ ++static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain) ++{ ++#endif /* STAGING_CSMT */ + HRESULT hr; + + if (FAILED(hr = device->shader_backend->shader_alloc_private(device, +@@ -1024,11 +1105,24 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru + return hr; + } + ++#if !defined(STAGING_CSMT) + target = swapchain->back_buffers ? swapchain->back_buffers[0] : swapchain->front_buffer; + context = context_acquire(device, target, 0); + create_dummy_textures(device, context); + create_default_samplers(device, context); + context_release(context); ++#else /* STAGING_CSMT */ ++ hr = wined3d_cs_emit_create_swapchain_context(device->cs, swapchain); ++ if (FAILED(hr)) ++ { ++ WARN("Failed to create context.\n"); ++ device->blitter->free_private(device); ++ device->shader_backend->shader_free_private(device); ++ return hr; ++ } ++ ++ wined3d_cs_emit_create_dummy_textures(device->cs); ++#endif /* STAGING_CSMT */ + + return WINED3D_OK; + } +@@ -1037,9 +1131,13 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc) { static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -3302,7 +3380,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c DWORD clear_flags = 0; HRESULT hr; -@@ -985,9 +1045,11 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, +@@ -1050,9 +1148,11 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, if (device->wined3d->flags & WINED3D_NO3D) return WINED3DERR_INVALIDCALL; @@ -3314,12 +3392,12 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (FAILED(hr = device->shader_backend->shader_alloc_private(device, device->adapter->vertex_pipe, device->adapter->fragment_pipe))) { -@@ -1038,17 +1100,23 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, +@@ -1103,17 +1203,23 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, device->swapchains[0] = swapchain; device_init_swapchain_state(device, swapchain); +#if !defined(STAGING_CSMT) - context = context_acquire(device, NULL); + context = context_acquire(device, NULL, 0); create_dummy_textures(device, context); create_default_samplers(device, context); @@ -3338,7 +3416,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Clear the screen */ if (swapchain->back_buffers && swapchain->back_buffers[0]) clear_flags |= WINED3DCLEAR_TARGET; -@@ -1064,7 +1132,9 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, +@@ -1129,7 +1235,9 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, return WINED3D_OK; err_out: @@ -3348,70 +3426,46 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c HeapFree(GetProcessHeap(), 0, device->swapchains); device->swapchain_count = 0; if (device->back_buffer_view) -@@ -1121,8 +1191,10 @@ static void device_free_sampler(struct wine_rb_entry *entry, void *context) - HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) - { - struct wined3d_resource *resource, *cursor; -+#if !defined(STAGING_CSMT) - const struct wined3d_gl_info *gl_info; - struct wined3d_context *context; -+#endif /* STAGING_CSMT */ - UINT i; - - TRACE("device %p.\n", device); -@@ -1130,11 +1202,16 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1192,6 +1300,11 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) if (!device->d3d_initialized) return WINED3DERR_INVALIDCALL; -+#if !defined(STAGING_CSMT) - /* I don't think that the interface guarantees that the device is destroyed from the same thread - * it was created. Thus make sure a context is active for the glDelete* calls - */ - context = context_acquire(device, NULL); - gl_info = context->gl_info; -+#else /* STAGING_CSMT */ ++#if defined(STAGING_CSMT) + if (wined3d_settings.cs_multithreaded) + wined3d_cs_emit_sync(device->cs); ++ +#endif /* STAGING_CSMT */ - if (device->logo_texture) wined3d_texture_decref(device->logo_texture); -@@ -1143,6 +1220,14 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) + if (device->cursor_texture) +@@ -1199,6 +1312,7 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) state_unbind_resources(&device->state); -+#if defined(STAGING_CSMT) ++#if !defined(STAGING_CSMT) + wine_rb_clear(&device->samplers, device_free_sampler, NULL); + + wined3d_device_delete_opengl_contexts(device); +@@ -1226,6 +1340,18 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) + { + wined3d_device_set_rendertarget_view(device, i, NULL, FALSE); + } ++#else /* STAGING_CSMT */ + if (device->auto_depth_stencil_view) + { + wined3d_rendertarget_view_decref(device->auto_depth_stencil_view); + device->auto_depth_stencil_view = NULL; + } + -+#endif /* STAGING_CSMT */ - /* Unload resources */ - LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) - { -@@ -1152,6 +1237,7 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) - - wine_rb_clear(&device->samplers, device_free_sampler, NULL); - -+#if !defined(STAGING_CSMT) - /* Destroy the depth blt resources, they will be invalid after the reset. Also free shader - * private data, it might contain opengl pointers - */ -@@ -1192,6 +1278,11 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) - { - wined3d_device_set_rendertarget_view(device, i, NULL, FALSE); - } -+#else /* STAGING_CSMT */ -+ /* FIXME: Is this in the right place??? */ -+ wined3d_cs_emit_delete_opengl_contexts(device->cs, device->swapchains[0]); ++ wine_rb_clear(&device->samplers, device_free_sampler, NULL); ++ ++ wined3d_device_delete_opengl_contexts(device); + +#endif /* STAGING_CSMT */ if (device->back_buffer_view) { wined3d_rendertarget_view_decref(device->back_buffer_view); -@@ -1209,9 +1300,11 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1243,9 +1369,11 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) device->swapchains = NULL; device->swapchain_count = 0; @@ -3423,7 +3477,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->d3d_initialized = FALSE; return WINED3D_OK; -@@ -1256,7 +1349,11 @@ UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device +@@ -1290,7 +1418,11 @@ UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device /* We can not acquire the context unless there is a swapchain. */ if (device->swapchains && gl_info->supported[NVX_GPU_MEMORY_INFO] && @@ -3435,7 +3489,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { GLint vram_free_kb; UINT64 vram_free; -@@ -1597,6 +1694,7 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, +@@ -1631,6 +1763,7 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, light->direction.x, light->direction.y, light->direction.z, light->range, light->falloff, light->theta, light->phi); @@ -3443,7 +3497,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Update the live definitions if the light is currently assigned a glIndex. */ if (object->glIndex != -1 && !device->recording) { -@@ -1605,6 +1703,7 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, +@@ -1639,6 +1772,7 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, device_invalidate_state(device, STATE_ACTIVELIGHT(object->glIndex)); } @@ -3451,7 +3505,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Save away the information. */ object->OriginalParms = *light; -@@ -1684,6 +1783,11 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, +@@ -1718,6 +1852,11 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, FIXME("Unrecognized light type %#x.\n", light->type); } @@ -3463,7 +3517,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -1756,12 +1860,14 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN +@@ -1790,12 +1929,14 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN { if (light_info->glIndex != -1) { @@ -3478,7 +3532,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->update_state->lights[light_info->glIndex] = NULL; light_info->glIndex = -1; } -@@ -1804,6 +1910,7 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN +@@ -1838,6 +1979,7 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN WARN("Too many concurrently active lights\n"); return WINED3D_OK; } @@ -3486,7 +3540,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* i == light_info->glIndex */ if (!device->recording) -@@ -1811,9 +1918,15 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN +@@ -1845,9 +1987,15 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN device_invalidate_state(device, STATE_LIGHT_TYPE); device_invalidate_state(device, STATE_ACTIVELIGHT(i)); } @@ -3502,7 +3556,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -2029,7 +2142,11 @@ static void resolve_depth_buffer(struct wined3d_state *state) +@@ -2063,7 +2211,11 @@ static void resolve_depth_buffer(struct wined3d_state *state) || !(dst_texture->resource.format_flags & WINED3DFMT_FLAG_DEPTH)) return; @@ -3514,7 +3568,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return; if (src_view->resource->type == WINED3D_RTYPE_BUFFER) { -@@ -2417,7 +2534,11 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, +@@ -2451,7 +2603,11 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, } else { @@ -3526,7 +3580,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2466,7 +2587,11 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, +@@ -2500,7 +2656,11 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, } else { @@ -3538,7 +3592,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2511,7 +2636,11 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, +@@ -2545,7 +2705,11 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, memset(&device->recording->changed.vs_consts_f[start_idx], 1, count * sizeof(*device->recording->changed.vs_consts_f)); else @@ -3550,7 +3604,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -2650,7 +2779,11 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, +@@ -2684,7 +2848,11 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, } else { @@ -3562,7 +3616,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2699,7 +2832,11 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device, +@@ -2733,7 +2901,11 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device, } else { @@ -3574,7 +3628,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2745,7 +2882,11 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device, +@@ -2779,7 +2951,11 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device, memset(&device->recording->changed.ps_consts_f[start_idx], 1, count * sizeof(*device->recording->changed.ps_consts_f)); else @@ -3586,7 +3640,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -2916,7 +3057,9 @@ void CDECL wined3d_device_set_unordered_access_view(struct wined3d_device *devic +@@ -2950,7 +3126,9 @@ void CDECL wined3d_device_set_unordered_access_view(struct wined3d_device *devic wined3d_device_set_pipeline_unordered_access_view(device, WINED3D_PIPELINE_GRAPHICS, idx, uav); } @@ -3596,7 +3650,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c #define copy_and_next(dest, src, size) memcpy(dest, src, size); dest += (size) static HRESULT process_vertices_strided(const struct wined3d_device *device, DWORD dwDestIndex, DWORD dwCount, const struct wined3d_stream_info *stream_info, struct wined3d_buffer *dest, DWORD flags, -@@ -3192,6 +3335,7 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, +@@ -3226,6 +3404,7 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, UINT src_start_idx, UINT dst_idx, UINT vertex_count, struct wined3d_buffer *dst_buffer, const struct wined3d_vertex_declaration *declaration, DWORD flags, DWORD dst_fvf) { @@ -3604,7 +3658,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c struct wined3d_state *state = &device->state; struct wined3d_stream_info stream_info; const struct wined3d_gl_info *gl_info; -@@ -3200,6 +3344,10 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, +@@ -3234,6 +3413,10 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, unsigned int i; HRESULT hr; WORD map; @@ -3615,15 +3669,15 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, src_start_idx %u, dst_idx %u, vertex_count %u, " "dst_buffer %p, declaration %p, flags %#x, dst_fvf %#x.\n", -@@ -3209,6 +3357,7 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, +@@ -3243,6 +3426,7 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, if (declaration) FIXME("Output vertex declaration not implemented yet.\n"); +#if !defined(STAGING_CSMT) /* Need any context to write to the vbo. */ - context = context_acquire(device, NULL); + context = context_acquire(device, NULL, 0); gl_info = context->gl_info; -@@ -3244,12 +3393,17 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, +@@ -3278,12 +3462,17 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, if (e->data.addr) e->data.addr += e->stride * src_start_idx; } @@ -3641,7 +3695,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return hr; } -@@ -3536,8 +3690,10 @@ HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device) +@@ -3570,8 +3759,10 @@ HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device) HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) { @@ -3652,15 +3706,15 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p.\n", device); if (!device->inScene) -@@ -3546,6 +3702,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3580,6 +3771,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) return WINED3DERR_INVALIDCALL; } +#if !defined(STAGING_CSMT) - context = context_acquire(device, NULL); + context = context_acquire(device, NULL, 0); /* We only have to do this if we need to read the, swapbuffers performs a flush for us */ context->gl_info->gl_ops.gl.p_glFlush(); -@@ -3553,6 +3710,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3587,6 +3779,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) * fails. */ context_release(context); @@ -3668,7 +3722,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->inScene = FALSE; return WINED3D_OK; } -@@ -3560,6 +3718,10 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3594,6 +3787,10 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) { @@ -3679,7 +3733,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, rect_count %u, rects %p, flags %#x, color %s, depth %.8e, stencil %u.\n", device, rect_count, rects, flags, debug_color(color), depth, stencil); -@@ -3571,7 +3733,11 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3605,7 +3802,11 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) { @@ -3691,7 +3745,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (!ds) { WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n"); -@@ -3580,8 +3746,13 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3614,8 +3815,13 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou } else if (flags & WINED3DCLEAR_TARGET) { @@ -3705,7 +3759,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { WARN("Silently ignoring depth and target clear with mismatching sizes\n"); return WINED3D_OK; -@@ -3644,8 +3815,13 @@ void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device, +@@ -3678,8 +3884,13 @@ void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device, device->update_state->gl_primitive_type = gl_primitive_type; if (device->recording) device->recording->changed.primitive_type = TRUE; @@ -3719,7 +3773,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } void CDECL wined3d_device_get_primitive_type(const struct wined3d_device *device, -@@ -3705,11 +3881,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device +@@ -3739,11 +3950,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device start_idx, index_count, start_instance, instance_count, TRUE); } @@ -3737,10 +3791,10 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c struct wined3d_context *context; struct wined3d_map_desc src; HRESULT hr = WINED3D_OK; -@@ -3733,6 +3915,13 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3767,6 +3984,13 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, } - context = context_acquire(device, NULL); + context = context_acquire(device, NULL, 0); +#else /* STAGING_CSMT */ + struct wined3d_map_desc src; + unsigned int i; @@ -3751,7 +3805,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Only a prepare, since we're uploading entire volumes. */ wined3d_texture_prepare_texture(dst_texture, context, FALSE); -@@ -3740,15 +3929,22 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3774,15 +3998,22 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, for (i = 0; i < level_count; ++i) { @@ -3774,7 +3828,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (FAILED(hr = wined3d_resource_unmap(&src_texture->resource, src_level + i))) goto done; } -@@ -3756,16 +3952,89 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3790,16 +4021,89 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, done: context_release(context); return hr; @@ -3864,7 +3918,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, dst_texture); -@@ -3802,6 +4071,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3836,6 +4140,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, return WINED3DERR_INVALIDCALL; } @@ -3872,7 +3926,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c level_count = min(wined3d_texture_get_level_count(src_texture), wined3d_texture_get_level_count(dst_texture)); -@@ -3824,9 +4094,21 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3858,9 +4163,21 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, context_release(context); /* Update every surface level of the texture. */ @@ -3894,7 +3948,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { unsigned int src_levels = src_texture->level_count; unsigned int dst_levels = dst_texture->level_count; -@@ -3859,6 +4141,38 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3893,6 +4210,38 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, FIXME("Unsupported texture type %#x.\n", type); return WINED3DERR_INVALIDCALL; } @@ -3933,7 +3987,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes) -@@ -3906,8 +4220,13 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device +@@ -3940,8 +4289,13 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_STENCILENABLE]) { @@ -3947,7 +4001,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -4044,10 +4363,16 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device, +@@ -4078,10 +4432,16 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device, if (dst_resource->type == WINED3D_RTYPE_BUFFER) { @@ -3964,7 +4018,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return; } -@@ -4096,6 +4421,9 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -4130,6 +4490,9 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev struct wined3d_texture *dst_texture, *src_texture; RECT dst_rect, src_rect; HRESULT hr; @@ -3974,7 +4028,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, dst_resource %p, dst_sub_resource_idx %u, dst_x %u, dst_y %u, dst_z %u, " "src_resource %p, src_sub_resource_idx %u, src_box %s.\n", -@@ -4168,8 +4496,14 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -4202,8 +4565,14 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev return WINED3DERR_INVALIDCALL; } @@ -3989,7 +4043,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } if (dst_resource->type != WINED3D_RTYPE_TEXTURE_2D) -@@ -4183,6 +4517,16 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -4217,6 +4586,16 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev if (src_box) { @@ -4006,7 +4060,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c SetRect(&src_rect, src_box->left, src_box->top, src_box->right, src_box->bottom); } else -@@ -4196,6 +4540,25 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -4230,6 +4609,25 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev SetRect(&dst_rect, dst_x, dst_y, dst_x + (src_rect.right - src_rect.left), dst_y + (src_rect.bottom - src_rect.top)); @@ -4032,7 +4086,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (FAILED(hr = wined3d_texture_blt(dst_texture, dst_sub_resource_idx, &dst_rect, src_texture, src_sub_resource_idx, &src_rect, 0, NULL, WINED3D_TEXF_POINT))) WARN("Failed to blit, hr %#x.\n", hr); -@@ -4208,27 +4571,40 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4242,27 +4640,40 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str unsigned int depth_pitch) { unsigned int width, height, depth, level; @@ -4073,7 +4127,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return; } -@@ -4259,6 +4635,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4293,6 +4704,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str return; } @@ -4081,7 +4135,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c addr.buffer_object = 0; addr.addr = data; -@@ -4278,6 +4655,9 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4312,6 +4724,9 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB); wined3d_texture_invalidate_location(texture, sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB); @@ -4091,7 +4145,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, -@@ -4326,10 +4706,15 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi +@@ -4360,10 +4775,15 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi return WINED3DERR_INVALIDCALL; } @@ -4107,7 +4161,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device, -@@ -4343,20 +4728,31 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co +@@ -4377,20 +4797,31 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co return NULL; } @@ -4139,7 +4193,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n", device, view_idx, view, set_viewport); -@@ -4393,13 +4789,21 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4427,13 +4858,21 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device } @@ -4161,7 +4215,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_set_rendertarget_view(device->cs, view_idx, view); /* Release after the assignment, to prevent device_resource_released() * from seeing the surface as still in use. */ -@@ -4411,18 +4815,29 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4445,18 +4884,29 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view) { @@ -4191,102 +4245,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_rendertarget_view_incref(view); wined3d_cs_emit_set_depth_stencil_view(device->cs, view); if (prev) -@@ -4656,19 +5071,26 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) - } - } - -+#if !defined(STAGING_CSMT) - static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d_swapchain *swapchain) - { - struct wined3d_resource *resource, *cursor; -+#else /* STAGING_CSMT */ -+void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wined3d_swapchain *swapchain) -+{ -+#endif /* STAGING_CSMT */ - const struct wined3d_gl_info *gl_info; - struct wined3d_context *context; - struct wined3d_shader *shader; - -+#if !defined(STAGING_CSMT) - LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) - { - TRACE("Unloading resource %p.\n", resource); - wined3d_cs_emit_unload_resource(device->cs, resource); - } - -+#endif /* STAGING_CSMT */ - LIST_FOR_EACH_ENTRY(shader, &device->shaders, struct wined3d_shader, shader_list_entry) - { - device->shader_backend->shader_destroy(shader); -@@ -4700,12 +5122,30 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d - - HeapFree(GetProcessHeap(), 0, swapchain->context); - swapchain->context = NULL; -+#if defined(STAGING_CSMT) -+ swapchain->num_contexts = 0; -+} -+ -+static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d_swapchain *swapchain) -+{ -+ struct wined3d_resource *resource, *cursor; -+ -+ LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) -+ { -+ TRACE("Unloading resource %p.\n", resource); -+ wined3d_cs_emit_unload_resource(device->cs, resource); -+ } -+ -+ wined3d_cs_emit_delete_opengl_contexts(device->cs, swapchain); -+#endif /* STAGING_CSMT */ - } - - static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain) - { -+#if !defined(STAGING_CSMT) - struct wined3d_context *context; - struct wined3d_texture *target; -+#endif /* STAGING_CSMT */ - HRESULT hr; - - if (FAILED(hr = device->shader_backend->shader_alloc_private(device, -@@ -4722,6 +5162,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru - return hr; - } - -+#if !defined(STAGING_CSMT) - /* Recreate the primary swapchain's context */ - swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(*swapchain->context)); - if (!swapchain->context) -@@ -4734,10 +5175,15 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru - - target = swapchain->back_buffers ? swapchain->back_buffers[0] : swapchain->front_buffer; - if (!(context = context_create(swapchain, target, swapchain->ds_format))) -+#else /* STAGING_CSMT */ -+ hr = wined3d_cs_emit_create_swapchain_context(device->cs, swapchain); -+ if (FAILED(hr)) -+#endif /* STAGING_CSMT */ - { - WARN("Failed to create context.\n"); - device->blitter->free_private(device); - device->shader_backend->shader_free_private(device); -+#if !defined(STAGING_CSMT) - HeapFree(GetProcessHeap(), 0, swapchain->context); - return E_FAIL; - } -@@ -4747,6 +5193,12 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru - create_dummy_textures(device, context); - create_default_samplers(device, context); - context_release(context); -+#else /* STAGING_CSMT */ -+ return hr; -+ } -+ -+ wined3d_cs_emit_create_dummy_textures(device->cs); -+#endif /* STAGING_CSMT */ - - return WINED3D_OK; - } -@@ -4783,10 +5235,16 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4722,10 +5172,16 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, wined3d_texture_decref(device->cursor_texture); device->cursor_texture = NULL; } @@ -4303,7 +4262,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4797,6 +5255,13 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4736,6 +5192,13 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (reset_state) { @@ -4317,9 +4276,9 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) { TRACE("Enumerating resource %p.\n", resource); -@@ -4965,27 +5430,48 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4904,27 +5367,48 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (device->d3d_initialized) - delete_opengl_contexts(device, swapchain); + wined3d_device_delete_opengl_contexts(device); +#if !defined(STAGING_CSMT) state_init(&device->state, &device->fb, &device->adapter->gl_info, @@ -4366,7 +4325,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -4993,7 +5479,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4932,7 +5416,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, { if (reset_state) hr = create_primary_opengl_context(device, swapchain); @@ -4378,7 +4337,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } /* All done. There is no need to reload resources or shaders, this will happen automatically on the -@@ -5077,11 +5567,19 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso +@@ -5016,11 +5504,19 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { @@ -4398,7 +4357,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c ERR("Resource %p is still in use as depth/stencil buffer.\n", resource); } -@@ -5207,8 +5705,17 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, +@@ -5146,8 +5642,17 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, device->blitter = adapter->blitter; @@ -4416,7 +4375,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->update_state = &device->state; if (!(device->cs = wined3d_cs_create(device))) -@@ -5308,3 +5815,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -5247,3 +5752,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -4518,7 +4477,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c } static struct wined3d_event_query *wined3d_event_query_from_query(struct wined3d_query *query) -@@ -347,7 +350,13 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query, +@@ -350,7 +353,13 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query, return WINED3DERR_INVALIDCALL; } @@ -4532,7 +4491,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c return S_FALSE; if (data) -@@ -500,7 +509,11 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD +@@ -504,7 +513,11 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD * restart. */ if (flags & WINED3DISSUE_BEGIN) { @@ -4544,7 +4503,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c { if (oq->context->tid != GetCurrentThreadId()) { -@@ -530,13 +543,20 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD +@@ -535,13 +548,20 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD checkGLcall("glBeginQuery()"); context_release(context); @@ -4565,7 +4524,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c { if (oq->context->tid != GetCurrentThreadId()) { -@@ -552,6 +572,9 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD +@@ -558,6 +578,9 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD context_release(context); } } @@ -4623,9 +4582,9 @@ diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c sampler->parent = parent; sampler->desc = *desc; - context = context_acquire(device, NULL); + context = context_acquire(device, NULL, 0); +#else /* STAGING_CSMT */ -+ context = context_acquire(sampler->device, NULL); ++ context = context_acquire(sampler->device, NULL, 0); +#endif /* STAGING_CSMT */ gl_info = context->gl_info; @@ -4684,7 +4643,7 @@ diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c -@@ -3247,7 +3247,11 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 +@@ -3265,7 +3265,11 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 UINT i; memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */ @@ -4984,7 +4943,7 @@ diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -675,8 +675,12 @@ static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const +@@ -676,8 +676,12 @@ static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const { struct wined3d_resource *resource = &surface->container->resource; struct wined3d_device *device = resource->device; @@ -4997,7 +4956,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c const struct blit_shader *blitter; HRESULT hr; -@@ -687,6 +691,7 @@ static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const +@@ -688,6 +692,7 @@ static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const return WINED3DERR_INVALIDCALL; } @@ -5005,7 +4964,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c view_desc.format_id = resource->format->id; view_desc.flags = 0; view_desc.u.texture.level_idx = surface->texture_level; -@@ -702,6 +707,19 @@ static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const +@@ -703,6 +708,19 @@ static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const hr = blitter->depth_fill(device, view, rect, WINED3DCLEAR_ZBUFFER, depth, 0); wined3d_rendertarget_view_decref(view); @@ -5025,7 +4984,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return hr; } -@@ -2477,8 +2495,12 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st +@@ -2481,8 +2499,12 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st { struct wined3d_resource *resource = &s->container->resource; struct wined3d_device *device = resource->device; @@ -5038,7 +4997,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c const struct blit_shader *blitter; HRESULT hr; -@@ -2489,6 +2511,7 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st +@@ -2493,6 +2515,7 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st return WINED3DERR_INVALIDCALL; } @@ -5046,7 +5005,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c view_desc.format_id = resource->format->id; view_desc.flags = 0; view_desc.u.texture.level_idx = s->texture_level; -@@ -2504,6 +2527,19 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st +@@ -2508,6 +2531,19 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st hr = blitter->color_fill(device, view, rect, color); wined3d_rendertarget_view_decref(view); @@ -5066,7 +5025,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return hr; } -@@ -2514,7 +2550,11 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE +@@ -2518,7 +2554,11 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE { struct wined3d_texture *dst_texture = dst_surface->container; struct wined3d_device *device = dst_texture->resource.device; @@ -5078,7 +5037,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c struct wined3d_swapchain *src_swapchain, *dst_swapchain; struct wined3d_texture *src_texture; -@@ -2850,7 +2890,11 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -2854,7 +2894,11 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, /* Don't use PBOs for converted surfaces. During PBO conversion we look at * WINED3D_TEXTURE_CONVERTED but it isn't set (yet) in all cases it is * getting called. */ @@ -5090,7 +5049,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { TRACE("Removing the pbo attached to surface %p.\n", surface); -@@ -3835,7 +3879,11 @@ const struct blit_shader cpu_blit = { +@@ -3839,7 +3883,11 @@ const struct blit_shader cpu_blit = { cpu_blit_blit_surface, }; @@ -5102,7 +5061,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter) { -@@ -3845,9 +3893,14 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3849,9 +3897,14 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst struct wined3d_texture *dst_texture = dst_surface->container; struct wined3d_device *device = dst_texture->resource.device; struct wined3d_swapchain *src_swapchain, *dst_swapchain; @@ -5117,7 +5076,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c DWORD src_ds_flags, dst_ds_flags; BOOL scale, convert; -@@ -3860,6 +3913,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3864,6 +3917,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst | WINED3D_BLT_DO_NOT_WAIT | WINED3D_BLT_ALPHA_TEST; @@ -5125,7 +5084,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n", dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), flags, fx, debug_d3dtexturefiltertype(filter)); -@@ -3877,10 +3931,12 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3881,10 +3935,12 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst fx->src_color_key.color_space_high_value); } @@ -5138,7 +5097,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } if (dst_texture->sub_resources[dst_sub_resource_idx].map_count -@@ -3938,6 +3994,15 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3942,6 +3998,15 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst if (!once++) FIXME("Can't handle WINED3D_BLT_DO_NOT_WAIT flag.\n"); flags &= ~WINED3D_BLT_DO_NOT_WAIT; @@ -5154,7 +5113,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } if (!device->d3d_initialized) -@@ -3962,11 +4027,13 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3966,11 +4031,13 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst goto fallback; } @@ -5168,7 +5127,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c dst_swapchain = dst_texture->swapchain; /* This isn't strictly needed. FBO blits for example could deal with -@@ -4002,13 +4069,21 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4006,13 +4073,21 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst TRACE("Depth fill.\n"); if (!surface_convert_depth_to_float(dst_surface, fx->fill_color, &depth)) @@ -5190,7 +5149,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (src_ds_flags != dst_ds_flags) { WARN("Rejecting depth / stencil blit between incompatible formats.\n"); -@@ -4018,6 +4093,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4022,6 +4097,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_texture->resource.draw_binding, src_rect, dst_surface, dst_texture->resource.draw_binding, dst_rect))) return WINED3D_OK; @@ -5202,7 +5161,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } else -@@ -4053,7 +4133,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4057,7 +4137,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst goto fallback; if (SUCCEEDED(surface_color_fill(dst_surface, dst_rect, &color))) @@ -5214,7 +5173,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } else { -@@ -4096,7 +4180,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4101,7 +4185,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst context, dst_texture->resource.draw_binding); context_release(context); } @@ -5226,7 +5185,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -4120,7 +4208,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4125,7 +4213,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, 0); dst_swapchain->desc.swap_effect = swap_effect; @@ -5238,7 +5197,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } if (fbo_blit_supported(&device->adapter->gl_info, blit_op, -@@ -4141,7 +4233,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4146,7 +4238,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~dst_texture->resource.draw_binding); @@ -5250,7 +5209,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info, blit_op, -@@ -4151,7 +4247,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4156,7 +4252,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst { blitter->blit_surface(device, blit_op, filter, src_surface, src_rect, dst_surface, dst_rect, color_key); @@ -5262,7 +5221,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -4159,9 +4259,151 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4164,9 +4264,151 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst fallback: /* Special cases for render targets. */ if (SUCCEEDED(surface_blt_special(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter))) @@ -5591,7 +5550,7 @@ diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c } if (swapchain->desc.backbuffer_count > 0) -@@ -1293,6 +1397,9 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha +@@ -1295,6 +1399,9 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha enum wined3d_multisample_type multisample_type, unsigned int multisample_quality) { BOOL update_desc = FALSE; @@ -5601,7 +5560,7 @@ diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c TRACE("swapchain %p, buffer_count %u, width %u, height %u, format %s, " "multisample_type %#x, multisample_quality %#x.\n", -@@ -1304,6 +1411,11 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha +@@ -1306,6 +1413,11 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha if (buffer_count && buffer_count != swapchain->desc.backbuffer_count) FIXME("Cannot change the back buffer count yet.\n"); @@ -5701,13 +5660,13 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (!context) +#if !defined(STAGING_CSMT) { - context = context_acquire(device, NULL); + context = context_acquire(device, NULL, 0); gl_info = context->gl_info; } GL_EXTCALL(glDeleteBuffers(1, &buffer_object)); +#else /* STAGING_CSMT */ -+ context = context_acquire(device, NULL); ++ context = context_acquire(device, NULL, 0); + + wined3d_device_release_bo(device, buffer, context); + texture->sub_resources[i].buffer = NULL; @@ -5916,7 +5875,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c + HRESULT hr = WINED3D_OK; + + if (device->d3d_initialized) -+ context = context_acquire(device, NULL); ++ context = context_acquire(device, NULL, 0); + + wined3d_texture_load_location(texture, sub_resource_idx, context, texture->resource.map_binding); + wined3d_texture_invalidate_location(texture, sub_resource_idx, ~texture->resource.map_binding); @@ -5958,7 +5917,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c +#if !defined(STAGING_CSMT) if (device->d3d_initialized) - context = context_acquire(device, NULL); + context = context_acquire(device, NULL, 0); @@ -3487,11 +3634,40 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i texture->flags |= WINED3D_TEXTURE_DC_IN_USE; @@ -6307,8 +6266,8 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h +#endif /* STAGING_CSMT */ struct wined3d_rendertarget_view *auto_depth_stencil_view; - /* For rendering to a texture using glCopyTexImage */ -@@ -2672,6 +2738,17 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL + /* Cursor management */ +@@ -2669,6 +2735,16 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN; @@ -6316,8 +6275,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h +void device_exec_update_texture(struct wined3d_context *context, struct wined3d_texture *src_texture, + struct wined3d_texture *dst_texture) DECLSPEC_HIDDEN; +void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN; -+void device_delete_opengl_contexts_cs(struct wined3d_device *device, -+ struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; ++void device_delete_opengl_contexts_cs(struct wined3d_device *device) DECLSPEC_HIDDEN; +struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT size, GLenum gl_usage, + GLenum type_hint, struct wined3d_context *context) DECLSPEC_HIDDEN; +void wined3d_device_release_bo(struct wined3d_device *device, struct wined3d_gl_bo *bo, @@ -6326,7 +6284,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) { -@@ -2747,11 +2824,13 @@ static inline void wined3d_resource_release(struct wined3d_resource *resource) +@@ -2744,11 +2820,13 @@ static inline void wined3d_resource_release(struct wined3d_resource *resource) InterlockedDecrement(&resource->access_count); } @@ -6340,7 +6298,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void resource_cleanup(struct wined3d_resource *resource) DECLSPEC_HIDDEN; HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *device, enum wined3d_resource_type type, const struct wined3d_format *format, -@@ -2862,7 +2941,11 @@ struct wined3d_texture +@@ -2859,7 +2937,11 @@ struct wined3d_texture unsigned int map_count; DWORD locations; @@ -6352,7 +6310,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h } sub_resources[1]; }; -@@ -2915,9 +2998,16 @@ void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, +@@ -2912,9 +2994,16 @@ void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture, unsigned int level, const struct wined3d_box *box) DECLSPEC_HIDDEN; @@ -6369,7 +6327,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_texture_invalidate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location) DECLSPEC_HIDDEN; void wined3d_texture_load(struct wined3d_texture *texture, -@@ -2930,6 +3020,10 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned +@@ -2927,6 +3016,10 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; @@ -6380,7 +6338,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_texture_set_map_binding(struct wined3d_texture *texture, DWORD map_binding) DECLSPEC_HIDDEN; void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; -@@ -3037,6 +3131,11 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -3034,6 +3127,11 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, const struct wined3d_format *format, const RECT *src_rect, UINT src_pitch, const POINT *dst_point, BOOL srgb, const struct wined3d_const_bo_address *data) DECLSPEC_HIDDEN; @@ -6392,7 +6350,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN; -@@ -3051,6 +3150,10 @@ struct wined3d_sampler +@@ -3048,6 +3146,10 @@ struct wined3d_sampler GLuint name; }; @@ -6403,7 +6361,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_vertex_declaration_element { const struct wined3d_format *format; -@@ -3146,9 +3249,14 @@ struct wined3d_stateblock +@@ -3143,9 +3245,14 @@ struct wined3d_stateblock void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -6418,7 +6376,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; enum wined3d_push_constants -@@ -3161,6 +3269,7 @@ enum wined3d_push_constants +@@ -3158,6 +3265,7 @@ enum wined3d_push_constants WINED3D_PUSH_CONSTANTS_PS_B, }; @@ -6426,7 +6384,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_cs_ops { void *(*require_space)(struct wined3d_cs *cs, size_t size); -@@ -3168,34 +3277,130 @@ struct wined3d_cs_ops +@@ -3165,34 +3273,129 @@ struct wined3d_cs_ops void (*push_constants)(struct wined3d_cs *cs, enum wined3d_push_constants p, unsigned int start_idx, unsigned int count, const void *constants); }; @@ -6521,8 +6479,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h +void wined3d_cs_emit_create_dummy_textures(struct wined3d_cs *cs) DECLSPEC_HIDDEN; +HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, + struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs, -+ struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; ++void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs) DECLSPEC_HIDDEN; +void wined3d_cs_emit_create_texture_view(struct wined3d_cs *cs, struct wined3d_gl_view *view, + GLenum view_target, const struct wined3d_view_desc *desc, struct wined3d_texture *texture, + const struct wined3d_format *view_format) DECLSPEC_HIDDEN; @@ -6557,7 +6514,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, -@@ -3206,9 +3411,17 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, +@@ -3203,9 +3406,17 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, enum wined3d_format_id format_id, unsigned int offset) DECLSPEC_HIDDEN; @@ -6575,17 +6532,17 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, struct wined3d_rasterizer_state *rasterizer_state) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, -@@ -3240,17 +3453,35 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined +@@ -3237,17 +3448,35 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN; +#if !defined(STAGING_CSMT) -+void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; + void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; +#else /* STAGING_CSMT */ +void wined3d_cs_emit_sync(struct wined3d_cs *cs); +void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs, struct wined3d_texture *texture, + unsigned int sub_resource_idx, const struct wined3d_box *dirty_region) DECLSPEC_HIDDEN; - void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; ++void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; +void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource, + unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, + unsigned int depth_pitch) DECLSPEC_HIDDEN; @@ -6611,7 +6568,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other * fixed function semantics as D3DCOLOR or FLOAT16 */ -@@ -3351,6 +3582,15 @@ struct wined3d_gl_view +@@ -3348,6 +3577,15 @@ struct wined3d_gl_view GLuint name; }; @@ -6627,7 +6584,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_shader_resource_view { LONG refcount; -@@ -3386,7 +3626,12 @@ void wined3d_unordered_access_view_invalidate_location(struct wined3d_unordered_ +@@ -3383,7 +3621,12 @@ void wined3d_unordered_access_view_invalidate_location(struct wined3d_unordered_ struct wined3d_swapchain_ops { void (*swapchain_present)(struct wined3d_swapchain *swapchain, @@ -6640,7 +6597,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void (*swapchain_frontbuffer_updated)(struct wined3d_swapchain *swapchain); }; -@@ -3423,6 +3668,10 @@ struct wined3d_swapchain +@@ -3420,6 +3663,10 @@ struct wined3d_swapchain void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) DECLSPEC_HIDDEN; struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-Revert_Buffer_Upload/0001-Revert-wined3d-Implement-wined3d_buffer_upload_data-.patch b/patches/wined3d-Revert_Buffer_Upload/0001-Revert-wined3d-Implement-wined3d_buffer_upload_data-.patch index f574750a..ba73b070 100644 --- a/patches/wined3d-Revert_Buffer_Upload/0001-Revert-wined3d-Implement-wined3d_buffer_upload_data-.patch +++ b/patches/wined3d-Revert_Buffer_Upload/0001-Revert-wined3d-Implement-wined3d_buffer_upload_data-.patch @@ -1,4 +1,4 @@ -From d9a65443731686d1191b8ddd6c3fa340b4f3f766 Mon Sep 17 00:00:00 2001 +From 77e96719b681f37950972bd78478c1c08a5faebc Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 8 Feb 2017 19:35:36 +0100 Subject: Revert "wined3d: Implement wined3d_buffer_upload_data() on top of @@ -7,12 +7,12 @@ Subject: Revert "wined3d: Implement wined3d_buffer_upload_data() on top of This reverts commit e2dbbec1af8ae2ea8813148d56e14c8c211ee334. --- dlls/wined3d/buffer.c | 30 +++++++++++++++++++----------- - dlls/wined3d/device.c | 13 +++---------- + dlls/wined3d/device.c | 14 +++----------- dlls/wined3d/wined3d_private.h | 2 +- - 3 files changed, 23 insertions(+), 22 deletions(-) + 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index de5ab17d1d7..e6e4d8379df 100644 +index fa3e3a7380a..5cf7b1068f9 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -532,7 +532,7 @@ ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer) @@ -91,10 +91,10 @@ index de5ab17d1d7..e6e4d8379df 100644 static ULONG buffer_resource_incref(struct wined3d_resource *resource) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 0e969be247e..d2b332e0089 100644 +index a7ee5bc099d..a3adf3255f1 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -4078,6 +4078,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4127,6 +4127,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str if (resource->type == WINED3D_RTYPE_BUFFER) { struct wined3d_buffer *buffer = buffer_from_resource(resource); @@ -102,14 +102,15 @@ index 0e969be247e..d2b332e0089 100644 if (sub_resource_idx > 0) { -@@ -4085,16 +4086,8 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4134,17 +4135,8 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str return; } -- context = context_acquire(resource->device, NULL); +- context = context_acquire(resource->device, NULL, 0); - if (!wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_BUFFER)) - { - ERR("Failed to load buffer location.\n"); +- context_release(context); - return; - } - @@ -122,10 +123,10 @@ index 0e969be247e..d2b332e0089 100644 return; } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 7209ce8d170..3044f16d1ce 100644 +index 50b7c93cad8..30de702098a 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3261,7 +3261,7 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer, +@@ -3300,7 +3300,7 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer, BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN; HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset, struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-Silence_FIXMEs/0006-wined3d-Silence-extremely-noisy-FIXME-in-wined3d_tex.patch b/patches/wined3d-Silence_FIXMEs/0006-wined3d-Silence-extremely-noisy-FIXME-in-wined3d_tex.patch index 90166d68..a93a280a 100644 --- a/patches/wined3d-Silence_FIXMEs/0006-wined3d-Silence-extremely-noisy-FIXME-in-wined3d_tex.patch +++ b/patches/wined3d-Silence_FIXMEs/0006-wined3d-Silence-extremely-noisy-FIXME-in-wined3d_tex.patch @@ -1,4 +1,4 @@ -From 0a7d13f672cea0839dade4d06a332c024bea9a24 Mon Sep 17 00:00:00 2001 +From 40557e752dfc48ee40e75173c6eb32bf640ef286 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 21 Mar 2016 18:27:59 +0100 Subject: wined3d: Silence extremely noisy FIXME in @@ -9,18 +9,18 @@ Subject: wined3d: Silence extremely noisy FIXME in 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 1f0a97a..2d8df58 100644 +index e77e13356a5..a26b2dfb619 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -1418,7 +1418,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, +@@ -1469,7 +1469,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, sub_resource_idx = layer * texture->level_count; if (dirty_region) - FIXME("Ignoring dirty_region %s.\n", debug_box(dirty_region)); + WARN("Ignoring dirty_region %s.\n", debug_box(dirty_region)); - context = context_acquire(texture->resource.device, NULL); + context = context_acquire(texture->resource.device, NULL, 0); if (!wined3d_texture_load_location(texture, sub_resource_idx, context, texture->resource.map_binding)) -- -2.9.0 +2.11.0