ReactOS  0.4.15-dev-2359-g0dedb9b
core.c File Reference
#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 115 of file core.c.

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

Referenced by D3DXCreateBuffer().

◆ D3DXCreateBuffer()

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

Definition at line 131 of file core.c.

132 {
133  struct ID3DXBufferImpl *object;
134  HRESULT hr;
135 
136  TRACE("size %u, buffer %p.\n", size, buffer);
137 
138  if (!buffer)
139  {
140  WARN("Invalid buffer specified.\n");
141  return D3DERR_INVALIDCALL;
142  }
143 
144  object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
145  if (!object)
146  return E_OUTOFMEMORY;
147 
148  hr = d3dx9_buffer_init(object, size);
149  if (FAILED(hr))
150  {
151  WARN("Failed to initialize buffer, hr %#x.\n", hr);
152  HeapFree(GetProcessHeap(), 0, object);
153  return hr;
154  }
155 
156  *buffer = &object->ID3DXBuffer_iface;
157 
158  TRACE("Created ID3DXBuffer %p.\n", *buffer);
159 
160  return D3D_OK;
161 }
coclass MSXML2::XSLTemplate40 object
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:112
#define D3DERR_INVALIDCALL
GLuint buffer
Definition: glext.h:5915
static HRESULT d3dx9_buffer_init(struct ID3DXBufferImpl *buffer, DWORD size)
Definition: core.c:115
#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:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:79
#define D3D_OK
Definition: d3d.h:106
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define HeapFree(x, y, z)
Definition: compat.h:594

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

◆ ID3DXBufferImpl_AddRef()

static ULONG WINAPI ID3DXBufferImpl_AddRef ( ID3DXBuffer iface)
static

Definition at line 60 of file core.c.

61 {
64 
65  TRACE("%p increasing refcount to %u\n", This, ref);
66 
67  return ref;
68 }
Definition: send.c:48
GLenum GLint ref
Definition: glext.h:6028
static struct ID3DXBufferImpl * impl_from_ID3DXBuffer(ID3DXBuffer *iface)
Definition: core.c:38
#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 86 of file core.c.

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

◆ ID3DXBufferImpl_GetBufferSize()

static DWORD WINAPI ID3DXBufferImpl_GetBufferSize ( ID3DXBuffer iface)
static

Definition at line 95 of file core.c.

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

◆ ID3DXBufferImpl_QueryInterface()

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

Definition at line 43 of file core.c.

44 {
45  TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), ppobj);
46 
48  || IsEqualGUID(riid, &IID_ID3DXBuffer))
49  {
50  IUnknown_AddRef(iface);
51  *ppobj = iface;
52  return D3D_OK;
53  }
54 
55  WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
56 
57  return E_NOINTERFACE;
58 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
#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 70 of file core.c.

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

◆ impl_from_ID3DXBuffer()

static struct ID3DXBufferImpl* impl_from_ID3DXBuffer ( ID3DXBuffer iface)
inlinestatic

Definition at line 38 of file core.c.

39 {
41 }
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:31

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 ULONG WINAPI ID3DXBufferImpl_AddRef(ID3DXBuffer *iface)
Definition: core.c:60
static void *WINAPI ID3DXBufferImpl_GetBufferPointer(ID3DXBuffer *iface)
Definition: core.c:86
static HRESULT WINAPI ID3DXBufferImpl_QueryInterface(ID3DXBuffer *iface, REFIID riid, void **ppobj)
Definition: core.c:43
static ULONG WINAPI ID3DXBufferImpl_Release(ID3DXBuffer *iface)
Definition: core.c:70
static DWORD WINAPI ID3DXBufferImpl_GetBufferSize(ID3DXBuffer *iface)
Definition: core.c:95

Definition at line 104 of file core.c.

Referenced by d3dx9_buffer_init().