ReactOS  0.4.15-dev-2961-gecb0c09
blob.c File Reference
Include dependency graph for blob.c:

Go to the source code of this file.

Classes

struct  d3dcompiler_blob
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3dcompiler)
 
static struct d3dcompiler_blobimpl_from_ID3DBlob (ID3DBlob *iface)
 
static HRESULT STDMETHODCALLTYPE d3dcompiler_blob_QueryInterface (ID3DBlob *iface, REFIID riid, void **object)
 
static ULONG STDMETHODCALLTYPE d3dcompiler_blob_AddRef (ID3DBlob *iface)
 
static ULONG STDMETHODCALLTYPE d3dcompiler_blob_Release (ID3DBlob *iface)
 
static void *STDMETHODCALLTYPE d3dcompiler_blob_GetBufferPointer (ID3DBlob *iface)
 
static SIZE_T STDMETHODCALLTYPE d3dcompiler_blob_GetBufferSize (ID3DBlob *iface)
 
static HRESULT d3dcompiler_blob_init (struct d3dcompiler_blob *blob, SIZE_T data_size)
 
HRESULT WINAPI D3DCreateBlob (SIZE_T data_size, ID3DBlob **blob)
 
static BOOL check_blob_part (DWORD tag, D3D_BLOB_PART part)
 
static HRESULT d3dcompiler_get_blob_part (const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob)
 
static BOOL check_blob_strip (DWORD tag, UINT flags)
 
static HRESULT d3dcompiler_strip_shader (const void *data, SIZE_T data_size, UINT flags, ID3DBlob **blob)
 
HRESULT WINAPI D3DGetBlobPart (const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob)
 
HRESULT WINAPI D3DGetInputSignatureBlob (const void *data, SIZE_T data_size, ID3DBlob **blob)
 
HRESULT WINAPI D3DGetOutputSignatureBlob (const void *data, SIZE_T data_size, ID3DBlob **blob)
 
HRESULT WINAPI D3DGetInputAndOutputSignatureBlob (const void *data, SIZE_T data_size, ID3DBlob **blob)
 
HRESULT WINAPI D3DGetDebugInfo (const void *data, SIZE_T data_size, ID3DBlob **blob)
 
HRESULT WINAPI D3DStripShader (const void *data, SIZE_T data_size, UINT flags, ID3D10Blob **blob)
 
HRESULT WINAPI D3DReadFileToBlob (const WCHAR *filename, ID3DBlob **contents)
 
HRESULT WINAPI D3DWriteBlobToFile (ID3DBlob *blob, const WCHAR *filename, BOOL overwrite)
 

Variables

static const struct ID3D10BlobVtbl d3dcompiler_blob_vtbl
 

Function Documentation

◆ check_blob_part()

static BOOL check_blob_part ( DWORD  tag,
D3D_BLOB_PART  part 
)
static

Definition at line 165 of file blob.c.

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 
191  case D3D_BLOB_DEBUG_INFO:
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 
203  case D3D_BLOB_XNA_SHADER:
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_an((const char *)&tag, 4));
213 
214  return add;
215 }
const char * debug_d3dcompiler_d3d_blob_part(D3D_BLOB_PART part) DECLSPEC_HIDDEN
Definition: utils.c:106
#define TAG_ISGN
Definition: blob.c:46
#define TAG_XNAP
Definition: blob.c:54
#define TRUE
Definition: types.h:120
Definition: ecma_167.h:138
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:111
#define TAG_OSG5
#define TRACE(s)
Definition: solgame.cpp:4
#define TAG_Aon9
Definition: blob.c:44
#define TAG_PCSG
Definition: blob.c:48
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
#define TAG_SDBG
Definition: blob.c:50
#define TAG_OSGN
Definition: blob.c:47
#define TAG_XNAS
Definition: blob.c:55

Referenced by d3dcompiler_get_blob_part().

◆ check_blob_strip()

static BOOL check_blob_strip ( DWORD  tag,
UINT  flags 
)
static

Definition at line 332 of file blob.c.

