ReactOS  0.4.14-dev-384-g5b37caa
vertexbuffer.c File Reference
#include "config.h"
#include "wine/port.h"
#include "ddraw_private.h"
Include dependency graph for vertexbuffer.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ddraw)
 
static struct d3d_vertex_bufferimpl_from_IDirect3DVertexBuffer7 (IDirect3DVertexBuffer7 *iface)
 
static HRESULT WINAPI d3d_vertex_buffer7_QueryInterface (IDirect3DVertexBuffer7 *iface, REFIID riid, void **obj)
 
static ULONG WINAPI d3d_vertex_buffer7_AddRef (IDirect3DVertexBuffer7 *iface)
 
static ULONG WINAPI d3d_vertex_buffer7_Release (IDirect3DVertexBuffer7 *iface)
 
static HRESULT d3d_vertex_buffer_create_wined3d_buffer (struct d3d_vertex_buffer *buffer, BOOL dynamic, struct wined3d_buffer **wined3d_buffer)
 
static HRESULT WINAPI d3d_vertex_buffer7_Lock (IDirect3DVertexBuffer7 *iface, DWORD flags, void **data, DWORD *data_size)
 
static HRESULT WINAPI d3d_vertex_buffer7_Unlock (IDirect3DVertexBuffer7 *iface)
 
static HRESULT WINAPI d3d_vertex_buffer7_ProcessVertices (IDirect3DVertexBuffer7 *iface, DWORD vertex_op, DWORD dst_idx, DWORD count, IDirect3DVertexBuffer7 *src_buffer, DWORD src_idx, IDirect3DDevice7 *device, DWORD flags)
 
static HRESULT WINAPI d3d_vertex_buffer7_GetVertexBufferDesc (IDirect3DVertexBuffer7 *iface, D3DVERTEXBUFFERDESC *desc)
 
static HRESULT WINAPI d3d_vertex_buffer7_Optimize (IDirect3DVertexBuffer7 *iface, IDirect3DDevice7 *device, DWORD flags)
 
static HRESULT WINAPI d3d_vertex_buffer7_ProcessVerticesStrided (IDirect3DVertexBuffer7 *iface, DWORD vertex_op, DWORD dst_idx, DWORD count, D3DDRAWPRIMITIVESTRIDEDDATA *data, DWORD fvf, IDirect3DDevice7 *device, DWORD flags)
 
HRESULT d3d_vertex_buffer_create (struct d3d_vertex_buffer **vertex_buf, struct ddraw *ddraw, D3DVERTEXBUFFERDESC *desc)
 
struct d3d_vertex_bufferunsafe_impl_from_IDirect3DVertexBuffer7 (IDirect3DVertexBuffer7 *iface)
 

Variables

static const struct IDirect3DVertexBuffer7Vtbl d3d_vertex_buffer7_vtbl
 

Function Documentation

◆ d3d_vertex_buffer7_AddRef()

static ULONG WINAPI d3d_vertex_buffer7_AddRef ( IDirect3DVertexBuffer7 *  iface)
static

Definition at line 67 of file vertexbuffer.c.

68 {
71 
72  TRACE("%p increasing refcount to %u.\n", buffer, ref);
73 
74  return ref;
75 }
static struct d3d_vertex_buffer * impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface)
Definition: vertexbuffer.c:27
GLuint buffer
Definition: glext.h:5915
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ d3d_vertex_buffer7_GetVertexBufferDesc()

static HRESULT WINAPI d3d_vertex_buffer7_GetVertexBufferDesc ( IDirect3DVertexBuffer7 *  iface,
D3DVERTEXBUFFERDESC desc 
)
static

Definition at line 323 of file vertexbuffer.c.

