ReactOS 0.4.15-dev-5666-gc548b97
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}
#define ERR(fmt,...)
Definition: debug.h:110
#define D3D_OK
Definition: d3d.h:106
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const struct ID3DXBufferVtbl ID3DXBufferImpl_Vtbl
Definition: core.c:104
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
GLsizeiptr size
Definition: glext.h:5919
GLuint buffer
Definition: glext.h:5915

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}
#define WARN(fmt,...)
Definition: debug.h:112
#define D3DERR_INVALIDCALL
static HRESULT d3dx9_buffer_init(struct ID3DXBufferImpl *buffer, DWORD size)
Definition: core.c:115
#define HeapFree(x, y, z)
Definition: compat.h:735
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4

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}
#define InterlockedIncrement
Definition: armddk.h:53
static struct ID3DXBufferImpl * impl_from_ID3DXBuffer(ID3DXBuffer *iface)
Definition: core.c:38
unsigned int ULONG
Definition: retypes.h:1
LONG ref
Definition: core.c:32
Definition: send.c:48

◆ 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}

◆ 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}

◆ 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}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ 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}
#define InterlockedDecrement
Definition: armddk.h:52

◆ impl_from_ID3DXBuffer()

static struct ID3DXBufferImpl * impl_from_ID3DXBuffer ( ID3DXBuffer iface)
inlinestatic

Definition at line 38 of file core.c.

39{
40 return CONTAINING_RECORD(iface, struct ID3DXBufferImpl, ID3DXBuffer_iface);
41}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

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

Definition at line 104 of file core.c.

Referenced by d3dx9_buffer_init().