1 // Copyright © 2016; Dmitry Roschin 2 // Licensed under the MIT License <LICENSE.md> 3 FLAGS!{ enum D3D12_SHADER_VERSION_TYPE { 4 D3D12_SHVER_PIXEL_SHADER = 0x0, 5 D3D12_SHVER_VERTEX_SHADER = 0x1, 6 D3D12_SHVER_GEOMETRY_SHADER = 0x2, 7 D3D12_SHVER_HULL_SHADER = 0x3, 8 D3D12_SHVER_DOMAIN_SHADER = 0x4, 9 D3D12_SHVER_COMPUTE_SHADER = 0x5, 10 D3D12_SHVER_RESERVED0 = 0xFFF0, 11 }} 12 13 STRUCT!{struct D3D12_FUNCTION_DESC { 14 Version: ::UINT, 15 Creator: ::LPCSTR, 16 Flags: ::UINT, 17 ConstantBuffers: ::UINT, 18 BoundResources: ::UINT, 19 InstructionCount: ::UINT, 20 TempRegisterCount: ::UINT, 21 TempArrayCount: ::UINT, 22 DefCount: ::UINT, 23 DclCount: ::UINT, 24 TextureNormalInstructions: ::UINT, 25 TextureLoadInstructions: ::UINT, 26 TextureCompInstructions: ::UINT, 27 TextureBiasInstructions: ::UINT, 28 TextureGradientInstructions: ::UINT, 29 FloatInstructionCount: ::UINT, 30 IntInstructionCount: ::UINT, 31 UintInstructionCount: ::UINT, 32 StaticFlowControlCount: ::UINT, 33 DynamicFlowControlCount: ::UINT, 34 MacroInstructionCount: ::UINT, 35 ArrayInstructionCount: ::UINT, 36 MovInstructionCount: ::UINT, 37 MovcInstructionCount: ::UINT, 38 ConversionInstructionCount: ::UINT, 39 BitwiseInstructionCount: ::UINT, 40 MinFeatureLevel: ::D3D_FEATURE_LEVEL, 41 RequiredFeatureFlags: ::UINT64, 42 Name: ::LPCSTR, 43 FunctionParameterCount: ::INT, 44 HasReturn: ::BOOL, 45 Has10Level9VertexShader: ::BOOL, 46 Has10Level9PixelShader: ::BOOL, 47 }} 48 49 STRUCT!{struct D3D12_LIBRARY_DESC { 50 Creator: ::LPCSTR, 51 Flags: ::UINT, 52 FunctionCount: ::UINT, 53 }} 54 55 STRUCT!{struct D3D12_PARAMETER_DESC { 56 Name: ::LPCSTR, 57 SemanticName: ::LPCSTR, 58 Type: ::D3D_SHADER_VARIABLE_TYPE, 59 Class: ::D3D_SHADER_VARIABLE_CLASS, 60 Rows: ::UINT, 61 Columns: ::UINT, 62 InterpolationMode: ::D3D_INTERPOLATION_MODE, 63 Flags: ::D3D_PARAMETER_FLAGS, 64 FirstInRegister: ::UINT, 65 FirstInComponent: ::UINT, 66 FirstOutRegister: ::UINT, 67 FirstOutComponent: ::UINT, 68 }} 69 70 STRUCT!{struct D3D12_SHADER_BUFFER_DESC { 71 Name: ::LPCSTR, 72 Type: ::D3D_CBUFFER_TYPE, 73 Variables: ::UINT, 74 Size: ::UINT, 75 uFlags: ::UINT, 76 }} 77 78 STRUCT!{struct D3D12_SHADER_DESC { 79 Version: ::UINT, 80 Creator: ::LPCSTR, 81 Flags: ::UINT, 82 ConstantBuffers: ::UINT, 83 BoundResources: ::UINT, 84 InputParameters: ::UINT, 85 OutputParameters: ::UINT, 86 InstructionCount: ::UINT, 87 TempRegisterCount: ::UINT, 88 TempArrayCount: ::UINT, 89 DefCount: ::UINT, 90 DclCount: ::UINT, 91 TextureNormalInstructions: ::UINT, 92 TextureLoadInstructions: ::UINT, 93 TextureCompInstructions: ::UINT, 94 TextureBiasInstructions: ::UINT, 95 TextureGradientInstructions: ::UINT, 96 FloatInstructionCount: ::UINT, 97 IntInstructionCount: ::UINT, 98 UintInstructionCount: ::UINT, 99 StaticFlowControlCount: ::UINT, 100 DynamicFlowControlCount: ::UINT, 101 MacroInstructionCount: ::UINT, 102 ArrayInstructionCount: ::UINT, 103 CutInstructionCount: ::UINT, 104 EmitInstructionCount: ::UINT, 105 GSOutputTopology: ::D3D_PRIMITIVE_TOPOLOGY, 106 GSMaxOutputVertexCount: ::UINT, 107 InputPrimitive: ::D3D_PRIMITIVE, 108 PatchConstantParameters: ::UINT, 109 cGSInstanceCount: ::UINT, 110 cControlPoints: ::UINT, 111 HSOutputPrimitive: ::D3D_TESSELLATOR_OUTPUT_PRIMITIVE, 112 HSPartitioning: ::D3D_TESSELLATOR_PARTITIONING, 113 TessellatorDomain: ::D3D_TESSELLATOR_DOMAIN, 114 cBarrierInstructions: ::UINT, 115 cInterlockedInstructions: ::UINT, 116 cTextureStoreInstructions: ::UINT, 117 }} 118 119 STRUCT!{struct D3D12_SHADER_INPUT_BIND_DESC { 120 Name: ::LPCSTR, 121 Type: ::D3D_SHADER_INPUT_TYPE, 122 BindPoint: ::UINT, 123 BindCount: ::UINT, 124 uFlags: ::UINT, 125 ReturnType: ::D3D_RESOURCE_RETURN_TYPE, 126 Dimension: ::D3D_SRV_DIMENSION, 127 NumSamples: ::UINT, 128 Space: ::UINT, 129 uID: ::UINT, 130 }} 131 132 STRUCT!{struct D3D12_SHADER_TYPE_DESC { 133 Class: ::D3D_SHADER_VARIABLE_CLASS, 134 Type: ::D3D_SHADER_VARIABLE_TYPE, 135 Rows: ::UINT, 136 Columns: ::UINT, 137 Elements: ::UINT, 138 Members: ::UINT, 139 Offset: ::UINT, 140 Name: ::LPCSTR, 141 }} 142 143 STRUCT!{struct D3D12_SHADER_VARIABLE_DESC { 144 Name: ::LPCSTR, 145 StartOffset: ::UINT, 146 Size: ::UINT, 147 uFlags: ::UINT, 148 DefaultValue: ::LPVOID, 149 StartTexture: ::UINT, 150 TextureSize: ::UINT, 151 StartSampler: ::UINT, 152 SamplerSize: ::UINT, 153 }} 154 155 STRUCT!{struct D3D12_SIGNATURE_PARAMETER_DESC { 156 SemanticName: ::LPCSTR, 157 SemanticIndex: ::UINT, 158 Register: ::UINT, 159 SystemValueType: ::D3D_NAME, 160 ComponentType: ::D3D_REGISTER_COMPONENT_TYPE, 161 Mask: ::BYTE, 162 ReadWriteMask: ::BYTE, 163 Stream: ::UINT, 164 MinPrecision: ::D3D_MIN_PRECISION, 165 }} 166 167 RIDL!( 168 interface ID3D12FunctionParameterReflection(ID3D12FunctionParameterReflectionVtbl) { 169 fn GetDesc(&mut self, pDesc: *mut ::D3D12_PARAMETER_DESC) -> ::HRESULT 170 }); 171 172 RIDL!( 173 interface ID3D12FunctionReflection(ID3D12FunctionReflectionVtbl) { 174 fn GetDesc(&mut self, pDesc: *mut ::D3D12_FUNCTION_DESC) -> ::HRESULT, 175 fn GetConstantBufferByIndex( 176 &mut self, BufferIndex: ::UINT 177 ) -> *mut ::ID3D12ShaderReflectionConstantBuffer, 178 fn GetConstantBufferByName( 179 &mut self, Name: ::LPCSTR 180 ) -> *mut ::ID3D12ShaderReflectionConstantBuffer, 181 fn GetResourceBindingDesc( 182 &mut self, ResourceIndex: ::UINT, pDesc: *mut ::D3D12_SHADER_INPUT_BIND_DESC 183 ) -> ::HRESULT, 184 fn GetVariableByName( 185 &mut self, Name: ::LPCSTR 186 ) -> *mut ::ID3D12ShaderReflectionVariable, 187 fn GetResourceBindingDescByName( 188 &mut self, Name: ::LPCSTR, pDesc: *mut ::D3D12_SHADER_INPUT_BIND_DESC 189 ) -> ::HRESULT, 190 fn GetFunctionParameter( 191 &mut self, ParameterIndex: ::INT 192 ) -> *mut ::ID3D12FunctionParameterReflection 193 }); 194 195 RIDL!( 196 interface ID3D12LibraryReflection(ID3D12LibraryReflectionVtbl): IUnknown(IUnknownVtbl) { 197 fn QueryInterface( 198 &mut self, iid: *const ::IID, ppv: *mut ::LPVOID 199 ) -> ::HRESULT, 200 fn AddRef(&mut self) -> ::ULONG, 201 fn Release(&mut self) -> ::ULONG, 202 fn GetDesc(&mut self, pDesc: *mut ::D3D12_LIBRARY_DESC) -> ::HRESULT, 203 fn GetFunctionByIndex( 204 &mut self, FunctionIndex: ::INT 205 ) -> *mut ::ID3D12FunctionReflection 206 }); 207 208 RIDL!( 209 interface ID3D12ShaderReflectionConstantBuffer(ID3D12ShaderReflectionConstantBufferVtbl) { 210 fn GetDesc(&mut self, pDesc: *mut ::D3D12_SHADER_BUFFER_DESC) -> ::HRESULT, 211 fn GetVariableByIndex( 212 &mut self, Index: ::UINT 213 ) -> *mut ::ID3D12ShaderReflectionVariable, 214 fn GetVariableByName( 215 &mut self, Name: ::LPCSTR 216 ) -> *mut ::ID3D12ShaderReflectionVariable 217 }); 218 219 RIDL!( 220 interface ID3D12ShaderReflectionType(ID3D12ShaderReflectionTypeVtbl) { 221 fn GetDesc(&mut self, pDesc: *mut ::D3D12_SHADER_TYPE_DESC) -> ::HRESULT, 222 fn GetMemberTypeByIndex( 223 &mut self, Index: ::UINT 224 ) -> *mut ::ID3D12ShaderReflectionType, 225 fn GetMemberTypeByName( 226 &mut self, Name: ::LPCSTR 227 ) -> *mut ::ID3D12ShaderReflectionType, 228 fn GetMemberTypeName(&mut self, Index: ::UINT) -> ::LPCSTR, 229 fn IsEqual( 230 &mut self, pType: *mut ::ID3D12ShaderReflectionType 231 ) -> ::HRESULT, 232 fn GetSubType(&mut self) -> *mut ::ID3D12ShaderReflectionType, 233 fn GetBaseClass(&mut self) -> *mut ::ID3D12ShaderReflectionType, 234 fn GetNumInterfaces(&mut self) -> ::UINT, 235 fn GetInterfaceByIndex( 236 &mut self, uIndex: ::UINT 237 ) -> *mut ::ID3D12ShaderReflectionType, 238 fn IsOfType( 239 &mut self, pType: *mut ::ID3D12ShaderReflectionType 240 ) -> ::HRESULT, 241 fn ImplementsInterface( 242 &mut self, pBase: *mut ::ID3D12ShaderReflectionType 243 ) -> ::HRESULT 244 }); 245 246 RIDL!( 247 interface ID3D12ShaderReflectionVariable(ID3D12ShaderReflectionVariableVtbl) { 248 fn GetDesc( 249 &mut self, pDesc: *mut ::D3D12_SHADER_VARIABLE_DESC 250 ) -> ::HRESULT, 251 fn GetType(&mut self) -> *mut ::ID3D12ShaderReflectionType, 252 fn GetBuffer(&mut self) -> *mut ::ID3D12ShaderReflectionConstantBuffer, 253 fn GetInterfaceSlot(&mut self, uArrayIndex: ::UINT) -> ::UINT 254 }); 255 256 RIDL!( 257 interface ID3D12ShaderReflection(ID3D12ShaderReflectionVtbl): IUnknown(IUnknownVtbl) { 258 fn QueryInterface( 259 &mut self, iid: *const ::IID, ppv: *mut ::LPVOID 260 ) -> ::HRESULT, 261 fn AddRef(&mut self) -> ::ULONG, 262 fn Release(&mut self) -> ::ULONG, 263 fn GetDesc(&mut self, pDesc: *mut ::D3D12_SHADER_DESC) -> ::HRESULT, 264 fn GetConstantBufferByIndex( 265 &mut self, Index: ::UINT 266 ) -> *mut ::ID3D12ShaderReflectionConstantBuffer, 267 fn GetConstantBufferByName( 268 &mut self, Name: ::LPCSTR 269 ) -> *mut ::ID3D12ShaderReflectionConstantBuffer, 270 fn GetResourceBindingDesc( 271 &mut self, ResourceIndex: ::UINT, pDesc: *mut ::D3D12_SHADER_INPUT_BIND_DESC 272 ) -> ::HRESULT, 273 fn GetInputParameterDesc( 274 &mut self, ParameterIndex: ::UINT, pDesc: *mut ::D3D12_SIGNATURE_PARAMETER_DESC 275 ) -> ::HRESULT, 276 fn GetOutputParameterDesc( 277 &mut self, ParameterIndex: ::UINT, pDesc: *mut ::D3D12_SIGNATURE_PARAMETER_DESC 278 ) -> ::HRESULT, 279 fn GetPatchConstantParameterDesc( 280 &mut self, ParameterIndex: ::UINT, pDesc: *mut ::D3D12_SIGNATURE_PARAMETER_DESC 281 ) -> ::HRESULT, 282 fn GetVariableByName( 283 &mut self, Name: ::LPCSTR 284 ) -> *mut ::ID3D12ShaderReflectionVariable, 285 fn GetResourceBindingDescByName( 286 &mut self, Name: ::LPCSTR, pDesc: *mut ::D3D12_SHADER_INPUT_BIND_DESC 287 ) -> ::HRESULT, 288 fn GetMovInstructionCount(&mut self) -> ::UINT, 289 fn GetMovcInstructionCount(&mut self) -> ::UINT, 290 fn GetConversionInstructionCount(&mut self) -> ::UINT, 291 fn GetBitwiseInstructionCount(&mut self) -> ::UINT, 292 fn GetGSInputPrimitive(&mut self) -> ::D3D_PRIMITIVE, 293 fn IsSampleFrequencyShader(&mut self) -> ::BOOL, 294 fn GetNumInterfaceSlots(&mut self) -> ::UINT, 295 fn GetMinFeatureLevel( 296 &mut self, pLevel: *mut ::D3D_FEATURE_LEVEL 297 ) -> ::HRESULT, 298 fn GetThreadGroupSize( 299 &mut self, pSizeX: *mut ::UINT, pSizeY: *mut ::UINT, pSizeZ: *mut ::UINT 300 ) -> ::UINT, 301 fn GetRequiresFlags(&mut self) -> ::UINT64 302 }); 303 304 pub type D3D12_CBUFFER_TYPE = ::D3D_CBUFFER_TYPE; 305 pub type D3D12_RESOURCE_RETURN_TYPE = ::D3D_RESOURCE_RETURN_TYPE; 306 pub type D3D12_TESSELLATOR_DOMAIN = ::D3D_TESSELLATOR_DOMAIN; 307 pub type D3D12_TESSELLATOR_OUTPUT_PRIMITIVE = ::D3D_TESSELLATOR_OUTPUT_PRIMITIVE; 308 pub type D3D12_TESSELLATOR_PARTITIONING = ::D3D_TESSELLATOR_PARTITIONING; 309 pub type LPD3D12FUNCTIONPARAMETERREFLECTION = *mut ::ID3D12FunctionParameterReflection; 310 pub type LPD3D12FUNCTIONREFLECTION = *mut ::ID3D12FunctionReflection; 311 pub type LPD3D12LIBRARYREFLECTION = *mut ::ID3D12LibraryReflection; 312 pub type LPD3D12SHADERREFLECTION = *mut ::ID3D12ShaderReflection; 313 pub type LPD3D12SHADERREFLECTIONCONSTANTBUFFER = *mut ::ID3D12ShaderReflectionConstantBuffer; 314 pub type LPD3D12SHADERREFLECTIONTYPE = *mut ::ID3D12ShaderReflectionType; 315 pub type LPD3D12SHADERREFLECTIONVARIABLE = *mut ::ID3D12ShaderReflectionVariable; 316 pub const D3D_SHADER_REQUIRES_INNER_COVERAGE: ::UINT64 = 0x00000400; 317 pub const D3D_SHADER_REQUIRES_ROVS: ::UINT64 = 0x00001000; 318 pub const D3D_SHADER_REQUIRES_STENCIL_REF: ::UINT64 = 0x00000200; 319 pub const D3D_SHADER_REQUIRES_TYPED_UAV_LOAD_ADDITIONAL_FORMATS: ::UINT64 = 0x00000800; 320 pub const D3D_SHADER_REQUIRES_VIEWPORT_AND_RT_ARRAY_INDEX_FROM_ANY_SHADER_FEEDING_RASTERIZER: ::UINT64 = 0x00002000; 321