ReactOS 0.4.15-dev-5667-ged97270
d3dcompiler.h File Reference
#include "d3d11shader.h"
Include dependency graph for d3dcompiler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define D3DCOMPILER_DLL_A   "d3dcompiler_43.dll"
 
#define D3DCOMPILER_DLL   WINELIB_NAME_AW(D3DCOMPILER_DLL_)
 
#define D3DCOMPILE_DEBUG   0x00000001
 
#define D3DCOMPILE_SKIP_VALIDATION   0x00000002
 
#define D3DCOMPILE_SKIP_OPTIMIZATION   0x00000004
 
#define D3DCOMPILE_PACK_MATRIX_ROW_MAJOR   0x00000008
 
#define D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR   0x00000010
 
#define D3DCOMPILE_PARTIAL_PRECISION   0x00000020
 
#define D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT   0x00000040
 
#define D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT   0x00000080
 
#define D3DCOMPILE_NO_PRESHADER   0x00000100
 
#define D3DCOMPILE_AVOID_FLOW_CONTROL   0x00000200
 
#define D3DCOMPILE_PREFER_FLOW_CONTROL   0x00000400
 
#define D3DCOMPILE_ENABLE_STRICTNESS   0x00000800
 
#define D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY   0x00001000
 
#define D3DCOMPILE_IEEE_STRICTNESS   0x00002000
 
#define D3DCOMPILE_OPTIMIZATION_LEVEL0   0x00004000
 
#define D3DCOMPILE_OPTIMIZATION_LEVEL1   0x00000000
 
#define D3DCOMPILE_OPTIMIZATION_LEVEL2   0x0000c000
 
#define D3DCOMPILE_OPTIMIZATION_LEVEL3   0x00008000
 
#define D3DCOMPILE_RESERVED16   0x00010000
 
#define D3DCOMPILE_RESERVED17   0x00020000
 
#define D3DCOMPILE_WARNINGS_ARE_ERRORS   0x00040000
 
#define D3DCOMPILE_RESOURCES_MAY_ALIAS   0x00080000
 
#define D3D_DISASM_ENABLE_COLOR_CODE   0x00000001
 
#define D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS   0x00000002
 
#define D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING   0x00000004
 
#define D3D_DISASM_ENABLE_INSTRUCTION_CYCLE   0x00000008
 
#define D3D_DISASM_DISABLE_DEBUG_INFO   0x00000010
 

Typedefs

typedef HRESULT(WINAPIpD3DCompile) (const void *data, SIZE_T data_size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint, const char *target, UINT sflags, UINT eflags, ID3DBlob **shader, ID3DBlob **error_messages)
 
typedef enum D3DCOMPILER_STRIP_FLAGS D3DCOMPILER_STRIP_FLAGS
 
typedef enum D3D_BLOB_PART D3D_BLOB_PART
 
typedef HRESULT(WINAPIpD3DDisassemble) (const void *data, SIZE_T data_size, UINT flags, const char *comments, ID3DBlob **disassembly)
 
typedef HRESULT(WINAPIpD3DPreprocess) (const void *data, SIZE_T size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, ID3DBlob **shader, ID3DBlob **error_messages)
 

Enumerations

enum  D3DCOMPILER_STRIP_FLAGS { D3DCOMPILER_STRIP_REFLECTION_DATA = 1 , D3DCOMPILER_STRIP_DEBUG_INFO = 2 , D3DCOMPILER_STRIP_TEST_BLOBS = 4 , D3DCOMPILER_STRIP_FORCE_DWORD = 0x7fffffff }
 
enum  D3D_BLOB_PART {
  D3D_BLOB_INPUT_SIGNATURE_BLOB , D3D_BLOB_OUTPUT_SIGNATURE_BLOB , D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB , D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB ,
  D3D_BLOB_ALL_SIGNATURE_BLOB , D3D_BLOB_DEBUG_INFO , D3D_BLOB_LEGACY_SHADER , D3D_BLOB_XNA_PREPASS_SHADER ,
  D3D_BLOB_XNA_SHADER , D3D_BLOB_TEST_ALTERNATE_SHADER = 0x8000 , D3D_BLOB_TEST_COMPILE_DETAILS , D3D_BLOB_TEST_COMPILE_PERF
}
 

Functions

