ReactOS  0.4.14-dev-608-gd495a4f
core.c File Reference
#include "config.h"
#include "wine/port.h"
#include "d3dx9_private.h"
Include dependency graph for core.c:

Go to the source code of this file.

Classes

struct  ID3DXBufferImpl
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3dx)
 
static struct ID3DXBufferImplimpl_from_ID3DXBuffer (ID3DXBuffer *iface)
 
static HRESULT WINAPI ID3DXBufferImpl_QueryInterface (ID3DXBuffer *iface, REFIID riid, void **ppobj)
 
static ULONG WINAPI ID3DXBufferImpl_AddRef (ID3DXBuffer *iface)
 
static ULONG WINAPI ID3DXBufferImpl_Release (ID3DXBuffer *iface)
 
static void *WINAPI ID3DXBufferImpl_GetBufferPointer (ID3DXBuffer *iface)
 
static DWORD WINAPI ID3DXBufferImpl_GetBufferSize (ID3DXBuffer *iface)
 
static HRESULT d3dx9_buffer_init (struct ID3DXBufferImpl *buffer, DWORD size)
 
HRESULT WINAPI D3DXCreateBuffer (DWORD size, ID3DXBuffer **buffer)
 

Variables

static const struct ID3DXBufferVtbl ID3DXBufferImpl_Vtbl
 

Function Documentation

◆ d3dx9_buffer_init()

static HRESULT d3dx9_buffer_init ( struct ID3DXBufferImpl buffer,
DWORD  size 
)
static

Definition at line 113 of file core.c.

114 {
115  buffer->ID3DXBuffer_iface.lpVtbl = &ID3DXBufferImpl_Vtbl;
116  buffer->ref = 1;
117  buffer->size = size;
118 
120  if (!buffer->buffer)
121  {
122  ERR("Failed to allocate buffer memory\n");
123  return E_OUTOFMEMORY;
124  }
125 
126  return D3D_OK;
127 }
static const struct ID3DXBufferVtbl ID3DXBufferImpl_Vtbl
Definition: core.c:102
GLuint buffer
Definition: glext.h:5915
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define ERR(fmt,...)
Definition: debug.h:109
#define D3D_OK
Definition: d3d.h:106
#define HEAP_ZERO_MEMORY
Definition: compat.h:123

Referenced by D3DXCreateBuffer().

◆ D3DXCreateBuffer()

HRESULT WINAPI D3DXCreateBuffer ( DWORD  size,
ID3DXBuffer **  buffer 
)

Definition at line 129 of file core.c.

130 {
131  struct ID3DXBufferImpl *object;
132  HRESULT hr;
133 
134  if (!buffer)
135  {
136  WARN("Invalid buffer specified.\n");
137  return D3DERR_INVALIDCALL;
138  }
139 
140  object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
141  if (!object)
142  return E_OUTOFMEMORY;
143 
144  hr = d3dx9_buffer_init(object, size);
145  if (FAILED(hr))
146  {
147  WARN("Failed to initialize buffer, hr %#x.\n", hr);
148  HeapFree(GetProcessHeap(), 0, object);
149  return hr;
150  }
151 
152  *buffer = &object->ID3DXBuffer_iface;
153 
154  TRACE("Created ID3DXBuffer %p.\n", *buffer);
155 
156  return D3D_OK;
157 }
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
#define D3DERR_INVALIDCALL
GLuint buffer
Definition: glext.h:5915
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
#define D3D_OK
Definition: d3d.h:106
static HRESULT d3dx9_buffer_init(struct ID3DXBufferImpl *buffer, DWORD size)
Definition: core.c:113
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define HeapFree(x, y, z)
Definition: compat.h:402
void * object
Definition: jmemsys.h:48

Referenced by compact_mesh(), d3dx9_mesh_OptimizeInplace(), D3DXCreateBox(), D3DXCreateCylinder(), D3DXCreatePolygon(), D3DXCreateSphere(), D3DXCreateTorus(), D3DXDisassembleShader(), D3DXLoadMeshFromXInMemory(), D3DXLoadSkinMeshFromXof(), D3DXSaveSurfaceToFileInMemory(), generate_effects(), and save_dds_surface_to_memory().

