diff --git a/patches/Makefile b/patches/Makefile index a96d7089..69f505a1 100644 --- a/patches/Makefile +++ b/patches/Makefile @@ -307,7 +307,7 @@ configure-Detect_Gnutls.ok: # Patchset d3dx9_36-CreatePolygon # | # | Included patches: -# | * Implement D3DXCreatePolygon. [by Sebastian Lackner] +# | * Implement D3DXCreatePolygon. [rev 2, by Sebastian Lackner] # | # | This patchset fixes the following Wine bugs: # | * [#13632] Support for D3DXCreatePolygon @@ -320,7 +320,7 @@ d3dx9_36-CreatePolygon.ok: $(call APPLY_FILE,d3dx9_36-CreatePolygon/0001-d3dx9_36-Implement-D3DXCreatePolygon.patch) $(call APPLY_FILE,d3dx9_36-CreatePolygon/0002-d3dx9_36-tests-Add-tests-for-D3DXCreatePolygon.patch) @( \ - echo '+ { "d3dx9_36-CreatePolygon", "Sebastian Lackner", "Implement D3DXCreatePolygon." },'; \ + echo '+ { "d3dx9_36-CreatePolygon", "Sebastian Lackner", "Implement D3DXCreatePolygon. [rev 2]" },'; \ ) > d3dx9_36-CreatePolygon.ok # Patchset d3dx9_36-Filter_Warnings diff --git a/patches/d3dx9_36-CreatePolygon/0001-d3dx9_36-Implement-D3DXCreatePolygon.patch b/patches/d3dx9_36-CreatePolygon/0001-d3dx9_36-Implement-D3DXCreatePolygon.patch index c371cab3..e0fae8c6 100644 --- a/patches/d3dx9_36-CreatePolygon/0001-d3dx9_36-Implement-D3DXCreatePolygon.patch +++ b/patches/d3dx9_36-CreatePolygon/0001-d3dx9_36-Implement-D3DXCreatePolygon.patch @@ -1,4 +1,4 @@ -From 0daaeab7e4e9b36cafbeb3fe296a1d62cd79c20b Mon Sep 17 00:00:00 2001 +From 09aaa5716d86ecab330f01957995864a683a98c9 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 31 Oct 2014 09:43:40 +0100 Subject: d3dx9_36: Implement D3DXCreatePolygon. @@ -6,12 +6,12 @@ Subject: d3dx9_36: Implement D3DXCreatePolygon. Based on a patch by David Adam. --- dlls/d3dx9_36/d3dx9_36.spec | 2 +- - dlls/d3dx9_36/mesh.c | 89 +++++++++++++++++++++++++++++++++++++++++++++ - include/d3dx9shape.h | 2 + - 3 files changed, 92 insertions(+), 1 deletion(-) + dlls/d3dx9_36/mesh.c | 88 +++++++++++++++++++++++++++++++++++++++++++++ + include/d3dx9shape.h | 2 ++ + 3 files changed, 91 insertions(+), 1 deletion(-) diff --git a/dlls/d3dx9_36/d3dx9_36.spec b/dlls/d3dx9_36/d3dx9_36.spec -index 4c72dc2..ebe46dc 100644 +index 4c72dc2..13f0d99 100644 --- a/dlls/d3dx9_36/d3dx9_36.spec +++ b/dlls/d3dx9_36/d3dx9_36.spec @@ -76,7 +76,7 @@ @@ -24,10 +24,10 @@ index 4c72dc2..ebe46dc 100644 @ stub D3DXCreatePRTBufferTex(long long long long ptr) @ stub D3DXCreatePRTCompBuffer(long long long ptr ptr ptr ptr) diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c -index aecb45d..9bd24e4 100644 +index aecb45d..fe2899a 100644 --- a/dlls/d3dx9_36/mesh.c +++ b/dlls/d3dx9_36/mesh.c -@@ -4555,6 +4555,95 @@ struct vertex +@@ -4555,6 +4555,94 @@ struct vertex D3DXVECTOR3 normal; }; @@ -42,15 +42,14 @@ index aecb45d..9bd24e4 100644 + float scale; + unsigned int i; + -+ TRACE("(%p, %f, %u, %p, %p)\n", device, length, sides, mesh, adjacency); ++ TRACE("device %p, length %f, sides %u, mesh %p, adjacency %p.\n", ++ device, length, sides, mesh, adjacency); + -+ if (!device || length < 0.0f || sides == 0 || !mesh) -+ { ++ if (!device || length < 0.0f || sides < 3 || !mesh) + return D3DERR_INVALIDCALL; -+ } + + if (FAILED(hr = D3DXCreateMeshFVF(sides, sides + 1, D3DXMESH_MANAGED, -+ D3DFVF_XYZ | D3DFVF_NORMAL,device, &polygon))) ++ D3DFVF_XYZ | D3DFVF_NORMAL, device, &polygon))) + { + return hr; + } @@ -68,7 +67,7 @@ index aecb45d..9bd24e4 100644 + return hr; + } + -+ scale = 0.5f * length / sin(D3DX_PI / sides); ++ scale = 0.5f * length / sinf(D3DX_PI / sides); + + vertices[0].position.x = 0.0f; + vertices[0].position.y = 0.0f; @@ -77,10 +76,10 @@ index aecb45d..9bd24e4 100644 + vertices[0].normal.y = 0.0f; + vertices[0].normal.z = 1.0f; + -+ for (i = 0; i < sides; i++) ++ for (i = 0; i < sides; ++i) + { -+ vertices[i + 1].position.x = cos(2.0f * D3DX_PI * i / sides) * scale; -+ vertices[i + 1].position.y = sin(2.0f * D3DX_PI * i / sides) * scale; ++ vertices[i + 1].position.x = cosf(2.0f * D3DX_PI * i / sides) * scale; ++ vertices[i + 1].position.y = sinf(2.0f * D3DX_PI * i / sides) * scale; + vertices[i + 1].position.z = 0.0f; + vertices[i + 1].normal.x = 0.0f; + vertices[i + 1].normal.y = 0.0f; @@ -105,10 +104,10 @@ index aecb45d..9bd24e4 100644 + } + + adjacency_buf = ID3DXBuffer_GetBufferPointer(*adjacency); -+ for (i = 0; i < sides; i++) ++ for (i = 0; i < sides; ++i) + { + adjacency_buf[i][0] = i - 1; -+ adjacency_buf[i][1] = -1; ++ adjacency_buf[i][1] = ~0; + adjacency_buf[i][2] = i + 1; + } + adjacency_buf[0][0] = sides - 1; @@ -137,5 +136,5 @@ index 0d24032..af49bb4 100644 UINT stacks, struct ID3DXMesh **mesh, struct ID3DXBuffer **adjacency); HRESULT WINAPI D3DXCreateTeapot(struct IDirect3DDevice9 *device, -- -2.1.2 +2.1.3 diff --git a/patches/d3dx9_36-CreatePolygon/0002-d3dx9_36-tests-Add-tests-for-D3DXCreatePolygon.patch b/patches/d3dx9_36-CreatePolygon/0002-d3dx9_36-tests-Add-tests-for-D3DXCreatePolygon.patch index d85eb0e0..687d7f14 100644 --- a/patches/d3dx9_36-CreatePolygon/0002-d3dx9_36-tests-Add-tests-for-D3DXCreatePolygon.patch +++ b/patches/d3dx9_36-CreatePolygon/0002-d3dx9_36-tests-Add-tests-for-D3DXCreatePolygon.patch @@ -1,22 +1,22 @@ -From 362624947b13048efb0577a980aa3f5306200fdc Mon Sep 17 00:00:00 2001 +From 093ae53bc51d4a75a510a6bf52e88d96eda486a7 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 31 Oct 2014 10:56:42 +0100 Subject: d3dx9_36/tests: Add tests for D3DXCreatePolygon. Based on a patch by David Adam. --- - dlls/d3dx9_36/tests/mesh.c | 154 +++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 154 insertions(+) + dlls/d3dx9_36/tests/mesh.c | 163 +++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 163 insertions(+) diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c -index 17c5d9c..9e4938c 100644 +index 17c5d9c..66faf4a 100644 --- a/dlls/d3dx9_36/tests/mesh.c +++ b/dlls/d3dx9_36/tests/mesh.c -@@ -2600,6 +2600,159 @@ end: +@@ -2600,6 +2600,168 @@ end: DestroyWindow(wnd); } -+static BOOL compute_polygon(struct mesh *mesh, float length, UINT sides) ++static BOOL compute_polygon(struct mesh *mesh, float length, unsigned int sides) +{ + unsigned int i; + float scale; @@ -24,7 +24,7 @@ index 17c5d9c..9e4938c 100644 + if (!new_mesh(mesh, sides + 1, sides)) + return FALSE; + -+ scale = 0.5f * length / sin(D3DX_PI / sides); ++ scale = 0.5f * length / sinf(D3DX_PI / sides); + + mesh->vertices[0].position.x = 0.0f; + mesh->vertices[0].position.y = 0.0f; @@ -33,10 +33,10 @@ index 17c5d9c..9e4938c 100644 + mesh->vertices[0].normal.y = 0.0f; + mesh->vertices[0].normal.z = 1.0f; + -+ for (i = 0; i < sides; i++) ++ for (i = 0; i < sides; ++i) + { -+ mesh->vertices[i + 1].position.x = cos(2.0f * D3DX_PI * i / sides) * scale; -+ mesh->vertices[i + 1].position.y = sin(2.0f * D3DX_PI * i / sides) * scale; ++ mesh->vertices[i + 1].position.x = cosf(2.0f * D3DX_PI * i / sides) * scale; ++ mesh->vertices[i + 1].position.y = sinf(2.0f * D3DX_PI * i / sides) * scale; + mesh->vertices[i + 1].position.z = 0.0f; + mesh->vertices[i + 1].normal.x = 0.0f; + mesh->vertices[i + 1].normal.y = 0.0f; @@ -52,7 +52,7 @@ index 17c5d9c..9e4938c 100644 + return TRUE; +} + -+static void test_polygon(IDirect3DDevice9 *device, float length, UINT sides) ++static void test_polygon(IDirect3DDevice9 *device, float length, unsigned int sides) +{ + HRESULT hr; + ID3DXMesh *polygon; @@ -88,11 +88,11 @@ index 17c5d9c..9e4938c 100644 +{ + HRESULT hr; + HWND wnd; -+ IDirect3D9* d3d; -+ IDirect3DDevice9* device; ++ IDirect3D9 *d3d; ++ IDirect3DDevice9 *device; + D3DPRESENT_PARAMETERS d3dpp; -+ ID3DXMesh* polygon; -+ ID3DXBuffer* ppBuffer; ++ ID3DXMesh *polygon; ++ ID3DXBuffer *adjacency; + DWORD (*buffer)[3], buffer_size; + unsigned int i; + @@ -112,7 +112,8 @@ index 17c5d9c..9e4938c 100644 + memset(&d3dpp, 0, sizeof(d3dpp)); + d3dpp.Windowed = TRUE; + d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; -+ hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp, &device); ++ hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, ++ D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &device); + if (FAILED(hr)) + { + skip("Failed to create IDirect3DDevice9 object %#x\n", hr); @@ -121,20 +122,27 @@ index 17c5d9c..9e4938c 100644 + return; + } + -+ hr = D3DXCreatePolygon(device, 2.0f, 11, NULL, &ppBuffer); ++ hr = D3DXCreatePolygon(device, 2.0f, 11, NULL, &adjacency); + ok(hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, received %#x\n", hr); + -+ hr = D3DXCreatePolygon(NULL, 2.0f, 11, &polygon, &ppBuffer); ++ hr = D3DXCreatePolygon(NULL, 2.0f, 11, &polygon, &adjacency); + ok(hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, received %#x\n", hr); + -+ hr = D3DXCreatePolygon(device, -2.0f, 11, &polygon, &ppBuffer); ++ hr = D3DXCreatePolygon(device, -2.0f, 11, &polygon, &adjacency); + ok(hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, received %#x\n", hr); + -+ hr = D3DXCreatePolygon(device, 2.0f, 0, &polygon, &ppBuffer); ++ polygon = (void *)0xdeadbeef; ++ adjacency = (void *)0xdeadbeef; ++ hr = D3DXCreatePolygon(device, 2.0f, 0, &polygon, &adjacency); ++ ok(hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, received %#x\n", hr); ++ ok(polygon == (void *)0xdeadbeef, "Polygon was changed to %p\n", polygon); ++ ok(adjacency == (void *)0xdeadbeef, "Adjacency was changed to %p\n", adjacency); ++ ++ hr = D3DXCreatePolygon(device, 2.0f, 2, &polygon, &adjacency); + ok(hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, received %#x\n", hr); + -+ ppBuffer = NULL; -+ hr = D3DXCreatePolygon(device, 3.0f, 11, &polygon, &ppBuffer); ++ adjacency = NULL; ++ hr = D3DXCreatePolygon(device, 3.0f, 11, &polygon, &adjacency); + ok(hr == D3D_OK, "Expected D3D_OK, received %#x\n", hr); + + if (FAILED(hr)) @@ -143,20 +151,20 @@ index 17c5d9c..9e4938c 100644 + goto end; + } + -+ buffer_size = ID3DXBuffer_GetBufferSize(ppBuffer); -+ ok(buffer_size == 33 * sizeof(DWORD), "expected size %d, received %d\n", -+ 33 * sizeof(DWORD), buffer_size); ++ buffer_size = ID3DXBuffer_GetBufferSize(adjacency); ++ ok(buffer_size == 33 * sizeof(DWORD), "Wrong adjacency buffer size %u\n", buffer_size); + -+ buffer = ID3DXBuffer_GetBufferPointer(ppBuffer); -+ for (i = 0; i < 11; i++) ++ buffer = ID3DXBuffer_GetBufferPointer(adjacency); ++ for (i = 0; i < 11; ++i) + { -+ ok(buffer[i][0] == (i + 10) % 11, "wrong adjacency[%d][0] = %d\n", i, buffer[i][0]); -+ ok(buffer[i][1] == -1, "wrong adjacency[%d][1] = %d\n", i, buffer[i][1]); -+ ok(buffer[i][2] == (i + 1) % 11, "wrong adjacency[%d][2] = %d\n", i, buffer[i][2]); ++ ok(buffer[i][0] == (i + 10) % 11, "Wrong adjacency[%d][0] = %u\n", i, buffer[i][0]); ++ ok(buffer[i][1] == ~0, "Wrong adjacency[%d][1] = %u\n", i, buffer[i][1]); ++ ok(buffer[i][2] == (i + 1) % 11, "Wrong adjacency[%d][2] = %u\n", i, buffer[i][2]); + } + + polygon->lpVtbl->Release(polygon); + ++ test_polygon(device, 2.0f, 3); + test_polygon(device, 10.0f, 3); + test_polygon(device, 10.0f, 5); + test_polygon(device, 10.0f, 10); @@ -165,14 +173,15 @@ index 17c5d9c..9e4938c 100644 +end: + IDirect3DDevice9_Release(device); + IDirect3D9_Release(d3d); -+ if (ppBuffer) ID3DXBuffer_Release(ppBuffer); ++ if (adjacency) ++ ID3DXBuffer_Release(adjacency); + DestroyWindow(wnd); +} + struct sincos_table { float *sin; -@@ -10458,6 +10611,7 @@ START_TEST(mesh) +@@ -10458,6 +10620,7 @@ START_TEST(mesh) D3DXCreateMeshFVFTest(); D3DXLoadMeshTest(); D3DXCreateBoxTest(); @@ -181,5 +190,5 @@ index 17c5d9c..9e4938c 100644 D3DXCreateCylinderTest(); D3DXCreateTextTest(); -- -2.1.2 +2.1.3 diff --git a/patches/d3dx9_36-CreatePolygon/definition b/patches/d3dx9_36-CreatePolygon/definition index b29b283b..78686ab4 100644 --- a/patches/d3dx9_36-CreatePolygon/definition +++ b/patches/d3dx9_36-CreatePolygon/definition @@ -1,4 +1,4 @@ Author: Sebastian Lackner Subject: Implement D3DXCreatePolygon. -Revision: 1 +Revision: 2 Fixes: [13632] Support for D3DXCreatePolygon