333 {
334  BOOL add = TRUE;
335 
336  if (flags & D3DCOMPILER_STRIP_TEST_BLOBS) FIXME("Unhandled flag D3DCOMPILER_STRIP_TEST_BLOBS.\n");
337 
338  switch(tag)
339  {
340  case TAG_RDEF:
341  case TAG_STAT:
343  break;
344 
345  case TAG_SDBG:
347  break;
348 
349  default:
350  break;
351  }
352 
353  TRACE("%s tag %s\n", add ? "Add" : "Skip", debugstr_an((const char *)&tag, 4));
354 
355  return add;
356 }
#define TRUE
Definition: types.h:120
Definition: ecma_167.h:138
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TAG_STAT
Definition: blob.c:53
#define FIXME(fmt,...)
Definition: debug.h:111
#define TRACE(s)
Definition: solgame.cpp:4
#define TAG_RDEF
Definition: blob.c:49
GLbitfield flags
Definition: glext.h:7161
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
#define TAG_SDBG
Definition: blob.c:50

Referenced by d3dcompiler_strip_shader().

◆ d3dcompiler_blob_AddRef()

static ULONG STDMETHODCALLTYPE d3dcompiler_blob_AddRef ( ID3DBlob iface)
static

Definition at line 60 of file blob.c.

61 {
62  struct d3dcompiler_blob *blob = impl_from_ID3DBlob(iface);
64 
65  TRACE("%p increasing refcount to %u\n", blob, refcount);
66 
67  return refcount;
68 }
Definition: image.c:133
static struct d3dcompiler_blob * impl_from_ID3DBlob(ID3DBlob *iface)
Definition: blob.c:35
LONG refcount
Definition: blob.c:29
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ d3dcompiler_blob_GetBufferPointer()

static void* STDMETHODCALLTYPE d3dcompiler_blob_GetBufferPointer ( ID3DBlob iface)
static

Definition at line 88 of file blob.c.

89 {
90  struct d3dcompiler_blob *blob = impl_from_ID3DBlob(iface);
91 
92  TRACE("iface %p\n", iface);
93 
94  return blob->data;
95 }
Definition: image.c:133
static struct d3dcompiler_blob * impl_from_ID3DBlob(ID3DBlob *iface)
Definition: blob.c:35
#define TRACE(s)
Definition: solgame.cpp:4

◆ d3dcompiler_blob_GetBufferSize()

static SIZE_T STDMETHODCALLTYPE d3dcompiler_blob_GetBufferSize ( ID3DBlob iface)
static

Definition at line 97 of file blob.c.

98 {
99  struct d3dcompiler_blob *blob = impl_from_ID3DBlob(iface);
100 
101  TRACE("iface %p\n", iface);
102 
103  return blob->size;
104 }
Definition: image.c:133
static struct d3dcompiler_blob * impl_from_ID3DBlob(ID3DBlob *iface)
Definition: blob.c:35
#define TRACE(s)
Definition: solgame.cpp:4

◆ d3dcompiler_blob_init()

static HRESULT d3dcompiler_blob_init ( struct d3dcompiler_blob blob,
SIZE_T  data_size 
)
static

Definition at line 117 of file blob.c.

118 {
119  blob->ID3DBlob_iface.lpVtbl = &d3dcompiler_blob_vtbl;
120  blob->refcount = 1;
121  blob->size = data_size;
122 
123  blob->data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 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 }
Definition: image.c:133
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static const struct ID3D10BlobVtbl d3dcompiler_blob_vtbl
Definition: blob.c:106
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
#define HEAP_ZERO_MEMORY
Definition: compat.h:134

Referenced by D3DCreateBlob(), and D3DReadFileToBlob().

◆ d3dcompiler_blob_QueryInterface()

static HRESULT STDMETHODCALLTYPE d3dcompiler_blob_QueryInterface ( ID3DBlob iface,
REFIID  riid,
void **  object 
)
static

Definition at line 42 of file blob.c.

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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ d3dcompiler_blob_Release()

static ULONG STDMETHODCALLTYPE d3dcompiler_blob_Release ( ID3DBlob iface)
static

Definition at line 70 of file blob.c.

71 {
72  struct d3dcompiler_blob *blob = impl_from_ID3DBlob(iface);
74 
75  TRACE("%p decreasing refcount to %u\n", blob, refcount);
76 
77  if (!refcount)
78  {
79  HeapFree(GetProcessHeap(), 0, blob->data);
81  }
82 
83  return refcount;
84 }
Definition: image.c:133
static struct d3dcompiler_blob * impl_from_ID3DBlob(ID3DBlob *iface)
Definition: blob.c:35
LONG refcount
Definition: blob.c:29
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ d3dcompiler_get_blob_part()

