ReactOS  0.4.15-dev-1187-g119f102
d3d9_main.c File Reference
#include "config.h"
#include "initguid.h"
#include "d3d9_private.h"
Include dependency graph for d3d9_main.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3d9)
 
void WINAPI DebugSetMute (void)
 
IDirect3D9 *WINAPI DECLSPEC_HOTPATCH Direct3DCreate9 (UINT sdk_version)
 
HRESULT WINAPI DECLSPEC_HOTPATCH Direct3DCreate9Ex (UINT sdk_version, IDirect3D9Ex **d3d9ex)
 
void *WINAPI Direct3DShaderValidatorCreate9 (void)
 
int WINAPI D3DPERF_BeginEvent (D3DCOLOR color, const WCHAR *name)
 
int WINAPI D3DPERF_EndEvent (void)
 
DWORD WINAPI D3DPERF_GetStatus (void)
 
void WINAPI D3DPERF_SetOptions (DWORD options)
 
BOOL WINAPI D3DPERF_QueryRepeatFrame (void)
 
void WINAPI D3DPERF_SetMarker (D3DCOLOR color, const WCHAR *name)
 
void WINAPI D3DPERF_SetRegion (D3DCOLOR color, const WCHAR *name)
 
void d3d9_resource_cleanup (struct d3d9_resource *resource)
 
HRESULT d3d9_resource_free_private_data (struct d3d9_resource *resource, const GUID *guid)
 
HRESULT d3d9_resource_get_private_data (struct d3d9_resource *resource, const GUID *guid, void *data, DWORD *data_size)
 
void d3d9_resource_init (struct d3d9_resource *resource)
 
HRESULT d3d9_resource_set_private_data (struct d3d9_resource *resource, const GUID *guid, const void *data, DWORD data_size, DWORD flags)
 

Variables

static int D3DPERF_event_level = 0
 

Function Documentation

◆ d3d9_resource_cleanup()

void d3d9_resource_cleanup ( struct d3d9_resource resource)

◆ d3d9_resource_free_private_data()

HRESULT d3d9_resource_free_private_data ( struct d3d9_resource resource,
const GUID guid 
)

Definition at line 160 of file d3d9_main.c.

161 {
162  struct wined3d_private_data *entry;
163 
166  if (!entry)
167  {
169  return D3DERR_NOTFOUND;
170  }
171 
174 
175  return D3D_OK;
176 }
static void wined3d_private_store_free_private_data(struct wined3d_private_store *store, struct wined3d_private_data *entry)
Definition: wined3d.h:2532
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
#define D3DERR_NOTFOUND
Definition: d3d8.h:80
const GUID * guid
uint32_t entry
Definition: isohybrid.c:63
#define D3D_OK
Definition: d3d.h:106
static struct wined3d_private_data * wined3d_private_store_get_private_data(const struct wined3d_private_store *store, const GUID *tag)
Definition: wined3d.h:2517
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

Referenced by d3d9_indexbuffer_FreePrivateData(), d3d9_surface_FreePrivateData(), d3d9_texture_2d_FreePrivateData(), d3d9_texture_3d_FreePrivateData(), d3d9_texture_cube_FreePrivateData(), d3d9_vertexbuffer_FreePrivateData(), and d3d9_volume_FreePrivateData().

◆ d3d9_resource_get_private_data()

HRESULT d3d9_resource_get_private_data ( struct d3d9_resource resource,
const GUID guid,
void data,
DWORD data_size 
)

Definition at line 178 of file d3d9_main.c.

180 {
181  const struct wined3d_private_data *stored_data;
182  DWORD size_in;
183  HRESULT hr;
184 
186  stored_data = wined3d_private_store_get_private_data(&resource->private_store, guid);
187  if (!stored_data)
188  {
190  goto done;
191  }
192 
193  size_in = *data_size;
194  *data_size = stored_data->size;
195  if (!data)
196  {
197  hr = D3D_OK;
198  goto done;
199  }
200  if (size_in < stored_data->size)
201  {
203  goto done;
204  }
205 
206  if (stored_data->flags & WINED3DSPD_IUNKNOWN)
207  IUnknown_AddRef(stored_data->content.object);
208  memcpy(data, stored_data->content.data, stored_data->size);
209  hr = D3D_OK;
210 
211 done:
213  return hr;
214 }
HRESULT hr
Definition: shlfolder.c:183
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
#define D3DERR_NOTFOUND
Definition: d3d8.h:80
const GUID * guid
union wined3d_private_data::@3651 content
#define D3DERR_MOREDATA
Definition: d3d8.h:81
#define WINED3DSPD_IUNKNOWN
Definition: wined3d.h:1006
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define D3D_OK
Definition: d3d.h:106
IUnknown * object
Definition: wined3d.h:2168
static struct wined3d_private_data * wined3d_private_store_get_private_data(const struct wined3d_private_store *store, const GUID *tag)
Definition: wined3d.h:2517
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

Referenced by d3d9_indexbuffer_GetPrivateData(), d3d9_surface_GetPrivateData(), d3d9_texture_2d_GetPrivateData(), d3d9_texture_3d_GetPrivateData(), d3d9_texture_cube_GetPrivateData(), d3d9_vertexbuffer_GetPrivateData(), and d3d9_volume_GetPrivateData().

◆ d3d9_resource_init()

void d3d9_resource_init ( struct d3d9_resource resource)

Definition at line 216 of file d3d9_main.c.

217 {
218  resource->refcount = 1;
219  wined3d_private_store_init(&resource->private_store);
220 }
static void wined3d_private_store_init(struct wined3d_private_store *store)
Definition: wined3d.h:2512

Referenced by cubetexture_init(), indexbuffer_init(), surface_init(), texture_init(), vertexbuffer_init(), volume_init(), and volumetexture_init().

◆ d3d9_resource_set_private_data()

HRESULT d3d9_resource_set_private_data ( struct d3d9_resource resource,
const GUID guid,
const void data,
DWORD  data_size,
DWORD  flags 
)

Definition at line 222 of file d3d9_main.c.

224 {
225  HRESULT hr;
226 
228  hr = wined3d_private_store_set_private_data(&resource->private_store, guid, data, data_size, flags);
230  return hr;
231 }
HRESULT hr
Definition: shlfolder.c:183
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
const GUID * guid
static HRESULT wined3d_private_store_set_private_data(struct wined3d_private_store *store, const GUID *guid, const void *data, DWORD data_size, DWORD flags)
Definition: wined3d.h:2553
LONG HRESULT
Definition: typedefs.h:79
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

Referenced by d3d9_indexbuffer_SetPrivateData(), d3d9_surface_SetPrivateData(), d3d9_texture_2d_SetPrivateData(), d3d9_texture_3d_SetPrivateData(), d3d9_texture_cube_SetPrivateData(), d3d9_vertexbuffer_SetPrivateData(), and d3d9_volume_SetPrivateData().

◆ D3DPERF_BeginEvent()

int WINAPI D3DPERF_BeginEvent ( D3DCOLOR  color,
const WCHAR name 
)

Definition at line 96 of file d3d9_main.c.

97 {
98  TRACE("color 0x%08x, name %s.\n", color, debugstr_w(name));
99 
100  return D3DPERF_event_level++;
101 }
static int D3DPERF_event_level
Definition: d3d9_main.c:30
GLuint color
Definition: glext.h:6243
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
Definition: name.c:38

◆ D3DPERF_EndEvent()

int WINAPI D3DPERF_EndEvent ( void  )

Definition at line 106 of file d3d9_main.c.

106  {
107  TRACE("(void) : stub\n");
108 
109  return --D3DPERF_event_level;
110 }
static int D3DPERF_event_level
Definition: d3d9_main.c:30
#define TRACE(s)
Definition: solgame.cpp:4

◆ D3DPERF_GetStatus()

DWORD WINAPI D3DPERF_GetStatus ( void  )

Definition at line 115 of file d3d9_main.c.

115  {
116  FIXME("(void) : stub\n");
117 
118  return 0;
119 }
#define FIXME(fmt,...)
Definition: debug.h:111

◆ D3DPERF_QueryRepeatFrame()

BOOL WINAPI D3DPERF_QueryRepeatFrame ( void  )

