[PATCH 1/7] d3dx9: Shape functions in own file, add stub and basic tests for D3DXCreateSphere.
Misha Koshelev
misha680 at gmail.com
Wed Jun 23 22:18:25 CDT 2010
Dan suggested tests ok during code freeze so blame Dan for my patches ;)
---
dlls/d3dx9_36/Makefile.in | 1 +
dlls/d3dx9_36/d3dx9_36.spec | 2 +-
dlls/d3dx9_36/mesh.c | 8 ----
dlls/d3dx9_36/shape.c | 52 +++++++++++++++++++++++++++
dlls/d3dx9_36/tests/Makefile.in | 1 +
dlls/d3dx9_36/tests/shape.c | 75 +++++++++++++++++++++++++++++++++++++++
include/d3dx9shape.h | 7 ++++
7 files changed, 137 insertions(+), 9 deletions(-)
create mode 100644 dlls/d3dx9_36/shape.c
create mode 100644 dlls/d3dx9_36/tests/shape.c
diff --git a/dlls/d3dx9_36/Makefile.in b/dlls/d3dx9_36/Makefile.in
index 712077b..ab02652 100644
--- a/dlls/d3dx9_36/Makefile.in
+++ b/dlls/d3dx9_36/Makefile.in
@@ -19,6 +19,7 @@ C_SRCS = \
math.c \
mesh.c \
shader.c \
+ shape.c \
sprite.c \
surface.c \
texture.c \
diff --git a/dlls/d3dx9_36/d3dx9_36.spec b/dlls/d3dx9_36/d3dx9_36.spec
index 19406e7..b9a00da 100644
--- a/dlls/d3dx9_36/d3dx9_36.spec
+++ b/dlls/d3dx9_36/d3dx9_36.spec
@@ -87,7 +87,7 @@
@ stub D3DXCreateSkinInfo
@ stub D3DXCreateSkinInfoFromBlendedMesh
@ stub D3DXCreateSkinInfoFVF
-@ stub D3DXCreateSphere
+@ stdcall D3DXCreateSphere(ptr long long long ptr ptr)
@ stdcall D3DXCreateSprite(ptr ptr)
@ stub D3DXCreateTeapot
@ stub D3DXCreateTextA
diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c
index 9691eed..37688c2 100644
--- a/dlls/d3dx9_36/mesh.c
+++ b/dlls/d3dx9_36/mesh.c
@@ -327,11 +327,3 @@ BOOL WINAPI D3DXSphereBoundProbe(CONST D3DXVECTOR3 *pcenter, FLOAT radius, CONST
if ( ( d <= 0.0f ) || ( sqrt(d) <= b ) ) return FALSE;
return TRUE;
}
-
-HRESULT WINAPI D3DXCreateBox(LPDIRECT3DDEVICE9 device, FLOAT width, FLOAT height,
- FLOAT depth, LPD3DXMESH* mesh, LPD3DXBUFFER* adjacency)
-{
- FIXME("(%p, %f, %f, %f, %p, %p): stub\n", device, width, height, depth, mesh, adjacency);
-
- return E_NOTIMPL;
-}
diff --git a/dlls/d3dx9_36/shape.c b/dlls/d3dx9_36/shape.c
new file mode 100644
index 0000000..715335e
--- /dev/null
+++ b/dlls/d3dx9_36/shape.c
@@ -0,0 +1,52 @@
+/*
+ * Shape operations specific to D3DX9.
+ *
+ * Copyright (C) 2010 Misha Koshelev
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+
+#define NONAMELESSUNION
+#include "windef.h"
+#include "wingdi.h"
+#include "d3dx9.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
+
+/*************************************************************************
+ * D3DXCreateBox
+ */
+HRESULT WINAPI D3DXCreateBox(LPDIRECT3DDEVICE9 device, FLOAT width, FLOAT height,
+ FLOAT depth, LPD3DXMESH* mesh, LPD3DXBUFFER* adjacency)
+{
+ FIXME("(%p, %f, %f, %f, %p, %p): stub\n", device, width, height, depth, mesh, adjacency);
+
+ return E_NOTIMPL;
+}
+
+/*************************************************************************
+ * D3DXCreateSphere
+ */
+HRESULT WINAPI D3DXCreateSphere(LPDIRECT3DDEVICE9 device, FLOAT radius, UINT slices,
+ UINT stacks, LPD3DXMESH* mesh, LPD3DXBUFFER* adjacency)
+{
+ FIXME("(%p, %f, %d, %d, %p, %p): stub\n", device, radius, slices, stacks, mesh, adjacency);
+
+ return E_NOTIMPL;
+}
diff --git a/dlls/d3dx9_36/tests/Makefile.in b/dlls/d3dx9_36/tests/Makefile.in
index b9ad40d..5be8ed2 100644
--- a/dlls/d3dx9_36/tests/Makefile.in
+++ b/dlls/d3dx9_36/tests/Makefile.in
@@ -13,6 +13,7 @@ C_SRCS = \
math.c \
mesh.c \
shader.c \
+ shape.c \
surface.c
RC_SRCS = rsrc.rc
diff --git a/dlls/d3dx9_36/tests/shape.c b/dlls/d3dx9_36/tests/shape.c
new file mode 100644
index 0000000..136853d
--- /dev/null
+++ b/dlls/d3dx9_36/tests/shape.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2010 Misha Koshelev
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "wine/test.h"
+#include "d3dx9.h"
+
+static void test_create_sphere(IDirect3DDevice9* device)
+{
+ HRESULT hr;
+
+ hr = D3DXCreateSphere(NULL, 0.0, 0, 0, NULL, NULL);
+ todo_wine ok( hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n",hr,D3DERR_INVALIDCALL);
+
+ hr = D3DXCreateSphere(NULL, 0.1, 0, 0, NULL, NULL);
+ todo_wine ok( hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n",hr,D3DERR_INVALIDCALL);
+
+ hr = D3DXCreateSphere(NULL, 0.0, 1, 0, NULL, NULL);
+ todo_wine ok( hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n",hr,D3DERR_INVALIDCALL);
+
+ hr = D3DXCreateSphere(NULL, 0.0, 0, 1, NULL, NULL);
+ todo_wine ok( hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n",hr,D3DERR_INVALIDCALL);
+}
+
+START_TEST(shape)
+{
+ HWND wnd;
+ IDirect3D9* d3d;
+ IDirect3DDevice9* device;
+ D3DPRESENT_PARAMETERS d3dpp;
+ HRESULT hr;
+
+ wnd = CreateWindow("static", "d3dx9_test", 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
+ d3d = Direct3DCreate9(D3D_SDK_VERSION);
+ if (!wnd) {
+ skip("Couldn't create application window\n");
+ return;
+ }
+ if (!d3d) {
+ skip("Couldn't create IDirect3D9 object\n");
+ DestroyWindow(wnd);
+ return;
+ }
+
+ ZeroMemory(&d3dpp, sizeof(d3dpp));
+ d3dpp.Windowed = TRUE;
+ d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
+ hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp, &device);
+ if (FAILED(hr)) {
+ skip("Failed to create IDirect3DDevice9 object %#x\n", hr);
+ IDirect3D9_Release(d3d);
+ DestroyWindow(wnd);
+ return;
+ }
+
+ test_create_sphere(device);
+
+ IDirect3DDevice9_Release(device);
+ IDirect3D9_Release(d3d);
+ DestroyWindow(wnd);
+}
diff --git a/include/d3dx9shape.h b/include/d3dx9shape.h
index e1bf231..36bca6b 100644
--- a/include/d3dx9shape.h
+++ b/include/d3dx9shape.h
@@ -32,6 +32,13 @@ HRESULT WINAPI D3DXCreateBox(LPDIRECT3DDEVICE9 device,
LPD3DXMESH* mesh,
LPD3DXBUFFER* adjacency);
+HRESULT WINAPI D3DXCreateSphere(LPDIRECT3DDEVICE9 device,
+ FLOAT radius,
+ UINT slices,
+ UINT stacks,
+ LPD3DXMESH* mesh,
+ LPD3DXBUFFER* adjacency);
+
#ifdef __cplusplus
}
#endif
--
1.7.1
More information about the wine-patches
mailing list