324 {
326  struct wined3d_resource_desc wined3d_desc;
328 
329  TRACE("iface %p, desc %p.\n", iface, desc);
330 
331  if (!desc) return DDERR_INVALIDPARAMS;
332 
337 
338  /* Now fill the desc structure */
339  desc->dwCaps = buffer->Caps;
340  desc->dwFVF = buffer->fvf;
341  desc->dwNumVertices = wined3d_desc.size / get_flexible_vertex_size(buffer->fvf);
342 
343  return D3D_OK;
344 }
void CDECL wined3d_resource_get_desc(const struct wined3d_resource *resource, struct wined3d_resource_desc *desc)
Definition: resource.c:295
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
static struct d3d_vertex_buffer * impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface)
Definition: vertexbuffer.c:27
GLuint buffer
Definition: glext.h:5915
static const WCHAR desc[]
Definition: protectdata.c:36
DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) DECLSPEC_HIDDEN
Definition: utils.c:923
#define TRACE(s)
Definition: solgame.cpp:4
#define D3D_OK
Definition: d3d.h:106
struct wined3d_resource *CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
Definition: buffer.c:995
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:79

◆ d3d_vertex_buffer7_Lock()

static HRESULT WINAPI d3d_vertex_buffer7_Lock ( IDirect3DVertexBuffer7 *  iface,
DWORD  flags,
void **  data,
DWORD data_size 
)
static

Definition at line 157 of file vertexbuffer.c.

159 {
161  struct wined3d_resource_desc wined3d_desc;
164  HRESULT hr;
165 
166  TRACE("iface %p, flags %#x, data %p, data_size %p.\n", iface, flags, data, data_size);
167 
168  if (buffer->version != 7)
170 
171  if (!(flags & DDLOCK_WAIT))
174  {
175  if (!buffer->dynamic)
176  {
177  struct wined3d_buffer *new_buffer;
180  if (SUCCEEDED(hr))
181  {
182  buffer->dynamic = TRUE;
183  wined3d_buffer_decref(buffer->wined3d_buffer);
184  buffer->wined3d_buffer = new_buffer;
185  }
186  else
187  {
188  WARN("Failed to create a dynamic buffer\n");
189  }
191  }
192  }
193 
195  if (data_size)
196  {
197  /* Get the size, for returning it, and for locking */
200  *data_size = wined3d_desc.size;
201  }
202 
206 
208 
209  return hr;
210 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
void CDECL wined3d_resource_get_desc(const struct wined3d_resource *resource, struct wined3d_resource_desc *desc)
Definition: resource.c:295
#define WARN(fmt,...)
Definition: debug.h:111
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
static struct d3d_vertex_buffer * impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface)
Definition: vertexbuffer.c:27
GLuint buffer
Definition: glext.h:5915
unsigned int wined3dmapflags_from_ddrawmapflags(unsigned int flags) DECLSPEC_HIDDEN
Definition: utils.c:564
static HRESULT d3d_vertex_buffer_create_wined3d_buffer(struct d3d_vertex_buffer *buffer, BOOL dynamic, struct wined3d_buffer **wined3d_buffer)
Definition: vertexbuffer.c:115
HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags)
Definition: resource.c:344
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
Definition: buffer.c:791
#define DDLOCK_DONOTWAIT
Definition: ddraw.h:630
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
#define DDLOCK_WAIT
Definition: ddraw.h:622
struct wined3d_resource *CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
Definition: buffer.c:995
#define DDLOCK_NOOVERWRITE
Definition: ddraw.h:627
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
#define DDLOCK_DISCARDCONTENTS
Definition: ddraw.h:628
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ d3d_vertex_buffer7_Optimize()

static HRESULT WINAPI d3d_vertex_buffer7_Optimize ( IDirect3DVertexBuffer7 *  iface,
IDirect3DDevice7 *  device,
DWORD  flags 
)
static

Definition at line 359 of file vertexbuffer.c.

361 {
363  static BOOL hide = FALSE;
364 
365  TRACE("iface %p, device %p, flags %#x.\n", iface, device, flags);
366 
367  if (!hide)
368  {
369  FIXME("iface %p, device %p, flags %#x stub!\n", iface, device, flags);
370  hide = TRUE;
371  }
372 
373  /* We could forward this call to WineD3D and take advantage
374  * of it once we use OpenGL vertex buffers
375  */
377  buffer->Caps |= D3DVBCAPS_OPTIMIZED;
379 
380  return DD_OK;
381 }
#define TRUE
Definition: types.h:120
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
static struct d3d_vertex_buffer * impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface)
Definition: vertexbuffer.c:27
GLuint buffer
Definition: glext.h:5915
#define DD_OK
Definition: ddraw.h:186
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
GLbitfield flags
Definition: glext.h:7161
#define D3DVBCAPS_OPTIMIZED
Definition: d3dtypes.h:1282
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

