ReactOS 0.4.17-dev-966-gf06eace
blob.c
Go to the documentation of this file.
1/*
2 * Direct3D blob file
3 *
4 * Copyright 2010 Rico Schüller
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 "d3dcompiler_private.h"
23
25
27{
30
32 void *data;
33};
34
35static inline struct d3dcompiler_blob *impl_from_ID3DBlob(ID3DBlob *iface)
36{
38}
39
40/* IUnknown methods */
41
43{
44 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
45
46 if (IsEqualGUID(riid, &IID_ID3D10Blob)
48 {
49 IUnknown_AddRef(iface);
50 *object = iface;
51 return S_OK;
52 }
53
54 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
55
56 *object = NULL;
57 return E_NOINTERFACE;
58}
59
61{
64
65 TRACE("%p increasing refcount to %lu.\n", blob, refcount);
66
67 return refcount;
68}
69
71{
74
75 TRACE("%p decreasing refcount to %lu.\n", blob, refcount);
76
77 if (!refcount)
78 {
79 free(blob->data);
80 free(blob);
81 }
82
83 return refcount;
84}
85
86/* ID3DBlob methods */
87
89{
91
92 TRACE("iface %p\n", iface);
93
94 return blob->data;
95}
96
98{
100
101 TRACE("iface %p\n", iface);
102
103 return blob->size;
104}
105
106static const struct ID3D10BlobVtbl d3dcompiler_blob_vtbl =
107{
108 /* IUnknown methods */
112 /* ID3DBlob methods */
115};
116
118{
119 blob->ID3DBlob_iface.lpVtbl = &d3dcompiler_blob_vtbl;
120 blob->refcount = 1;
121 blob->size = data_size;
122
123 blob->data = calloc(1, data_size);
124 if (!blob->data)
125 {
126 ERR("Failed to allocate D3D blob data memory\n");
127 return E_OUTOFMEMORY;
128 }
129
130 return S_OK;
131}
132
134{
135 struct d3dcompiler_blob *object;
136 HRESULT hr;
137
138 TRACE("data_size %Iu, blob %p.\n", data_size, blob);
139
140 if (!blob)
141 {
142 WARN("Invalid blob specified.\n");
143 return D3DERR_INVALIDCALL;
144 }
145
146 object = calloc(1, sizeof(*object));
147 if (!object)
148 return E_OUTOFMEMORY;
149
150 hr = d3dcompiler_blob_init(object, data_size);
151 if (FAILED(hr))
152 {
153 WARN("Failed to initialize blob, hr %#lx.\n", hr);
154 free(object);
155 return hr;
156 }
157
158 *blob = &object->ID3DBlob_iface;
159
160 TRACE("Created ID3DBlob %p\n", *blob);
161
162 return S_OK;
163}
164
166{
167 BOOL add = FALSE;
168
169 switch(part)
170 {
172 if (tag == TAG_ISGN) add = TRUE;
173 break;
174
176 if (tag == TAG_OSGN || tag == TAG_OSG5) add = TRUE;
177 break;
178
180 if (tag == TAG_ISGN || tag == TAG_OSGN || tag == TAG_OSG5) add = TRUE;
181 break;
182
184 if (tag == TAG_PCSG) add = TRUE;
185 break;
186
188 if (tag == TAG_ISGN || tag == TAG_OSGN || tag == TAG_OSG5 || tag == TAG_PCSG) add = TRUE;
189 break;
190
192 if (tag == TAG_SDBG) add = TRUE;
193 break;
194
196 if (tag == TAG_Aon9) add = TRUE;
197 break;
198
200 if (tag == TAG_XNAP) add = TRUE;
201 break;
202
204 if (tag == TAG_XNAS) add = TRUE;
205 break;
206
207 default:
208 FIXME("Unhandled D3D_BLOB_PART %s.\n", debug_d3dcompiler_d3d_blob_part(part));
209 break;
210 }
211
212 TRACE("%s tag %s\n", add ? "Add" : "Skip", debugstr_fourcc(tag));
213
214 return add;
215}
216
218{
219 const struct vkd3d_shader_code src_dxbc = {.code = data, .size = data_size};
221 struct vkd3d_shader_dxbc_desc src_dxbc_desc;
222 struct vkd3d_shader_code dst_dxbc;
223 unsigned int section_count, i;
224 HRESULT hr;
225 int ret;
226
227 if (!data || data_size < DXBC_HEADER_SIZE || flags || !blob)
228 {
229 WARN("Invalid arguments: data %p, data_size %Iu, flags %#x, blob %p.\n", data, data_size, flags, blob);
230 return D3DERR_INVALIDCALL;
231 }
232
234 || (part < D3D_BLOB_TEST_ALTERNATE_SHADER && part > D3D_BLOB_XNA_SHADER))
235 {
236 WARN("Invalid D3D_BLOB_PART: part %s\n", debug_d3dcompiler_d3d_blob_part(part));
237 return D3DERR_INVALIDCALL;
238 }
239
240 if ((ret = vkd3d_shader_parse_dxbc(&src_dxbc, 0, &src_dxbc_desc, NULL)) < 0)
241 {
242 WARN("Failed to parse source data, ret %d.\n", ret);
243 return E_FAIL;
244 }
245
246 if (!(sections = calloc(src_dxbc_desc.section_count, sizeof(*sections))))
247 {
248 ERR("Failed to allocate sections memory.\n");
249 vkd3d_shader_free_dxbc(&src_dxbc_desc);
250 return E_OUTOFMEMORY;
251 }
252
253 for (i = 0, section_count = 0; i < src_dxbc_desc.section_count; ++i)
254 {
255 const struct vkd3d_shader_dxbc_section_desc *src_section = &src_dxbc_desc.sections[i];
256
257 if (check_blob_part(src_section->tag, part))
258 sections[section_count++] = *src_section;
259 }
260
261 switch(part)
262 {
270 if (section_count != 1)
271 section_count = 0;
272 break;
273
275 if (section_count != 2)
276 section_count = 0;
277 break;
278
280 if (section_count != 3)
281 section_count = 0;
282 break;
283
284 default:
285 FIXME("Unhandled D3D_BLOB_PART %s.\n", debug_d3dcompiler_d3d_blob_part(part));
286 break;
287 }
288
289 if (!section_count)
290 {
291 WARN("Nothing to write into the blob.\n");
292 hr = E_FAIL;
293 goto done;
294 }
295
296 /* some parts aren't full DXBCs, they contain only the data */
297 if (section_count == 1 && (part == D3D_BLOB_DEBUG_INFO || part == D3D_BLOB_LEGACY_SHADER
299 {
300 dst_dxbc = sections[0].data;
301 }
302 else if ((ret = vkd3d_shader_serialize_dxbc(section_count, sections, &dst_dxbc, NULL) < 0))
303 {
304 WARN("Failed to serialise DXBC, ret %d.\n", ret);
305 hr = E_FAIL;
306 goto done;
307 }
308
309 if (FAILED(hr = D3DCreateBlob(dst_dxbc.size, blob)))
310 WARN("Failed to create blob, hr %#lx.\n", hr);
311 else
312 memcpy(ID3D10Blob_GetBufferPointer(*blob), dst_dxbc.code, dst_dxbc.size);
313 if (dst_dxbc.code != sections[0].data.code)
315
316done:
317 free(sections);
318 vkd3d_shader_free_dxbc(&src_dxbc_desc);
319
320 return hr;
321}
322
324{
325 BOOL add = TRUE;
326
327 if (flags & D3DCOMPILER_STRIP_TEST_BLOBS) FIXME("Unhandled flag D3DCOMPILER_STRIP_TEST_BLOBS.\n");
328
329 switch(tag)
330 {
331 case TAG_RDEF:
332 case TAG_STAT:
334 break;
335
336 case TAG_SDBG:
338 break;
339
340 default:
341 break;
342 }
343
344 TRACE("%s tag %s\n", add ? "Add" : "Skip", debugstr_fourcc(tag));
345
346 return add;
347}
348
350{
351 const struct vkd3d_shader_code src_dxbc = {.code = data, .size = data_size};
353 struct vkd3d_shader_dxbc_desc src_dxbc_desc;
354 struct vkd3d_shader_code dst_dxbc;
355 unsigned int section_count, i;
356 HRESULT hr;
357 int ret;
358
359 if (!blob)
360 {
361 WARN("NULL for blob specified\n");
362 return E_FAIL;
363 }
364
365 if (!data || data_size < DXBC_HEADER_SIZE)
366 {
367 WARN("Invalid arguments: data %p, data_size %Iu.\n", data, data_size);
368 return D3DERR_INVALIDCALL;
369 }
370
371 if ((ret = vkd3d_shader_parse_dxbc(&src_dxbc, 0, &src_dxbc_desc, NULL)) < 0)
372 {
373 WARN("Failed to parse source data, ret %d.\n", ret);
374 return E_FAIL;
375 }
376
377 /* src_dxbc.count >= dst_dxbc.count */
378 if (!(sections = calloc(src_dxbc_desc.section_count, sizeof(*sections))))
379 {
380 ERR("Failed to allocate sections memory.\n");
381 vkd3d_shader_free_dxbc(&src_dxbc_desc);
382 return E_OUTOFMEMORY;
383 }
384
385 for (i = 0, section_count = 0; i < src_dxbc_desc.section_count; ++i)
386 {
387 const struct vkd3d_shader_dxbc_section_desc *src_section = &src_dxbc_desc.sections[i];
388
389 if (check_blob_strip(src_section->tag, flags))
390 sections[section_count++] = *src_section;
391 }
392
393 if ((ret = vkd3d_shader_serialize_dxbc(section_count, sections, &dst_dxbc, NULL) < 0))
394 {
395 WARN("Failed to serialise DXBC, ret %d.\n", ret);
396 hr = E_FAIL;
397 goto done;
398 }
399
400 if (FAILED(hr = D3DCreateBlob(dst_dxbc.size, blob)))
401 WARN("Failed to create blob, hr %#lx.\n", hr);
402 else
403 memcpy(ID3D10Blob_GetBufferPointer(*blob), dst_dxbc.code, dst_dxbc.size);
405
406done:
407 free(sections);
408 vkd3d_shader_free_dxbc(&src_dxbc_desc);
409
410 return hr;
411}
412
414{
415 TRACE("data %p, data_size %Iu, part %s, flags %#x, blob %p.\n", data,
416 data_size, debug_d3dcompiler_d3d_blob_part(part), flags, blob);
417
418 return d3dcompiler_get_blob_part(data, data_size, part, flags, blob);
419}
420
422{
423 TRACE("data %p, data_size %Iu, blob %p.\n", data, data_size, blob);
424
426}
427
429{
430 TRACE("data %p, data_size %Iu, blob %p.\n", data, data_size, blob);
431
433}
434
436{
437 TRACE("data %p, data_size %Iu, blob %p.\n", data, data_size, blob);
438
440}
441
443{
444 TRACE("data %p, data_size %Iu, blob %p.\n", data, data_size, blob);
445
447}
448
450{
451 TRACE("data %p, data_size %Iu, flags %#x, blob %p.\n", data, data_size, flags, blob);
452
453 return d3dcompiler_strip_shader(data, data_size, flags, blob);
454}
455
457{
458 struct d3dcompiler_blob *object;
459 SIZE_T data_size;
460 DWORD read_size;
461 HANDLE file;
462 HRESULT hr;
463
464 TRACE("filename %s, contents %p.\n", debugstr_w(filename), contents);
465
469
470 data_size = GetFileSize(file, NULL);
471 if (data_size == INVALID_FILE_SIZE)
472 {
475 }
476
477 if (!(object = calloc(1, sizeof(*object))))
478 {
480 return E_OUTOFMEMORY;
481 }
482
483 if (FAILED(hr = d3dcompiler_blob_init(object, data_size)))
484 {
485 WARN("Failed to initialise blob, hr %#lx.\n", hr);
487 free(object);
488 return hr;
489 }
490
491 if (!ReadFile(file, object->data, data_size, &read_size, NULL) || (read_size != data_size))
492 {
493 WARN("Failed to read file contents.\n");
495 free(object->data);
496 free(object);
497 return E_FAIL;
498 }
500 object->size = read_size;
501
502 *contents = &object->ID3DBlob_iface;
503
504 TRACE("Returning ID3DBlob %p.\n", *contents);
505
506 return S_OK;
507}
508
510{
511 DWORD written_size;
512 SIZE_T data_size;
513 HANDLE file;
514 BOOL ret;
515
516 TRACE("blob %p, filename %s, overwrite %#x.\n", blob, debugstr_w(filename), overwrite);
517
522
523 data_size = ID3D10Blob_GetBufferSize(blob);
524 ret = WriteFile(file, ID3D10Blob_GetBufferPointer(blob), data_size, &written_size, NULL);
526 if (!ret || data_size != written_size)
527 {
528 WARN("Failed to write blob contents.\n");
529 return E_FAIL;
530 }
531
532 return S_OK;
533}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
const GUID IID_IUnknown
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
#define D3DERR_INVALIDCALL
Definition: d3d10_private.h:42
D3D_BLOB_PART
Definition: d3dcompiler.h:112
@ D3D_BLOB_ALL_SIGNATURE_BLOB
Definition: d3dcompiler.h:117
@ D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB
Definition: d3dcompiler.h:115
@ D3D_BLOB_TEST_COMPILE_PERF
Definition: d3dcompiler.h:128
@ D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB
Definition: d3dcompiler.h:116
@ D3D_BLOB_XNA_SHADER
Definition: d3dcompiler.h:121
@ D3D_BLOB_INPUT_SIGNATURE_BLOB
Definition: d3dcompiler.h:113
@ D3D_BLOB_OUTPUT_SIGNATURE_BLOB
Definition: d3dcompiler.h:114
@ D3D_BLOB_DEBUG_INFO
Definition: d3dcompiler.h:118
@ D3D_BLOB_XNA_PREPASS_SHADER
Definition: d3dcompiler.h:120
@ D3D_BLOB_LEGACY_SHADER
Definition: d3dcompiler.h:119
@ D3DCOMPILER_STRIP_TEST_BLOBS
Definition: d3dcompiler.h:103
@ D3DCOMPILER_STRIP_DEBUG_INFO
Definition: d3dcompiler.h:102
@ D3DCOMPILER_STRIP_REFLECTION_DATA
Definition: d3dcompiler.h:101
#define DXBC_HEADER_SIZE
#define TAG_ISGN
#define TAG_Aon9
#define TAG_OSGN
const char * debug_d3dcompiler_d3d_blob_part(D3D_BLOB_PART part)
Definition: utils.c:106
#define TAG_XNAP
#define TAG_XNAS
#define TAG_STAT
#define TAG_SDBG
#define TAG_OSG5
#define TAG_PCSG
#define TAG_RDEF
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static BOOL check_blob_strip(DWORD tag, UINT flags)
Definition: blob.c:323
HRESULT WINAPI D3DGetInputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob)
Definition: blob.c:421
static HRESULT d3dcompiler_strip_shader(const void *data, SIZE_T data_size, UINT flags, ID3DBlob **blob)
Definition: blob.c:349
HRESULT WINAPI D3DGetBlobPart(const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob)
Definition: blob.c:413
static struct d3dcompiler_blob * impl_from_ID3DBlob(ID3DBlob *iface)
Definition: blob.c:35
HRESULT WINAPI D3DWriteBlobToFile(ID3DBlob *blob, const WCHAR *filename, BOOL overwrite)
Definition: blob.c:509
HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3DBlob **blob)
Definition: blob.c:133
HRESULT WINAPI D3DGetOutputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob)
Definition: blob.c:428
HRESULT WINAPI D3DGetDebugInfo(const void *data, SIZE_T data_size, ID3DBlob **blob)
Definition: blob.c:442
static HRESULT d3dcompiler_blob_init(struct d3dcompiler_blob *blob, SIZE_T data_size)
Definition: blob.c:117
HRESULT WINAPI D3DGetInputAndOutputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob)
Definition: blob.c:435
static HRESULT d3dcompiler_get_blob_part(const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob)
Definition: blob.c:217
static SIZE_T STDMETHODCALLTYPE d3dcompiler_blob_GetBufferSize(ID3DBlob *iface)
Definition: blob.c:97
static ULONG STDMETHODCALLTYPE d3dcompiler_blob_Release(ID3DBlob *iface)
Definition: blob.c:70
static void *STDMETHODCALLTYPE d3dcompiler_blob_GetBufferPointer(ID3DBlob *iface)
Definition: blob.c:88
HRESULT WINAPI D3DStripShader(const void *data, SIZE_T data_size, UINT flags, ID3D10Blob **blob)
Definition: blob.c:449
static HRESULT STDMETHODCALLTYPE d3dcompiler_blob_QueryInterface(ID3DBlob *iface, REFIID riid, void **object)
Definition: blob.c:42
static BOOL check_blob_part(DWORD tag, D3D_BLOB_PART part)
Definition: blob.c:165
static const struct ID3D10BlobVtbl d3dcompiler_blob_vtbl
Definition: blob.c:106
HRESULT WINAPI D3DReadFileToBlob(const WCHAR *filename, ID3DBlob **contents)
Definition: blob.c:456
static ULONG STDMETHODCALLTYPE d3dcompiler_blob_AddRef(ID3DBlob *iface)
Definition: blob.c:60
#define CloseHandle
Definition: compat.h:739
#define OPEN_EXISTING
Definition: compat.h:775
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define FILE_SHARE_READ
Definition: compat.h:136
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
BOOL WINAPI WriteFile(_In_ HANDLE hFile, _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer, _In_ DWORD nNumberOfBytesToWrite, _Out_opt_ LPDWORD lpNumberOfBytesWritten, _Inout_opt_ LPOVERLAPPED lpOverlapped)
Definition: rw.c:25
return ret
Definition: mutex.c:147
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: sysinfo.c:13
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
const char * filename
Definition: ioapi.h:137
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define CREATE_ALWAYS
Definition: disk.h:72
#define CREATE_NEW
Definition: disk.h:69
struct section sections[2]
Definition: diskspace.c:792
static const char * contents
Definition: parser.c:511
#define GENERIC_WRITE
Definition: nt_native.h:90
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define calloc
Definition: rosglue.h:14
static __inline const char * debugstr_fourcc(unsigned int cc)
Definition: debug.h:397
#define TRACE(s)
Definition: solgame.cpp:4
Definition: image.c:229
LONG refcount
Definition: blob.c:29
void * data
Definition: blob.c:32
SIZE_T size
Definition: blob.c:31
ID3DBlob ID3DBlob_iface
Definition: blob.c:28
Definition: fci.c:123
Definition: ecma_167.h:138
const void * code
Definition: vkd3d_shader.h:413
struct vkd3d_shader_dxbc_section_desc * sections
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
VKD3D_SHADER_API void vkd3d_shader_free_shader_code(struct vkd3d_shader_code *code)
VKD3D_SHADER_API int vkd3d_shader_serialize_dxbc(size_t section_count, const struct vkd3d_shader_dxbc_section_desc *sections, struct vkd3d_shader_code *dxbc, char **messages)
Definition: dxbc.c:53
VKD3D_SHADER_API void vkd3d_shader_free_dxbc(struct vkd3d_shader_dxbc_desc *dxbc)
Definition: dxbc.c:290
VKD3D_SHADER_API int vkd3d_shader_parse_dxbc(const struct vkd3d_shader_code *dxbc, uint32_t flags, struct vkd3d_shader_dxbc_desc *desc, char **messages)
Definition: dxbc.c:320
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define INVALID_FILE_SIZE
Definition: winbase.h:528
#define WINAPI
Definition: msvc.h:6
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define E_NOINTERFACE
Definition: winerror.h:3479