Home | History | Annotate | Download | only in d3dapi
      1 /**************************************************************************
      2  *
      3  * Copyright 2010 Luca Barbieri
      4  *
      5  * Permission is hereby granted, free of charge, to any person obtaining
      6  * a copy of this software and associated documentation files (the
      7  * "Software"), to deal in the Software without restriction, including
      8  * without limitation the rights to use, copy, modify, merge, publish,
      9  * distribute, sublicense, and/or sell copies of the Software, and to
     10  * permit persons to whom the Software is furnished to do so, subject to
     11  * the following conditions:
     12  *
     13  * The above copyright notice and this permission notice (including the
     14  * next paragraph) shall be included in all copies or substantial
     15  * portions of the Software.
     16  *
     17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
     18  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
     20  * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
     21  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
     22  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
     23  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     24  *
     25  **************************************************************************/
     26 
     27 import "d3d10.idl";
     28 
     29 cpp_quote("#define D3D10_TX_VERSION(a, b) (('T' << 24) | ('X' << 16) | ((a) << 8) | (b)))")
     30 
     31 const unsigned int D3D10_SHADER_DEBUG = (1 << 0);
     32 const unsigned int D3D10_SHADER_SKIP_VALIDATION = (1 << 1);
     33 const unsigned int D3D10_SHADER_SKIP_OPTIMIZATION = (1 << 2);
     34 const unsigned int D3D10_SHADER_PACK_MATRIX_ROW_MAJOR = (1 << 3);
     35 const unsigned int D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR = (1 << 4);
     36 const unsigned int D3D10_SHADER_PARTIAL_PRECISION = (1 << 5);
     37 const unsigned int D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT = (1 << 6);
     38 const unsigned int D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT = (1 << 7);
     39 const unsigned int D3D10_SHADER_NO_PRESHADER = (1 << 8);
     40 const unsigned int D3D10_SHADER_AVOID_FLOW_CONTROL = (1 << 9);
     41 const unsigned int D3D10_SHADER_PREFER_FLOW_CONTROL = (1 << 10);
     42 const unsigned int D3D10_SHADER_ENABLE_STRICTNESS = (1 << 11);
     43 const unsigned int D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY = (1 << 12);
     44 const unsigned int D3D10_SHADER_IEEE_STRICTNESS = (1 << 13);
     45 const unsigned int D3D10_SHADER_WARNINGS_ARE_ERRORS = (1 << 18);
     46 
     47 
     48 const unsigned int D3D10_SHADER_OPTIMIZATION_LEVEL0 = (1 << 14);
     49 const unsigned int D3D10_SHADER_OPTIMIZATION_LEVEL1 = 0;
     50 const unsigned int D3D10_SHADER_OPTIMIZATION_LEVEL2 = ((1 << 14) | (1 << 15));
     51 const unsigned int D3D10_SHADER_OPTIMIZATION_LEVEL3 = (1 << 15);
     52 
     53 typedef D3D_SHADER_MACRO D3D10_SHADER_MACRO;
     54 typedef D3D10_SHADER_MACRO* LPD3D10_SHADER_MACRO;
     55 
     56 
     57 typedef D3D_SHADER_VARIABLE_CLASS D3D10_SHADER_VARIABLE_CLASS;
     58 typedef D3D10_SHADER_VARIABLE_CLASS* LPD3D10_SHADER_VARIABLE_CLASS;
     59 typedef D3D_SHADER_VARIABLE_FLAGS D3D10_SHADER_VARIABLE_FLAGS;
     60 typedef D3D10_SHADER_VARIABLE_FLAGS* LPD3D10_SHADER_VARIABLE_FLAGS;
     61 typedef D3D_SHADER_VARIABLE_TYPE D3D10_SHADER_VARIABLE_TYPE;
     62 typedef D3D10_SHADER_VARIABLE_TYPE* LPD3D10_SHADER_VARIABLE_TYPE;
     63 typedef D3D_SHADER_INPUT_FLAGS D3D10_SHADER_INPUT_FLAGS;
     64 typedef D3D10_SHADER_INPUT_FLAGS* LPD3D10_SHADER_INPUT_FLAGS;
     65 typedef D3D_SHADER_INPUT_TYPE D3D10_SHADER_INPUT_TYPE;
     66 typedef D3D10_SHADER_INPUT_TYPE* LPD3D10_SHADER_INPUT_TYPE;
     67 typedef D3D_SHADER_CBUFFER_FLAGS D3D10_SHADER_CBUFFER_FLAGS;
     68 typedef D3D10_SHADER_CBUFFER_FLAGS* LPD3D10_SHADER_CBUFFER_FLAGS;
     69 typedef D3D_CBUFFER_TYPE D3D10_CBUFFER_TYPE;
     70 typedef D3D10_CBUFFER_TYPE* LPD3D10_CBUFFER_TYPE;
     71 typedef D3D_NAME D3D10_NAME;
     72 typedef D3D_RESOURCE_RETURN_TYPE D3D10_RESOURCE_RETURN_TYPE;
     73 typedef D3D_REGISTER_COMPONENT_TYPE D3D10_REGISTER_COMPONENT_TYPE;
     74 typedef D3D_INCLUDE_TYPE D3D10_INCLUDE_TYPE;
     75 typedef ID3DInclude* LPD3D10INCLUDE;
     76 
     77 cpp_quote("#define D3D10_SHVER_GET_TYPE(v) (((v) >> 16) & 0xffff)")
     78 cpp_quote("#define D3D10_SHVER_GET_MAJOR(v) (((v) >> 4) & 0xf)")
     79 cpp_quote("#define D3D10_SHVER_GET_MINOR(v) (((v) >> 0) & 0xf)")
     80 
     81 typedef struct _D3D10_SIGNATURE_PARAMETER_DESC
     82 {
     83 	LPCSTR SemanticName;
     84 	UINT SemanticIndex;
     85 	UINT Register;
     86 	D3D_NAME SystemValueType;
     87 	D3D_REGISTER_COMPONENT_TYPE ComponentType;
     88 	BYTE Mask;
     89 	BYTE ReadWriteMask;
     90 } D3D10_SIGNATURE_PARAMETER_DESC;
     91 
     92 typedef struct _D3D10_SHADER_BUFFER_DESC
     93 {
     94 	LPCSTR Name;
     95 	D3D_CBUFFER_TYPE Type;
     96 	UINT Variables;
     97 	UINT Size;
     98 	UINT uFlags;
     99 } D3D10_SHADER_BUFFER_DESC;
    100 
    101 typedef struct _D3D10_SHADER_VARIABLE_DESC
    102 {
    103 	LPCSTR Name;
    104 	UINT StartOffset;
    105 	UINT Size;
    106 	UINT uFlags;
    107 	LPVOID DefaultValue;
    108 	UINT StartTexture;
    109 	UINT TextureSize;
    110 	UINT StartSampler;
    111 	UINT SamplerSize;
    112 } D3D10_SHADER_VARIABLE_DESC;
    113 
    114 typedef struct _D3D10_SHADER_TYPE_DESC
    115 {
    116 	D3D_SHADER_VARIABLE_CLASS Class;
    117 	D3D_SHADER_VARIABLE_TYPE Type;
    118 	UINT Rows;
    119 	UINT Columns;
    120 	UINT Elements;
    121 	UINT Members;
    122 	UINT Offset;
    123 	LPCSTR Name;
    124 } D3D10_SHADER_TYPE_DESC;
    125 
    126 typedef D3D_TESSELLATOR_DOMAIN D3D10_TESSELLATOR_DOMAIN;
    127 typedef D3D_TESSELLATOR_PARTITIONING D3D10_TESSELLATOR_PARTITIONING;
    128 typedef D3D_TESSELLATOR_OUTPUT_PRIMITIVE D3D10_TESSELLATOR_OUTPUT_PRIMITIVE;
    129 
    130 typedef struct _D3D10_SHADER_DESC
    131 {
    132 	UINT Version;
    133 	LPCSTR Creator;
    134 	UINT Flags;
    135 
    136 	UINT ConstantBuffers;
    137 	UINT BoundResources;
    138 	UINT InputParameters;
    139 	UINT OutputParameters;
    140 
    141 	UINT InstructionCount;
    142 	UINT TempRegisterCount;
    143 	UINT TempArrayCount;
    144 	UINT DefCount;
    145 	UINT DclCount;
    146 	UINT TextureNormalInstructions;
    147 	UINT TextureLoadInstructions;
    148 	UINT TextureCompInstructions;
    149 	UINT TextureBiasInstructions;
    150 	UINT TextureGradientInstructions;
    151 	UINT FloatInstructionCount;
    152 	UINT IntInstructionCount;
    153 	UINT UintInstructionCount;
    154 	UINT StaticFlowControlCount;
    155 	UINT DynamicFlowControlCount;
    156 	UINT MacroInstructionCount;
    157 	UINT ArrayInstructionCount;
    158 	UINT CutInstructionCount;
    159 	UINT EmitInstructionCount;
    160 	D3D_PRIMITIVE_TOPOLOGY GSOutputTopology;
    161 	UINT GSMaxOutputVertexCount;
    162 } D3D10_SHADER_DESC;
    163 
    164 typedef struct _D3D10_SHADER_INPUT_BIND_DESC
    165 {
    166 	LPCSTR Name;
    167 	D3D_SHADER_INPUT_TYPE Type;
    168 	UINT BindPoint;
    169 	UINT BindCount;
    170 
    171 	UINT uFlags;
    172 	D3D_RESOURCE_RETURN_TYPE ReturnType;
    173 	D3D_SRV_DIMENSION Dimension;
    174 	UINT NumSamples;
    175 } D3D10_SHADER_INPUT_BIND_DESC;
    176 
    177 [local, object, uuid("C530AD7D-9B16-4395-A979-BA2ECFF83ADD")]
    178 interface ID3D10ShaderReflectionType
    179 {
    180 	HRESULT GetDesc(
    181 		[out] D3D10_SHADER_TYPE_DESC *a
    182 	);
    183 
    184 	ID3D10ShaderReflectionType* GetMemberTypeByIndex(
    185 		[in] UINT a
    186 	);
    187 
    188 	ID3D10ShaderReflectionType* GetMemberTypeByName(
    189 		[in] LPCSTR a
    190 	);
    191 
    192 	LPCSTR GetMemberTypeName(
    193 		[in] UINT a
    194 	);
    195 };
    196 
    197 interface ID3D10ShaderReflectionConstantBuffer;
    198 
    199 [object, local, uuid("1BF63C95-2650-405d-99C1-3636BD1DA0A1")]
    200 interface ID3D10ShaderReflectionVariable
    201 {
    202 	HRESULT GetDesc(
    203 		[out] D3D10_SHADER_VARIABLE_DESC *a
    204 	);
    205 
    206 	ID3D10ShaderReflectionType* GetType();
    207 };
    208 
    209 [object, local, uuid("66C66A94-DDDD-4b62-A66A-F0DA33C2B4D0")]
    210 interface ID3D10ShaderReflectionConstantBuffer
    211 {
    212 	HRESULT GetDesc(
    213 		[out] D3D10_SHADER_BUFFER_DESC *a
    214 	);
    215 
    216 	ID3D10ShaderReflectionVariable* GetVariableByIndex(
    217 		[in] UINT a
    218 	);
    219 
    220 	ID3D10ShaderReflectionVariable* GetVariableByName(
    221 		[in] LPCSTR a
    222 	);
    223 };
    224 
    225 [object,local,uuid("D40E20B6-F8F7-42ad-AB20-4BAF8F15DFAA")]
    226 interface ID3D10ShaderReflection : IUnknown
    227 {
    228 	HRESULT GetDesc(
    229 		[out] D3D10_SHADER_DESC *a
    230 	);
    231 
    232 	ID3D10ShaderReflectionConstantBuffer* GetConstantBufferByIndex(
    233 		[in] UINT a
    234 	);
    235 
    236 	ID3D10ShaderReflectionConstantBuffer* GetConstantBufferByName(
    237 		[in] LPCSTR a
    238 	);
    239 
    240 	HRESULT GetResourceBindingDesc(
    241 		[in] UINT a,
    242 		[out] D3D10_SHADER_INPUT_BIND_DESC *b
    243 	);
    244 
    245 	HRESULT GetInputParameterDesc(
    246 		[in] UINT a,
    247 		[out] D3D10_SIGNATURE_PARAMETER_DESC *b
    248 	);
    249 
    250 	HRESULT GetOutputParameterDesc
    251 	(
    252 		[in] UINT a,
    253 		[out] D3D10_SIGNATURE_PARAMETER_DESC *b
    254 	);
    255 };
    256 
    257 HRESULT D3D10CompileShader(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, const D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,
    258 	LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs);
    259 HRESULT D3D10DisassembleShader(const void *pShader, SIZE_T BytecodeLength, BOOL EnableColorCode, LPCSTR pComments, ID3D10Blob** ppDisassembly);
    260 LPCSTR D3D10GetPixelShaderProfile(ID3D10Device *pDevice);
    261 LPCSTR D3D10GetVertexShaderProfile(ID3D10Device *pDevice);
    262 LPCSTR D3D10GetGeometryShaderProfile(ID3D10Device *pDevice);
    263 HRESULT D3D10ReflectShader(const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10ShaderReflection **ppReflector);
    264 HRESULT D3D10PreprocessShader(LPCSTR pSrcData, SIZE_T SrcDataSize, LPCSTR pFileName, const D3D10_SHADER_MACRO* pDefines,
    265 	LPD3D10INCLUDE pInclude, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs);
    266 HRESULT D3D10GetInputSignatureBlob(const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob);
    267 HRESULT D3D10GetOutputSignatureBlob(const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob);
    268 HRESULT D3D10GetInputAndOutputSignatureBlob(const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob);
    269 HRESULT D3D10GetShaderDebugInfo(const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob** ppDebugInfo);
    270