◆ d3d_vertex_buffer7_ProcessVertices()

static HRESULT WINAPI d3d_vertex_buffer7_ProcessVertices ( IDirect3DVertexBuffer7 *  iface,
DWORD  vertex_op,
DWORD  dst_idx,
DWORD  count,
IDirect3DVertexBuffer7 *  src_buffer,
DWORD  src_idx,
IDirect3DDevice7 *  device,
DWORD  flags 
)
static

Definition at line 256 of file vertexbuffer.c.

259 {
260  struct d3d_vertex_buffer *dst_buffer_impl = impl_from_IDirect3DVertexBuffer7(iface);
261  struct d3d_vertex_buffer *src_buffer_impl = unsafe_impl_from_IDirect3DVertexBuffer7(src_buffer);
262  struct d3d_device *device_impl = dst_buffer_impl->version == 7
264  : unsafe_impl_from_IDirect3DDevice3((IDirect3DDevice3 *)device);
265  BOOL oldClip, doClip;
266  HRESULT hr;
267 
268  TRACE("iface %p, vertex_op %#x, dst_idx %u, count %u, src_buffer %p, src_idx %u, device %p, flags %#x.\n",
269  iface, vertex_op, dst_idx, count, src_buffer, src_idx, device, flags);
270 
271  /* Vertex operations:
272  * D3DVOP_CLIP: Clips vertices outside the viewing frustrum. Needs clipping information
273  * in the vertex buffer (Buffer may not be created with D3DVBCAPS_DONOTCLIP)
274  * D3DVOP_EXTENTS: Causes the screen extents to be updated when rendering the vertices
275  * D3DVOP_LIGHT: Lights the vertices
276  * D3DVOP_TRANSFORM: Transform the vertices. This flag is necessary
277  *
278  * WineD3D only transforms and clips the vertices by now, so EXTENTS and LIGHT
279  * are not implemented. Clipping is disabled ATM, because of unsure conditions.
280  */
281  if (!(vertex_op & D3DVOP_TRANSFORM))
282  return DDERR_INVALIDPARAMS;
283 
285 
286  /* WineD3D doesn't know d3d7 vertex operation, it uses
287  * render states instead. Set the render states according to
288  * the vertex ops
289  */
290  doClip = !!(vertex_op & D3DVOP_CLIP);
292  if (doClip != oldClip)
294 
296  0, src_buffer_impl->wined3d_buffer, 0, get_flexible_vertex_size(src_buffer_impl->fvf));
298  hr = wined3d_device_process_vertices(device_impl->wined3d_device, src_idx, dst_idx,
299  count, dst_buffer_impl->wined3d_buffer, NULL, flags, dst_buffer_impl->fvf);
300 
301  /* Restore the states if needed */
302  if (doClip != oldClip)
304 
306 
307  return hr;
308 }
void CDECL wined3d_device_set_render_state(struct wined3d_device *device, enum wined3d_render_state state, DWORD value)
Definition: device.c:2027
HRESULT hr
Definition: shlfolder.c:183
struct wined3d_buffer * wined3d_buffer
GLuint GLuint GLsizei count
Definition: gl.h:1545
struct d3d_device * unsafe_impl_from_IDirect3DDevice7(IDirect3DDevice7 *iface) DECLSPEC_HIDDEN
Definition: device.c:6850
void CDECL wined3d_device_set_vertex_declaration(struct wined3d_device *device, struct wined3d_vertex_declaration *declaration)
Definition: device.c:2157
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
static struct d3d_vertex_buffer * impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface)
Definition: vertexbuffer.c:27
#define D3DVOP_CLIP
Definition: d3dtypes.h:1287
struct wined3d_device * wined3d_device
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
unsigned int version
struct wined3d_vertex_declaration * wined3d_declaration
DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) DECLSPEC_HIDDEN
Definition: utils.c:923
smooth NULL
Definition: ftsmooth.c:416
struct d3d_vertex_buffer * unsafe_impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface)
Definition: vertexbuffer.c:486
HRESULT CDECL wined3d_device_set_stream_source(struct wined3d_device *device, UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride)
Definition: device.c:1378
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
struct d3d_device * unsafe_impl_from_IDirect3DDevice3(IDirect3DDevice3 *iface) DECLSPEC_HIDDEN
Definition: device.c:6857
GLbitfield flags
Definition: glext.h:7161
#define D3DVOP_TRANSFORM
Definition: d3dtypes.h:1286
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)
Definition: device.c:3340
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:79
DWORD CDECL wined3d_device_get_render_state(const struct wined3d_device *device, enum wined3d_render_state state)
Definition: device.c:2064

