CommonLibSSE NG
D3DCOMPILER.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "REX/W32/D3D.h"
4 
5 namespace REX::W32
6 {
7  struct ID3DBlob;
8  struct ID3DInclude;
9  struct ID3D10Effect;
10  struct ID3D11FunctionLinkingGraph;
11  struct ID3D11Linker;
12  struct ID3D11Module;
13 }
14 
15 namespace REX::W32
16 {
18  {
36  };
37 
39  {
48  };
49 
51  {
54  };
55 
57  {
58  D3DCOMPILE_DEBUG = (1 << 0),
74  D3DCOMPILE_OPTIMIZATION_LEVEL2 = ((1 << 14) | (1 << 15)),
76  D3DCOMPILE_RESERVED16 = (1 << 16),
77  D3DCOMPILE_RESERVED17 = (1 << 17),
84  };
85 
87  {
91  };
92 
94  {
98  };
99 
101  {
108  };
109 }
110 
111 namespace REX::W32
112 {
114  {
115  const void* bytecode;
116  std::size_t bytecodeLength;
117  };
118 }
119 
120 namespace REX::W32
121 {
122  inline const auto D3D_COMPILE_STANDARD_FILE_INCLUDE{ reinterpret_cast<ID3DInclude*>(static_cast<std::uintptr_t>(1)) };
123  inline constexpr auto D3D_COMPRESS_SHADER_KEEP_ALL_PARTS{ 0x00000001u };
124  inline constexpr auto D3D_GET_INST_OFFSETS_INCLUDE_NON_EXECUTABLE{ 0x00000001u };
125 }
126 
127 namespace REX::W32
128 {
129  HRESULT D3DCompile(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, ID3DBlob** a_code, ID3DBlob** a_errorMsgs);
130  HRESULT D3DCompile2(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, std::uint32_t a_secondaryDataFlags, const void* a_secondaryData, std::size_t a_secondaryDataSize, ID3DBlob** a_code, ID3DBlob** a_errorMsgs);
131  HRESULT D3DCompileFromFile(const wchar_t* a_fileName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, ID3DBlob** a_code, ID3DBlob** a_errorMsgs);
132  HRESULT D3DCompressShaders(std::uint32_t a_numShaders, D3D_SHADER_DATA* a_shaderData, std::uint32_t a_flags, ID3DBlob** a_compressedData);
133  HRESULT D3DCreateBlob(std::size_t a_size, ID3DBlob** a_blob);
134  HRESULT D3DCreateFunctionLinkingGraph(std::uint32_t a_flags, ID3D11FunctionLinkingGraph** a_functionLinkingGraph);
135  HRESULT D3DCreateLinker(ID3D11Linker** a_linker);
136  HRESULT D3DDecompressShaders(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_numShaders, std::uint32_t a_startIndex, std::uint32_t* a_indices, std::uint32_t a_flags, ID3DBlob** a_shaders, std::uint32_t* a_totalShaders);
137  HRESULT D3DDisassemble(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, const char* a_comments, ID3DBlob** a_disassembly);
138  HRESULT D3DDisassemble10Effect(ID3D10Effect* a_effect, std::uint32_t a_flags, ID3DBlob** a_disassembly);
139  HRESULT D3DDisassembleRegion(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, const char* a_comments, std::size_t a_startByteOffset, std::size_t a_numInsts, std::size_t* a_finishByteOffset, ID3DBlob** a_disassembly);
140  HRESULT D3DGetBlobPart(const void* a_srcData, std::size_t a_srcDataSize, D3D_BLOB_PART a_partType, std::uint32_t a_flags, ID3DBlob** a_part);
141  HRESULT D3DGetDebugInfo(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_debugInfo);
142  HRESULT D3DGetInputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob);
143  HRESULT D3DGetInputAndOutputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob);
144  HRESULT D3DGetOutputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob);
145  HRESULT D3DGetTraceInstructionOffsets(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, std::size_t a_startInstIndex, std::size_t a_numInsts, std::size_t* a_offsets, std::size_t* a_totalInsts);
146  HRESULT D3DLoadModule(const void* a_srcData, std::size_t a_srcDataSize, ID3D11Module** a_module);
147  HRESULT D3DPreprocess(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, ID3DBlob** a_codeText, ID3DBlob** a_errorMsgs);
148  HRESULT D3DReadFileToBlob(const wchar_t* a_fileName, ID3DBlob** a_contents);
149  HRESULT D3DReflect(const void* a_srcData, std::size_t a_srcDataSize, const IID& a_iid, void** a_reflector);
150  HRESULT D3DReflectLibrary(const void* a_srcData, std::size_t a_srcDataSize, const IID& a_iid, void** a_reflector);
151  HRESULT D3DSetBlobPart(const void* a_srcData, std::size_t a_srcDataSize, D3D_BLOB_PART a_partType, std::uint32_t a_flags, const void* a_part, std::size_t a_partSize, ID3DBlob** a_newShader);
152  HRESULT D3DStripShader(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_stripFlags, ID3DBlob** a_strippedBlob);
153  HRESULT D3DWriteBlobToFile(ID3DBlob* a_blob, const wchar_t* a_fileName, bool a_overwrite);
154 }
Definition: BSDirectInputManager.h:8
HRESULT D3DCreateBlob(std::size_t a_size, ID3DBlob **a_blob)
D3D_DISASM_FLAGS
Definition: D3DCOMPILER.h:39
@ D3D_DISASM_ENABLE_INSTRUCTION_OFFSET
Definition: D3DCOMPILER.h:45
@ D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS
Definition: D3DCOMPILER.h:41
@ D3D_DISASM_INSTRUCTION_ONLY
Definition: D3DCOMPILER.h:46
@ D3D_DISASM_PRINT_HEX_LITERALS
Definition: D3DCOMPILER.h:47
@ D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING
Definition: D3DCOMPILER.h:42
@ D3D_DISASM_ENABLE_INSTRUCTION_CYCLE
Definition: D3DCOMPILER.h:43
@ D3D_DISASM_ENABLE_COLOR_CODE
Definition: D3DCOMPILER.h:40
@ D3D_DISASM_DISABLE_DEBUG_INFO
Definition: D3DCOMPILER.h:44
HRESULT D3DPreprocess(const void *a_srcData, std::size_t a_srcDataSize, const char *a_sourceName, const D3D_SHADER_MACRO *a_defines, ID3DInclude *a_include, ID3DBlob **a_codeText, ID3DBlob **a_errorMsgs)
constexpr auto D3D_GET_INST_OFFSETS_INCLUDE_NON_EXECUTABLE
Definition: D3DCOMPILER.h:124
HRESULT D3DCompile2(const void *a_srcData, std::size_t a_srcDataSize, const char *a_sourceName, const D3D_SHADER_MACRO *a_defines, ID3DInclude *a_include, const char *a_entrypoint, const char *a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, std::uint32_t a_secondaryDataFlags, const void *a_secondaryData, std::size_t a_secondaryDataSize, ID3DBlob **a_code, ID3DBlob **a_errorMsgs)
HRESULT D3DCompileFromFile(const wchar_t *a_fileName, const D3D_SHADER_MACRO *a_defines, ID3DInclude *a_include, const char *a_entrypoint, const char *a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, ID3DBlob **a_code, ID3DBlob **a_errorMsgs)
HRESULT D3DDisassemble(const void *a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, const char *a_comments, ID3DBlob **a_disassembly)
HRESULT D3DReflectLibrary(const void *a_srcData, std::size_t a_srcDataSize, const IID &a_iid, void **a_reflector)
HRESULT D3DDisassemble10Effect(ID3D10Effect *a_effect, std::uint32_t a_flags, ID3DBlob **a_disassembly)
HRESULT D3DCreateFunctionLinkingGraph(std::uint32_t a_flags, ID3D11FunctionLinkingGraph **a_functionLinkingGraph)
HRESULT D3DReadFileToBlob(const wchar_t *a_fileName, ID3DBlob **a_contents)
HRESULT D3DGetTraceInstructionOffsets(const void *a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, std::size_t a_startInstIndex, std::size_t a_numInsts, std::size_t *a_offsets, std::size_t *a_totalInsts)
D3DCOMPILE_FLAGS2
Definition: D3DCOMPILER.h:87
@ D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_1
Definition: D3DCOMPILER.h:90
@ D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_LATEST
Definition: D3DCOMPILER.h:88
@ D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_0
Definition: D3DCOMPILER.h:89
HRESULT D3DDisassembleRegion(const void *a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, const char *a_comments, std::size_t a_startByteOffset, std::size_t a_numInsts, std::size_t *a_finishByteOffset, ID3DBlob **a_disassembly)
HRESULT D3DStripShader(const void *a_srcData, std::size_t a_srcDataSize, std::uint32_t a_stripFlags, ID3DBlob **a_strippedBlob)
HRESULT D3DGetInputAndOutputSignatureBlob(const void *a_srcData, std::size_t a_srcDataSize, ID3DBlob **a_signatureBlob)
constexpr auto D3D_COMPRESS_SHADER_KEEP_ALL_PARTS
Definition: D3DCOMPILER.h:123
HRESULT D3DWriteBlobToFile(ID3DBlob *a_blob, const wchar_t *a_fileName, bool a_overwrite)
HRESULT D3DGetBlobPart(const void *a_srcData, std::size_t a_srcDataSize, D3D_BLOB_PART a_partType, std::uint32_t a_flags, ID3DBlob **a_part)
HRESULT D3DSetBlobPart(const void *a_srcData, std::size_t a_srcDataSize, D3D_BLOB_PART a_partType, std::uint32_t a_flags, const void *a_part, std::size_t a_partSize, ID3DBlob **a_newShader)
HRESULT D3DCreateLinker(ID3D11Linker **a_linker)
HRESULT D3DCompressShaders(std::uint32_t a_numShaders, D3D_SHADER_DATA *a_shaderData, std::uint32_t a_flags, ID3DBlob **a_compressedData)
D3D_BLOB_PART
Definition: D3DCOMPILER.h:18
@ D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB
Definition: D3DCOMPILER.h:22
@ D3D_BLOB_ALL_SIGNATURE_BLOB
Definition: D3DCOMPILER.h:23
@ D3D_BLOB_OUTPUT_SIGNATURE_BLOB
Definition: D3DCOMPILER.h:20
@ D3D_BLOB_XNA_PREPASS_SHADER
Definition: D3DCOMPILER.h:26
@ D3D_BLOB_LEGACY_SHADER
Definition: D3DCOMPILER.h:25
@ D3D_BLOB_XNA_SHADER
Definition: D3DCOMPILER.h:27
@ D3D_BLOB_TEST_COMPILE_DETAILS
Definition: D3DCOMPILER.h:33
@ D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB
Definition: D3DCOMPILER.h:21
@ D3D_BLOB_ROOT_SIGNATURE
Definition: D3DCOMPILER.h:30
@ D3D_BLOB_TEST_ALTERNATE_SHADER
Definition: D3DCOMPILER.h:32
@ D3D_BLOB_INPUT_SIGNATURE_BLOB
Definition: D3DCOMPILER.h:19
@ D3D_BLOB_PDB
Definition: D3DCOMPILER.h:28
@ D3D_BLOB_DEBUG_INFO
Definition: D3DCOMPILER.h:24
@ D3D_BLOB_TEST_COMPILE_REPORT
Definition: D3DCOMPILER.h:35
@ D3D_BLOB_TEST_COMPILE_PERF
Definition: D3DCOMPILER.h:34
@ D3D_BLOB_DEBUG_NAME
Definition: D3DCOMPILER.h:31
@ D3D_BLOB_PRIVATE_DATA
Definition: D3DCOMPILER.h:29
HRESULT D3DReflect(const void *a_srcData, std::size_t a_srcDataSize, const IID &a_iid, void **a_reflector)
D3DCOMPILE_SECDATA_FLAGS
Definition: D3DCOMPILER.h:94
@ D3DCOMPILE_SECDATA_MERGE_UAV_SLOTS
Definition: D3DCOMPILER.h:95
@ D3DCOMPILE_SECDATA_PRESERVE_TEMPLATE_SLOTS
Definition: D3DCOMPILER.h:96
@ D3DCOMPILE_SECDATA_REQUIRE_TEMPLATE_MATCH
Definition: D3DCOMPILER.h:97
const auto D3D_COMPILE_STANDARD_FILE_INCLUDE
Definition: D3DCOMPILER.h:122
HRESULT D3DGetOutputSignatureBlob(const void *a_srcData, std::size_t a_srcDataSize, ID3DBlob **a_signatureBlob)
D3DCOMPILE_EFFECT
Definition: D3DCOMPILER.h:51
@ D3DCOMPILE_EFFECT_CHILD_EFFECT
Definition: D3DCOMPILER.h:52
@ D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS
Definition: D3DCOMPILER.h:53
HRESULT D3DLoadModule(const void *a_srcData, std::size_t a_srcDataSize, ID3D11Module **a_module)
D3DCOMPILER_STRIP_FLAGS
Definition: D3DCOMPILER.h:101
@ D3DCOMPILER_STRIP_FORCE_DWORD
Definition: D3DCOMPILER.h:107
@ D3DCOMPILER_STRIP_REFLECTION_DATA
Definition: D3DCOMPILER.h:102
@ D3DCOMPILER_STRIP_ROOT_SIGNATURE
Definition: D3DCOMPILER.h:106
@ D3DCOMPILER_STRIP_PRIVATE_DATA
Definition: D3DCOMPILER.h:105
@ D3DCOMPILER_STRIP_DEBUG_INFO
Definition: D3DCOMPILER.h:103
@ D3DCOMPILER_STRIP_TEST_BLOBS
Definition: D3DCOMPILER.h:104
HRESULT D3DGetInputSignatureBlob(const void *a_srcData, std::size_t a_srcDataSize, ID3DBlob **a_signatureBlob)
HRESULT D3DDecompressShaders(const void *a_srcData, std::size_t a_srcDataSize, std::uint32_t a_numShaders, std::uint32_t a_startIndex, std::uint32_t *a_indices, std::uint32_t a_flags, ID3DBlob **a_shaders, std::uint32_t *a_totalShaders)
std::int32_t HRESULT
Definition: BASE.h:28
HRESULT D3DCompile(const void *a_srcData, std::size_t a_srcDataSize, const char *a_sourceName, const D3D_SHADER_MACRO *a_defines, ID3DInclude *a_include, const char *a_entrypoint, const char *a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, ID3DBlob **a_code, ID3DBlob **a_errorMsgs)
HRESULT D3DGetDebugInfo(const void *a_srcData, std::size_t a_srcDataSize, ID3DBlob **a_debugInfo)
D3DCOMPILE_FLAGS
Definition: D3DCOMPILER.h:57
@ D3DCOMPILE_PARTIAL_PRECISION
Definition: D3DCOMPILER.h:63
@ D3DCOMPILE_AVOID_FLOW_CONTROL
Definition: D3DCOMPILER.h:67
@ D3DCOMPILE_DEBUG
Definition: D3DCOMPILER.h:58
@ D3DCOMPILE_PREFER_FLOW_CONTROL
Definition: D3DCOMPILER.h:68
@ D3DCOMPILE_RESOURCES_MAY_ALIAS
Definition: D3DCOMPILER.h:79
@ D3DCOMPILE_RESERVED17
Definition: D3DCOMPILER.h:77
@ D3DCOMPILE_OPTIMIZATION_LEVEL0
Definition: D3DCOMPILER.h:72
@ D3DCOMPILE_DEBUG_NAME_FOR_BINARY
Definition: D3DCOMPILER.h:83
@ D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY
Definition: D3DCOMPILER.h:70
@ D3DCOMPILE_ENABLE_STRICTNESS
Definition: D3DCOMPILER.h:69
@ D3DCOMPILE_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES
Definition: D3DCOMPILER.h:80
@ D3DCOMPILE_ALL_RESOURCES_BOUND
Definition: D3DCOMPILER.h:81
@ D3DCOMPILE_SKIP_OPTIMIZATION
Definition: D3DCOMPILER.h:60
@ D3DCOMPILE_RESERVED16
Definition: D3DCOMPILER.h:76
@ D3DCOMPILE_OPTIMIZATION_LEVEL1
Definition: D3DCOMPILER.h:73
@ D3DCOMPILE_SKIP_VALIDATION
Definition: D3DCOMPILER.h:59
@ D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR
Definition: D3DCOMPILER.h:62
@ D3DCOMPILE_NO_PRESHADER
Definition: D3DCOMPILER.h:66
@ D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT
Definition: D3DCOMPILER.h:64
@ D3DCOMPILE_WARNINGS_ARE_ERRORS
Definition: D3DCOMPILER.h:78
@ D3DCOMPILE_OPTIMIZATION_LEVEL3
Definition: D3DCOMPILER.h:75
@ D3DCOMPILE_OPTIMIZATION_LEVEL2
Definition: D3DCOMPILER.h:74
@ D3DCOMPILE_IEEE_STRICTNESS
Definition: D3DCOMPILER.h:71
@ D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT
Definition: D3DCOMPILER.h:65
@ D3DCOMPILE_PACK_MATRIX_ROW_MAJOR
Definition: D3DCOMPILER.h:61
@ D3DCOMPILE_DEBUG_NAME_FOR_SOURCE
Definition: D3DCOMPILER.h:82
Definition: D3DCOMPILER.h:114
std::size_t bytecodeLength
Definition: D3DCOMPILER.h:116
const void * bytecode
Definition: D3DCOMPILER.h:115
Definition: D3D.h:691
Definition: BASE.h:62