HRESULT WINAPI D3DCompile (const void *data, SIZE_T data_size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint, const char *target, UINT sflags, UINT eflags, ID3DBlob **shader, ID3DBlob **error_messages)
 
HRESULT WINAPI D3DStripShader (const void *data, SIZE_T data_size, UINT flags, ID3DBlob **blob)
 
HRESULT WINAPI D3DDisassemble (const void *data, SIZE_T data_size, UINT flags, const char *comments, ID3DBlob **disassembly)
 
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 D3DReadFileToBlob (const WCHAR *filename, ID3DBlob **contents)
 
HRESULT WINAPI D3DWriteBlobToFile (ID3DBlob *blob, const WCHAR *filename, BOOL overwrite)
 
HRESULT WINAPI D3DReflect (const void *data, SIZE_T data_size, REFIID riid, void **reflector)
 
HRESULT WINAPI D3DCreateBlob (SIZE_T data_size, ID3DBlob **blob)
 
HRESULT WINAPI D3DPreprocess (const void *data, SIZE_T size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, ID3DBlob **shader, ID3DBlob **error_messages)
 

Variables

static const WCHAR D3DCOMPILER_DLL_W [] = {'d','3','d','c','o','m','p','i','l','e','r','_','4','3','.','d','l','l',0}
 

Macro Definition Documentation

◆ D3D_DISASM_DISABLE_DEBUG_INFO

#define D3D_DISASM_DISABLE_DEBUG_INFO   0x00000010

Definition at line 66 of file d3dcompiler.h.

◆ D3D_DISASM_ENABLE_COLOR_CODE

#define D3D_DISASM_ENABLE_COLOR_CODE   0x00000001

Definition at line 62 of file d3dcompiler.h.

◆ D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS

#define D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS   0x00000002

Definition at line 63 of file d3dcompiler.h.

◆ D3D_DISASM_ENABLE_INSTRUCTION_CYCLE

#define D3D_DISASM_ENABLE_INSTRUCTION_CYCLE   0x00000008

Definition at line 65 of file d3dcompiler.h.

◆ D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING

#define D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING   0x00000004

Definition at line 64 of file d3dcompiler.h.

◆ D3DCOMPILE_AVOID_FLOW_CONTROL

#define D3DCOMPILE_AVOID_FLOW_CONTROL   0x00000200

Definition at line 48 of file d3dcompiler.h.

◆ D3DCOMPILE_DEBUG

#define D3DCOMPILE_DEBUG   0x00000001

Definition at line 39 of file d3dcompiler.h.

◆ D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY

#define D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY   0x00001000

Definition at line 51 of file d3dcompiler.h.

◆ D3DCOMPILE_ENABLE_STRICTNESS

#define D3DCOMPILE_ENABLE_STRICTNESS   0x00000800

Definition at line 50 of file d3dcompiler.h.

◆ D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT

#define D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT   0x00000080

Definition at line 46 of file d3dcompiler.h.

◆ D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT

#define D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT   0x00000040

Definition at line 45 of file d3dcompiler.h.

◆ D3DCOMPILE_IEEE_STRICTNESS

#define D3DCOMPILE_IEEE_STRICTNESS   0x00002000

Definition at line 52 of file d3dcompiler.h.

◆ D3DCOMPILE_NO_PRESHADER

#define D3DCOMPILE_NO_PRESHADER   0x00000100

Definition at line 47 of file d3dcompiler.h.

◆ D3DCOMPILE_OPTIMIZATION_LEVEL0

#define D3DCOMPILE_OPTIMIZATION_LEVEL0   0x00004000

Definition at line 53 of file d3dcompiler.h.

◆ D3DCOMPILE_OPTIMIZATION_LEVEL1

#define D3DCOMPILE_OPTIMIZATION_LEVEL1   0x00000000

Definition at line 54 of file d3dcompiler.h.

◆ D3DCOMPILE_OPTIMIZATION_LEVEL2

#define D3DCOMPILE_OPTIMIZATION_LEVEL2   0x0000c000

Definition at line 55 of file d3dcompiler.h.

◆ D3DCOMPILE_OPTIMIZATION_LEVEL3

#define D3DCOMPILE_OPTIMIZATION_LEVEL3   0x00008000

Definition at line 56 of file d3dcompiler.h.

◆ D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR

#define D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR   0x00000010

Definition at line 43 of file d3dcompiler.h.