◆ d3d_vertex_buffer7_ProcessVerticesStrided()

static HRESULT WINAPI d3d_vertex_buffer7_ProcessVerticesStrided ( IDirect3DVertexBuffer7 *  iface,
DWORD  vertex_op,
DWORD  dst_idx,
DWORD  count,
D3DDRAWPRIMITIVESTRIDEDDATA data,
DWORD  fvf,
IDirect3DDevice7 *  device,
DWORD  flags 
)
static

Definition at line 405 of file vertexbuffer.c.

408 {
409  FIXME("iface %p, vertex_op %#x, dst_idx %u, count %u, data %p, fvf %#x, device %p, flags %#x stub!\n",
410  iface, vertex_op, dst_idx, count, data, fvf, device, flags);
411 
412  return DD_OK;
413 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define DD_OK
Definition: ddraw.h:186
Definition: devices.h:37
#define FIXME(fmt,...)
Definition: debug.h:110
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161

◆ d3d_vertex_buffer7_QueryInterface()

static HRESULT WINAPI d3d_vertex_buffer7_QueryInterface ( IDirect3DVertexBuffer7 *  iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 36 of file vertexbuffer.c.

37 {
39 
40  TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obj);
41 
42  *obj = NULL;
43 
45  {
47  *obj = iface;
48  return S_OK;
49  }
50  if (IsEqualGUID(&IID_IDirect3DVertexBuffer7, riid) && buffer->version == 7)
51  {
53  *obj = iface;
54  return S_OK;
55  }
56  if (IsEqualGUID(&IID_IDirect3DVertexBuffer, riid) && buffer->version == 3)
57  {
59  *obj = iface;
60  return S_OK;
61  }
62 
63  WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
64  return E_NOINTERFACE;
65 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
static struct d3d_vertex_buffer * impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface)
Definition: vertexbuffer.c:27
GLuint buffer
Definition: glext.h:5915
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define IDirect3DVertexBuffer7_AddRef(p)
Definition: d3d.h:1514
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ d3d_vertex_buffer7_Release()

static ULONG WINAPI d3d_vertex_buffer7_Release ( IDirect3DVertexBuffer7 *  iface)
static

Definition at line 77 of file vertexbuffer.c.

78 {
81 
82  TRACE("%p decreasing refcount to %u.\n", buffer, ref);
83 
84  if (!ref)
85  {
86  struct wined3d_buffer *vb = NULL;
88 
89  /* D3D7 vertex buffers don't stay bound in the device, they are passed
90  * as a parameter to DrawPrimitiveVB. DrawPrimitiveVB sets them as the
91  * stream source in wined3d and they should get unset there before
92  * they are destroyed. */
94  wined3d_device_get_stream_source(buffer->ddraw->wined3d_device, 0, &vb, &offset, &stride);
95  if (vb == buffer->wined3d_buffer)
96  wined3d_device_set_stream_source(buffer->ddraw->wined3d_device, 0, NULL, 0, 0);
97 
98  wined3d_vertex_declaration_decref(buffer->wined3d_declaration);
99  wined3d_buffer_decref(buffer->wined3d_buffer);
101 
102  if (buffer->version == 7)
103  IDirectDraw7_Release(&buffer->ddraw->IDirectDraw7_iface);
104 
105  heap_free(buffer);
106  }
107 
108  return ref;
109 }
HRESULT CDECL wined3d_device_get_stream_source(const struct wined3d_device *device, UINT stream_idx, struct wined3d_buffer **buffer, UINT *offset, UINT *stride)
Definition: device.c:1428
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
GLintptr offset
Definition: glext.h:5920
static struct d3d_vertex_buffer * impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface)
Definition: vertexbuffer.c:27
GLuint buffer
Definition: glext.h:5915
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
smooth NULL
Definition: ftsmooth.c:416
HRESULT CDECL wined3d_device_set_stream_source(struct wined3d_device *device, UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride)
Definition: device.c:1378
ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration)
#define TRACE(s)
Definition: solgame.cpp:4
GLsizei stride
Definition: glext.h:5848
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
Definition: buffer.c:791
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int UINT
Definition: ndis.h:50
unsigned int ULONG
Definition: retypes.h:1
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ d3d_vertex_buffer7_Unlock()