static HRESULT d3dcompiler_get_blob_part ( const void data,
SIZE_T  data_size,
D3D_BLOB_PART  part,
UINT  flags,
ID3DBlob **  blob 
)
static

Definition at line 217 of file blob.c.

218 {
219  struct dxbc src_dxbc, dst_dxbc;
220  HRESULT hr;
221  unsigned int i, count;
222 
223  if (!data || !data_size || flags || !blob)
224  {
225  WARN("Invalid arguments: data %p, data_size %lu, flags %#x, blob %p\n", data, data_size, flags, blob);
226  return D3DERR_INVALIDCALL;
227  }
228 
229  if (part > D3D_BLOB_TEST_COMPILE_PERF
230  || (part < D3D_BLOB_TEST_ALTERNATE_SHADER && part > D3D_BLOB_XNA_SHADER))
231  {
232  WARN("Invalid D3D_BLOB_PART: part %s\n", debug_d3dcompiler_d3d_blob_part(part));
233  return D3DERR_INVALIDCALL;
234  }
235 
236  hr = dxbc_parse(data, data_size, &src_dxbc);
237  if (FAILED(hr))
238  {
239  WARN("Failed to parse blob part\n");
240  return hr;
241  }
242 
243  hr = dxbc_init(&dst_dxbc, 0);
244  if (FAILED(hr))
245  {
246  dxbc_destroy(&src_dxbc);
247  WARN("Failed to init dxbc\n");
248  return hr;
249  }
250 
251  for (i = 0; i < src_dxbc.count; ++i)
252  {
253  struct dxbc_section *section = &src_dxbc.sections[i];
254 
255  if (check_blob_part(section->tag, part))
256  {
257  hr = dxbc_add_section(&dst_dxbc, section->tag, section->data, section->data_size);
258  if (FAILED(hr))
259  {
260  dxbc_destroy(&src_dxbc);
261  dxbc_destroy(&dst_dxbc);
262  WARN("Failed to add section to dxbc\n");
263  return hr;
264  }
265  }
266  }
267 
268  count = dst_dxbc.count;
269 
270  switch(part)
271  {
275  case D3D_BLOB_DEBUG_INFO:
278  case D3D_BLOB_XNA_SHADER:
279  if (count != 1) count = 0;
280  break;
281 
283  if (count != 2) count = 0;
284  break;
285 
287  if (count != 3) count = 0;
288  break;
289 
290  default:
291  FIXME("Unhandled D3D_BLOB_PART %s.\n", debug_d3dcompiler_d3d_blob_part(part));
292  break;
293  }
294 
295  if (count == 0)
296  {
297  dxbc_destroy(&src_dxbc);
298  dxbc_destroy(&dst_dxbc);
299  WARN("Nothing to write into the blob (count = 0)\n");
300  return E_FAIL;
301  }
302 
303  /* some parts aren't full DXBCs, they contain only the data */
304  if (count == 1 && (part == D3D_BLOB_DEBUG_INFO || part == D3D_BLOB_LEGACY_SHADER || part == D3D_BLOB_XNA_PREPASS_SHADER
305  || part == D3D_BLOB_XNA_SHADER))
306  {
307  hr = D3DCreateBlob(dst_dxbc.sections[0].data_size, blob);
308  if (SUCCEEDED(hr))
309  {
310  memcpy(ID3D10Blob_GetBufferPointer(*blob), dst_dxbc.sections[0].data, dst_dxbc.sections[0].data_size);
311  }
312  else
313  {
314  WARN("Could not create blob\n");
315  }
316  }
317  else
318  {
319  hr = dxbc_write_blob(&dst_dxbc, blob);
320  if (FAILED(hr))
321  {
322  WARN("Failed to write blob part\n");
323  }
324  }
325 
326  dxbc_destroy(&src_dxbc);
327  dxbc_destroy(&dst_dxbc);
328 
329  return hr;
330 }
const char * debug_d3dcompiler_d3d_blob_part(D3D_BLOB_PART part) DECLSPEC_HIDDEN
Definition: utils.c:106
HRESULT dxbc_add_section(struct dxbc *dxbc, DWORD tag, const char *data, DWORD data_size) DECLSPEC_HIDDEN
Definition: utils.c:529
HRESULT dxbc_init(struct dxbc *dxbc, unsigned int size) DECLSPEC_HIDDEN
Definition: utils.c:557
HRESULT hr
Definition: shlfolder.c:183
Definition: image.c:133
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:112
Definition: parser.c:55
#define E_FAIL
Definition: ddrawi.h:102
if SUCCEEDED(hr)
#define FIXME(fmt,...)
Definition: debug.h:111
#define D3DERR_INVALIDCALL
Definition: blob.c:34
LONG HRESULT
Definition: typedefs.h:79
HRESULT dxbc_parse(const char *data, SIZE_T data_size, struct dxbc *dxbc) DECLSPEC_HIDDEN
Definition: utils.c:577
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
HRESULT dxbc_write_blob(struct dxbc *dxbc, ID3DBlob **blob) DECLSPEC_HIDDEN
Definition: utils.c:655
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
void dxbc_destroy(struct dxbc *dxbc) DECLSPEC_HIDDEN
Definition: utils.c:648
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
HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3DBlob **blob)
Definition: blob.c:133
static BOOL check_blob_part(DWORD tag, D3D_BLOB_PART part)
Definition: blob.c:165

