D3D10shader.h 24 KB

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