static HRESULT WINAPI d3d_vertex_buffer7_Unlock ( IDirect3DVertexBuffer7 *  iface)
static

Definition at line 221 of file vertexbuffer.c.

222 {
224 
225  TRACE("iface %p.\n", iface);
226 
230 
231  return D3D_OK;
232 }
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
Definition: resource.c:382
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
static struct d3d_vertex_buffer * impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface)
Definition: vertexbuffer.c:27
GLuint buffer
Definition: glext.h:5915
#define TRACE(s)
Definition: solgame.cpp:4
#define D3D_OK
Definition: d3d.h:106
struct wined3d_resource *CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
Definition: buffer.c:995
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

◆ d3d_vertex_buffer_create()

HRESULT d3d_vertex_buffer_create ( struct d3d_vertex_buffer **  vertex_buf,
struct ddraw ddraw,
D3DVERTEXBUFFERDESC desc 
)

Definition at line 432 of file vertexbuffer.c.

434 {
435  struct d3d_vertex_buffer *buffer;
436  HRESULT hr = D3D_OK;
437 
438  TRACE("Vertex buffer description:\n");
439  TRACE(" dwSize %u\n", desc->dwSize);
440  TRACE(" dwCaps %#x\n", desc->dwCaps);
441  TRACE(" FVF %#x\n", desc->dwFVF);
442  TRACE(" dwNumVertices %u\n", desc->dwNumVertices);
443 
444  if (!(buffer = heap_alloc_zero(sizeof(*buffer))))
445  return DDERR_OUTOFMEMORY;
446 
447  buffer->IDirect3DVertexBuffer7_iface.lpVtbl = &d3d_vertex_buffer7_vtbl;
448  buffer->ref = 1;
449  buffer->version = ddraw->d3dversion;
450  if (buffer->version == 7)
451  IDirectDraw7_AddRef(&ddraw->IDirectDraw7_iface);
452  buffer->ddraw = ddraw;
453  buffer->Caps = desc->dwCaps;
454  buffer->fvf = desc->dwFVF;
455  buffer->size = get_flexible_vertex_size(desc->dwFVF) * desc->dwNumVertices;
456 
458 
460  {
461  WARN("Failed to create wined3d vertex buffer, hr %#x.\n", hr);
462  if (hr == WINED3DERR_INVALIDCALL)
464  goto end;
465  }
466 
467  if (!(buffer->wined3d_declaration = ddraw_find_decl(ddraw, desc->dwFVF)))
468  {
469  ERR("Failed to find vertex declaration for fvf %#x.\n", desc->dwFVF);
470  wined3d_buffer_decref(buffer->wined3d_buffer);
472  goto end;
473  }
474  wined3d_vertex_declaration_incref(buffer->wined3d_declaration);
475 
476 end:
478  if (hr == D3D_OK)
479  *vertex_buf = buffer;
480  else
481  heap_free(buffer);
482 
483  return hr;
484 }
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:48
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
int d3dversion
GLuint buffer
Definition: glext.h:5915
#define DDERR_OUTOFMEMORY
Definition: ddraw.h:111
GLuint GLuint end
Definition: gl.h:1545
struct ddraw * ddraw
static HRESULT d3d_vertex_buffer_create_wined3d_buffer(struct d3d_vertex_buffer *buffer, BOOL dynamic, struct wined3d_buffer **wined3d_buffer)
Definition: vertexbuffer.c:115
static const WCHAR desc[]
Definition: protectdata.c:36
DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) DECLSPEC_HIDDEN
Definition: utils.c:923
static const struct IDirect3DVertexBuffer7Vtbl d3d_vertex_buffer7_vtbl
Definition: vertexbuffer.c:419
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
Definition: buffer.c:791
#define ERR(fmt,...)
Definition: debug.h:109
#define D3D_OK
Definition: d3d.h:106
IDirectDraw7 IDirectDraw7_iface
Definition: ddraw_private.h:79
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
ULONG CDECL wined3d_vertex_declaration_incref(struct wined3d_vertex_declaration *declaration)
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:79
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
struct wined3d_vertex_declaration * ddraw_find_decl(struct ddraw *This, DWORD fvf)
Definition: ddraw.c:4781