Referenced by D3DGetBlobPart(), D3DGetDebugInfo(), D3DGetInputAndOutputSignatureBlob(), D3DGetInputSignatureBlob(), and D3DGetOutputSignatureBlob().

◆ d3dcompiler_strip_shader()

static HRESULT d3dcompiler_strip_shader ( const void data,
SIZE_T  data_size,
UINT  flags,
ID3DBlob **  blob 
)
static

Definition at line 358 of file blob.c.

359 {
360  struct dxbc src_dxbc, dst_dxbc;
361  HRESULT hr;
362  unsigned int i;
363 
364  if (!blob)
365  {
366  WARN("NULL for blob specified\n");
367  return E_FAIL;
368  }
369 
370  if (!data || !data_size)
371  {
372  WARN("Invalid arguments: data %p, data_size %lu\n", data, data_size);
373  return D3DERR_INVALIDCALL;
374  }
375 
376  hr = dxbc_parse(data, data_size, &src_dxbc);
377  if (FAILED(hr))
378  {
379  WARN("Failed to parse blob part\n");
380  return hr;
381  }
382 
383  /* src_dxbc.count >= dst_dxbc.count */
384  hr = dxbc_init(&dst_dxbc, src_dxbc.count);
385  if (FAILED(hr))
386  {
387  dxbc_destroy(&src_dxbc);
388  WARN("Failed to init dxbc\n");
389  return hr;
390  }
391 
392  for (i = 0; i < src_dxbc.count; ++i)
393  {
394  struct dxbc_section *section = &src_dxbc.sections[i];
395 
396  if (check_blob_strip(section->tag, flags))
397  {
398  hr = dxbc_add_section(&dst_dxbc, section->tag, section->data, section->data_size);
399  if (FAILED(hr))
400  {
401  dxbc_destroy(&src_dxbc);
402  dxbc_destroy(&dst_dxbc);
403  WARN("Failed to add section to dxbc\n");
404  return hr;
405  }
406  }
407  }
408 
409  hr = dxbc_write_blob(&dst_dxbc, blob);
410  if (FAILED(hr))
411  {
412  WARN("Failed to write blob part\n");
413  }
414 
415  dxbc_destroy(&src_dxbc);
416  dxbc_destroy(&dst_dxbc);
417 
418  return hr;
419 }
HRESULT dxbc_add_section(struct dxbc *dxbc, DWORD tag, const char *data, DWORD data_size) DECLSPEC_HIDDEN
Definition: utils.c:529
HRESULT dxbc_init(struct dxbc *dxbc, unsigned int size) DECLSPEC_HIDDEN
Definition: utils.c:557
HRESULT hr
Definition: shlfolder.c:183
Definition: image.c:133
#define WARN(fmt,...)
Definition: debug.h:112
Definition: parser.c:55
#define E_FAIL
Definition: ddrawi.h:102
static BOOL check_blob_strip(DWORD tag, UINT flags)
Definition: blob.c:332
#define D3DERR_INVALIDCALL
Definition: blob.c:34
LONG HRESULT
Definition: typedefs.h:79
HRESULT dxbc_parse(const char *data, SIZE_T data_size, struct dxbc *dxbc) DECLSPEC_HIDDEN
Definition: utils.c:577
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
HRESULT dxbc_write_blob(struct dxbc *dxbc, ID3DBlob **blob) DECLSPEC_HIDDEN
Definition: utils.c:655
void dxbc_destroy(struct dxbc *dxbc) DECLSPEC_HIDDEN
Definition: utils.c:648
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