◆ ID3DXBufferImpl_AddRef()

static ULONG WINAPI ID3DXBufferImpl_AddRef ( ID3DXBuffer iface)
static

Definition at line 58 of file core.c.

59 {
62 
63  TRACE("%p increasing refcount to %u\n", This, ref);
64 
65  return ref;
66 }
static struct ID3DXBufferImpl * impl_from_ID3DXBuffer(ID3DXBuffer *iface)
Definition: core.c:36
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

◆ ID3DXBufferImpl_GetBufferPointer()

static void* WINAPI ID3DXBufferImpl_GetBufferPointer ( ID3DXBuffer iface)
static

Definition at line 84 of file core.c.

85 {
87 
88  TRACE("iface %p\n", iface);
89 
90  return This->buffer;
91 }
static struct ID3DXBufferImpl * impl_from_ID3DXBuffer(ID3DXBuffer *iface)
Definition: core.c:36
#define TRACE(s)
Definition: solgame.cpp:4

◆ ID3DXBufferImpl_GetBufferSize()

static DWORD WINAPI ID3DXBufferImpl_GetBufferSize ( ID3DXBuffer iface)
static

Definition at line 93 of file core.c.

94 {
96 
97  TRACE("iface %p\n", iface);
98 
99  return This->size;
100 }
static struct ID3DXBufferImpl * impl_from_ID3DXBuffer(ID3DXBuffer *iface)
Definition: core.c:36
#define TRACE(s)
Definition: solgame.cpp:4

◆ ID3DXBufferImpl_QueryInterface()

static HRESULT WINAPI ID3DXBufferImpl_QueryInterface ( ID3DXBuffer iface,
REFIID  riid,
void **  ppobj 
)
static

Definition at line 41 of file core.c.

42 {
43  TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), ppobj);
44 
46  || IsEqualGUID(riid, &IID_ID3DXBuffer))
47  {
48  IUnknown_AddRef(iface);
49  *ppobj = iface;
50  return D3D_OK;
51  }
52 
53  WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
54 
55  return E_NOINTERFACE;
56 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define D3D_OK
Definition: d3d.h:106
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ ID3DXBufferImpl_Release()

static ULONG WINAPI ID3DXBufferImpl_Release ( ID3DXBuffer iface)
static

Definition at line 68 of file core.c.

69 {
72 
73  TRACE("%p decreasing refcount to %u\n", This, ref);
74 
75  if (ref == 0)
76  {
77  HeapFree(GetProcessHeap(), 0, This->buffer);
79  }
80 
81  return ref;
82 }
static struct ID3DXBufferImpl * impl_from_ID3DXBuffer(ID3DXBuffer *iface)
Definition: core.c:36
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ impl_from_ID3DXBuffer()

static struct ID3DXBufferImpl* impl_from_ID3DXBuffer ( ID3DXBuffer iface)
inlinestatic

Definition at line 36 of file core.c.

37 {
39 }
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
ID3DXBuffer ID3DXBuffer_iface
Definition: core.c:29

Referenced by ID3DXBufferImpl_AddRef(), ID3DXBufferImpl_GetBufferPointer(), ID3DXBufferImpl_GetBufferSize(), and ID3DXBufferImpl_Release().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3dx  )

Variable Documentation

◆ ID3DXBufferImpl_Vtbl

const struct ID3DXBufferVtbl ID3DXBufferImpl_Vtbl
static
Initial value:
=
{
}
static DWORD WINAPI ID3DXBufferImpl_GetBufferSize(ID3DXBuffer *iface)
Definition: core.c:93
static HRESULT WINAPI ID3DXBufferImpl_QueryInterface(ID3DXBuffer *iface, REFIID riid, void **ppobj)
Definition: core.c:41
static ULONG WINAPI ID3DXBufferImpl_Release(ID3DXBuffer *iface)
Definition: core.c:68
static ULONG WINAPI ID3DXBufferImpl_AddRef(ID3DXBuffer *iface)
Definition: core.c:58
static void *WINAPI ID3DXBufferImpl_GetBufferPointer(ID3DXBuffer *iface)
Definition: core.c:84

Definition at line 102 of file core.c.

Referenced by d3dx9_buffer_init().