◆ D3DCOMPILE_PACK_MATRIX_ROW_MAJOR

#define D3DCOMPILE_PACK_MATRIX_ROW_MAJOR   0x00000008

Definition at line 42 of file d3dcompiler.h.

◆ D3DCOMPILE_PARTIAL_PRECISION

#define D3DCOMPILE_PARTIAL_PRECISION   0x00000020

Definition at line 44 of file d3dcompiler.h.

◆ D3DCOMPILE_PREFER_FLOW_CONTROL

#define D3DCOMPILE_PREFER_FLOW_CONTROL   0x00000400

Definition at line 49 of file d3dcompiler.h.

◆ D3DCOMPILE_RESERVED16

#define D3DCOMPILE_RESERVED16   0x00010000

Definition at line 57 of file d3dcompiler.h.

◆ D3DCOMPILE_RESERVED17

#define D3DCOMPILE_RESERVED17   0x00020000

Definition at line 58 of file d3dcompiler.h.

◆ D3DCOMPILE_RESOURCES_MAY_ALIAS

#define D3DCOMPILE_RESOURCES_MAY_ALIAS   0x00080000

Definition at line 60 of file d3dcompiler.h.

◆ D3DCOMPILE_SKIP_OPTIMIZATION

#define D3DCOMPILE_SKIP_OPTIMIZATION   0x00000004

Definition at line 41 of file d3dcompiler.h.

◆ D3DCOMPILE_SKIP_VALIDATION

#define D3DCOMPILE_SKIP_VALIDATION   0x00000002

Definition at line 40 of file d3dcompiler.h.

◆ D3DCOMPILE_WARNINGS_ARE_ERRORS

#define D3DCOMPILE_WARNINGS_ARE_ERRORS   0x00040000

Definition at line 59 of file d3dcompiler.h.

◆ D3DCOMPILER_DLL

#define D3DCOMPILER_DLL   WINELIB_NAME_AW(D3DCOMPILER_DLL_)

Definition at line 37 of file d3dcompiler.h.

◆ D3DCOMPILER_DLL_A

#define D3DCOMPILER_DLL_A   "d3dcompiler_43.dll"

Definition at line 36 of file d3dcompiler.h.

Typedef Documentation

◆ D3D_BLOB_PART

◆ D3DCOMPILER_STRIP_FLAGS

◆ pD3DCompile

◆ pD3DDisassemble

typedef HRESULT(WINAPI * pD3DDisassemble) (const void *data, SIZE_T data_size, UINT flags, const char *comments, ID3DBlob **disassembly)

Definition at line 103 of file d3dcompiler.h.

◆ pD3DPreprocess

Enumeration Type Documentation

◆ D3D_BLOB_PART

Enumerator
D3D_BLOB_INPUT_SIGNATURE_BLOB 
D3D_BLOB_OUTPUT_SIGNATURE_BLOB 
D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB 
D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB 
D3D_BLOB_ALL_SIGNATURE_BLOB 
D3D_BLOB_DEBUG_INFO 
D3D_BLOB_LEGACY_SHADER 
D3D_BLOB_XNA_PREPASS_SHADER 
D3D_BLOB_XNA_SHADER 
D3D_BLOB_TEST_ALTERNATE_SHADER 
D3D_BLOB_TEST_COMPILE_DETAILS 
D3D_BLOB_TEST_COMPILE_PERF 

Definition at line 85 of file d3dcompiler.h.

