d3d10shader.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) Microsoft Corporation. All rights reserved.
  4. //
  5. // File: D3D10Shader.h
  6. // Content: D3D10 Shader Types and APIs
  7. //
  8. //////////////////////////////////////////////////////////////////////////////
  9. #ifndef __D3D10SHADER_H__
  10. #define __D3D10SHADER_H__
  11. #include "d3d10.h"
  12. #include <winapifamily.h>
  13. #pragma region Desktop Family
  14. #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  15. //---------------------------------------------------------------------------
  16. // D3D10_TX_VERSION:
  17. // --------------
  18. // Version token used to create a procedural texture filler in effects
  19. // Used by D3D10Fill[]TX functions
  20. //---------------------------------------------------------------------------
  21. #define D3D10_TX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor))
  22. //----------------------------------------------------------------------------
  23. // D3D10SHADER flags:
  24. // -----------------
  25. // D3D10_SHADER_DEBUG
  26. // Insert debug file/line/type/symbol information.
  27. //
  28. // D3D10_SHADER_SKIP_VALIDATION
  29. // Do not validate the generated code against known capabilities and
  30. // constraints. This option is only recommended when compiling shaders
  31. // you KNOW will work. (ie. have compiled before without this option.)
  32. // Shaders are always validated by D3D before they are set to the device.
  33. //
  34. // D3D10_SHADER_SKIP_OPTIMIZATION
  35. // Instructs the compiler to skip optimization steps during code generation.
  36. // Unless you are trying to isolate a problem in your code using this option
  37. // is not recommended.
  38. //
  39. // D3D10_SHADER_PACK_MATRIX_ROW_MAJOR
  40. // Unless explicitly specified, matrices will be packed in row-major order
  41. // on input and output from the shader.
  42. //
  43. // D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR
  44. // Unless explicitly specified, matrices will be packed in column-major
  45. // order on input and output from the shader. This is generally more
  46. // efficient, since it allows vector-matrix multiplication to be performed
  47. // using a series of dot-products.
  48. //
  49. // D3D10_SHADER_PARTIAL_PRECISION
  50. // Force all computations in resulting shader to occur at partial precision.
  51. // This may result in faster evaluation of shaders on some hardware.
  52. //
  53. // D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT
  54. // Force compiler to compile against the next highest available software
  55. // target for vertex shaders. This flag also turns optimizations off,
  56. // and debugging on.
  57. //
  58. // D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT
  59. // Force compiler to compile against the next highest available software
  60. // target for pixel shaders. This flag also turns optimizations off,
  61. // and debugging on.
  62. //
  63. // D3D10_SHADER_NO_PRESHADER
  64. // Disables Preshaders. Using this flag will cause the compiler to not
  65. // pull out static expression for evaluation on the host cpu
  66. //
  67. // D3D10_SHADER_AVOID_FLOW_CONTROL
  68. // Hint compiler to avoid flow-control constructs where possible.
  69. //
  70. // D3D10_SHADER_PREFER_FLOW_CONTROL
  71. // Hint compiler to prefer flow-control constructs where possible.
  72. //
  73. // D3D10_SHADER_ENABLE_STRICTNESS
  74. // By default, the HLSL/Effect compilers are not strict on deprecated syntax.
  75. // Specifying this flag enables the strict mode. Deprecated syntax may be
  76. // removed in a future release, and enabling syntax is a good way to make sure
  77. // your shaders comply to the latest spec.
  78. //
  79. // D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY
  80. // This enables older shaders to compile to 4_0 targets.
  81. //
  82. //----------------------------------------------------------------------------
  83. #define D3D10_SHADER_DEBUG (1 << 0)
  84. #define D3D10_SHADER_SKIP_VALIDATION (1 << 1)
  85. #define D3D10_SHADER_SKIP_OPTIMIZATION (1 << 2)
  86. #define D3D10_SHADER_PACK_MATRIX_ROW_MAJOR (1 << 3)
  87. #define D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR (1 << 4)
  88. #define D3D10_SHADER_PARTIAL_PRECISION (1 << 5)
  89. #define D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT (1 << 6)
  90. #define D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT (1 << 7)
  91. #define D3D10_SHADER_NO_PRESHADER (1 << 8)
  92. #define D3D10_SHADER_AVOID_FLOW_CONTROL (1 << 9)
  93. #define D3D10_SHADER_PREFER_FLOW_CONTROL (1 << 10)
  94. #define D3D10_SHADER_ENABLE_STRICTNESS (1 << 11)
  95. #define D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY (1 << 12)
  96. #define D3D10_SHADER_IEEE_STRICTNESS (1 << 13)
  97. #define D3D10_SHADER_WARNINGS_ARE_ERRORS (1 << 18)
  98. #define D3D10_SHADER_RESOURCES_MAY_ALIAS (1 << 19)
  99. #define D3D10_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES (1 << 20)
  100. #define D3D10_ALL_RESOURCES_BOUND (1 << 21)
  101. // optimization level flags
  102. #define D3D10_SHADER_OPTIMIZATION_LEVEL0 (1 << 14)
  103. #define D3D10_SHADER_OPTIMIZATION_LEVEL1 0
  104. #define D3D10_SHADER_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15))
  105. #define D3D10_SHADER_OPTIMIZATION_LEVEL3 (1 << 15)
  106. // Force root signature flags. (Passed in Flags2)
  107. #define D3D10_SHADER_FLAGS2_FORCE_ROOT_SIGNATURE_LATEST 0
  108. #define D3D10_SHADER_FLAGS2_FORCE_ROOT_SIGNATURE_1_0 (1 << 4)
  109. #define D3D10_SHADER_FLAGS2_FORCE_ROOT_SIGNATURE_1_1 (1 << 5)
  110. typedef D3D_SHADER_MACRO D3D10_SHADER_MACRO;
  111. typedef D3D10_SHADER_MACRO* LPD3D10_SHADER_MACRO;
  112. typedef D3D_SHADER_VARIABLE_CLASS D3D10_SHADER_VARIABLE_CLASS;
  113. typedef D3D10_SHADER_VARIABLE_CLASS* LPD3D10_SHADER_VARIABLE_CLASS;
  114. typedef D3D_SHADER_VARIABLE_FLAGS D3D10_SHADER_VARIABLE_FLAGS;
  115. typedef D3D10_SHADER_VARIABLE_FLAGS* LPD3D10_SHADER_VARIABLE_FLAGS;
  116. typedef D3D_SHADER_VARIABLE_TYPE D3D10_SHADER_VARIABLE_TYPE;
  117. typedef D3D10_SHADER_VARIABLE_TYPE* LPD3D10_SHADER_VARIABLE_TYPE;
  118. typedef D3D_SHADER_INPUT_FLAGS D3D10_SHADER_INPUT_FLAGS;
  119. typedef D3D10_SHADER_INPUT_FLAGS* LPD3D10_SHADER_INPUT_FLAGS;
  120. typedef D3D_SHADER_INPUT_TYPE D3D10_SHADER_INPUT_TYPE;
  121. typedef D3D10_SHADER_INPUT_TYPE* LPD3D10_SHADER_INPUT_TYPE;
  122. typedef D3D_SHADER_CBUFFER_FLAGS D3D10_SHADER_CBUFFER_FLAGS;
  123. typedef D3D10_SHADER_CBUFFER_FLAGS* LPD3D10_SHADER_CBUFFER_FLAGS;
  124. typedef D3D_CBUFFER_TYPE D3D10_CBUFFER_TYPE;
  125. typedef D3D10_CBUFFER_TYPE* LPD3D10_CBUFFER_TYPE;
  126. typedef D3D_NAME D3D10_NAME;
  127. typedef D3D_RESOURCE_RETURN_TYPE D3D10_RESOURCE_RETURN_TYPE;
  128. typedef D3D_REGISTER_COMPONENT_TYPE D3D10_REGISTER_COMPONENT_TYPE;
  129. typedef D3D_INCLUDE_TYPE D3D10_INCLUDE_TYPE;
  130. // ID3D10Include has been made version-neutral and moved to d3dcommon.h.
  131. typedef interface ID3DInclude ID3D10Include;
  132. typedef interface ID3DInclude* LPD3D10INCLUDE;
  133. #define IID_ID3D10Include IID_ID3DInclude
  134. //----------------------------------------------------------------------------
  135. // ID3D10ShaderReflection:
  136. //----------------------------------------------------------------------------
  137. //
  138. // Structure definitions
  139. //
  140. typedef struct _D3D10_SHADER_DESC
  141. {
  142. UINT Version; // Shader version
  143. LPCSTR Creator; // Creator string
  144. UINT Flags; // Shader compilation/parse flags
  145. UINT ConstantBuffers; // Number of constant buffers
  146. UINT BoundResources; // Number of bound resources
  147. UINT InputParameters; // Number of parameters in the input signature
  148. UINT OutputParameters; // Number of parameters in the output signature
  149. UINT InstructionCount; // Number of emitted instructions
  150. UINT TempRegisterCount; // Number of temporary registers used
  151. UINT TempArrayCount; // Number of temporary arrays used
  152. UINT DefCount; // Number of constant defines
  153. UINT DclCount; // Number of declarations (input + output)
  154. UINT TextureNormalInstructions; // Number of non-categorized texture instructions
  155. UINT TextureLoadInstructions; // Number of texture load instructions
  156. UINT TextureCompInstructions; // Number of texture comparison instructions
  157. UINT TextureBiasInstructions; // Number of texture bias instructions
  158. UINT TextureGradientInstructions; // Number of texture gradient instructions
  159. UINT FloatInstructionCount; // Number of floating point arithmetic instructions used
  160. UINT IntInstructionCount; // Number of signed integer arithmetic instructions used
  161. UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used
  162. UINT StaticFlowControlCount; // Number of static flow control instructions used
  163. UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used
  164. UINT MacroInstructionCount; // Number of macro instructions used
  165. UINT ArrayInstructionCount; // Number of array instructions used
  166. UINT CutInstructionCount; // Number of cut instructions used
  167. UINT EmitInstructionCount; // Number of emit instructions used
  168. D3D10_PRIMITIVE_TOPOLOGY GSOutputTopology; // Geometry shader output topology
  169. UINT GSMaxOutputVertexCount; // Geometry shader maximum output vertex count
  170. } D3D10_SHADER_DESC;
  171. typedef struct _D3D10_SHADER_BUFFER_DESC
  172. {
  173. LPCSTR Name; // Name of the constant buffer
  174. D3D10_CBUFFER_TYPE Type; // Indicates that this is a CBuffer or TBuffer
  175. UINT Variables; // Number of member variables
  176. UINT Size; // Size of CB (in bytes)
  177. UINT uFlags; // Buffer description flags
  178. } D3D10_SHADER_BUFFER_DESC;
  179. typedef struct _D3D10_SHADER_VARIABLE_DESC
  180. {
  181. LPCSTR Name; // Name of the variable
  182. UINT StartOffset; // Offset in constant buffer's backing store
  183. UINT Size; // Size of variable (in bytes)
  184. UINT uFlags; // Variable flags
  185. LPVOID DefaultValue; // Raw pointer to default value
  186. } D3D10_SHADER_VARIABLE_DESC;
  187. typedef struct _D3D10_SHADER_TYPE_DESC
  188. {
  189. D3D10_SHADER_VARIABLE_CLASS Class; // Variable class (e.g. object, matrix, etc.)
  190. D3D10_SHADER_VARIABLE_TYPE Type; // Variable type (e.g. float, sampler, etc.)
  191. UINT Rows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable)
  192. UINT Columns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable)
  193. UINT Elements; // Number of elements (0 if not an array)
  194. UINT Members; // Number of members (0 if not a structure)
  195. UINT Offset; // Offset from the start of structure (0 if not a structure member)
  196. } D3D10_SHADER_TYPE_DESC;
  197. typedef struct _D3D10_SHADER_INPUT_BIND_DESC
  198. {
  199. LPCSTR Name; // Name of the resource
  200. D3D10_SHADER_INPUT_TYPE Type; // Type of resource (e.g. texture, cbuffer, etc.)
  201. UINT BindPoint; // Starting bind point
  202. UINT BindCount; // Number of contiguous bind points (for arrays)
  203. UINT uFlags; // Input binding flags
  204. D3D10_RESOURCE_RETURN_TYPE ReturnType; // Return type (if texture)
  205. D3D10_SRV_DIMENSION Dimension; // Dimension (if texture)
  206. UINT NumSamples; // Number of samples (0 if not MS texture)
  207. } D3D10_SHADER_INPUT_BIND_DESC;
  208. typedef struct _D3D10_SIGNATURE_PARAMETER_DESC
  209. {
  210. LPCSTR SemanticName; // Name of the semantic
  211. UINT SemanticIndex; // Index of the semantic
  212. UINT Register; // Number of member variables
  213. D3D10_NAME SystemValueType;// A predefined system value, or D3D10_NAME_UNDEFINED if not applicable
  214. D3D10_REGISTER_COMPONENT_TYPE ComponentType;// Scalar type (e.g. uint, float, etc.)
  215. BYTE Mask; // Mask to indicate which components of the register
  216. // are used (combination of D3D10_COMPONENT_MASK values)
  217. BYTE ReadWriteMask; // Mask to indicate whether a given component is
  218. // never written (if this is an output signature) or
  219. // always read (if this is an input signature).
  220. // (combination of D3D10_COMPONENT_MASK values)
  221. } D3D10_SIGNATURE_PARAMETER_DESC;
  222. //
  223. // Interface definitions
  224. //
  225. typedef interface ID3D10ShaderReflectionType ID3D10ShaderReflectionType;
  226. typedef interface ID3D10ShaderReflectionType *LPD3D10SHADERREFLECTIONTYPE;
  227. // {C530AD7D-9B16-4395-A979-BA2ECFF83ADD}
  228. interface DECLSPEC_UUID("C530AD7D-9B16-4395-A979-BA2ECFF83ADD") ID3D10ShaderReflectionType;
  229. DEFINE_GUID(IID_ID3D10ShaderReflectionType,
  230. 0xc530ad7d, 0x9b16, 0x4395, 0xa9, 0x79, 0xba, 0x2e, 0xcf, 0xf8, 0x3a, 0xdd);
  231. #undef INTERFACE
  232. #define INTERFACE ID3D10ShaderReflectionType
  233. DECLARE_INTERFACE(ID3D10ShaderReflectionType)
  234. {
  235. STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_TYPE_DESC *pDesc) PURE;
  236. STDMETHOD_(ID3D10ShaderReflectionType*, GetMemberTypeByIndex)(THIS_ UINT Index) PURE;
  237. STDMETHOD_(ID3D10ShaderReflectionType*, GetMemberTypeByName)(THIS_ LPCSTR Name) PURE;
  238. STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ UINT Index) PURE;
  239. };
  240. typedef interface ID3D10ShaderReflectionVariable ID3D10ShaderReflectionVariable;
  241. typedef interface ID3D10ShaderReflectionVariable *LPD3D10SHADERREFLECTIONVARIABLE;
  242. // {1BF63C95-2650-405d-99C1-3636BD1DA0A1}
  243. interface DECLSPEC_UUID("1BF63C95-2650-405d-99C1-3636BD1DA0A1") ID3D10ShaderReflectionVariable;
  244. DEFINE_GUID(IID_ID3D10ShaderReflectionVariable,
  245. 0x1bf63c95, 0x2650, 0x405d, 0x99, 0xc1, 0x36, 0x36, 0xbd, 0x1d, 0xa0, 0xa1);
  246. #undef INTERFACE
  247. #define INTERFACE ID3D10ShaderReflectionVariable
  248. DECLARE_INTERFACE(ID3D10ShaderReflectionVariable)
  249. {
  250. STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_SHADER_VARIABLE_DESC *pDesc) PURE;
  251. STDMETHOD_(ID3D10ShaderReflectionType*, GetType)(THIS) PURE;
  252. };
  253. typedef interface ID3D10ShaderReflectionConstantBuffer ID3D10ShaderReflectionConstantBuffer;
  254. typedef interface ID3D10ShaderReflectionConstantBuffer *LPD3D10SHADERREFLECTIONCONSTANTBUFFER;
  255. // {66C66A94-DDDD-4b62-A66A-F0DA33C2B4D0}
  256. interface DECLSPEC_UUID("66C66A94-DDDD-4b62-A66A-F0DA33C2B4D0") ID3D10ShaderReflectionConstantBuffer;
  257. DEFINE_GUID(IID_ID3D10ShaderReflectionConstantBuffer,
  258. 0x66c66a94, 0xdddd, 0x4b62, 0xa6, 0x6a, 0xf0, 0xda, 0x33, 0xc2, 0xb4, 0xd0);
  259. #undef INTERFACE
  260. #define INTERFACE ID3D10ShaderReflectionConstantBuffer
  261. DECLARE_INTERFACE(ID3D10ShaderReflectionConstantBuffer)
  262. {
  263. STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_SHADER_BUFFER_DESC *pDesc) PURE;
  264. STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByIndex)(THIS_ UINT Index) PURE;
  265. STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE;
  266. };
  267. typedef interface ID3D10ShaderReflection ID3D10ShaderReflection;
  268. typedef interface ID3D10ShaderReflection *LPD3D10SHADERREFLECTION;
  269. // {D40E20B6-F8F7-42ad-AB20-4BAF8F15DFAA}
  270. interface DECLSPEC_UUID("D40E20B6-F8F7-42ad-AB20-4BAF8F15DFAA") ID3D10ShaderReflection;
  271. DEFINE_GUID(IID_ID3D10ShaderReflection,
  272. 0xd40e20b6, 0xf8f7, 0x42ad, 0xab, 0x20, 0x4b, 0xaf, 0x8f, 0x15, 0xdf, 0xaa);
  273. #undef INTERFACE
  274. #define INTERFACE ID3D10ShaderReflection
  275. DECLARE_INTERFACE_(ID3D10ShaderReflection, IUnknown)
  276. {
  277. STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  278. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  279. STDMETHOD_(ULONG, Release)(THIS) PURE;
  280. STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_SHADER_DESC *pDesc) PURE;
  281. STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE;
  282. STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE;
  283. STDMETHOD(GetResourceBindingDesc)(THIS_ UINT ResourceIndex, _Out_ D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE;
  284. STDMETHOD(GetInputParameterDesc)(THIS_ UINT ParameterIndex, _Out_ D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
  285. STDMETHOD(GetOutputParameterDesc)(THIS_ UINT ParameterIndex, _Out_ D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
  286. };
  287. //////////////////////////////////////////////////////////////////////////////
  288. // APIs //////////////////////////////////////////////////////////////////////
  289. //////////////////////////////////////////////////////////////////////////////
  290. #ifdef __cplusplus
  291. extern "C" {
  292. #endif //__cplusplus
  293. //----------------------------------------------------------------------------
  294. // D3D10CompileShader:
  295. // ------------------
  296. // Compiles a shader.
  297. //
  298. // Parameters:
  299. // pSrcFile
  300. // Source file name.
  301. // hSrcModule
  302. // Module handle. if NULL, current module will be used.
  303. // pSrcResource
  304. // Resource name in module.
  305. // pSrcData
  306. // Pointer to source code.
  307. // SrcDataSize
  308. // Size of source code, in bytes.
  309. // pDefines
  310. // Optional NULL-terminated array of preprocessor macro definitions.
  311. // pInclude
  312. // Optional interface pointer to use for handling #include directives.
  313. // If this parameter is NULL, #includes will be honored when compiling
  314. // from file, and will error when compiling from resource or memory.
  315. // pFunctionName
  316. // Name of the entrypoint function where execution should begin.
  317. // pProfile
  318. // Instruction set to be used when generating code. The D3D10 entry
  319. // point currently supports only "vs_4_0", "ps_4_0", and "gs_4_0".
  320. // Flags
  321. // See D3D10_SHADER_xxx flags.
  322. // ppShader
  323. // Returns a buffer containing the created shader. This buffer contains
  324. // the compiled shader code, as well as any embedded debug and symbol
  325. // table info. (See D3D10GetShaderConstantTable)
  326. // ppErrorMsgs
  327. // Returns a buffer containing a listing of errors and warnings that were
  328. // encountered during the compile. If you are running in a debugger,
  329. // these are the same messages you will see in your debug output.
  330. //----------------------------------------------------------------------------
  331. HRESULT WINAPI D3D10CompileShader(_In_reads_bytes_(SrcDataSize) LPCSTR pSrcData, SIZE_T SrcDataSize, _In_opt_ LPCSTR pFileName, _In_opt_ CONST D3D10_SHADER_MACRO* pDefines, _In_opt_ LPD3D10INCLUDE pInclude,
  332. LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags, _Out_ ID3D10Blob** ppShader, _Out_opt_ ID3D10Blob** ppErrorMsgs);
  333. //----------------------------------------------------------------------------
  334. // D3D10DisassembleShader:
  335. // ----------------------
  336. // Takes a binary shader, and returns a buffer containing text assembly.
  337. //
  338. // Parameters:
  339. // pShader
  340. // Pointer to the shader byte code.
  341. // BytecodeLength
  342. // Size of the shader byte code in bytes.
  343. // EnableColorCode
  344. // Emit HTML tags for color coding the output?
  345. // pComments
  346. // Pointer to a comment string to include at the top of the shader.
  347. // ppDisassembly
  348. // Returns a buffer containing the disassembled shader.
  349. //----------------------------------------------------------------------------
  350. HRESULT WINAPI D3D10DisassembleShader(_In_reads_bytes_(BytecodeLength) CONST void *pShader, SIZE_T BytecodeLength, BOOL EnableColorCode, _In_opt_ LPCSTR pComments, _Out_ ID3D10Blob** ppDisassembly);
  351. //----------------------------------------------------------------------------
  352. // D3D10GetPixelShaderProfile/D3D10GetVertexShaderProfile/D3D10GetGeometryShaderProfile:
  353. // -----------------------------------------------------
  354. // Returns the name of the HLSL profile best suited to a given device.
  355. //
  356. // Parameters:
  357. // pDevice
  358. // Pointer to the device in question
  359. //----------------------------------------------------------------------------
  360. LPCSTR WINAPI D3D10GetPixelShaderProfile(_In_ ID3D10Device *pDevice);
  361. LPCSTR WINAPI D3D10GetVertexShaderProfile(_In_ ID3D10Device *pDevice);
  362. LPCSTR WINAPI D3D10GetGeometryShaderProfile(_In_ ID3D10Device *pDevice);
  363. //----------------------------------------------------------------------------
  364. // D3D10ReflectShader:
  365. // ------------------
  366. // Creates a shader reflection object that can be used to retrieve information
  367. // about a compiled shader
  368. //
  369. // Parameters:
  370. // pShaderBytecode
  371. // Pointer to a compiled shader (same pointer that is passed into
  372. // ID3D10Device::CreateShader)
  373. // BytecodeLength
  374. // Length of the shader bytecode buffer
  375. // ppReflector
  376. // [out] Returns a ID3D10ShaderReflection object that can be used to
  377. // retrieve shader resource and constant buffer information
  378. //
  379. //----------------------------------------------------------------------------
  380. HRESULT WINAPI D3D10ReflectShader(_In_reads_bytes_(BytecodeLength) CONST void *pShaderBytecode, SIZE_T BytecodeLength, _Out_ ID3D10ShaderReflection **ppReflector);
  381. //----------------------------------------------------------------------------
  382. // D3D10PreprocessShader
  383. // ---------------------
  384. // Creates a shader reflection object that can be used to retrieve information
  385. // about a compiled shader
  386. //
  387. // Parameters:
  388. // pSrcData
  389. // Pointer to source code
  390. // SrcDataSize
  391. // Size of source code, in bytes
  392. // pFileName
  393. // Source file name (used for error output)
  394. // pDefines
  395. // Optional NULL-terminated array of preprocessor macro definitions.
  396. // pInclude
  397. // Optional interface pointer to use for handling #include directives.
  398. // If this parameter is NULL, #includes will be honored when assembling
  399. // from file, and will error when assembling from resource or memory.
  400. // ppShaderText
  401. // Returns a buffer containing a single large string that represents
  402. // the resulting formatted token stream
  403. // ppErrorMsgs
  404. // Returns a buffer containing a listing of errors and warnings that were
  405. // encountered during assembly. If you are running in a debugger,
  406. // these are the same messages you will see in your debug output.
  407. //----------------------------------------------------------------------------
  408. HRESULT WINAPI D3D10PreprocessShader(_In_reads_bytes_(SrcDataSize) LPCSTR pSrcData, SIZE_T SrcDataSize, _In_opt_ LPCSTR pFileName, _In_opt_ CONST D3D10_SHADER_MACRO* pDefines,
  409. _In_opt_ LPD3D10INCLUDE pInclude, _Out_ ID3D10Blob** ppShaderText, _Out_opt_ ID3D10Blob** ppErrorMsgs);
  410. //////////////////////////////////////////////////////////////////////////
  411. //
  412. // Shader blob manipulation routines
  413. // ---------------------------------
  414. //
  415. // void *pShaderBytecode - a buffer containing the result of an HLSL
  416. // compilation. Typically this opaque buffer contains several
  417. // discrete sections including the shader executable code, the input
  418. // signature, and the output signature. This can typically be retrieved
  419. // by calling ID3D10Blob::GetBufferPointer() on the returned blob
  420. // from HLSL's compile APIs.
  421. //
  422. // UINT BytecodeLength - the length of pShaderBytecode. This can
  423. // typically be retrieved by calling ID3D10Blob::GetBufferSize()
  424. // on the returned blob from HLSL's compile APIs.
  425. //
  426. // ID3D10Blob **ppSignatureBlob(s) - a newly created buffer that
  427. // contains only the signature portions of the original bytecode.
  428. // This is a copy; the original bytecode is not modified. You may
  429. // specify NULL for this parameter to have the bytecode validated
  430. // for the presence of the corresponding signatures without actually
  431. // copying them and creating a new blob.
  432. //
  433. // Returns E_INVALIDARG if any required parameters are NULL
  434. // Returns E_FAIL is the bytecode is corrupt or missing signatures
  435. // Returns S_OK on success
  436. //
  437. //////////////////////////////////////////////////////////////////////////
  438. HRESULT WINAPI D3D10GetInputSignatureBlob(_In_reads_bytes_(BytecodeLength) CONST void *pShaderBytecode, SIZE_T BytecodeLength, _Out_ ID3D10Blob **ppSignatureBlob);
  439. HRESULT WINAPI D3D10GetOutputSignatureBlob(_In_reads_bytes_(BytecodeLength) CONST void *pShaderBytecode, SIZE_T BytecodeLength, _Out_ ID3D10Blob **ppSignatureBlob);
  440. HRESULT WINAPI D3D10GetInputAndOutputSignatureBlob(_In_reads_bytes_(BytecodeLength) CONST void *pShaderBytecode, SIZE_T BytecodeLength, _Out_ ID3D10Blob **ppSignatureBlob);
  441. //----------------------------------------------------------------------------
  442. // D3D10GetShaderDebugInfo:
  443. // -----------------------
  444. // Gets shader debug info. Debug info is generated by D3D10CompileShader and is
  445. // embedded in the body of the shader.
  446. //
  447. // Parameters:
  448. // pShaderBytecode
  449. // Pointer to the function bytecode
  450. // BytecodeLength
  451. // Length of the shader bytecode buffer
  452. // ppDebugInfo
  453. // Buffer used to return debug info. For information about the layout
  454. // of this buffer, see definition of D3D10_SHADER_DEBUG_INFO above.
  455. //----------------------------------------------------------------------------
  456. HRESULT WINAPI D3D10GetShaderDebugInfo(_In_reads_bytes_(BytecodeLength) CONST void *pShaderBytecode, SIZE_T BytecodeLength, _Out_ ID3D10Blob** ppDebugInfo);
  457. #ifdef __cplusplus
  458. }
  459. #endif //__cplusplus
  460. #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
  461. #pragma endregion
  462. #endif //__D3D10SHADER_H__