kernelbase/tests: Use win_skip() for missing APIs.
[wine.git] / dlls / d3dx10_43 / mesh.c
blob5966661573de797dd56de7fd8150fcfe0e6df6a4
1 /*
2 * Copyright 2021 Nikolay Sivov for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #define COBJMACROS
21 #include "d3dx10.h"
23 #include "wine/debug.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
27 struct d3dx10_mesh
29 ID3DX10Mesh ID3DX10Mesh_iface;
30 LONG refcount;
33 static inline struct d3dx10_mesh *impl_from_ID3DX10Mesh(ID3DX10Mesh *iface)
35 return CONTAINING_RECORD(iface, struct d3dx10_mesh, ID3DX10Mesh_iface);
38 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_QueryInterface(ID3DX10Mesh *iface, REFIID riid, void **out)
40 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
42 if (IsEqualGUID(riid, &IID_ID3DX10Mesh)
43 || IsEqualGUID(riid, &IID_IUnknown))
45 IUnknown_AddRef(iface);
46 *out = iface;
47 return S_OK;
50 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
52 *out = NULL;
53 return E_NOINTERFACE;
56 static ULONG STDMETHODCALLTYPE d3dx10_mesh_AddRef(ID3DX10Mesh *iface)
58 struct d3dx10_mesh *mesh = impl_from_ID3DX10Mesh(iface);
59 ULONG refcount = InterlockedIncrement(&mesh->refcount);
61 TRACE("%p increasing refcount to %lu.\n", iface, refcount);
63 return refcount;
66 static ULONG STDMETHODCALLTYPE d3dx10_mesh_Release(ID3DX10Mesh *iface)
68 struct d3dx10_mesh *mesh = impl_from_ID3DX10Mesh(iface);
69 ULONG refcount = InterlockedDecrement(&mesh->refcount);
71 TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
73 if (!refcount)
74 free(mesh);
76 return refcount;
79 static UINT STDMETHODCALLTYPE d3dx10_mesh_GetFaceCount(ID3DX10Mesh *iface)
81 FIXME("iface %p stub!\n", iface);
83 return 0;
86 static UINT STDMETHODCALLTYPE d3dx10_mesh_GetVertexCount(ID3DX10Mesh *iface)
88 FIXME("iface %p stub!\n", iface);
90 return 0;
93 static UINT STDMETHODCALLTYPE d3dx10_mesh_GetVertexBufferCount(ID3DX10Mesh *iface)
95 FIXME("iface %p stub!\n", iface);
97 return 0;
100 static UINT STDMETHODCALLTYPE d3dx10_mesh_GetFlags(ID3DX10Mesh *iface)
102 FIXME("iface %p stub!\n", iface);
104 return 0;
107 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GetVertexDescription(ID3DX10Mesh *iface,
108 const D3D10_INPUT_ELEMENT_DESC **desc, UINT *count)
110 FIXME("iface %p, desc %p, count %p stub!\n", iface, desc, count);
112 return E_NOTIMPL;
115 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_SetVertexData(ID3DX10Mesh *iface, UINT index,
116 const void *data)
118 FIXME("iface %p, index %u, data %p stub!\n", iface, index, data);
120 return E_NOTIMPL;
123 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GetVertexBuffer(ID3DX10Mesh *iface, UINT index,
124 ID3DX10MeshBuffer **buffer)
126 FIXME("iface %p, index %u, buffer %p stub!\n", iface, index, buffer);
128 return E_NOTIMPL;
131 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_SetIndexData(ID3DX10Mesh *iface, const void *data,
132 UINT count)
134 FIXME("iface %p, data %p, count %u stub!\n", iface, data, count);
136 return E_NOTIMPL;
139 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GetIndexBuffer(ID3DX10Mesh *iface,
140 ID3DX10MeshBuffer **buffer)
142 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
144 return E_NOTIMPL;
147 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_SetAttributeData(ID3DX10Mesh *iface,
148 const UINT *data)
150 FIXME("iface %p, data %p stub!\n", iface, data);
152 return E_NOTIMPL;
155 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GetAttributeBuffer(ID3DX10Mesh *iface,
156 ID3DX10MeshBuffer **buffer)
158 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
160 return E_NOTIMPL;
163 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_SetAttributeTable(ID3DX10Mesh *iface,
164 const D3DX10_ATTRIBUTE_RANGE *table, UINT count)
166 FIXME("iface %p, table %p, count %u stub!\n", iface, table, count);
168 return E_NOTIMPL;
171 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GetAttributeTable(ID3DX10Mesh *iface,
172 D3DX10_ATTRIBUTE_RANGE *table, UINT *count)
174 FIXME("iface %p, table %p, count %p stub!\n", iface, table, count);
176 return E_NOTIMPL;
179 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GenerateAdjacencyAndPointReps(ID3DX10Mesh *iface,
180 float epsilon)
182 FIXME("iface %p, epsilon %.8e stub!\n", iface, epsilon);
184 return E_NOTIMPL;
187 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GenerateGSAdjacency(ID3DX10Mesh *iface)
189 FIXME("iface %p stub!\n", iface);
191 return E_NOTIMPL;
194 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_SetAdjacencyData(ID3DX10Mesh *iface,
195 const UINT *adjacency)
197 FIXME("iface %p, adjacency %p stub!\n", iface, adjacency);
199 return E_NOTIMPL;
202 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GetAdjacencyBuffer(ID3DX10Mesh *iface,
203 ID3DX10MeshBuffer **buffer)
205 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
207 return E_NOTIMPL;
210 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_SetPointRepData(ID3DX10Mesh *iface,
211 const UINT *pointreps)
213 FIXME("iface %p, pointreps %p stub!\n", iface, pointreps);
215 return E_NOTIMPL;
218 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GetPointRepBuffer(ID3DX10Mesh *iface,
219 ID3DX10MeshBuffer **buffer)
221 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
223 return E_NOTIMPL;
226 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_Discard(ID3DX10Mesh *iface,
227 D3DX10_MESH_DISCARD_FLAGS flags)
229 FIXME("iface %p, flags %#x stub!\n", iface, flags);
231 return E_NOTIMPL;
234 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_CloneMesh(ID3DX10Mesh *iface, UINT flags,
235 const char *pos_semantic, const D3D10_INPUT_ELEMENT_DESC *desc, UINT decl_count,
236 ID3DX10Mesh **cloned_mesh)
238 FIXME("iface %p, flags %#x, pos_semantic %s, desc %p, decl_count %u, cloned_mesh %p stub!\n",
239 iface, flags, debugstr_a(pos_semantic), desc, decl_count, cloned_mesh);
241 return E_NOTIMPL;
244 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_Optimize(ID3DX10Mesh *iface, UINT flags,
245 UINT *face_remap, ID3D10Blob **vertex_remap)
247 FIXME("iface %p, flags %#x, face_remap %p, vertex_remap %p stub!\n", iface, flags,
248 face_remap, vertex_remap);
250 return E_NOTIMPL;
253 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GenerateAttributeBufferFromTable(ID3DX10Mesh *iface)
255 FIXME("iface %p stub!\n", iface);
257 return E_NOTIMPL;
260 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_Intersect(ID3DX10Mesh *iface, D3DXVECTOR3 *ray_pos,
261 D3DXVECTOR3 *ray_dir, UINT *hit_count, UINT *face_index, float *u, float *v, float *dist,
262 ID3D10Blob **all_hits)
264 FIXME("iface %p, ray_pos %p, ray_dir %p, hit_count %p, u %p, v %p, dist %p, all_hits %p stub!\n",
265 iface, ray_pos, ray_dir, hit_count, u, v, dist, all_hits);
267 return E_NOTIMPL;
270 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_IntersectSubset(ID3DX10Mesh *iface, UINT attr_id,
271 D3DXVECTOR3 *ray_pos, D3DXVECTOR3 *ray_dir, UINT *hit_count, float *u, float *v,
272 float *dist, ID3D10Blob **all_hits)
274 FIXME("iface %p, attr_id %u, ray_pos %p, ray_dir %p, hit_count %p, u %p, v %p, dist %p, all_hits %p stub!\n",
275 iface, attr_id, ray_pos, ray_dir, hit_count, u, v, dist, all_hits);
277 return E_NOTIMPL;
280 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_CommitToDevice(ID3DX10Mesh *iface)
282 FIXME("iface %p stub!\n", iface);
284 return E_NOTIMPL;
287 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_DrawSubset(ID3DX10Mesh *iface, UINT attr_id)
289 FIXME("iface %p, attr_id %u stub!\n", iface, attr_id);
291 return E_NOTIMPL;
294 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_DrawSubsetInstanced(ID3DX10Mesh *iface, UINT attr_id,
295 UINT instance_count, UINT start_instance)
297 FIXME("iface %p, attr_id %u, instance_count %u, start_instance %u stub!\n", iface, attr_id,
298 instance_count, start_instance);
300 return E_NOTIMPL;
303 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GetDeviceVertexBuffer(ID3DX10Mesh *iface, UINT index,
304 ID3D10Buffer **buffer)
306 FIXME("iface %p, index %u, buffer %p stub!\n", iface, index, buffer);
308 return E_NOTIMPL;
311 static HRESULT STDMETHODCALLTYPE d3dx10_mesh_GetDeviceIndexBuffer(ID3DX10Mesh *iface,
312 ID3D10Buffer **buffer)
314 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
316 return E_NOTIMPL;
319 static const ID3DX10MeshVtbl d3dx10_mesh_vtbl =
321 d3dx10_mesh_QueryInterface,
322 d3dx10_mesh_AddRef,
323 d3dx10_mesh_Release,
324 d3dx10_mesh_GetFaceCount,
325 d3dx10_mesh_GetVertexCount,
326 d3dx10_mesh_GetVertexBufferCount,
327 d3dx10_mesh_GetFlags,
328 d3dx10_mesh_GetVertexDescription,
329 d3dx10_mesh_SetVertexData,
330 d3dx10_mesh_GetVertexBuffer,
331 d3dx10_mesh_SetIndexData,
332 d3dx10_mesh_GetIndexBuffer,
333 d3dx10_mesh_SetAttributeData,
334 d3dx10_mesh_GetAttributeBuffer,
335 d3dx10_mesh_SetAttributeTable,
336 d3dx10_mesh_GetAttributeTable,
337 d3dx10_mesh_GenerateAdjacencyAndPointReps,
338 d3dx10_mesh_GenerateGSAdjacency,
339 d3dx10_mesh_SetAdjacencyData,
340 d3dx10_mesh_GetAdjacencyBuffer,
341 d3dx10_mesh_SetPointRepData,
342 d3dx10_mesh_GetPointRepBuffer,
343 d3dx10_mesh_Discard,
344 d3dx10_mesh_CloneMesh,
345 d3dx10_mesh_Optimize,
346 d3dx10_mesh_GenerateAttributeBufferFromTable,
347 d3dx10_mesh_Intersect,
348 d3dx10_mesh_IntersectSubset,
349 d3dx10_mesh_CommitToDevice,
350 d3dx10_mesh_DrawSubset,
351 d3dx10_mesh_DrawSubsetInstanced,
352 d3dx10_mesh_GetDeviceVertexBuffer,
353 d3dx10_mesh_GetDeviceIndexBuffer,
356 HRESULT WINAPI D3DX10CreateMesh(ID3D10Device *device, const D3D10_INPUT_ELEMENT_DESC *decl,
357 UINT decl_count, const char *position_semantic, UINT vertex_count, UINT face_count,
358 UINT options, ID3DX10Mesh **mesh)
360 struct d3dx10_mesh *object;
362 FIXME("device %p, decl %p, decl_count %u, position_semantic %s, vertex_count %u, face_count %u, "
363 "options %#x, mesh %p semi-stub.\n", device, decl, decl_count, debugstr_a(position_semantic), vertex_count,
364 face_count, options, mesh);
366 *mesh = NULL;
368 if (!(object = calloc(1, sizeof(*object))))
369 return E_OUTOFMEMORY;
371 object->ID3DX10Mesh_iface.lpVtbl = &d3dx10_mesh_vtbl;
372 object->refcount = 1;
374 *mesh = &object->ID3DX10Mesh_iface;
376 return S_OK;