Referenced by d3d3_CreateVertexBuffer(), and d3d7_CreateVertexBuffer().

◆ d3d_vertex_buffer_create_wined3d_buffer()

static HRESULT d3d_vertex_buffer_create_wined3d_buffer ( struct d3d_vertex_buffer buffer,
BOOL  dynamic,
struct wined3d_buffer **  wined3d_buffer 
)
static

Definition at line 115 of file vertexbuffer.c.

117 {
118  struct wined3d_buffer_desc desc;
119 
120  desc.byte_width = buffer->size;
122  if (buffer->Caps & D3DVBCAPS_WRITEONLY)
123  desc.usage |= WINED3DUSAGE_WRITEONLY;
124  if (dynamic)
125  desc.usage |= WINED3DUSAGE_DYNAMIC;
126  desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
127  if (buffer->Caps & D3DVBCAPS_SYSTEMMEMORY)
129  else
131  desc.misc_flags = 0;
132  desc.structure_byte_stride = 0;
133 
134  return wined3d_buffer_create(buffer->ddraw->wined3d_device, &desc,
136 }
#define WINED3D_BIND_VERTEX_BUFFER
Definition: wined3d.h:890
#define WINED3DUSAGE_DYNAMIC
Definition: wined3d.h:907
#define D3DVBCAPS_SYSTEMMEMORY
Definition: d3dtypes.h:1280
GLuint buffer
Definition: glext.h:5915
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:58
#define WINED3D_RESOURCE_ACCESS_CPU
Definition: wined3d.h:56
static const WCHAR desc[]
Definition: protectdata.c:36
#define WINED3DUSAGE_STATICDECL
Definition: wined3d.h:920
smooth NULL
Definition: ftsmooth.c:416
#define D3DVBCAPS_WRITEONLY
Definition: d3dtypes.h:1281
#define WINED3DUSAGE_WRITEONLY
Definition: wined3d.h:901
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:57
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:55
HRESULT CDECL wined3d_buffer_create(struct wined3d_device *device, const struct wined3d_buffer_desc *desc, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_buffer **buffer)
Definition: buffer.c:1436
const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops
Definition: ddraw.c:83

Referenced by d3d_vertex_buffer7_Lock(), and d3d_vertex_buffer_create().

◆ impl_from_IDirect3DVertexBuffer7()

static struct d3d_vertex_buffer* impl_from_IDirect3DVertexBuffer7 ( IDirect3DVertexBuffer7 *  iface)
inlinestatic

Definition at line 27 of file vertexbuffer.c.

28 {
29  return CONTAINING_RECORD(iface, struct d3d_vertex_buffer, IDirect3DVertexBuffer7_iface);
30 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by d3d_vertex_buffer7_AddRef(), d3d_vertex_buffer7_GetVertexBufferDesc(), d3d_vertex_buffer7_Lock(), d3d_vertex_buffer7_Optimize(), d3d_vertex_buffer7_ProcessVertices(), d3d_vertex_buffer7_QueryInterface(), d3d_vertex_buffer7_Release(), d3d_vertex_buffer7_Unlock(), and unsafe_impl_from_IDirect3DVertexBuffer7().

◆ unsafe_impl_from_IDirect3DVertexBuffer7()

struct d3d_vertex_buffer* unsafe_impl_from_IDirect3DVertexBuffer7 ( IDirect3DVertexBuffer7 *  iface)

Definition at line 486 of file vertexbuffer.c.

487 {
488  if (!iface)
489  return NULL;
490  assert(iface->lpVtbl == &d3d_vertex_buffer7_vtbl);
491 
492  return impl_from_IDirect3DVertexBuffer7(iface);
493 }
#define assert(x)
Definition: debug.h:53
static struct d3d_vertex_buffer * impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface)
Definition: vertexbuffer.c:27
smooth NULL
Definition: ftsmooth.c:416
static const struct IDirect3DVertexBuffer7Vtbl d3d_vertex_buffer7_vtbl
Definition: vertexbuffer.c:419

Referenced by d3d_device3_DrawIndexedPrimitiveVB(), d3d_device3_DrawPrimitiveVB(), d3d_device7_DrawIndexedPrimitiveVB(), d3d_device7_DrawPrimitiveVB(), and d3d_vertex_buffer7_ProcessVertices().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ddraw  )