Referenced by D3DStripShader().

◆ D3DCreateBlob()

HRESULT WINAPI D3DCreateBlob ( SIZE_T  data_size,
ID3DBlob **  blob 
)

Definition at line 133 of file blob.c.

134 {
135  struct d3dcompiler_blob *object;
136  HRESULT hr;
137 
138  TRACE("data_size %lu, 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 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 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 %#x.\n", hr);
154  HeapFree(GetProcessHeap(), 0, 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 }
coclass MSXML2::XSLTemplate40 object
HRESULT hr
Definition: shlfolder.c:183
Definition: image.c:133
#define WARN(fmt,...)
Definition: debug.h:112
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define D3DERR_INVALIDCALL
Definition: blob.c:34
static HRESULT d3dcompiler_blob_init(struct d3dcompiler_blob *blob, SIZE_T data_size)
Definition: blob.c:117
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:52
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by assemble_shader(), compile_shader(), d3dcompiler_get_blob_part(), D3DPreprocess(), dxbc_write_blob(), and preprocess_shader().

◆ D3DGetBlobPart()

HRESULT WINAPI D3DGetBlobPart ( const void data,
SIZE_T  data_size,
D3D_BLOB_PART  part,
UINT  flags,
ID3DBlob **  blob 
)

Definition at line 421 of file blob.c.

422 {
423  TRACE("data %p, data_size %lu, part %s, flags %#x, blob %p\n", data,
424  data_size, debug_d3dcompiler_d3d_blob_part(part), flags, blob);
425 
426  return d3dcompiler_get_blob_part(data, data_size, part, flags, blob);
427 }
const char * debug_d3dcompiler_d3d_blob_part(D3D_BLOB_PART part) DECLSPEC_HIDDEN
Definition: utils.c:106
Definition: image.c:133
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
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161

◆ D3DGetDebugInfo()

HRESULT WINAPI D3DGetDebugInfo ( const void data,
SIZE_T  data_size,
ID3DBlob **  blob 
)

Definition at line 450 of file blob.c.

451 {
452  TRACE("data %p, data_size %lu, blob %p\n", data, data_size, blob);
453 
454  return d3dcompiler_get_blob_part(data, data_size, D3D_BLOB_DEBUG_INFO, 0, blob);
455 }
Definition: image.c:133
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
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ D3DGetInputAndOutputSignatureBlob()

HRESULT WINAPI D3DGetInputAndOutputSignatureBlob ( const void data,
SIZE_T  data_size,
ID3DBlob **  blob 
)

Definition at line 443 of file blob.c.

444 {
445  TRACE("data %p, data_size %lu, blob %p\n", data, data_size, blob);
446 
448 }
Definition: image.c:133
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
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ D3DGetInputSignatureBlob()

HRESULT WINAPI D3DGetInputSignatureBlob ( const void data,
SIZE_T  data_size,
ID3DBlob **  blob 
)

Definition at line 429 of file blob.c.

430 {
431  TRACE("data %p, data_size %lu, blob %p\n", data, data_size, blob);
432 
434 }
Definition: image.c:133
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
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ D3DGetOutputSignatureBlob()

HRESULT WINAPI D3DGetOutputSignatureBlob ( const void data,
SIZE_T  data_size,
ID3DBlob **  blob 
)

Definition at line 436 of file blob.c.

437 {
438  TRACE("data %p, data_size %lu, blob %p\n", data, data_size, blob);
439 
441 }
Definition: image.c:133
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
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ D3DReadFileToBlob()

HRESULT WINAPI D3DReadFileToBlob ( const WCHAR filename,
ID3DBlob **  contents 
)

Definition at line 464 of file blob.c.

465 {
466  struct d3dcompiler_blob *object;
467  SIZE_T data_size;
468  DWORD read_size;
469  HANDLE file;
470  HRESULT hr;
471 
472  TRACE("filename %s, contents %p.\n", debugstr_w(filename), contents);
473 
475  if (file == INVALID_HANDLE_VALUE)
477 
478  data_size = GetFileSize(file, NULL);
479  if (data_size == INVALID_FILE_SIZE)
480  {
481  CloseHandle(file);
483  }
484 
485  if (!(object = heap_alloc_zero(sizeof(*object))))
486  {
487  CloseHandle(file);
488  return E_OUTOFMEMORY;
489  }
490 
491  if (FAILED(hr = d3dcompiler_blob_init(object, data_size)))
492  {
493  WARN("Failed to initialize blob, hr %#x.\n", hr);
494  CloseHandle(file);
495  heap_free(object);
496  return hr;
497  }
498 
499  if (!ReadFile(file, object->data, data_size, &read_size, NULL) || (read_size != data_size))
500  {
501  WARN("Failed to read file contents.\n");
502  CloseHandle(file);
503  heap_free(object->data);
504  heap_free(object);
505  return E_FAIL;
506  }
507  CloseHandle(file);
508  object->size = read_size;
509 
510  *contents = &object->ID3DBlob_iface;
511 
512  TRACE("Returning ID3DBlob %p.\n", *contents);
513 
514  return S_OK;
515 }
#define CloseHandle
Definition: compat.h:598
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
coclass MSXML2::XSLTemplate40 object
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:112
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define INVALID_FILE_SIZE
Definition: winbase.h:545
const char * filename
Definition: ioapi.h:135
#define E_FAIL
Definition: ddrawi.h:102
#define FILE_SHARE_READ
Definition: compat.h:136
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
#define OPEN_EXISTING
Definition: compat.h:634
static HRESULT d3dcompiler_blob_init(struct d3dcompiler_blob *blob, SIZE_T data_size)
Definition: blob.c:117
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define GENERIC_READ
Definition: compat.h:135
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define S_OK
Definition: intsafe.h:52
#define ReadFile(a, b, c, d, e)
Definition: compat.h:601
#define NULL
Definition: types.h:112
#define CreateFileW
Definition: compat.h:600
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
Definition: fci.c:126

◆ D3DStripShader()

HRESULT WINAPI D3DStripShader ( const void data,
SIZE_T  data_size,
UINT  flags,
ID3D10Blob **  blob 
)

Definition at line 457 of file blob.c.

458 {
459  TRACE("data %p, data_size %lu, flags %#x, blob %p\n", data, data_size, flags, blob);
460 
461  return d3dcompiler_strip_shader(data, data_size, flags, blob);
462 }
Definition: image.c:133
static HRESULT d3dcompiler_strip_shader(const void *data, SIZE_T data_size, UINT flags, ID3DBlob **blob)
Definition: blob.c:358
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161

◆ D3DWriteBlobToFile()

HRESULT WINAPI D3DWriteBlobToFile ( ID3DBlob blob,
const WCHAR filename,
BOOL  overwrite 
)

Definition at line 517 of file blob.c.

518 {
519  FIXME("blob %p, filename %s, overwrite %d\n", blob, debugstr_w(filename), overwrite);
520 
521  return E_NOTIMPL;
522 }
Definition: image.c:133
const char * filename
Definition: ioapi.h:135
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ impl_from_ID3DBlob()

static struct d3dcompiler_blob* impl_from_ID3DBlob ( ID3DBlob iface)
inlinestatic

Definition at line 35 of file blob.c.

36 {
37  return CONTAINING_RECORD(iface, struct d3dcompiler_blob, ID3DBlob_iface);
38 }
ID3DBlob ID3DBlob_iface
Definition: blob.c:28
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by d3dcompiler_blob_AddRef(), d3dcompiler_blob_GetBufferPointer(), d3dcompiler_blob_GetBufferSize(), and d3dcompiler_blob_Release().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3dcompiler  )

Variable Documentation

◆ d3dcompiler_blob_vtbl

const struct ID3D10BlobVtbl d3dcompiler_blob_vtbl
static
Initial value:
=
{
}
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 HRESULT STDMETHODCALLTYPE d3dcompiler_blob_QueryInterface(ID3DBlob *iface, REFIID riid, void **object)
Definition: blob.c:42
static void *STDMETHODCALLTYPE d3dcompiler_blob_GetBufferPointer(ID3DBlob *iface)
Definition: blob.c:88
static ULONG STDMETHODCALLTYPE d3dcompiler_blob_AddRef(ID3DBlob *iface)
Definition: blob.c:60

Definition at line 106 of file blob.c.

Referenced by d3dcompiler_blob_init().