86{
D3D_BLOB_PART
Definition: d3dcompiler.h:86
@ D3D_BLOB_ALL_SIGNATURE_BLOB
Definition: d3dcompiler.h:91
@ D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB
Definition: d3dcompiler.h:89
@ D3D_BLOB_TEST_COMPILE_PERF
Definition: d3dcompiler.h:98
@ D3D_BLOB_TEST_ALTERNATE_SHADER
Definition: d3dcompiler.h:96
@ D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB
Definition: d3dcompiler.h:90
@ D3D_BLOB_XNA_SHADER
Definition: d3dcompiler.h:95
@ D3D_BLOB_TEST_COMPILE_DETAILS
Definition: d3dcompiler.h:97
@ D3D_BLOB_INPUT_SIGNATURE_BLOB
Definition: d3dcompiler.h:87
@ D3D_BLOB_OUTPUT_SIGNATURE_BLOB
Definition: d3dcompiler.h:88
@ D3D_BLOB_DEBUG_INFO
Definition: d3dcompiler.h:92
@ D3D_BLOB_XNA_PREPASS_SHADER
Definition: d3dcompiler.h:94
@ D3D_BLOB_LEGACY_SHADER
Definition: d3dcompiler.h:93

◆ D3DCOMPILER_STRIP_FLAGS

Enumerator
D3DCOMPILER_STRIP_REFLECTION_DATA 
D3DCOMPILER_STRIP_DEBUG_INFO 
D3DCOMPILER_STRIP_TEST_BLOBS 
D3DCOMPILER_STRIP_FORCE_DWORD 

Definition at line 75 of file d3dcompiler.h.

76{
D3DCOMPILER_STRIP_FLAGS
Definition: d3dcompiler.h:76
@ D3DCOMPILER_STRIP_TEST_BLOBS
Definition: d3dcompiler.h:79
@ D3DCOMPILER_STRIP_DEBUG_INFO
Definition: d3dcompiler.h:78
@ D3DCOMPILER_STRIP_FORCE_DWORD
Definition: d3dcompiler.h:80
@ D3DCOMPILER_STRIP_REFLECTION_DATA
Definition: d3dcompiler.h:77

Function Documentation

◆ D3DCompile()

HRESULT WINAPI D3DCompile ( const void data,
SIZE_T  data_size,
const char filename,
const D3D_SHADER_MACRO defines,
ID3DInclude include,
const char entrypoint,
const char target,
UINT  sflags,
UINT  eflags,
ID3DBlob **  shader,
ID3DBlob **  error_messages 
)

Definition at line 889 of file compiler.c.

892{
893 TRACE("data %p, data_size %lu, filename %s, defines %p, include %p, entrypoint %s, "
894 "target %s, sflags %#x, eflags %#x, shader %p, error_messages %p.\n",
895 data, data_size, debugstr_a(filename), defines, include, debugstr_a(entrypoint),
897
898 return D3DCompile2(data, data_size, filename, defines, include, entrypoint, target, sflags,
900}
HRESULT WINAPI D3DCompile2(const void *data, SIZE_T data_size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint, const char *target, UINT sflags, UINT eflags, UINT secondary_flags, const void *secondary_data, SIZE_T secondary_data_size, ID3DBlob **shader, ID3DBlob **error_messages)
Definition: compiler.c:857
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:31
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: asm.c:32
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:31
#define NULL
Definition: types.h:112
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint shader
Definition: glext.h:6030
GLenum target
Definition: glext.h:7315
const char * filename
Definition: ioapi.h:137
#define debugstr_a
Definition: kernel32.h:31
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by d3dx9_effect_init(), D3DXCompileShader(), and D3DXCompileShaderFromFileW().

◆ 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}
#define WARN(fmt,...)
Definition: debug.h:112
#define D3DERR_INVALIDCALL
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static HRESULT d3dcompiler_blob_init(struct d3dcompiler_blob *blob, SIZE_T data_size)
Definition: blob.c:117
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183
Definition: image.c:134

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

◆ D3DDisassemble()

HRESULT WINAPI D3DDisassemble ( const void data,
SIZE_T  data_size,
UINT  flags,
const char comments,
ID3DBlob **  disassembly 
)

Definition at line 942 of file compiler.c.

943{
944 FIXME("data %p, size %lu, flags %#x, comments %p, disassembly %p stub!\n",
945 data, size, flags, comments, disassembly);
946 return E_NOTIMPL;
947}
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99
char comments[4096]
GLsizeiptr size
Definition: glext.h:5919
GLbitfield flags
Definition: glext.h:7161

◆ 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
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

◆ 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
455}

◆ 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}

◆ 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}

◆ 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}

◆ D3DPreprocess()

HRESULT WINAPI D3DPreprocess ( const void data,
SIZE_T  size,
const char filename,
const D3D_SHADER_MACRO defines,
ID3DInclude include,
ID3DBlob **  shader,
ID3DBlob **  error_messages 
)

Definition at line 902 of file compiler.c.