Variable Documentation

◆ d3d_vertex_buffer7_vtbl

const struct IDirect3DVertexBuffer7Vtbl d3d_vertex_buffer7_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI d3d_vertex_buffer7_QueryInterface(IDirect3DVertexBuffer7 *iface, REFIID riid, void **obj)
Definition: vertexbuffer.c:36
static HRESULT WINAPI d3d_vertex_buffer7_Lock(IDirect3DVertexBuffer7 *iface, DWORD flags, void **data, DWORD *data_size)
Definition: vertexbuffer.c:157
static ULONG WINAPI d3d_vertex_buffer7_AddRef(IDirect3DVertexBuffer7 *iface)
Definition: vertexbuffer.c:67
static HRESULT WINAPI d3d_vertex_buffer7_Unlock(IDirect3DVertexBuffer7 *iface)
Definition: vertexbuffer.c:221
static HRESULT WINAPI d3d_vertex_buffer7_GetVertexBufferDesc(IDirect3DVertexBuffer7 *iface, D3DVERTEXBUFFERDESC *desc)
Definition: vertexbuffer.c:323
static HRESULT WINAPI d3d_vertex_buffer7_ProcessVertices(IDirect3DVertexBuffer7 *iface, DWORD vertex_op, DWORD dst_idx, DWORD count, IDirect3DVertexBuffer7 *src_buffer, DWORD src_idx, IDirect3DDevice7 *device, DWORD flags)
Definition: vertexbuffer.c:256
static HRESULT WINAPI d3d_vertex_buffer7_ProcessVerticesStrided(IDirect3DVertexBuffer7 *iface, DWORD vertex_op, DWORD dst_idx, DWORD count, D3DDRAWPRIMITIVESTRIDEDDATA *data, DWORD fvf, IDirect3DDevice7 *device, DWORD flags)
Definition: vertexbuffer.c:405
static HRESULT WINAPI d3d_vertex_buffer7_Optimize(IDirect3DVertexBuffer7 *iface, IDirect3DDevice7 *device, DWORD flags)
Definition: vertexbuffer.c:359
static ULONG WINAPI d3d_vertex_buffer7_Release(IDirect3DVertexBuffer7 *iface)
Definition: vertexbuffer.c:77

Definition at line 419 of file vertexbuffer.c.

Referenced by d3d_vertex_buffer_create(), and unsafe_impl_from_IDirect3DVertexBuffer7().