d3dcompiler.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. #include <_mingw_unicode.h>
  2. /*
  3. * Copyright 2010 Matteo Bruni for CodeWeavers
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2.1 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  18. */
  19. #ifndef __D3DCOMPILER_H__
  20. #define __D3DCOMPILER_H__
  21. #include "d3d11shader.h"
  22. #include "d3d12shader.h"
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. #if defined(_MSC_VER) || defined(__MINGW32__)
  27. #define D3DCOMPILER_DLL_W L"d3dcompiler_47.dll"
  28. #else
  29. static const WCHAR D3DCOMPILER_DLL_W[] = {'d','3','d','c','o','m','p','i','l','e','r','_','4','7','.','d','l','l',0};
  30. #endif
  31. #define D3DCOMPILER_DLL_A "d3dcompiler_47.dll"
  32. #define D3DCOMPILER_DLL __MINGW_NAME_AW(D3DCOMPILER_DLL_)
  33. #ifndef D3D_COMPILER_VERSION
  34. #define D3D_COMPILER_VERSION 47
  35. #endif
  36. #define D3DCOMPILE_DEBUG 0x00000001
  37. #define D3DCOMPILE_SKIP_VALIDATION 0x00000002
  38. #define D3DCOMPILE_SKIP_OPTIMIZATION 0x00000004
  39. #define D3DCOMPILE_PACK_MATRIX_ROW_MAJOR 0x00000008
  40. #define D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR 0x00000010
  41. #define D3DCOMPILE_PARTIAL_PRECISION 0x00000020
  42. #define D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT 0x00000040
  43. #define D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT 0x00000080
  44. #define D3DCOMPILE_NO_PRESHADER 0x00000100
  45. #define D3DCOMPILE_AVOID_FLOW_CONTROL 0x00000200
  46. #define D3DCOMPILE_PREFER_FLOW_CONTROL 0x00000400
  47. #define D3DCOMPILE_ENABLE_STRICTNESS 0x00000800
  48. #define D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY 0x00001000
  49. #define D3DCOMPILE_IEEE_STRICTNESS 0x00002000
  50. #define D3DCOMPILE_OPTIMIZATION_LEVEL0 0x00004000
  51. #define D3DCOMPILE_OPTIMIZATION_LEVEL1 0x00000000
  52. #define D3DCOMPILE_OPTIMIZATION_LEVEL2 0x0000c000
  53. #define D3DCOMPILE_OPTIMIZATION_LEVEL3 0x00008000
  54. #define D3DCOMPILE_RESERVED16 0x00010000
  55. #define D3DCOMPILE_RESERVED17 0x00020000
  56. #define D3DCOMPILE_WARNINGS_ARE_ERRORS 0x00040000
  57. #define D3DCOMPILE_RESOURCES_MAY_ALIAS 0x00080000
  58. #define D3DCOMPILE_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES 0x00100000
  59. #define D3DCOMPILE_ALL_RESOURCES_BOUND 0x00200000
  60. #define D3DCOMPILE_DEBUG_NAME_FOR_SOURCE 0x00400000
  61. #define D3DCOMPILE_DEBUG_NAME_FOR_BINARY 0x00800000
  62. #define D3DCOMPILE_EFFECT_CHILD_EFFECT 0x00000001
  63. #define D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS 0x00000002
  64. #define D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_LATEST 0x00000000
  65. #define D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_0 0x00000010
  66. #define D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_1 0x00000020
  67. #define D3D_DISASM_ENABLE_COLOR_CODE 0x00000001
  68. #define D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS 0x00000002
  69. #define D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING 0x00000004
  70. #define D3D_DISASM_ENABLE_INSTRUCTION_CYCLE 0x00000008
  71. #define D3D_DISASM_DISABLE_DEBUG_INFO 0x00000010
  72. #define D3D_DISASM_ENABLE_INSTRUCTION_OFFSET 0x00000020
  73. #define D3D_DISASM_INSTRUCTION_ONLY 0x00000040
  74. #define D3D_DISASM_PRINT_HEX_LITERALS 0x00000080
  75. #define D3D_COMPILE_STANDARD_FILE_INCLUDE ((ID3DInclude *)(UINT_PTR)1)
  76. HRESULT WINAPI D3DCompile(const void *data, SIZE_T data_size, const char *filename,
  77. const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint,
  78. const char *target, UINT sflags, UINT eflags, ID3DBlob **shader, ID3DBlob **error_messages);
  79. typedef HRESULT (WINAPI *pD3DCompile)(const void *data, SIZE_T data_size, const char *filename,
  80. const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint,
  81. const char *target, UINT sflags, UINT eflags, ID3DBlob **shader, ID3DBlob **error_messages);
  82. HRESULT WINAPI D3DCompile2(const void *data, SIZE_T data_size, const char *filename,
  83. const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint,
  84. const char *target, UINT sflags, UINT eflags, UINT secondary_flags,
  85. const void *secondary_data, SIZE_T secondary_data_size, ID3DBlob **shader,
  86. ID3DBlob **error_messages);
  87. typedef enum D3DCOMPILER_STRIP_FLAGS
  88. {
  89. D3DCOMPILER_STRIP_REFLECTION_DATA = 0x1,
  90. D3DCOMPILER_STRIP_DEBUG_INFO = 0x2,
  91. D3DCOMPILER_STRIP_TEST_BLOBS = 0x4,
  92. D3DCOMPILER_STRIP_PRIVATE_DATA = 0x8,
  93. D3DCOMPILER_STRIP_ROOT_SIGNATURE = 0x10,
  94. D3DCOMPILER_STRIP_FORCE_DWORD = 0x7fffffff
  95. } D3DCOMPILER_STRIP_FLAGS;
  96. HRESULT WINAPI D3DStripShader(const void *data, SIZE_T data_size, UINT flags, ID3DBlob **blob);
  97. typedef enum D3D_BLOB_PART
  98. {
  99. D3D_BLOB_INPUT_SIGNATURE_BLOB,
  100. D3D_BLOB_OUTPUT_SIGNATURE_BLOB,
  101. D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB,
  102. D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB,
  103. D3D_BLOB_ALL_SIGNATURE_BLOB,
  104. D3D_BLOB_DEBUG_INFO,
  105. D3D_BLOB_LEGACY_SHADER,
  106. D3D_BLOB_XNA_PREPASS_SHADER,
  107. D3D_BLOB_XNA_SHADER,
  108. D3D_BLOB_PDB,
  109. D3D_BLOB_PRIVATE_DATA,
  110. D3D_BLOB_ROOT_SIGNATURE,
  111. D3D_BLOB_DEBUG_NAME,
  112. D3D_BLOB_TEST_ALTERNATE_SHADER = 0x8000,
  113. D3D_BLOB_TEST_COMPILE_DETAILS,
  114. D3D_BLOB_TEST_COMPILE_PERF,
  115. D3D_BLOB_TEST_COMPILE_REPORT
  116. } D3D_BLOB_PART;
  117. HRESULT WINAPI D3DDisassemble(const void *data, SIZE_T data_size,
  118. UINT flags, const char *comments, ID3DBlob **disassembly);
  119. typedef HRESULT (WINAPI *pD3DDisassemble)(const void *data, SIZE_T data_size,
  120. UINT flags, const char *comments, ID3DBlob **disassembly);
  121. HRESULT WINAPI D3DCompileFromFile(const WCHAR *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *includes,
  122. const char *entrypoint, const char *target, UINT flags1, UINT flags2, ID3DBlob **code, ID3DBlob **errors);
  123. HRESULT WINAPI D3DGetBlobPart(const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob);
  124. HRESULT WINAPI D3DGetInputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob);
  125. HRESULT WINAPI D3DGetOutputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob);
  126. HRESULT WINAPI D3DGetInputAndOutputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob);
  127. HRESULT WINAPI D3DGetDebugInfo(const void *data, SIZE_T data_size, ID3DBlob **blob);
  128. HRESULT WINAPI D3DReadFileToBlob(const WCHAR *filename, ID3DBlob **contents);
  129. HRESULT WINAPI D3DWriteBlobToFile(ID3DBlob *blob, const WCHAR *filename, WINBOOL overwrite);
  130. HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void **reflector);
  131. HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3DBlob **blob);
  132. HRESULT WINAPI D3DPreprocess(const void *data, SIZE_T size, const char *filename,
  133. const D3D_SHADER_MACRO *defines, ID3DInclude *include,
  134. ID3DBlob **shader, ID3DBlob **error_messages);
  135. typedef HRESULT (WINAPI *pD3DPreprocess)(const void *data, SIZE_T size, const char *filename,
  136. const D3D_SHADER_MACRO *defines, ID3DInclude *include,
  137. ID3DBlob **shader, ID3DBlob **error_messages);
  138. HRESULT WINAPI D3DLoadModule(const void *data, SIZE_T size, ID3D11Module **module);
  139. #ifdef __cplusplus
  140. }
  141. #endif
  142. #endif