Definition at line 133 of file d3d9_main.c.

133  {
134  FIXME("(void) : stub\n");
135 
136  return FALSE;
137 }
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111

◆ D3DPERF_SetMarker()

void WINAPI D3DPERF_SetMarker ( D3DCOLOR  color,
const WCHAR name 
)

Definition at line 142 of file d3d9_main.c.

143 {
144  FIXME("color 0x%08x, name %s stub!\n", color, debugstr_w(name));
145 }
GLuint color
Definition: glext.h:6243
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
Definition: name.c:38

◆ D3DPERF_SetOptions()

void WINAPI D3DPERF_SetOptions ( DWORD  options)

Definition at line 125 of file d3d9_main.c.

126 {
127  FIXME("(%#x) : stub\n", options);
128 }
#define FIXME(fmt,...)
Definition: debug.h:111

◆ D3DPERF_SetRegion()

void WINAPI D3DPERF_SetRegion ( D3DCOLOR  color,
const WCHAR name 
)

Definition at line 150 of file d3d9_main.c.

151 {
152  FIXME("color 0x%08x, name %s stub!\n", color, debugstr_w(name));
153 }
GLuint color
Definition: glext.h:6243
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
Definition: name.c:38

◆ DebugSetMute()

void WINAPI DebugSetMute ( void  )

Definition at line 32 of file d3d9_main.c.

32  {
33  /* nothing to do */
34 }

◆ Direct3DCreate9()

IDirect3D9* WINAPI DECLSPEC_HOTPATCH Direct3DCreate9 ( UINT  sdk_version)

Definition at line 36 of file d3d9_main.c.

37 {
38  struct d3d9 *object;
39 
40  TRACE("sdk_version %#x.\n", sdk_version);
41 
42  if (!(object = heap_alloc_zero(sizeof(*object))))
43  return NULL;
44 
45  if (!d3d9_init(object, FALSE))
46  {
47  WARN("Failed to initialize d3d9.\n");
48  heap_free(object);
49  return NULL;
50  }
51 
52  TRACE("Created d3d9 object %p.\n", object);
53 
54  return (IDirect3D9 *)&object->IDirect3D9Ex_iface;
55 }
#define WARN(fmt,...)
Definition: debug.h:112
BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended) DECLSPEC_HIDDEN
Definition: directx.c:577
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
void * object
Definition: jmemsys.h:48
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ Direct3DCreate9Ex()

HRESULT WINAPI DECLSPEC_HOTPATCH Direct3DCreate9Ex ( UINT  sdk_version,
IDirect3D9Ex **  d3d9ex 
)

Definition at line 57 of file d3d9_main.c.

58 {
59  struct d3d9 *object;
60 
61  TRACE("sdk_version %#x, d3d9ex %p.\n", sdk_version, d3d9ex);
62 
63  if (!(object = heap_alloc_zero(sizeof(*object))))
64  return E_OUTOFMEMORY;
65 
66  if (!d3d9_init(object, TRUE))
67  {
68  WARN("Failed to initialize d3d9.\n");
69  heap_free(object);
70  return D3DERR_NOTAVAILABLE;
71  }
72 
73  TRACE("Created d3d9 object %p.\n", object);
74  *d3d9ex = &object->IDirect3D9Ex_iface;
75 
76  return D3D_OK;
77 }
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:112
BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended) DECLSPEC_HIDDEN
Definition: directx.c:577
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define D3DERR_NOTAVAILABLE
Definition: d3d8.h:84
#define TRACE(s)
Definition: solgame.cpp:4
#define D3D_OK
Definition: d3d.h:106
void * object
Definition: jmemsys.h:48
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ Direct3DShaderValidatorCreate9()

void* WINAPI Direct3DShaderValidatorCreate9 ( void  )

Definition at line 85 of file d3d9_main.c.

86 {
87  static int once;
88 
89  if (!once++) FIXME("stub\n");
90  return NULL;
91 }
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3d9  )

Variable Documentation

◆ D3DPERF_event_level

int D3DPERF_event_level = 0
static

Definition at line 30 of file d3d9_main.c.

Referenced by D3DPERF_BeginEvent(), and D3DPERF_EndEvent().