ReactOS 0.4.16-dev-122-g325d74c
d3d8_main.c
Go to the documentation of this file.
1/*
2 * Direct3D 8
3 *
4 * Copyright 2005 Oliver Stieber
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 *
20 */
21
22#include "config.h"
23#include "initguid.h"
24#include "d3d8_private.h"
25#include "wine/debug.h"
26
28
30 FIXME("(void): stub\n");
31 return 0;
32}
33
34void WINAPI DebugSetMute(void) {
35 /* nothing to do */
36}
37
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}
58
59/***********************************************************************
60 * ValidateVertexShader (D3D8.@)
61 */
63 BOOL return_error, char **errors)
64{
65 const char *message = "";
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
88done:
89 if (!return_error) message = "";
90 if (errors && (*errors = HeapAlloc(GetProcessHeap(), 0, strlen(message) + 1)))
91 strcpy(*errors, message);
92
93 return hr;
94}
95
96/***********************************************************************
97 * ValidatePixelShader (D3D8.@)
98 */
99HRESULT WINAPI ValidatePixelShader(DWORD *pixelshader, DWORD *reserved1, BOOL return_error, char **errors)
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}
129
131{
133}
134
136{
138
141 if (!entry)
142 {
144 return D3DERR_NOTFOUND;
145 }
146
149
150 return D3D_OK;
151}
152
154 void *data, DWORD *data_size)
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
186done:
188 return hr;
189}
190
192{
193 resource->refcount = 1;
194 wined3d_private_store_init(&resource->private_store);
195}
196
198 const void *data, DWORD data_size, DWORD flags)
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}
#define DECLSPEC_HOTPATCH
Definition: _mingw.h:243
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
IDirect3D8 *WINAPI DECLSPEC_HOTPATCH Direct3DCreate8(UINT sdk_version)
Definition: d3d8_main.c:38
HRESULT d3d8_resource_get_private_data(struct d3d8_resource *resource, const GUID *guid, void *data, DWORD *data_size)
Definition: d3d8_main.c:153
HRESULT WINAPI ValidatePixelShader(DWORD *pixelshader, DWORD *reserved1, BOOL return_error, char **errors)
Definition: d3d8_main.c:99
void d3d8_resource_cleanup(struct d3d8_resource *resource)
Definition: d3d8_main.c:130
void WINAPI DebugSetMute(void)
Definition: d3d8_main.c:34
void d3d8_resource_init(struct d3d8_resource *resource)
Definition: d3d8_main.c:191
HRESULT WINAPI ValidateVertexShader(DWORD *vertexshader, DWORD *reserved1, DWORD *reserved2, BOOL return_error, char **errors)
Definition: d3d8_main.c:62
HRESULT WINAPI D3D8GetSWInfo(void)
Definition: d3d8_main.c:29
HRESULT d3d8_resource_set_private_data(struct d3d8_resource *resource, const GUID *guid, const void *data, DWORD data_size, DWORD flags)
Definition: d3d8_main.c:197
HRESULT d3d8_resource_free_private_data(struct d3d8_resource *resource, const GUID *guid)
Definition: d3d8_main.c:135
BOOL d3d8_init(struct d3d8 *d3d8) DECLSPEC_HIDDEN
Definition: directx.c:415
#define D3D_OK
Definition: d3d.h:106
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
uint8_t reserved2[12]
Definition: fsck.fat.h:23
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
GLbitfield flags
Definition: glext.h:7161
#define S_OK
Definition: intsafe.h:52
uint32_t entry
Definition: isohybrid.c:63
const GUID * guid
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned int UINT
Definition: ndis.h:50
#define D3DERR_MOREDATA
Definition: d3d8.h:81
#define D3DERR_NOTFOUND
Definition: d3d8.h:80
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
Definition: tftpd.h:60
union wined3d_private_data::@3675 content
IUnknown * object
Definition: wined3d.h:2168
#define WINAPI
Definition: msvc.h:6
static void wined3d_private_store_cleanup(struct wined3d_private_store *store)
Definition: wined3d.h:2541
static struct wined3d_private_data * wined3d_private_store_get_private_data(const struct wined3d_private_store *store, const GUID *tag)
Definition: wined3d.h:2517
static void wined3d_private_store_free_private_data(struct wined3d_private_store *store, struct wined3d_private_data *entry)
Definition: wined3d.h:2532
static void wined3d_private_store_init(struct wined3d_private_store *store)
Definition: wined3d.h:2512
#define WINED3DSPD_IUNKNOWN
Definition: wined3d.h:1006
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
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
@ vertexshader