ReactOS  0.4.14-dev-323-g6fe6a88
d3d8_main.c File Reference
#include "config.h"
#include "initguid.h"
#include "d3d8_private.h"
#include "wine/debug.h"
Include dependency graph for d3d8_main.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3d8)
 
HRESULT WINAPI D3D8GetSWInfo (void)
 
void WINAPI DebugSetMute (void)
 
IDirect3D8 *WINAPI DECLSPEC_HOTPATCH Direct3DCreate8 (UINT sdk_version)
 
HRESULT WINAPI ValidateVertexShader (DWORD *vertexshader, DWORD *reserved1, DWORD *reserved2, BOOL return_error, char **errors)
 
HRESULT WINAPI ValidatePixelShader (DWORD *pixelshader, DWORD *reserved1, BOOL return_error, char **errors)
 
void d3d8_resource_cleanup (struct d3d8_resource *resource)
 
HRESULT d3d8_resource_free_private_data (struct d3d8_resource *resource, const GUID *guid)
 
HRESULT d3d8_resource_get_private_data (struct d3d8_resource *resource, const GUID *guid, void *data, DWORD *data_size)
 
void d3d8_resource_init (struct d3d8_resource *resource)
 
HRESULT d3d8_resource_set_private_data (struct d3d8_resource *resource, const GUID *guid, const void *data, DWORD data_size, DWORD flags)
 

Function Documentation

◆ d3d8_resource_cleanup()

void d3d8_resource_cleanup ( struct d3d8_resource resource)

◆ d3d8_resource_free_private_data()

HRESULT d3d8_resource_free_private_data ( struct d3d8_resource resource,
const GUID guid 
)

Definition at line 135 of file d3d8_main.c.

136 {
137  struct wined3d_private_data *entry;
138 
141  if (!entry)
142  {
144  return D3DERR_NOTFOUND;
145  }
146 
149 
150  return D3D_OK;
151 }
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 d3d8_indexbuffer_FreePrivateData(), d3d8_surface_FreePrivateData(), d3d8_texture_2d_FreePrivateData(), d3d8_texture_3d_FreePrivateData(), d3d8_texture_cube_FreePrivateData(), d3d8_vertexbuffer_FreePrivateData(), and d3d8_volume_FreePrivateData().

◆ d3d8_resource_get_private_data()

HRESULT d3d8_resource_get_private_data ( struct d3d8_resource resource,
const GUID guid,
void data,
DWORD data_size 
)

Definition at line 153 of file d3d8_main.c.

155 {
156  const struct wined3d_private_data *stored_data;
157  DWORD size_in;
158  HRESULT hr;
159 
161  stored_data = wined3d_private_store_get_private_data(&resource->private_store, guid);
162  if (!stored_data)
163  {
165  goto done;
166  }
167 
168  size_in = *data_size;
169  *data_size = stored_data->size;
170  if (!data)
171  {
172  hr = D3D_OK;
173  goto done;
174  }
175  if (size_in < stored_data->size)
176  {
178  goto done;
179  }
180 
181  if (stored_data->flags & WINED3DSPD_IUNKNOWN)
182  IUnknown_AddRef(stored_data->content.object);
183  memcpy(data, stored_data->content.data, stored_data->size);
184  hr = D3D_OK;
185 
186 done:
188  return hr;
189 }
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
#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:77
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
union wined3d_private_data::@3553 content

Referenced by d3d8_indexbuffer_GetPrivateData(), d3d8_surface_GetPrivateData(), d3d8_texture_2d_GetPrivateData(), d3d8_texture_3d_GetPrivateData(), d3d8_texture_cube_GetPrivateData(), d3d8_vertexbuffer_GetPrivateData(), and d3d8_volume_GetPrivateData().

◆ d3d8_resource_init()

void d3d8_resource_init ( struct d3d8_resource resource)

Definition at line 191 of file d3d8_main.c.

192 {
193  resource->refcount = 1;
194  wined3d_private_store_init(&resource->private_store);
195 }
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().

◆ d3d8_resource_set_private_data()

HRESULT d3d8_resource_set_private_data ( struct d3d8_resource resource,
const GUID guid,
const void data,
DWORD  data_size,
DWORD  flags 
)

Definition at line 197 of file d3d8_main.c.

199 {
200  HRESULT hr;
201 
203  hr = wined3d_private_store_set_private_data(&resource->private_store, guid, data, data_size, flags);
205  return hr;
206 }
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:77
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 d3d8_indexbuffer_SetPrivateData(), d3d8_surface_SetPrivateData(), d3d8_texture_2d_SetPrivateData(), d3d8_texture_3d_SetPrivateData(), d3d8_texture_cube_SetPrivateData(), d3d8_vertexbuffer_SetPrivateData(), and d3d8_volume_SetPrivateData().

