From 725789885840027a4ef647bd86cb457b6ce172fa Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 20 Jan 2017 07:53:43 +0100 Subject: [PATCH] Added patch to fix DrawIndexedPrimitiveUP with non-zero min_vertex_idx. --- ...exedPrimitiveUP-with-non-zero-min_ve.patch | 58 ++++++++ ...exedPrimitiveUP-with-non-zero-min_ve.patch | 58 ++++++++ ...dd-a-test-for-DrawIndexedPrimitiveUP.patch | 123 ++++++++++++++++ ...dd-a-test-for-DrawIndexedPrimitiveUP.patch | 132 ++++++++++++++++++ .../d3d9-DrawIndexedPrimitiveUP/definition | 1 + patches/patchinstall.sh | 25 ++++ 6 files changed, 397 insertions(+) create mode 100644 patches/d3d9-DrawIndexedPrimitiveUP/0001-d3d9-Fix-DrawIndexedPrimitiveUP-with-non-zero-min_ve.patch create mode 100644 patches/d3d9-DrawIndexedPrimitiveUP/0002-d3d8-Fix-DrawIndexedPrimitiveUP-with-non-zero-min_ve.patch create mode 100644 patches/d3d9-DrawIndexedPrimitiveUP/0003-d3d9-tests-Add-a-test-for-DrawIndexedPrimitiveUP.patch create mode 100644 patches/d3d9-DrawIndexedPrimitiveUP/0004-d3d8-tests-Add-a-test-for-DrawIndexedPrimitiveUP.patch create mode 100644 patches/d3d9-DrawIndexedPrimitiveUP/definition diff --git a/patches/d3d9-DrawIndexedPrimitiveUP/0001-d3d9-Fix-DrawIndexedPrimitiveUP-with-non-zero-min_ve.patch b/patches/d3d9-DrawIndexedPrimitiveUP/0001-d3d9-Fix-DrawIndexedPrimitiveUP-with-non-zero-min_ve.patch new file mode 100644 index 00000000..378008a6 --- /dev/null +++ b/patches/d3d9-DrawIndexedPrimitiveUP/0001-d3d9-Fix-DrawIndexedPrimitiveUP-with-non-zero-min_ve.patch @@ -0,0 +1,58 @@ +From 5c5620766e4e3be85bdec4aab689b9f5b42b2f2b Mon Sep 17 00:00:00 2001 +From: Matteo Bruni +Date: Wed, 18 Jan 2017 21:35:28 +0100 +Subject: d3d9: Fix DrawIndexedPrimitiveUP with non-zero min_vertex_idx. + +Signed-off-by: Matteo Bruni +--- + dlls/d3d9/device.c | 14 ++++++-------- + 1 file changed, 6 insertions(+), 8 deletions(-) + +diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c +index e0bc5859c61..e646cb76c76 100644 +--- a/dlls/d3d9/device.c ++++ b/dlls/d3d9/device.c +@@ -2485,18 +2485,16 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitiveUP(IDirect3DDevice9Ex *ifa + UINT primitive_count, const void *index_data, D3DFORMAT index_format, + const void *vertex_data, UINT vertex_stride) + { +- struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); +- HRESULT hr; + UINT idx_count = vertex_count_from_primitive_count(primitive_type, primitive_count); ++ struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); + UINT idx_fmt_size = index_format == D3DFMT_INDEX16 ? 2 : 4; ++ UINT vtx_size = vertex_count * vertex_stride; + UINT idx_size = idx_count * idx_fmt_size; + struct wined3d_map_desc wined3d_map_desc; + struct wined3d_box wined3d_box = {0}; + struct wined3d_resource *ib, *vb; +- UINT ib_pos; +- +- UINT vtx_size = vertex_count * vertex_stride; +- UINT vb_pos, align; ++ UINT vb_pos, ib_pos, align; ++ HRESULT hr; + + TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, vertex_count %u, primitive_count %u, " + "index_data %p, index_format %#x, vertex_data %p, vertex_stride %u.\n", +@@ -2536,7 +2534,7 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitiveUP(IDirect3DDevice9Ex *ifa + if (FAILED(hr = wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box, + vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD))) + goto done; +- memcpy(wined3d_map_desc.data, vertex_data, vtx_size); ++ memcpy(wined3d_map_desc.data, (char *)vertex_data + min_vertex_idx * vertex_stride, vtx_size); + wined3d_resource_unmap(vb, 0); + device->vertex_buffer_pos = vb_pos + vtx_size; + +@@ -2568,7 +2566,7 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitiveUP(IDirect3DDevice9Ex *ifa + + wined3d_device_set_index_buffer(device->wined3d_device, device->index_buffer, + wined3dformat_from_d3dformat(index_format), 0); +- wined3d_device_set_base_vertex_index(device->wined3d_device, vb_pos / vertex_stride); ++ wined3d_device_set_base_vertex_index(device->wined3d_device, vb_pos / vertex_stride - min_vertex_idx); + + wined3d_device_set_primitive_type(device->wined3d_device, primitive_type); + hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / idx_fmt_size, idx_count); +-- +2.11.0 + diff --git a/patches/d3d9-DrawIndexedPrimitiveUP/0002-d3d8-Fix-DrawIndexedPrimitiveUP-with-non-zero-min_ve.patch b/patches/d3d9-DrawIndexedPrimitiveUP/0002-d3d8-Fix-DrawIndexedPrimitiveUP-with-non-zero-min_ve.patch new file mode 100644 index 00000000..9ed82a46 --- /dev/null +++ b/patches/d3d9-DrawIndexedPrimitiveUP/0002-d3d8-Fix-DrawIndexedPrimitiveUP-with-non-zero-min_ve.patch @@ -0,0 +1,58 @@ +From 6ab43f9745b48a8646b54c1a072a07ddd96e333b Mon Sep 17 00:00:00 2001 +From: Matteo Bruni +Date: Wed, 18 Jan 2017 21:35:29 +0100 +Subject: d3d8: Fix DrawIndexedPrimitiveUP with non-zero min_vertex_idx. + +Signed-off-by: Matteo Bruni +--- + dlls/d3d8/device.c | 14 ++++++-------- + 1 file changed, 6 insertions(+), 8 deletions(-) + +diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c +index 43b8e2be4bb..805694b8536 100644 +--- a/dlls/d3d8/device.c ++++ b/dlls/d3d8/device.c +@@ -2124,18 +2124,16 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface + UINT primitive_count, const void *index_data, D3DFORMAT index_format, + const void *vertex_data, UINT vertex_stride) + { +- struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); +- HRESULT hr; + UINT idx_count = vertex_count_from_primitive_count(primitive_type, primitive_count); ++ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); + UINT idx_fmt_size = index_format == D3DFMT_INDEX16 ? 2 : 4; ++ UINT vtx_size = vertex_count * vertex_stride; + UINT idx_size = idx_count * idx_fmt_size; + struct wined3d_map_desc wined3d_map_desc; + struct wined3d_box wined3d_box = {0}; + struct wined3d_resource *ib, *vb; +- UINT ib_pos; +- +- UINT vtx_size = vertex_count * vertex_stride; +- UINT vb_pos, align; ++ UINT vb_pos, ib_pos, align; ++ HRESULT hr; + + TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, vertex_count %u, primitive_count %u, " + "index_data %p, index_format %#x, vertex_data %p, vertex_stride %u.\n", +@@ -2168,7 +2166,7 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface + if (FAILED(hr = wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box, + vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD))) + goto done; +- memcpy(wined3d_map_desc.data, vertex_data, vtx_size); ++ memcpy(wined3d_map_desc.data, (char *)vertex_data + min_vertex_idx * vertex_stride, vtx_size); + wined3d_resource_unmap(vb, 0); + device->vertex_buffer_pos = vb_pos + vtx_size; + +@@ -2200,7 +2198,7 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface + + wined3d_device_set_index_buffer(device->wined3d_device, device->index_buffer, + wined3dformat_from_d3dformat(index_format), 0); +- wined3d_device_set_base_vertex_index(device->wined3d_device, vb_pos / vertex_stride); ++ wined3d_device_set_base_vertex_index(device->wined3d_device, vb_pos / vertex_stride - min_vertex_idx); + + wined3d_device_set_primitive_type(device->wined3d_device, primitive_type); + hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / idx_fmt_size, idx_count); +-- +2.11.0 + diff --git a/patches/d3d9-DrawIndexedPrimitiveUP/0003-d3d9-tests-Add-a-test-for-DrawIndexedPrimitiveUP.patch b/patches/d3d9-DrawIndexedPrimitiveUP/0003-d3d9-tests-Add-a-test-for-DrawIndexedPrimitiveUP.patch new file mode 100644 index 00000000..9cb91083 --- /dev/null +++ b/patches/d3d9-DrawIndexedPrimitiveUP/0003-d3d9-tests-Add-a-test-for-DrawIndexedPrimitiveUP.patch @@ -0,0 +1,123 @@ +From c50f96ff6353cc65ed3e39b43fd7e46cf2678c69 Mon Sep 17 00:00:00 2001 +From: Matteo Bruni +Date: Wed, 18 Jan 2017 21:35:30 +0100 +Subject: d3d9/tests: Add a test for DrawIndexedPrimitiveUP(). + +Signed-off-by: Matteo Bruni +--- + dlls/d3d9/tests/visual.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 94 insertions(+) + +diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c +index a1064127d5a..be544f3b5c7 100644 +--- a/dlls/d3d9/tests/visual.c ++++ b/dlls/d3d9/tests/visual.c +@@ -22244,6 +22244,99 @@ done: + DestroyWindow(window); + } + ++static void test_drawindexedprimitiveup(void) ++{ ++ static const struct vertex ++ { ++ struct vec3 position; ++ DWORD diffuse; ++ } ++ quad[] = ++ { ++ {{-1.0f, -1.0f, 0.1f}, 0xff00ff00}, ++ {{-1.0f, 1.0f, 0.1f}, 0xff0000ff}, ++ {{ 1.0f, -1.0f, 0.1f}, 0xffff0000}, ++ {{ 1.0f, 1.0f, 0.1f}, 0xff0000ff}, ++ ++ {{-1.0f, -1.0f, 0.1f}, 0xff0000ff}, ++ {{-1.0f, 1.0f, 0.1f}, 0xff00ff00}, ++ {{ 1.0f, -1.0f, 0.1f}, 0xffff0000}, ++ {{ 1.0f, 1.0f, 0.1f}, 0xff00ff00}, ++ }; ++ static const unsigned short indices[] = {0, 1, 2, 3, 4, 5, 6, 7}; ++ IDirect3DDevice9 *device; ++ IDirect3D9 *d3d; ++ ULONG refcount; ++ D3DCOLOR color; ++ HWND window; ++ HRESULT hr; ++ ++ window = create_window(); ++ d3d = Direct3DCreate9(D3D_SDK_VERSION); ++ ok(!!d3d, "Failed to create a D3D object.\n"); ++ ++ if (!(device = create_device(d3d, window, window, TRUE))) ++ { ++ skip("Failed to create a D3D device.\n"); ++ IDirect3D9_Release(d3d); ++ DestroyWindow(window); ++ return; ++ } ++ ++ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_CLIPPING, FALSE); ++ ok(SUCCEEDED(hr), "Failed to disable clipping, hr %#x.\n", hr); ++ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, FALSE); ++ ok(SUCCEEDED(hr), "Failed to disable Z test, hr %#x.\n", hr); ++ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); ++ ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr); ++ ++ hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); ++ ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr); ++ ++ hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0f, 0); ++ ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); ++ ++ hr = IDirect3DDevice9_BeginScene(device); ++ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); ++ hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 4, 4, 2, indices + 4, D3DFMT_INDEX16, quad, sizeof(*quad)); ++ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); ++ hr = IDirect3DDevice9_EndScene(device); ++ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); ++ ++ color = getPixelColor(device, 160, 120); ++ ok(color_match(color, 0x0040bf00, 1), "Got unexpected color 0x%08x.\n", color); ++ color = getPixelColor(device, 480, 120); ++ ok(color_match(color, 0x0040bf00, 1), "Got unexpected color 0x%08x.\n", color); ++ color = getPixelColor(device, 160, 360); ++ ok(color_match(color, 0x00404080, 1), "Got unexpected color 0x%08x.\n", color); ++ color = getPixelColor(device, 480, 360); ++ ok(color_match(color, 0x00bf4000, 1), "Got unexpected color 0x%08x.\n", color); ++ ++ hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0f, 0); ++ ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); ++ ++ hr = IDirect3DDevice9_BeginScene(device); ++ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); ++ hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 0, 4, 2, indices, D3DFMT_INDEX16, quad, sizeof(*quad)); ++ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); ++ hr = IDirect3DDevice9_EndScene(device); ++ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); ++ ++ color = getPixelColor(device, 160, 120); ++ ok(color_match(color, 0x004000bf, 1), "Got unexpected color 0x%08x.\n", color); ++ color = getPixelColor(device, 480, 120); ++ ok(color_match(color, 0x004000bf, 1), "Got unexpected color 0x%08x.\n", color); ++ color = getPixelColor(device, 160, 360); ++ ok(color_match(color, 0x00408040, 1), "Got unexpected color 0x%08x.\n", color); ++ color = getPixelColor(device, 480, 360); ++ ok(color_match(color, 0x00bf0040, 1), "Got unexpected color 0x%08x.\n", color); ++ ++ refcount = IDirect3DDevice9_Release(device); ++ ok(!refcount, "Device has %u references left.\n", refcount); ++ IDirect3D9_Release(d3d); ++ DestroyWindow(window); ++} ++ + START_TEST(visual) + { + D3DADAPTER_IDENTIFIER9 identifier; +@@ -22372,4 +22465,5 @@ START_TEST(visual) + test_evict_bound_resources(); + test_max_index16(); + test_backbuffer_resize(); ++ test_drawindexedprimitiveup(); + } +-- +2.11.0 + diff --git a/patches/d3d9-DrawIndexedPrimitiveUP/0004-d3d8-tests-Add-a-test-for-DrawIndexedPrimitiveUP.patch b/patches/d3d9-DrawIndexedPrimitiveUP/0004-d3d8-tests-Add-a-test-for-DrawIndexedPrimitiveUP.patch new file mode 100644 index 00000000..90380cb6 --- /dev/null +++ b/patches/d3d9-DrawIndexedPrimitiveUP/0004-d3d8-tests-Add-a-test-for-DrawIndexedPrimitiveUP.patch @@ -0,0 +1,132 @@ +From 38c67dd093a7b64dc3730cf6b919f4bcf31c65f0 Mon Sep 17 00:00:00 2001 +From: Matteo Bruni +Date: Wed, 18 Jan 2017 21:35:31 +0100 +Subject: d3d8/tests: Add a test for DrawIndexedPrimitiveUP(). + +Signed-off-by: Matteo Bruni +--- + dlls/d3d8/tests/visual.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 103 insertions(+) + +diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c +index c0ecc6a6fa6..57c89171b7d 100644 +--- a/dlls/d3d8/tests/visual.c ++++ b/dlls/d3d8/tests/visual.c +@@ -9700,6 +9700,108 @@ done: + DestroyWindow(window); + } + ++static void test_drawindexedprimitiveup(void) ++{ ++ static const struct vertex ++ { ++ struct vec3 position; ++ DWORD diffuse; ++ } ++ quad[] = ++ { ++ {{-1.0f, -1.0f, 0.1f}, 0xff00ff00}, ++ {{-1.0f, 1.0f, 0.1f}, 0xff0000ff}, ++ {{ 1.0f, -1.0f, 0.1f}, 0xffff0000}, ++ {{ 1.0f, 1.0f, 0.1f}, 0xff0000ff}, ++ ++ {{-1.0f, -1.0f, 0.1f}, 0xff0000ff}, ++ {{-1.0f, 1.0f, 0.1f}, 0xff00ff00}, ++ {{ 1.0f, -1.0f, 0.1f}, 0xffff0000}, ++ {{ 1.0f, 1.0f, 0.1f}, 0xff00ff00}, ++ }; ++ static const unsigned short indices[] = {0, 1, 2, 3, 4, 5, 6, 7}; ++ IDirect3DDevice8 *device; ++ IDirect3D8 *d3d; ++ ULONG refcount; ++ D3DCOLOR color; ++ HWND window; ++ HRESULT hr; ++ ++ window = create_window(); ++ d3d = Direct3DCreate8(D3D_SDK_VERSION); ++ ok(!!d3d, "Failed to create a D3D object.\n"); ++ ++ if (!(device = create_device(d3d, window, window, TRUE))) ++ { ++ skip("Failed to create a D3D device.\n"); ++ IDirect3D8_Release(d3d); ++ DestroyWindow(window); ++ return; ++ } ++ ++ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_CLIPPING, FALSE); ++ ok(SUCCEEDED(hr), "Failed to disable clipping, hr %#x.\n", hr); ++ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZENABLE, FALSE); ++ ok(SUCCEEDED(hr), "Failed to disable Z test, hr %#x.\n", hr); ++ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); ++ ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr); ++ ++ hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); ++ ok(SUCCEEDED(hr), "Failed to set color op, hr %#x.\n", hr); ++ hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_DIFFUSE); ++ ok(SUCCEEDED(hr), "Failed to set color arg, hr %#x.\n", hr); ++ hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); ++ ok(SUCCEEDED(hr), "Failed to set alpha op, hr %#x.\n", hr); ++ hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE); ++ ok(SUCCEEDED(hr), "Failed to set alpha arg, hr %#x.\n", hr); ++ ++ hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); ++ ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr); ++ ++ hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0f, 0); ++ ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); ++ ++ hr = IDirect3DDevice8_BeginScene(device); ++ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); ++ hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 4, 4, 2, indices + 4, D3DFMT_INDEX16, quad, sizeof(*quad)); ++ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); ++ hr = IDirect3DDevice8_EndScene(device); ++ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); ++ ++ color = getPixelColor(device, 160, 120); ++ ok(color_match(color, 0x0040bf00, 1), "Got unexpected color 0x%08x.\n", color); ++ color = getPixelColor(device, 480, 120); ++ ok(color_match(color, 0x0040bf00, 1), "Got unexpected color 0x%08x.\n", color); ++ color = getPixelColor(device, 160, 360); ++ ok(color_match(color, 0x00404080, 1), "Got unexpected color 0x%08x.\n", color); ++ color = getPixelColor(device, 480, 360); ++ ok(color_match(color, 0x00bf4000, 1), "Got unexpected color 0x%08x.\n", color); ++ ++ hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0f, 0); ++ ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); ++ ++ hr = IDirect3DDevice8_BeginScene(device); ++ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); ++ hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 0, 4, 2, indices, D3DFMT_INDEX16, quad, sizeof(*quad)); ++ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); ++ hr = IDirect3DDevice8_EndScene(device); ++ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); ++ ++ color = getPixelColor(device, 160, 120); ++ ok(color_match(color, 0x004000bf, 1), "Got unexpected color 0x%08x.\n", color); ++ color = getPixelColor(device, 480, 120); ++ ok(color_match(color, 0x004000bf, 1), "Got unexpected color 0x%08x.\n", color); ++ color = getPixelColor(device, 160, 360); ++ ok(color_match(color, 0x00408040, 1), "Got unexpected color 0x%08x.\n", color); ++ color = getPixelColor(device, 480, 360); ++ ok(color_match(color, 0x00bf0040, 1), "Got unexpected color 0x%08x.\n", color); ++ ++ refcount = IDirect3DDevice8_Release(device); ++ ok(!refcount, "Device has %u references left.\n", refcount); ++ IDirect3D8_Release(d3d); ++ DestroyWindow(window); ++} ++ + START_TEST(visual) + { + D3DADAPTER_IDENTIFIER8 identifier; +@@ -9770,4 +9872,5 @@ START_TEST(visual) + test_edge_antialiasing_blending(); + test_max_index16(); + test_backbuffer_resize(); ++ test_drawindexedprimitiveup(); + } +-- +2.11.0 + diff --git a/patches/d3d9-DrawIndexedPrimitiveUP/definition b/patches/d3d9-DrawIndexedPrimitiveUP/definition new file mode 100644 index 00000000..4db3461b --- /dev/null +++ b/patches/d3d9-DrawIndexedPrimitiveUP/definition @@ -0,0 +1 @@ +Fixes: [35993] Fix DrawIndexedPrimitiveUP with non-zero min_vertex_idx diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 71f8c070..af27cdb2 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -113,6 +113,7 @@ patch_enable_all () enable_d3d11_ID3D11Texture1D="$1" enable_d3d8_ValidateShader="$1" enable_d3d9_DesktopWindow="$1" + enable_d3d9_DrawIndexedPrimitiveUP="$1" enable_d3d9_Surface_Refcount="$1" enable_d3d9_Tests="$1" enable_d3dx11_D3DX11CreateShaderResourceViewFromMemory="$1" @@ -553,6 +554,9 @@ patch_enable () d3d9-DesktopWindow) enable_d3d9_DesktopWindow="$2" ;; + d3d9-DrawIndexedPrimitiveUP) + enable_d3d9_DrawIndexedPrimitiveUP="$2" + ;; d3d9-Surface_Refcount) enable_d3d9_Surface_Refcount="$2" ;; @@ -3382,6 +3386,27 @@ if test "$enable_d3d9_DesktopWindow" -eq 1; then ) >> "$patchlist" fi +# Patchset d3d9-DrawIndexedPrimitiveUP +# | +# | This patchset fixes the following Wine bugs: +# | * [#35993] Fix DrawIndexedPrimitiveUP with non-zero min_vertex_idx +# | +# | Modified files: +# | * dlls/d3d8/device.c, dlls/d3d8/tests/visual.c, dlls/d3d9/device.c, dlls/d3d9/tests/visual.c +# | +if test "$enable_d3d9_DrawIndexedPrimitiveUP" -eq 1; then + patch_apply d3d9-DrawIndexedPrimitiveUP/0001-d3d9-Fix-DrawIndexedPrimitiveUP-with-non-zero-min_ve.patch + patch_apply d3d9-DrawIndexedPrimitiveUP/0002-d3d8-Fix-DrawIndexedPrimitiveUP-with-non-zero-min_ve.patch + patch_apply d3d9-DrawIndexedPrimitiveUP/0003-d3d9-tests-Add-a-test-for-DrawIndexedPrimitiveUP.patch + patch_apply d3d9-DrawIndexedPrimitiveUP/0004-d3d8-tests-Add-a-test-for-DrawIndexedPrimitiveUP.patch + ( + printf '%s\n' '+ { "Matteo Bruni", "d3d9: Fix DrawIndexedPrimitiveUP with non-zero min_vertex_idx.", 1 },'; + printf '%s\n' '+ { "Matteo Bruni", "d3d8: Fix DrawIndexedPrimitiveUP with non-zero min_vertex_idx.", 1 },'; + printf '%s\n' '+ { "Matteo Bruni", "d3d9/tests: Add a test for DrawIndexedPrimitiveUP().", 1 },'; + printf '%s\n' '+ { "Matteo Bruni", "d3d8/tests: Add a test for DrawIndexedPrimitiveUP().", 1 },'; + ) >> "$patchlist" +fi + # Patchset d3d9-Surface_Refcount # | # | This patchset fixes the following Wine bugs: