ReactOS  0.4.15-dev-509-g96a357b
buffer.c File Reference
#include "config.h"
#include "d3d9_private.h"
Include dependency graph for buffer.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3d9)
 
static struct d3d9_vertexbufferimpl_from_IDirect3DVertexBuffer9 (IDirect3DVertexBuffer9 *iface)
 
static HRESULT WINAPI d3d9_vertexbuffer_QueryInterface (IDirect3DVertexBuffer9 *iface, REFIID riid, void **out)
 
static ULONG WINAPI d3d9_vertexbuffer_AddRef (IDirect3DVertexBuffer9 *iface)
 
static ULONG WINAPI d3d9_vertexbuffer_Release (IDirect3DVertexBuffer9 *iface)
 
static HRESULT WINAPI d3d9_vertexbuffer_GetDevice (IDirect3DVertexBuffer9 *iface, IDirect3DDevice9 **device)
 
static HRESULT WINAPI d3d9_vertexbuffer_SetPrivateData (IDirect3DVertexBuffer9 *iface, REFGUID guid, const void *data, DWORD data_size, DWORD flags)
 
static HRESULT WINAPI d3d9_vertexbuffer_GetPrivateData (IDirect3DVertexBuffer9 *iface, REFGUID guid, void *data, DWORD *data_size)
 
static HRESULT WINAPI d3d9_vertexbuffer_FreePrivateData (IDirect3DVertexBuffer9 *iface, REFGUID guid)
 
static DWORD WINAPI d3d9_vertexbuffer_SetPriority (IDirect3DVertexBuffer9 *iface, DWORD priority)
 
static DWORD WINAPI d3d9_vertexbuffer_GetPriority (IDirect3DVertexBuffer9 *iface)
 
static void WINAPI d3d9_vertexbuffer_PreLoad (IDirect3DVertexBuffer9 *iface)
 
static D3DRESOURCETYPE WINAPI d3d9_vertexbuffer_GetType (IDirect3DVertexBuffer9 *iface)
 
static HRESULT WINAPI d3d9_vertexbuffer_Lock (IDirect3DVertexBuffer9 *iface, UINT offset, UINT size, void **data, DWORD flags)
 
static HRESULT WINAPI d3d9_vertexbuffer_Unlock (IDirect3DVertexBuffer9 *iface)
 
static HRESULT WINAPI d3d9_vertexbuffer_GetDesc (IDirect3DVertexBuffer9 *iface, D3DVERTEXBUFFER_DESC *desc)
 
static void STDMETHODCALLTYPE d3d9_vertexbuffer_wined3d_object_destroyed (void *parent)
 
HRESULT vertexbuffer_init (struct d3d9_vertexbuffer *buffer, struct d3d9_device *device, UINT size, UINT usage, DWORD fvf, D3DPOOL pool)
 
struct d3d9_vertexbufferunsafe_impl_from_IDirect3DVertexBuffer9 (IDirect3DVertexBuffer9 *iface)
 
static struct d3d9_indexbufferimpl_from_IDirect3DIndexBuffer9 (IDirect3DIndexBuffer9 *iface)
 
static HRESULT WINAPI d3d9_indexbuffer_QueryInterface (IDirect3DIndexBuffer9 *iface, REFIID riid, void **out)
 
static ULONG WINAPI d3d9_indexbuffer_AddRef (IDirect3DIndexBuffer9 *iface)
 
static ULONG WINAPI d3d9_indexbuffer_Release (IDirect3DIndexBuffer9 *iface)
 
static HRESULT WINAPI d3d9_indexbuffer_GetDevice (IDirect3DIndexBuffer9 *iface, IDirect3DDevice9 **device)
 
static HRESULT WINAPI d3d9_indexbuffer_SetPrivateData (IDirect3DIndexBuffer9 *iface, REFGUID guid, const void *data, DWORD data_size, DWORD flags)
 
static HRESULT WINAPI d3d9_indexbuffer_GetPrivateData (IDirect3DIndexBuffer9 *iface, REFGUID guid, void *data, DWORD *data_size)
 
static HRESULT WINAPI d3d9_indexbuffer_FreePrivateData (IDirect3DIndexBuffer9 *iface, REFGUID guid)
 
static DWORD WINAPI d3d9_indexbuffer_SetPriority (IDirect3DIndexBuffer9 *iface, DWORD priority)
 
static DWORD WINAPI d3d9_indexbuffer_GetPriority (IDirect3DIndexBuffer9 *iface)
 
static void WINAPI d3d9_indexbuffer_PreLoad (IDirect3DIndexBuffer9 *iface)
 
static D3DRESOURCETYPE WINAPI d3d9_indexbuffer_GetType (IDirect3DIndexBuffer9 *iface)
 
static HRESULT WINAPI d3d9_indexbuffer_Lock (IDirect3DIndexBuffer9 *iface, UINT offset, UINT size, void **data, DWORD flags)
 
static HRESULT WINAPI d3d9_indexbuffer_Unlock (IDirect3DIndexBuffer9 *iface)
 
static HRESULT WINAPI d3d9_indexbuffer_GetDesc (IDirect3DIndexBuffer9 *iface, D3DINDEXBUFFER_DESC *desc)
 
static void STDMETHODCALLTYPE d3d9_indexbuffer_wined3d_object_destroyed (void *parent)
 
HRESULT indexbuffer_init (struct d3d9_indexbuffer *buffer, struct d3d9_device *device, UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool)
 
struct d3d9_indexbufferunsafe_impl_from_IDirect3DIndexBuffer9 (IDirect3DIndexBuffer9 *iface)
 

Variables

static const IDirect3DVertexBuffer9Vtbl d3d9_vertexbuffer_vtbl
 
static const struct wined3d_parent_ops d3d9_vertexbuffer_wined3d_parent_ops
 
static const IDirect3DIndexBuffer9Vtbl d3d9_indexbuffer_vtbl
 
static const struct wined3d_parent_ops d3d9_indexbuffer_wined3d_parent_ops
 

Function Documentation

◆ d3d9_indexbuffer_AddRef()

static ULONG WINAPI d3d9_indexbuffer_AddRef ( IDirect3DIndexBuffer9 *  iface)
static

Definition at line 347 of file buffer.c.

348 {
350  ULONG refcount = InterlockedIncrement(&buffer->resource.refcount);
351 
352  TRACE("%p increasing refcount to %u.\n", iface, refcount);
353 
354  if (refcount == 1)
355  {
356  IDirect3DDevice9Ex_AddRef(buffer->parent_device);
358  wined3d_buffer_incref(buffer->wined3d_buffer);
360  }
361 
362  return refcount;
363 }
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
GLuint buffer
Definition: glext.h:5915
ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer)
Definition: buffer.c:525
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1916
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1
static struct d3d9_indexbuffer * impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:323
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

◆ d3d9_indexbuffer_FreePrivateData()

static HRESULT WINAPI d3d9_indexbuffer_FreePrivateData ( IDirect3DIndexBuffer9 *  iface,
REFGUID  guid 
)
static

Definition at line 421 of file buffer.c.

422 {
424  TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
425 
426  return d3d9_resource_free_private_data(&buffer->resource, guid);
427 }
GLuint buffer
Definition: glext.h:5915
const GUID * guid
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
static struct d3d9_indexbuffer * impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:323
HRESULT d3d9_resource_free_private_data(struct d3d9_resource *resource, const GUID *guid)
Definition: d3d9_main.c:160

◆ d3d9_indexbuffer_GetDesc()

static HRESULT WINAPI d3d9_indexbuffer_GetDesc ( IDirect3DIndexBuffer9 *  iface,
D3DINDEXBUFFER_DESC desc 
)
static

Definition at line 514 of file buffer.c.

515 {
517  struct wined3d_resource_desc wined3d_desc;
519 
520  TRACE("iface %p, desc %p.\n", iface, desc);
521 
526 
527  desc->Format = d3dformat_from_wined3dformat(buffer->format);
528  desc->Type = D3DRTYPE_INDEXBUFFER;
529  desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage);
530  desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
531  desc->Size = wined3d_desc.size;
532 
533  return D3D_OK;
534 }
void CDECL wined3d_resource_get_desc(const struct wined3d_resource *resource, struct wined3d_resource_desc *desc)
Definition: resource.c:295
static D3DPOOL d3dpool_from_wined3daccess(unsigned int access, unsigned int usage)
Definition: d3d8_private.h:285
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
GLuint buffer
Definition: glext.h:5915
static const WCHAR desc[]
Definition: protectdata.c:36
#define TRACE(s)
Definition: solgame.cpp:4
#define D3D_OK
Definition: d3d.h:106
static DWORD d3dusage_from_wined3dusage(unsigned int usage)
Definition: d3d8_private.h:280
struct wined3d_resource *CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
Definition: buffer.c:995
D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN
Definition: device.c:44
static struct d3d9_indexbuffer * impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:323
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

◆ d3d9_indexbuffer_GetDevice()

static HRESULT WINAPI d3d9_indexbuffer_GetDevice ( IDirect3DIndexBuffer9 *  iface,
IDirect3DDevice9 **  device 
)
static

Definition at line 387 of file buffer.c.

388 {
390 
391  TRACE("iface %p, device %p.\n", iface, device);
392 
393  *device = (IDirect3DDevice9 *)buffer->parent_device;
395 
396  TRACE("Returning device %p.\n", *device);
397 
398  return D3D_OK;
399 }
GLuint buffer
Definition: glext.h:5915
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
#define IDirect3DDevice9_AddRef(p)
Definition: d3d9.h:1507
#define D3D_OK
Definition: d3d.h:106
static struct d3d9_indexbuffer * impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:323

◆ d3d9_indexbuffer_GetPriority()

static DWORD WINAPI d3d9_indexbuffer_GetPriority ( IDirect3DIndexBuffer9 *  iface)
static

Definition at line 445 of file buffer.c.

446 {
448  const struct wined3d_resource *resource;
449  DWORD priority;
450 
451  TRACE("iface %p.\n", iface);
452 
454  resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
457 
458  return priority;
459 }
DWORD CDECL wined3d_resource_get_priority(const struct wined3d_resource *resource)
Definition: resource.c:279
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
GLuint buffer
Definition: glext.h:5915
int resource
Definition: rdpsnd_sgi.c:44
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
struct wined3d_resource *CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
Definition: buffer.c:995
static int priority
Definition: timer.c:163
static struct d3d9_indexbuffer * impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:323
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

◆ d3d9_indexbuffer_GetPrivateData()

static HRESULT WINAPI d3d9_indexbuffer_GetPrivateData ( IDirect3DIndexBuffer9 *  iface,
REFGUID  guid,
void data,
DWORD data_size 
)
static

Definition at line 411 of file buffer.c.

413 {
415  TRACE("iface %p, guid %s, data %p, data_size %p.\n",
416  iface, debugstr_guid(guid), data, data_size);
417 
418  return d3d9_resource_get_private_data(&buffer->resource, guid, data, data_size);
419 }
GLuint buffer
Definition: glext.h:5915
const GUID * guid
#define debugstr_guid
Definition: kernel32.h:35
HRESULT d3d9_resource_get_private_data(struct d3d9_resource *resource, const GUID *guid, void *data, DWORD *data_size)
Definition: d3d9_main.c:178
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static struct d3d9_indexbuffer * impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:323

◆ d3d9_indexbuffer_GetType()

static D3DRESOURCETYPE WINAPI d3d9_indexbuffer_GetType ( IDirect3DIndexBuffer9 *  iface)
static

Definition at line 472 of file buffer.c.

473 {
474  TRACE("iface %p.\n", iface);
475 
476  return D3DRTYPE_INDEXBUFFER;
477 }
#define TRACE(s)
Definition: solgame.cpp:4

◆ d3d9_indexbuffer_Lock()

static HRESULT WINAPI d3d9_indexbuffer_Lock ( IDirect3DIndexBuffer9 *  iface,
UINT  offset,
UINT  size,
void **  data,
DWORD  flags 
)
static

Definition at line 479 of file buffer.c.

481 {
484  struct wined3d_box wined3d_box = {0};
485  HRESULT hr;
486 
487  TRACE("iface %p, offset %u, size %u, data %p, flags %#x.\n",
488  iface, offset, size, data, flags);
489 
497 
498  return hr;
499 }
UINT left
Definition: wined3d.h:1839
HRESULT hr
Definition: shlfolder.c:183
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
GLintptr offset
Definition: glext.h:5920
GLuint buffer
Definition: glext.h:5915
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
UINT right
Definition: wined3d.h:1841
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:78
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
struct wined3d_resource *CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
Definition: buffer.c:995
unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags) DECLSPEC_HIDDEN
Definition: device.c:144
static struct d3d9_indexbuffer * impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:323
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

◆ d3d9_indexbuffer_PreLoad()

static void WINAPI d3d9_indexbuffer_PreLoad ( IDirect3DIndexBuffer9 *  iface)
static

Definition at line 461 of file buffer.c.

462 {
464 
465  TRACE("iface %p.\n", iface);
466 
470 }
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
GLuint buffer
Definition: glext.h:5915
void CDECL wined3d_resource_preload(struct wined3d_resource *resource)
Definition: resource.c:482
#define TRACE(s)
Definition: solgame.cpp:4
struct wined3d_resource *CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
Definition: buffer.c:995
static struct d3d9_indexbuffer * impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:323
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

◆ d3d9_indexbuffer_QueryInterface()

static HRESULT WINAPI d3d9_indexbuffer_QueryInterface ( IDirect3DIndexBuffer9 *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 328 of file buffer.c.

329 {
330  TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
331 
332  if (IsEqualGUID(riid, &IID_IDirect3DIndexBuffer9)
333  || IsEqualGUID(riid, &IID_IDirect3DResource9)
335  {
337  *out = iface;
338  return S_OK;
339  }
340 
341  WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
342 
343  *out = NULL;
344  return E_NOINTERFACE;
345 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
static FILE * out
Definition: regtests2xml.c:44
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define IDirect3DIndexBuffer9_AddRef(p)
Definition: d3d9.h:763

◆ d3d9_indexbuffer_Release()

static ULONG WINAPI d3d9_indexbuffer_Release ( IDirect3DIndexBuffer9 *  iface)
static

Definition at line 365 of file buffer.c.

366 {
368  ULONG refcount = InterlockedDecrement(&buffer->resource.refcount);
369 
370  TRACE("%p decreasing refcount to %u.\n", iface, refcount);
371 
372  if (!refcount)
373  {
374  IDirect3DDevice9Ex *device = buffer->parent_device;
375 
377  wined3d_buffer_decref(buffer->wined3d_buffer);
379 
380  /* Release the device last, as it may cause the device to be destroyed. */
382  }
383 
384  return refcount;
385 }
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
GLuint buffer
Definition: glext.h:5915
#define IDirect3DDevice9Ex_Release(p)
Definition: d3d9.h:1917
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
Definition: buffer.c:791
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
static struct d3d9_indexbuffer * impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:323
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

◆ d3d9_indexbuffer_SetPriority()

static DWORD WINAPI d3d9_indexbuffer_SetPriority ( IDirect3DIndexBuffer9 *  iface,
DWORD  priority 
)
static

Definition at line 429 of file buffer.c.

430 {
432  struct wined3d_resource *resource;
433  DWORD previous;
434 
435  TRACE("iface %p, priority %u.\n", iface, priority);
436 
438  resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
441 
442  return previous;
443 }
DWORD CDECL wined3d_resource_set_priority(struct wined3d_resource *resource, DWORD priority)
Definition: resource.c:263
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
GLuint buffer
Definition: glext.h:5915
int resource
Definition: rdpsnd_sgi.c:44
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
struct wined3d_resource *CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
Definition: buffer.c:995
static int priority
Definition: timer.c:163
static struct d3d9_indexbuffer * impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:323
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

◆ d3d9_indexbuffer_SetPrivateData()

static HRESULT WINAPI d3d9_indexbuffer_SetPrivateData ( IDirect3DIndexBuffer9 *  iface,
REFGUID  guid,
const void data,
DWORD  data_size,
DWORD  flags 
)
static

Definition at line 401 of file buffer.c.

403 {
405  TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
406  iface, debugstr_guid(guid), data, data_size, flags);
407 
408  return d3d9_resource_set_private_data(&buffer->resource, guid, data, data_size, flags);
409 }
GLuint buffer
Definition: glext.h:5915
HRESULT d3d9_resource_set_private_data(struct d3d9_resource *resource, const GUID *guid, const void *data, DWORD data_size, DWORD flags)
Definition: d3d9_main.c:222
const GUID * guid
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
static struct d3d9_indexbuffer * impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:323

◆ d3d9_indexbuffer_Unlock()

static HRESULT WINAPI d3d9_indexbuffer_Unlock ( IDirect3DIndexBuffer9 *  iface)
static

Definition at line 501 of file buffer.c.

502 {
504 
505  TRACE("iface %p.\n", iface);
506 
510 
511  return D3D_OK;
512 }
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
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
static struct d3d9_indexbuffer * impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:323
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

◆ d3d9_indexbuffer_wined3d_object_destroyed()

static void STDMETHODCALLTYPE d3d9_indexbuffer_wined3d_object_destroyed ( void parent)
static

Definition at line 557 of file buffer.c.

558 {
559  struct d3d9_indexbuffer *buffer = parent;
560  d3d9_resource_cleanup(&buffer->resource);
561  heap_free(buffer);
562 }
GLuint buffer
Definition: glext.h:5915
r parent
Definition: btrfs.c:2944
void d3d9_resource_cleanup(struct d3d9_resource *resource)
Definition: d3d9_main.c:155
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ d3d9_vertexbuffer_AddRef()

static ULONG WINAPI d3d9_vertexbuffer_AddRef ( IDirect3DVertexBuffer9 *  iface)
static

Definition at line 50 of file buffer.c.

51 {
53  ULONG refcount = InterlockedIncrement(&buffer->resource.refcount);
54 
55  TRACE("%p increasing refcount to %u.\n", iface, refcount);
56 
57  if (refcount == 1)
58  {
59  IDirect3DDevice9Ex_AddRef(buffer->parent_device);
61  wined3d_buffer_incref(buffer->wined3d_buffer);
63  }
64 
65  return refcount;
66 }
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
GLuint buffer
Definition: glext.h:5915
ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer)
Definition: buffer.c:525
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1916
#define TRACE(s)
Definition: solgame.cpp:4
static struct d3d9_vertexbuffer * impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:26
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

◆ d3d9_vertexbuffer_FreePrivateData()

static HRESULT WINAPI d3d9_vertexbuffer_FreePrivateData ( IDirect3DVertexBuffer9 *  iface,
REFGUID  guid 
)
static

Definition at line 124 of file buffer.c.

125 {
127  TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
128 
129  return d3d9_resource_free_private_data(&buffer->resource, guid);
130 }
GLuint buffer
Definition: glext.h:5915
const GUID * guid
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
static struct d3d9_vertexbuffer * impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:26
HRESULT d3d9_resource_free_private_data(struct d3d9_resource *resource, const GUID *guid)
Definition: d3d9_main.c:160

◆ d3d9_vertexbuffer_GetDesc()

static HRESULT WINAPI d3d9_vertexbuffer_GetDesc ( IDirect3DVertexBuffer9 *  iface,
D3DVERTEXBUFFER_DESC desc 
)
static

Definition at line 217 of file buffer.c.

219 {
221  struct wined3d_resource_desc wined3d_desc;
223 
224  TRACE("iface %p, desc %p.\n", iface, desc);
225 
230 
231  desc->Format = D3DFMT_VERTEXDATA;
232  desc->Type = D3DRTYPE_VERTEXBUFFER;
233  desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage);
234  desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
235  desc->Size = wined3d_desc.size;
236  desc->FVF = buffer->fvf;
237 
238  return D3D_OK;
239 }
void CDECL wined3d_resource_get_desc(const struct wined3d_resource *resource, struct wined3d_resource_desc *desc)
Definition: resource.c:295
static D3DPOOL d3dpool_from_wined3daccess(unsigned int access, unsigned int usage)
Definition: d3d8_private.h:285
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
GLuint buffer
Definition: glext.h:5915
static const WCHAR desc[]
Definition: protectdata.c:36
#define TRACE(s)
Definition: solgame.cpp:4
static struct d3d9_vertexbuffer * impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:26
#define D3D_OK
Definition: d3d.h:106
static DWORD d3dusage_from_wined3dusage(unsigned int usage)
Definition: d3d8_private.h:280
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

◆ d3d9_vertexbuffer_GetDevice()

static HRESULT WINAPI d3d9_vertexbuffer_GetDevice ( IDirect3DVertexBuffer9 *  iface,
IDirect3DDevice9 **  device 
)
static

Definition at line 90 of file buffer.c.

91 {
93 
94  TRACE("iface %p, device %p.\n", iface, device);
95 
96  *device = (IDirect3DDevice9 *)buffer->parent_device;
98 
99  TRACE("Returning device %p.\n", *device);
100 
101  return D3D_OK;
102 }
GLuint buffer
Definition: glext.h:5915
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
#define IDirect3DDevice9_AddRef(p)
Definition: d3d9.h:1507
static struct d3d9_vertexbuffer * impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:26
#define D3D_OK
Definition: d3d.h:106

◆ d3d9_vertexbuffer_GetPriority()

static DWORD WINAPI d3d9_vertexbuffer_GetPriority ( IDirect3DVertexBuffer9 *  iface)
static

Definition at line 148 of file buffer.c.

149 {
151  const struct wined3d_resource *resource;
152  DWORD priority;
153 
154  TRACE("iface %p.\n", iface);
155 
157  resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
160 
161  return priority;
162 }
DWORD CDECL wined3d_resource_get_priority(const struct wined3d_resource *resource)
Definition: resource.c:279
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
GLuint buffer
Definition: glext.h:5915
int resource
Definition: rdpsnd_sgi.c:44
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
static struct d3d9_vertexbuffer * impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:26
struct wined3d_resource *CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
Definition: buffer.c:995
static int priority
Definition: timer.c:163
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

◆ d3d9_vertexbuffer_GetPrivateData()

static HRESULT WINAPI d3d9_vertexbuffer_GetPrivateData ( IDirect3DVertexBuffer9 *  iface,
REFGUID  guid,
void data,
DWORD data_size 
)
static

Definition at line 114 of file buffer.c.

116 {
118  TRACE("iface %p, guid %s, data %p, data_size %p.\n",
119  iface, debugstr_guid(guid), data, data_size);
120 
121  return d3d9_resource_get_private_data(&buffer->resource, guid, data, data_size);
122 }
GLuint buffer
Definition: glext.h:5915
const GUID * guid
#define debugstr_guid
Definition: kernel32.h:35
HRESULT d3d9_resource_get_private_data(struct d3d9_resource *resource, const GUID *guid, void *data, DWORD *data_size)
Definition: d3d9_main.c:178
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static struct d3d9_vertexbuffer * impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:26

◆ d3d9_vertexbuffer_GetType()

static D3DRESOURCETYPE WINAPI d3d9_vertexbuffer_GetType ( IDirect3DVertexBuffer9 *  iface)
static

Definition at line 175 of file buffer.c.

176 {
177  TRACE("iface %p.\n", iface);
178 
179  return D3DRTYPE_VERTEXBUFFER;
180 }
#define TRACE(s)
Definition: solgame.cpp:4

◆ d3d9_vertexbuffer_Lock()

static HRESULT WINAPI d3d9_vertexbuffer_Lock ( IDirect3DVertexBuffer9 *  iface,
UINT  offset,
UINT  size,
void **  data,
DWORD  flags 
)
static

Definition at line 182 of file buffer.c.

184 {
187  struct wined3d_box wined3d_box = {0};
188  HRESULT hr;
189 
190  TRACE("iface %p, offset %u, size %u, data %p, flags %#x.\n",
191  iface, offset, size, data, flags);
192 
200 
201  return hr;
202 }
UINT left
Definition: wined3d.h:1839
HRESULT hr
Definition: shlfolder.c:183
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
GLintptr offset
Definition: glext.h:5920
GLuint buffer
Definition: glext.h:5915
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
UINT right
Definition: wined3d.h:1841
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:78
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
static struct d3d9_vertexbuffer * impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:26
struct wined3d_resource *CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
Definition: buffer.c:995
unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags) DECLSPEC_HIDDEN
Definition: device.c:144
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

◆ d3d9_vertexbuffer_PreLoad()

static void WINAPI d3d9_vertexbuffer_PreLoad ( IDirect3DVertexBuffer9 *  iface)
static

Definition at line 164 of file buffer.c.

165 {
167 
168  TRACE("iface %p.\n", iface);
169 
173 }
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
GLuint buffer
Definition: glext.h:5915
void CDECL wined3d_resource_preload(struct wined3d_resource *resource)
Definition: resource.c:482
#define TRACE(s)
Definition: solgame.cpp:4
static struct d3d9_vertexbuffer * impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:26
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

◆ d3d9_vertexbuffer_QueryInterface()

static HRESULT WINAPI d3d9_vertexbuffer_QueryInterface ( IDirect3DVertexBuffer9 *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 31 of file buffer.c.

32 {
33  TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
34 
35  if (IsEqualGUID(riid, &IID_IDirect3DVertexBuffer9)
36  || IsEqualGUID(riid, &IID_IDirect3DResource9)
38  {
40  *out = iface;
41  return S_OK;
42  }
43 
44  WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
45 
46  *out = NULL;
47  return E_NOINTERFACE;
48 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
#define IDirect3DVertexBuffer9_AddRef(p)
Definition: d3d9.h:695
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
static FILE * out
Definition: regtests2xml.c:44
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ d3d9_vertexbuffer_Release()

static ULONG WINAPI d3d9_vertexbuffer_Release ( IDirect3DVertexBuffer9 *  iface)
static

Definition at line 68 of file buffer.c.

69 {
71  ULONG refcount = InterlockedDecrement(&buffer->resource.refcount);
72 
73  TRACE("%p decreasing refcount to %u.\n", iface, refcount);
74 
75  if (!refcount)
76  {
77  IDirect3DDevice9Ex *device = buffer->parent_device;
78 
80  wined3d_buffer_decref(buffer->wined3d_buffer);
82 
83  /* Release the device last, as it may cause the device to be destroyed. */
85  }
86 
87  return refcount;
88 }
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
GLuint buffer
Definition: glext.h:5915
#define IDirect3DDevice9Ex_Release(p)
Definition: d3d9.h:1917
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
Definition: buffer.c:791
#define InterlockedDecrement
Definition: armddk.h:52
static struct d3d9_vertexbuffer * impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:26
unsigned int ULONG
Definition: retypes.h:1
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

◆ d3d9_vertexbuffer_SetPriority()

static DWORD WINAPI d3d9_vertexbuffer_SetPriority ( IDirect3DVertexBuffer9 *  iface,
DWORD  priority 
)
static

Definition at line 132 of file buffer.c.

133 {
135  struct wined3d_resource *resource;
136  DWORD previous;
137 
138  TRACE("iface %p, priority %u.\n", iface, priority);
139 
141  resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
144 
145  return previous;
146 }
DWORD CDECL wined3d_resource_set_priority(struct wined3d_resource *resource, DWORD priority)
Definition: resource.c:263
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
GLuint buffer
Definition: glext.h:5915
int resource
Definition: rdpsnd_sgi.c:44
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
static struct d3d9_vertexbuffer * impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:26
struct wined3d_resource *CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
Definition: buffer.c:995
static int priority
Definition: timer.c:163
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

◆ d3d9_vertexbuffer_SetPrivateData()

static HRESULT WINAPI d3d9_vertexbuffer_SetPrivateData ( IDirect3DVertexBuffer9 *  iface,
REFGUID  guid,
const void data,
DWORD  data_size,
DWORD  flags 
)
static

Definition at line 104 of file buffer.c.

106 {
108  TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
109  iface, debugstr_guid(guid), data, data_size, flags);
110 
111  return d3d9_resource_set_private_data(&buffer->resource, guid, data, data_size, flags);
112 }
GLuint buffer
Definition: glext.h:5915
HRESULT d3d9_resource_set_private_data(struct d3d9_resource *resource, const GUID *guid, const void *data, DWORD data_size, DWORD flags)
Definition: d3d9_main.c:222
const GUID * guid
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
static struct d3d9_vertexbuffer * impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:26

◆ d3d9_vertexbuffer_Unlock()

static HRESULT WINAPI d3d9_vertexbuffer_Unlock ( IDirect3DVertexBuffer9 *  iface)
static

Definition at line 204 of file buffer.c.

205 {
207 
208  TRACE("iface %p.\n", iface);
209 
213 
214  return D3D_OK;
215 }
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
GLuint buffer
Definition: glext.h:5915
#define TRACE(s)
Definition: solgame.cpp:4
static struct d3d9_vertexbuffer * impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:26
#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

◆ d3d9_vertexbuffer_wined3d_object_destroyed()

static void STDMETHODCALLTYPE d3d9_vertexbuffer_wined3d_object_destroyed ( void parent)
static

Definition at line 262 of file buffer.c.

263 {
264  struct d3d9_vertexbuffer *buffer = parent;
265  d3d9_resource_cleanup(&buffer->resource);
266  heap_free(buffer);
267 }
GLuint buffer
Definition: glext.h:5915
r parent
Definition: btrfs.c:2944
void d3d9_resource_cleanup(struct d3d9_resource *resource)
Definition: d3d9_main.c:155
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ impl_from_IDirect3DIndexBuffer9()

static struct d3d9_indexbuffer* impl_from_IDirect3DIndexBuffer9 ( IDirect3DIndexBuffer9 *  iface)
inlinestatic

Definition at line 323 of file buffer.c.

324 {
325  return CONTAINING_RECORD(iface, struct d3d9_indexbuffer, IDirect3DIndexBuffer9_iface);
326 }
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 d3d9_indexbuffer_AddRef(), d3d9_indexbuffer_FreePrivateData(), d3d9_indexbuffer_GetDesc(), d3d9_indexbuffer_GetDevice(), d3d9_indexbuffer_GetPriority(), d3d9_indexbuffer_GetPrivateData(), d3d9_indexbuffer_Lock(), d3d9_indexbuffer_PreLoad(), d3d9_indexbuffer_Release(), d3d9_indexbuffer_SetPriority(), d3d9_indexbuffer_SetPrivateData(), d3d9_indexbuffer_Unlock(), and unsafe_impl_from_IDirect3DIndexBuffer9().

◆ impl_from_IDirect3DVertexBuffer9()

static struct d3d9_vertexbuffer* impl_from_IDirect3DVertexBuffer9 ( IDirect3DVertexBuffer9 *  iface)
inlinestatic

Definition at line 26 of file buffer.c.

27 {
29 }
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
IDirect3DVertexBuffer9 IDirect3DVertexBuffer9_iface
Definition: d3d9_private.h:180

Referenced by d3d9_vertexbuffer_AddRef(), d3d9_vertexbuffer_FreePrivateData(), d3d9_vertexbuffer_GetDesc(), d3d9_vertexbuffer_GetDevice(), d3d9_vertexbuffer_GetPriority(), d3d9_vertexbuffer_GetPrivateData(), d3d9_vertexbuffer_Lock(), d3d9_vertexbuffer_PreLoad(), d3d9_vertexbuffer_Release(), d3d9_vertexbuffer_SetPriority(), d3d9_vertexbuffer_SetPrivateData(), d3d9_vertexbuffer_Unlock(), and unsafe_impl_from_IDirect3DVertexBuffer9().

◆ indexbuffer_init()

HRESULT indexbuffer_init ( struct d3d9_indexbuffer buffer,
struct d3d9_device device,
UINT  size,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool 
)

Definition at line 569 of file buffer.c.

571 {
572  struct wined3d_buffer_desc desc;
573  HRESULT hr;
574 
575  desc.byte_width = size;
577  if (pool == D3DPOOL_SCRATCH)
578  desc.usage |= WINED3DUSAGE_SCRATCH;
579  desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
582  desc.misc_flags = 0;
583  desc.structure_byte_stride = 0;
584 
585  buffer->IDirect3DIndexBuffer9_iface.lpVtbl = &d3d9_indexbuffer_vtbl;
587  d3d9_resource_init(&buffer->resource);
588 
590  hr = wined3d_buffer_create(device->wined3d_device, &desc, NULL, buffer,
591  &d3d9_indexbuffer_wined3d_parent_ops, &buffer->wined3d_buffer);
593  if (FAILED(hr))
594  {
595  WARN("Failed to create wined3d buffer, hr %#x.\n", hr);
596  return hr;
597  }
598 
599  buffer->parent_device = &device->IDirect3DDevice9Ex_iface;
600  IDirect3DDevice9Ex_AddRef(buffer->parent_device);
601 
602  return D3D_OK;
603 }
HRESULT hr
Definition: shlfolder.c:183
enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) DECLSPEC_HIDDEN
Definition: device.c:94
#define WARN(fmt,...)
Definition: debug.h:112
void d3d9_resource_init(struct d3d9_resource *resource)
Definition: d3d9_main.c:216
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
GLuint buffer
Definition: glext.h:5915
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:58
#define WINED3DUSAGE_MASK
Definition: wined3d.h:913
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define WINED3D_BIND_INDEX_BUFFER
Definition: wined3d.h:891
static const struct wined3d_parent_ops d3d9_indexbuffer_wined3d_parent_ops
Definition: buffer.c:564
Definition: devices.h:37
static const WCHAR desc[]
Definition: protectdata.c:36
#define WINED3DUSAGE_STATICDECL
Definition: wined3d.h:920
smooth NULL
Definition: ftsmooth.c:416
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1916
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:78
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:57
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define D3D_OK
Definition: d3d.h:106
static const IDirect3DIndexBuffer9Vtbl d3d9_indexbuffer_vtbl
Definition: buffer.c:536
#define WINED3DUSAGE_SCRATCH
Definition: wined3d.h:915
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
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
static unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int usage)
Definition: d3d8_private.h:301

◆ unsafe_impl_from_IDirect3DIndexBuffer9()

struct d3d9_indexbuffer* unsafe_impl_from_IDirect3DIndexBuffer9 ( IDirect3DIndexBuffer9 *  iface)

Definition at line 605 of file buffer.c.

606 {
607  if (!iface)
608  return NULL;
609  assert(iface->lpVtbl == &d3d9_indexbuffer_vtbl);
610 
611  return impl_from_IDirect3DIndexBuffer9(iface);
612 }
#define assert(x)
Definition: debug.h:53
smooth NULL
Definition: ftsmooth.c:416
static const IDirect3DIndexBuffer9Vtbl d3d9_indexbuffer_vtbl
Definition: buffer.c:536
static struct d3d9_indexbuffer * impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:323

Referenced by d3d9_device_SetIndices().

◆ unsafe_impl_from_IDirect3DVertexBuffer9()

struct d3d9_vertexbuffer* unsafe_impl_from_IDirect3DVertexBuffer9 ( IDirect3DVertexBuffer9 *  iface)

Definition at line 314 of file buffer.c.

315 {
316  if (!iface)
317  return NULL;
318  assert(iface->lpVtbl == &d3d9_vertexbuffer_vtbl);
319 
320  return impl_from_IDirect3DVertexBuffer9(iface);
321 }
#define assert(x)
Definition: debug.h:53
smooth NULL
Definition: ftsmooth.c:416
static const IDirect3DVertexBuffer9Vtbl d3d9_vertexbuffer_vtbl
Definition: buffer.c:241
static struct d3d9_vertexbuffer * impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:26

Referenced by d3d9_device_ProcessVertices(), and d3d9_device_SetStreamSource().

◆ vertexbuffer_init()

HRESULT vertexbuffer_init ( struct d3d9_vertexbuffer buffer,
struct d3d9_device device,
UINT  size,
UINT  usage,
DWORD  fvf,
D3DPOOL  pool 
)

Definition at line 274 of file buffer.c.

276 {
277  struct wined3d_buffer_desc desc;
278  HRESULT hr;
279 
280  if (pool == D3DPOOL_SCRATCH)
281  {
282  WARN("Vertex buffer with D3DPOOL_SCRATCH requested.\n");
283  return D3DERR_INVALIDCALL;
284  }
285 
286  buffer->IDirect3DVertexBuffer9_iface.lpVtbl = &d3d9_vertexbuffer_vtbl;
287  buffer->fvf = fvf;
288  d3d9_resource_init(&buffer->resource);
289 
290  desc.byte_width = size;
291  desc.usage = usage & WINED3DUSAGE_MASK;
292  desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
295  desc.misc_flags = 0;
296  desc.structure_byte_stride = 0;
297 
299  hr = wined3d_buffer_create(device->wined3d_device, &desc, NULL, buffer,
300  &d3d9_vertexbuffer_wined3d_parent_ops, &buffer->wined3d_buffer);
302  if (FAILED(hr))
303  {
304  WARN("Failed to create wined3d buffer, hr %#x.\n", hr);
305  return hr;
306  }
307 
308  buffer->parent_device = &device->IDirect3DDevice9Ex_iface;
309  IDirect3DDevice9Ex_AddRef(buffer->parent_device);
310 
311  return D3D_OK;
312 }
HRESULT hr
Definition: shlfolder.c:183
#define WINED3D_BIND_VERTEX_BUFFER
Definition: wined3d.h:890
#define WARN(fmt,...)
Definition: debug.h:112
void d3d9_resource_init(struct d3d9_resource *resource)
Definition: d3d9_main.c:216
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
static const struct wined3d_parent_ops d3d9_vertexbuffer_wined3d_parent_ops
Definition: buffer.c:269
#define D3DERR_INVALIDCALL
GLuint buffer
Definition: glext.h:5915
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:58
#define WINED3DUSAGE_MASK
Definition: wined3d.h:913
Definition: devices.h:37
static const WCHAR desc[]
Definition: protectdata.c:36
smooth NULL
Definition: ftsmooth.c:416
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1916
static const IDirect3DVertexBuffer9Vtbl d3d9_vertexbuffer_vtbl
Definition: buffer.c:241
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:78
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:57
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define D3D_OK
Definition: d3d.h:106
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
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
static unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int usage)
Definition: d3d8_private.h:301

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3d9  )

Variable Documentation

◆ d3d9_indexbuffer_vtbl

const IDirect3DIndexBuffer9Vtbl d3d9_indexbuffer_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI d3d9_indexbuffer_Release(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:365
static void WINAPI d3d9_indexbuffer_PreLoad(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:461
static HRESULT WINAPI d3d9_indexbuffer_GetDevice(IDirect3DIndexBuffer9 *iface, IDirect3DDevice9 **device)
Definition: buffer.c:387
static HRESULT WINAPI d3d9_indexbuffer_SetPrivateData(IDirect3DIndexBuffer9 *iface, REFGUID guid, const void *data, DWORD data_size, DWORD flags)
Definition: buffer.c:401
static HRESULT WINAPI d3d9_indexbuffer_QueryInterface(IDirect3DIndexBuffer9 *iface, REFIID riid, void **out)
Definition: buffer.c:328
static DWORD WINAPI d3d9_indexbuffer_GetPriority(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:445
static ULONG WINAPI d3d9_indexbuffer_AddRef(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:347
static DWORD WINAPI d3d9_indexbuffer_SetPriority(IDirect3DIndexBuffer9 *iface, DWORD priority)
Definition: buffer.c:429
static HRESULT WINAPI d3d9_indexbuffer_FreePrivateData(IDirect3DIndexBuffer9 *iface, REFGUID guid)
Definition: buffer.c:421
static HRESULT WINAPI d3d9_indexbuffer_Unlock(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:501
static HRESULT WINAPI d3d9_indexbuffer_GetDesc(IDirect3DIndexBuffer9 *iface, D3DINDEXBUFFER_DESC *desc)
Definition: buffer.c:514
static HRESULT WINAPI d3d9_indexbuffer_Lock(IDirect3DIndexBuffer9 *iface, UINT offset, UINT size, void **data, DWORD flags)
Definition: buffer.c:479
static D3DRESOURCETYPE WINAPI d3d9_indexbuffer_GetType(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:472
static HRESULT WINAPI d3d9_indexbuffer_GetPrivateData(IDirect3DIndexBuffer9 *iface, REFGUID guid, void *data, DWORD *data_size)
Definition: buffer.c:411

Definition at line 536 of file buffer.c.

Referenced by indexbuffer_init(), and unsafe_impl_from_IDirect3DIndexBuffer9().

◆ d3d9_indexbuffer_wined3d_parent_ops

const struct wined3d_parent_ops d3d9_indexbuffer_wined3d_parent_ops
static
Initial value:
=
{
}
static void STDMETHODCALLTYPE d3d9_indexbuffer_wined3d_object_destroyed(void *parent)
Definition: buffer.c:557

Definition at line 564 of file buffer.c.

Referenced by indexbuffer_init().

◆ d3d9_vertexbuffer_vtbl

const IDirect3DVertexBuffer9Vtbl d3d9_vertexbuffer_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI d3d9_vertexbuffer_GetDevice(IDirect3DVertexBuffer9 *iface, IDirect3DDevice9 **device)
Definition: buffer.c:90
static void WINAPI d3d9_vertexbuffer_PreLoad(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:164
static HRESULT WINAPI d3d9_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer9 *iface, REFGUID guid, void *data, DWORD *data_size)
Definition: buffer.c:114
static HRESULT WINAPI d3d9_vertexbuffer_GetDesc(IDirect3DVertexBuffer9 *iface, D3DVERTEXBUFFER_DESC *desc)
Definition: buffer.c:217
static ULONG WINAPI d3d9_vertexbuffer_AddRef(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:50
static HRESULT WINAPI d3d9_vertexbuffer_Lock(IDirect3DVertexBuffer9 *iface, UINT offset, UINT size, void **data, DWORD flags)
Definition: buffer.c:182
static D3DRESOURCETYPE WINAPI d3d9_vertexbuffer_GetType(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:175
static HRESULT WINAPI d3d9_vertexbuffer_QueryInterface(IDirect3DVertexBuffer9 *iface, REFIID riid, void **out)
Definition: buffer.c:31
static HRESULT WINAPI d3d9_vertexbuffer_FreePrivateData(IDirect3DVertexBuffer9 *iface, REFGUID guid)
Definition: buffer.c:124
static HRESULT WINAPI d3d9_vertexbuffer_Unlock(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:204
static ULONG WINAPI d3d9_vertexbuffer_Release(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:68
static HRESULT WINAPI d3d9_vertexbuffer_SetPrivateData(IDirect3DVertexBuffer9 *iface, REFGUID guid, const void *data, DWORD data_size, DWORD flags)
Definition: buffer.c:104
static DWORD WINAPI d3d9_vertexbuffer_SetPriority(IDirect3DVertexBuffer9 *iface, DWORD priority)
Definition: buffer.c:132
static DWORD WINAPI d3d9_vertexbuffer_GetPriority(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:148

Definition at line 241 of file buffer.c.

Referenced by unsafe_impl_from_IDirect3DVertexBuffer9(), and vertexbuffer_init().

◆ d3d9_vertexbuffer_wined3d_parent_ops

const struct wined3d_parent_ops d3d9_vertexbuffer_wined3d_parent_ops
static
Initial value:
=
{
}
static void STDMETHODCALLTYPE d3d9_vertexbuffer_wined3d_object_destroyed(void *parent)
Definition: buffer.c:262

Definition at line 269 of file buffer.c.

Referenced by vertexbuffer_init().