905{
906 HRESULT hr;
908
909 TRACE("data %p, size %lu, filename %s, defines %p, include %p, shader %p, error_messages %p\n",
911
912 if (!data)
913 return E_INVALIDARG;
914
916
917 if (shader) *shader = NULL;
919
921
922 if (SUCCEEDED(hr))
923 {
924 if (shader)
925 {
927 if (FAILED(hr))
928 goto cleanup;
929 CopyMemory(ID3D10Blob_GetBufferPointer(buffer), wpp_output, wpp_output_size);
930 *shader = buffer;
931 }
932 else
934 }
935
936cleanup:
939 return hr;
940}
static CRITICAL_SECTION wpp_mutex
Definition: compiler.c:75
static int wpp_output_size
Definition: compiler.c:58
static char * wpp_output
Definition: compiler.c:57
static HRESULT preprocess_shader(const void *data, SIZE_T data_size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, ID3DBlob **error_messages)
Definition: compiler.c:484
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3DBlob **blob)
Definition: blob.c:133
static void cleanup(void)
Definition: main.c:1335
GLuint buffer
Definition: glext.h:5915
#define SUCCEEDED(hr)
Definition: intsafe.h:50
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define CopyMemory
Definition: winbase.h:1668
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

Referenced by D3DXPreprocessShader(), and D3DXPreprocessShaderFromFileW().

◆ 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
477
478 data_size = GetFileSize(file, NULL);
479 if (data_size == INVALID_FILE_SIZE)
480 {
483 }
484
485 if (!(object = heap_alloc_zero(sizeof(*object))))
486 {
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);
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");
503 heap_free(object->data);
504 heap_free(object);
505 return E_FAIL;
506 }
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}
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define E_FAIL
Definition: ddrawi.h:102
#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
unsigned long DWORD
Definition: ntddk_ex.h:95
#define debugstr_w
Definition: kernel32.h:32
static const char * contents
Definition: parser.c:511
Definition: fci.c:127
ULONG_PTR SIZE_T
Definition: typedefs.h:80
DWORD WINAPI GetLastError(void)
Definition: except.c:1040
#define INVALID_FILE_SIZE
Definition: winbase.h:548
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

◆ D3DReflect()

HRESULT WINAPI D3DReflect ( const void data,
SIZE_T  data_size,
REFIID  riid,
void **  reflector 
)

Definition at line 1851 of file reflection.c.

1852{
1854 HRESULT hr;
1855 const DWORD *temp = data;
1856
1857 TRACE("data %p, data_size %lu, riid %s, blob %p\n", data, data_size, debugstr_guid(riid), reflector);
1858
1859 if (!data || data_size < 32)
1860 {
1861 WARN("Invalid argument supplied.\n");
1862 return D3DERR_INVALIDCALL;
1863 }
1864
1865 if (temp[6] != data_size)
1866 {
1867 WARN("Wrong size supplied.\n");
1868 return E_FAIL;
1869 }
1870
1871 if (!IsEqualGUID(riid, &IID_ID3D11ShaderReflection))
1872 {
1873 WARN("Wrong riid %s, accept only %s!\n", debugstr_guid(riid), debugstr_guid(&IID_ID3D11ShaderReflection));
1874 return E_NOINTERFACE;
1875 }
1876
1877 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1878 if (!object)
1879 return E_OUTOFMEMORY;
1880
1881 hr = d3dcompiler_shader_reflection_init(object, data, data_size);
1882 if (FAILED(hr))
1883 {
1884 WARN("Failed to initialize shader reflection\n");
1885 HeapFree(GetProcessHeap(), 0, object);
1886 return hr;
1887 }
1888
1889 *reflector = object;
1890
1891 TRACE("Created ID3D11ShaderReflection %p\n", object);
1892
1893 return S_OK;
1894}
static HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_reflection *reflection, const void *data, SIZE_T data_size)
Definition: reflection.c:1729
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
static calc_node_t temp
Definition: rpn_ieee.c:38
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ D3DStripShader()

HRESULT WINAPI D3DStripShader ( const void data,
SIZE_T  data_size,
UINT  flags,
ID3DBlob **  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}
static HRESULT d3dcompiler_strip_shader(const void *data, SIZE_T data_size, UINT flags, ID3DBlob **blob)
Definition: blob.c:358

◆ 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}

Variable Documentation

◆ D3DCOMPILER_DLL_W

const WCHAR D3DCOMPILER_DLL_W[] = {'d','3','d','c','o','m','p','i','l','e','r','_','4','3','.','d','l','l',0}
static

Definition at line 33 of file d3dcompiler.h.