◆ D3D8GetSWInfo()

HRESULT WINAPI D3D8GetSWInfo ( void  )

Definition at line 29 of file d3d8_main.c.

29  {
30  FIXME("(void): stub\n");
31  return 0;
32 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ DebugSetMute()

void WINAPI DebugSetMute ( void  )

Definition at line 34 of file d3d8_main.c.

34  {
35  /* nothing to do */
36 }

◆ Direct3DCreate8()

IDirect3D8* WINAPI DECLSPEC_HOTPATCH Direct3DCreate8 ( UINT  sdk_version)

Definition at line 38 of file d3d8_main.c.

39 {
40  struct d3d8 *object;
41 
42  TRACE("sdk_version %#x.\n", sdk_version);
43 
44  if (!(object = heap_alloc_zero(sizeof(*object))))
45  return NULL;
46 
47  if (!d3d8_init(object))
48  {
49  WARN("Failed to initialize d3d8.\n");
50  heap_free(object);
51  return NULL;
52  }
53 
54  TRACE("Created d3d8 object %p.\n", object);
55 
56  return &object->IDirect3D8_iface;
57 }
#define WARN(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
BOOL d3d8_init(struct d3d8 *d3d8) DECLSPEC_HIDDEN
Definition: directx.c:415
void * object
Definition: jmemsys.h:48
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ ValidatePixelShader()

HRESULT WINAPI ValidatePixelShader ( DWORD pixelshader,
DWORD reserved1,
BOOL  return_error,
char **  errors 
)

Definition at line 99 of file d3d8_main.c.

100 {
101  const char *message = "";
102  HRESULT hr = E_FAIL;
103 
104  TRACE("(%p %p %d %p): semi-stub\n", pixelshader, reserved1, return_error, errors);
105 
106  if (!pixelshader)
107  return E_FAIL;
108 
109  switch (*pixelshader)
110  {
111  case 0xFFFF0100:
112  case 0xFFFF0101:
113  case 0xFFFF0102:
114  case 0xFFFF0103:
115  case 0xFFFF0104:
116  hr = S_OK;
117  break;
118  default:
119  WARN("Invalid shader version token %#x.\n", *pixelshader);
120  message = "(Global Validation Error) Version Token: Unsupported pixel shader version.\n";
121  }
122 
123  if (!return_error) message = "";
124  if (errors && (*errors = HeapAlloc(GetProcessHeap(), 0, strlen(message) + 1)))
125  strcpy(*errors, message);
126 
127  return hr;
128 }
Definition: tftpd.h:59
HRESULT hr
Definition: shlfolder.c:183
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define WARN(fmt,...)
Definition: debug.h:111
#define E_FAIL
Definition: ddrawi.h:102
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

◆ ValidateVertexShader()

HRESULT WINAPI ValidateVertexShader ( DWORD vertexshader,
DWORD reserved1,
DWORD reserved2,
BOOL  return_error,
char **  errors 
)

Definition at line 62 of file d3d8_main.c.

64 {
65  const char *message = "";
66  HRESULT hr = E_FAIL;
67 
68  TRACE("(%p %p %p %d %p): semi-stub\n", vertexshader, reserved1, reserved2, return_error, errors);
69 
70  if (!vertexshader)
71  {
72  message = "(Global Validation Error) Version Token: Code pointer cannot be NULL.\n";
73  goto done;
74  }
75 
76  switch (*vertexshader)
77  {
78  case 0xFFFE0101:
79  case 0xFFFE0100:
80  hr = S_OK;
81  break;
82 
83  default:
84  WARN("Invalid shader version token %#x.\n", *vertexshader);
85  message = "(Global Validation Error) Version Token: Unsupported vertex shader version.\n";
86  }
87 
88 done:
89  if (!return_error) message = "";
90  if (errors && (*errors = HeapAlloc(GetProcessHeap(), 0, strlen(message) + 1)))
91  strcpy(*errors, message);
92 
93  return hr;
94 }
Definition: tftpd.h:59
HRESULT hr
Definition: shlfolder.c:183
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define WARN(fmt,...)
Definition: debug.h:111
#define E_FAIL
Definition: ddrawi.h:102
#define TRACE(s)
Definition: solgame.cpp:4
uint8_t reserved2[12]
Definition: fsck.fat.h:58
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3d8  )