1 // Copyright © 2016, Peter Atashian 2 // Licensed under the MIT License <LICENSE.md> 3 use super::*; 4 ENUM!{enum D3D11_SHADER_VERSION_TYPE { 5 D3D11_SHVER_PIXEL_SHADER = 0, 6 D3D11_SHVER_VERTEX_SHADER = 1, 7 D3D11_SHVER_GEOMETRY_SHADER = 2, 8 D3D11_SHVER_HULL_SHADER = 3, 9 D3D11_SHVER_DOMAIN_SHADER = 4, 10 D3D11_SHVER_COMPUTE_SHADER = 5, 11 D3D11_SHVER_RESERVED0 = 0xFFF0, 12 }} 13 pub const D3D_RETURN_PARAMETER_INDEX: c_int = -1; 14 pub type D3D11_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE; 15 pub type D3D11_CBUFFER_TYPE = D3D_CBUFFER_TYPE; 16 STRUCT!{struct D3D11_SIGNATURE_PARAMETER_DESC { 17 SemanticName: LPCSTR, 18 SemanticIndex: UINT, 19 Register: UINT, 20 SystemValueType: D3D_NAME, 21 ComponentType: D3D_REGISTER_COMPONENT_TYPE, 22 Mask: BYTE, 23 ReadWriteMask: BYTE, 24 Stream: UINT, 25 MinPrecision: D3D_MIN_PRECISION, 26 }} 27 STRUCT!{struct D3D11_SHADER_BUFFER_DESC { 28 Name: LPCSTR, 29 Type: D3D_CBUFFER_TYPE, 30 Variables: UINT, 31 Size: UINT, 32 uFlags: UINT, 33 }} 34 STRUCT!{struct D3D11_SHADER_VARIABLE_DESC { 35 Name: LPCSTR, 36 StartOffset: UINT, 37 Size: UINT, 38 uFlags: UINT, 39 DefaultValue: LPVOID, 40 StartTexture: UINT, 41 TextureSize: UINT, 42 StartSampler: UINT, 43 SamplerSize: UINT, 44 }} 45 STRUCT!{struct D3D11_SHADER_TYPE_DESC { 46 Class: D3D_SHADER_VARIABLE_CLASS, 47 Type: D3D_SHADER_VARIABLE_TYPE, 48 Rows: UINT, 49 Columns: UINT, 50 Elements: UINT, 51 Members: UINT, 52 Offset: UINT, 53 Name: LPCSTR, 54 }} 55 pub type D3D11_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN; 56 pub type D3D11_TESSELLATOR_PARTITIONING = D3D_TESSELLATOR_PARTITIONING; 57 pub type D3D11_TESSELLATOR_OUTPUT_PRIMITIVE = D3D_TESSELLATOR_OUTPUT_PRIMITIVE; 58 STRUCT!{struct D3D11_SHADER_DESC { 59 Version: UINT, 60 Creator: LPCSTR, 61 Flags: UINT, 62 ConstantBuffers: UINT, 63 BoundResources: UINT, 64 InputParameters: UINT, 65 OutputParameters: UINT, 66 InstructionCount: UINT, 67 TempRegisterCount: UINT, 68 TempArrayCount: UINT, 69 DefCount: UINT, 70 DclCount: UINT, 71 TextureNormalInstructions: UINT, 72 TextureLoadInstructions: UINT, 73 TextureCompInstructions: UINT, 74 TextureBiasInstructions: UINT, 75 TextureGradientInstructions: UINT, 76 FloatInstructionCount: UINT, 77 IntInstructionCount: UINT, 78 UintInstructionCount: UINT, 79 StaticFlowControlCount: UINT, 80 DynamicFlowControlCount: UINT, 81 MacroInstructionCount: UINT, 82 ArrayInstructionCount: UINT, 83 CutInstructionCount: UINT, 84 EmitInstructionCount: UINT, 85 GSOutputTopology: D3D_PRIMITIVE_TOPOLOGY, 86 GSMaxOutputVertexCount: UINT, 87 InputPrimitive: D3D_PRIMITIVE, 88 PatchConstantParameters: UINT, 89 cGSInstanceCount: UINT, 90 cControlPoints: UINT, 91 HSOutputPrimitive: D3D_TESSELLATOR_OUTPUT_PRIMITIVE, 92 HSPartitioning: D3D_TESSELLATOR_PARTITIONING, 93 TessellatorDomain: D3D_TESSELLATOR_DOMAIN, 94 cBarrierInstructions: UINT, 95 cInterlockedInstructions: UINT, 96 cTextureStoreInstructions: UINT, 97 }} 98 STRUCT!{struct D3D11_SHADER_INPUT_BIND_DESC { 99 Name: LPCSTR, 100 Type: D3D_SHADER_INPUT_TYPE, 101 BindPoint: UINT, 102 BindCount: UINT, 103 uFlags: UINT, 104 ReturnType: D3D_RESOURCE_RETURN_TYPE, 105 Dimension: D3D_SRV_DIMENSION, 106 NumSamples: UINT, 107 }} 108 pub const D3D_SHADER_REQUIRES_DOUBLES: UINT64 = 0x00000001; 109 pub const D3D_SHADER_REQUIRES_EARLY_DEPTH_STENCIL: UINT64 = 0x00000002; 110 pub const D3D_SHADER_REQUIRES_UAVS_AT_EVERY_STAGE: UINT64 = 0x00000004; 111 pub const D3D_SHADER_REQUIRES_64_UAVS: UINT64 = 0x00000008; 112 pub const D3D_SHADER_REQUIRES_MINIMUM_PRECISION: UINT64 = 0x00000010; 113 pub const D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS: UINT64 = 0x00000020; 114 pub const D3D_SHADER_REQUIRES_11_1_SHADER_EXTENSIONS: UINT64 = 0x00000040; 115 pub const D3D_SHADER_REQUIRES_LEVEL_9_COMPARISON_FILTERING: UINT64 = 0x00000080; 116 pub const D3D_SHADER_REQUIRES_TILED_RESOURCES: UINT64 = 0x00000100; 117 STRUCT!{struct D3D11_LIBRARY_DESC { 118 Creator: LPCSTR, 119 Flags: UINT, 120 FunctionCount: UINT, 121 }} 122 STRUCT!{struct D3D11_FUNCTION_DESC { 123 Version: UINT, 124 Creator: LPCSTR, 125 Flags: UINT, 126 ConstantBuffers: UINT, 127 BoundResources: UINT, 128 InstructionCount: UINT, 129 TempRegisterCount: UINT, 130 TempArrayCount: UINT, 131 DefCount: UINT, 132 DclCount: UINT, 133 TextureNormalInstructions: UINT, 134 TextureLoadInstructions: UINT, 135 TextureCompInstructions: UINT, 136 TextureBiasInstructions: UINT, 137 TextureGradientInstructions: UINT, 138 FloatInstructionCount: UINT, 139 IntInstructionCount: UINT, 140 UintInstructionCount: UINT, 141 StaticFlowControlCount: UINT, 142 DynamicFlowControlCount: UINT, 143 MacroInstructionCount: UINT, 144 ArrayInstructionCount: UINT, 145 MovInstructionCount: UINT, 146 MovcInstructionCount: UINT, 147 ConversionInstructionCount: UINT, 148 BitwiseInstructionCount: UINT, 149 MinFeatureLevel: D3D_FEATURE_LEVEL, 150 RequiredFeatureFlags: UINT64, 151 Name: LPCSTR, 152 FunctionParameterCount: INT, 153 HasReturn: BOOL, 154 Has10Level9VertexShader: BOOL, 155 Has10Level9PixelShader: BOOL, 156 }} 157 STRUCT!{struct D3D11_PARAMETER_DESC { 158 Name: LPCSTR, 159 SemanticName: LPCSTR, 160 Type: D3D_SHADER_VARIABLE_TYPE, 161 Class: D3D_SHADER_VARIABLE_CLASS, 162 Rows: UINT, 163 Columns: UINT, 164 InterpolationMode: D3D_INTERPOLATION_MODE, 165 Flags: D3D_PARAMETER_FLAGS, 166 FirstInRegister: UINT, 167 FirstInComponent: UINT, 168 FirstOutRegister: UINT, 169 FirstOutComponent: UINT, 170 }} 171 RIDL!{interface ID3D11ShaderReflectionType(ID3D11ShaderReflectionTypeVtbl) { 172 fn GetDesc(&mut self, pDesc: *mut D3D11_SHADER_TYPE_DESC) -> HRESULT, 173 fn GetMemberTypeByIndex(&mut self, Index: UINT) -> *mut ID3D11ShaderReflectionType, 174 fn GetMemberTypeByName(&mut self, Name: LPCSTR) -> *mut ID3D11ShaderReflectionType, 175 fn GetMemberTypeName(&mut self, Index: UINT) -> LPCSTR, 176 fn IsEqual(&mut self, pType: *mut ID3D11ShaderReflectionType) -> HRESULT, 177 fn GetSubType(&mut self) -> *mut ID3D11ShaderReflectionType, 178 fn GetBaseClass(&mut self) -> *mut ID3D11ShaderReflectionType, 179 fn GetNumInterfaces(&mut self) -> UINT, 180 fn GetInterfaceByIndex(&mut self, uIndex: UINT) -> *mut ID3D11ShaderReflectionType, 181 fn IsOfType(&mut self, pType: *mut ID3D11ShaderReflectionType) -> HRESULT, 182 fn ImplementsInterface(&mut self, pBase: *mut ID3D11ShaderReflectionType) -> HRESULT 183 }} 184 RIDL!{interface ID3D11ShaderReflectionVariable(ID3D11ShaderReflectionVariableVtbl) { 185 fn GetDesc(&mut self, pDesc: *mut D3D11_SHADER_VARIABLE_DESC) -> HRESULT, 186 fn GetType(&mut self) -> *mut ID3D11ShaderReflectionType, 187 fn GetBuffer(&mut self) -> *mut ID3D11ShaderReflectionConstantBuffer, 188 fn GetInterfaceSlot(&mut self, uArrayIndex: UINT) -> UINT 189 }} 190 RIDL!{interface ID3D11ShaderReflectionConstantBuffer(ID3D11ShaderReflectionConstantBufferVtbl) { 191 fn GetDesc(&mut self, pDesc: *mut D3D11_SHADER_BUFFER_DESC) -> HRESULT, 192 fn GetVariableByIndex(&mut self, Index: UINT) -> *mut ID3D11ShaderReflectionVariable, 193 fn GetVariableByName(&mut self, Name: LPCSTR) -> *mut ID3D11ShaderReflectionVariable 194 }} 195 RIDL!{interface ID3D11ShaderReflection(ID3D11ShaderReflectionVtbl): IUnknown(IUnknownVtbl) { 196 fn GetDesc(&mut self, pDesc: *mut D3D11_SHADER_DESC) -> HRESULT, 197 fn GetConstantBufferByIndex( 198 &mut self, Index: UINT 199 ) -> *mut ID3D11ShaderReflectionConstantBuffer, 200 fn GetConstantBufferByName( 201 &mut self, Name: LPCSTR 202 ) -> *mut ID3D11ShaderReflectionConstantBuffer, 203 fn GetResourceBindingDesc( 204 &mut self, ResourceIndex: UINT, pDesc: *mut D3D11_SHADER_INPUT_BIND_DESC 205 ) -> HRESULT, 206 fn GetInputParameterDesc( 207 &mut self, ParameterIndex: UINT, pDesc: *mut D3D11_SIGNATURE_PARAMETER_DESC 208 ) -> HRESULT, 209 fn GetOutputParameterDesc( 210 &mut self, ParameterIndex: UINT, pDesc: *mut D3D11_SIGNATURE_PARAMETER_DESC 211 ) -> HRESULT, 212 fn GetPatchConstantParameterDesc( 213 &mut self, ParameterIndex: UINT, pDesc: *mut D3D11_SIGNATURE_PARAMETER_DESC 214 ) -> HRESULT, 215 fn GetVariableByName(&mut self, Name: LPCSTR) -> *mut ID3D11ShaderReflectionVariable, 216 fn GetResourceBindingDescByName( 217 &mut self, Name: LPCSTR, pDesc: *mut D3D11_SHADER_INPUT_BIND_DESC 218 ) -> HRESULT, 219 fn GetMovInstructionCount(&mut self) -> UINT, 220 fn GetMovcInstructionCount(&mut self) -> UINT, 221 fn GetConversionInstructionCount(&mut self) -> UINT, 222 fn GetBitwiseInstructionCount(&mut self) -> UINT, 223 fn GetGSInputPrimitive(&mut self) -> D3D_PRIMITIVE, 224 fn IsSampleFrequencyShader(&mut self) -> BOOL, 225 fn GetNumInterfaceSlots(&mut self) -> UINT, 226 fn GetMinFeatureLevel(&mut self, pLevel: *mut D3D_FEATURE_LEVEL) -> HRESULT, 227 fn GetThreadGroupSize( 228 &mut self, pSizeX: *mut UINT, pSizeY: *mut UINT, pSizeZ: *mut UINT 229 ) -> UINT, 230 fn GetRequiresFlags(&mut self) -> UINT64 231 }} 232 RIDL!{interface ID3D11LibraryReflection(ID3D11LibraryReflectionVtbl): IUnknown(IUnknownVtbl) { 233 fn GetDesc(&mut self, pDesc: *mut D3D11_LIBRARY_DESC) -> HRESULT, 234 fn GetFunctionByIndex(&mut self, FunctionIndex: INT) -> *mut ID3D11FunctionReflection 235 }} 236 RIDL!{interface ID3D11FunctionReflection(ID3D11FunctionReflectionVtbl) { 237 fn GetDesc(&mut self, pDesc: *mut D3D11_FUNCTION_DESC) -> HRESULT, 238 fn GetConstantBufferByIndex( 239 &mut self, BufferIndex: UINT 240 ) -> *mut ID3D11ShaderReflectionConstantBuffer, 241 fn GetConstantBufferByName( 242 &mut self, Name: LPCSTR 243 ) -> *mut ID3D11ShaderReflectionConstantBuffer, 244 fn GetResourceBindingDesc( 245 &mut self, ResourceIndex: UINT, pDesc: *mut D3D11_SHADER_INPUT_BIND_DESC 246 ) -> HRESULT, 247 fn GetVariableByName(&mut self, Name: LPCSTR) -> *mut ID3D11ShaderReflectionVariable, 248 fn GetResourceBindingDescByName( 249 &mut self, Name: LPCSTR, pDesc: *mut D3D11_SHADER_INPUT_BIND_DESC 250 ) -> HRESULT, 251 fn GetFunctionParameter( 252 &mut self, ParameterIndex: INT 253 ) -> *mut ID3D11FunctionParameterReflection 254 }} 255 RIDL!{interface ID3D11FunctionParameterReflection(ID3D11FunctionParameterReflectionVtbl) { 256 fn GetDesc(&mut self, pDesc: *mut D3D11_PARAMETER_DESC) -> HRESULT 257 }} 258 RIDL!{interface ID3D11Module(ID3D11ModuleVtbl): IUnknown(IUnknownVtbl) { 259 fn CreateInstance( 260 &mut self, pNamespace: LPCSTR, ppModuleInstance: *mut *mut ID3D11ModuleInstance 261 ) -> HRESULT 262 }} 263 RIDL!{interface ID3D11ModuleInstance(ID3D11ModuleInstanceVtbl): IUnknown(IUnknownVtbl) { 264 fn BindConstantBuffer(&mut self, uSrcSlot: UINT, uDstSlot: UINT, cbDstOffset: UINT) -> HRESULT, 265 fn BindConstantBufferByName( 266 &mut self, pName: LPCSTR, uDstSlot: UINT, cbDstOffset: UINT 267 ) -> HRESULT, 268 fn BindResource(&mut self, uSrcSlot: UINT, uDstSlot: UINT, uCount: UINT) -> HRESULT, 269 fn BindResourceByName(&mut self, pName: LPCSTR, uDstSlot: UINT, uCount: UINT) -> HRESULT, 270 fn BindSampler(&mut self, uSrcSlot: UINT, uDstSlot: UINT, uCount: UINT) -> HRESULT, 271 fn BindSamplerByName(&mut self, pName: LPCSTR, uDstSlot: UINT, uCount: UINT) -> HRESULT, 272 fn BindUnorderedAccessView(&mut self, uSrcSlot: UINT, uDstSlot: UINT, uCount: UINT) -> HRESULT, 273 fn BindUnorderedAccessViewByName( 274 &mut self, pName: LPCSTR, uDstSlot: UINT, uCount: UINT 275 ) -> HRESULT, 276 fn BindResourceAsUnorderedAccessView( 277 &mut self, uSrcSrvSlot: UINT, uDstUavSlot: UINT, uCount: UINT 278 ) -> HRESULT, 279 fn BindResourceAsUnorderedAccessViewByName( 280 &mut self, pSrvName: LPCSTR, uDstUavSlot: UINT, uCount: UINT 281 ) -> HRESULT 282 }} 283 RIDL!{interface ID3D11Linker(ID3D11LinkerVtbl): IUnknown(IUnknownVtbl) { 284 fn Link( 285 &mut self, pEntry: *mut ID3D11ModuleInstance, pEntryName: LPCSTR, pTargetName: LPCSTR, 286 uFlags: UINT, ppShaderBlob: *mut *mut ID3DBlob, ppErrorBuffer: *mut *mut ID3DBlob 287 ) -> HRESULT, 288 fn UseLibrary(&mut self, pLibraryMI: *mut ID3D11ModuleInstance) -> HRESULT, 289 fn AddClipPlaneFromCBuffer(&mut self, uCBufferSlot: UINT, uCBufferEntry: UINT) -> HRESULT 290 }} 291 RIDL!{interface ID3D11LinkingNode(ID3D11LinkingNodeVtbl): IUnknown(IUnknownVtbl) {}} 292 RIDL!{interface ID3D11FunctionLinkingGraph(ID3D11FunctionLinkingGraphVtbl): IUnknown(IUnknownVtbl) { 293 fn CreateModuleInstance( 294 &mut self, ppModuleInstance: *mut *mut ID3D11ModuleInstance, 295 ppErrorBuffer: *mut *mut ID3DBlob 296 ) -> HRESULT, 297 fn SetInputSignature( 298 &mut self, pInputParameters: *const D3D11_PARAMETER_DESC, cInputParameters: UINT, 299 ppInputNode: *mut *mut ID3D11LinkingNode 300 ) -> HRESULT, 301 fn SetOutputSignature( 302 &mut self, pOutputParameters: *const D3D11_PARAMETER_DESC, cOutputParameters: UINT, 303 ppOutputNode: *mut *mut ID3D11LinkingNode 304 ) -> HRESULT, 305 fn CallFunction( 306 &mut self, pModuleInstanceNamespace: LPCSTR, 307 pModuleWithFunctionPrototype: *mut ID3D11Module, pFunctionName: LPCSTR, 308 ppCallNode: *mut *mut ID3D11LinkingNode 309 ) -> HRESULT, 310 fn PassValue( 311 &mut self, pSrcNode: *mut ID3D11LinkingNode, SrcParameterIndex: INT, 312 pDstNode: *mut ID3D11LinkingNode, DstParameterIndex: INT 313 ) -> HRESULT, 314 fn PassValueWithSwizzle( 315 &mut self, pSrcNode: *mut ID3D11LinkingNode, SrcParameterIndex: INT, pSrcSwizzle: LPCSTR, 316 pDstNode: *mut ID3D11LinkingNode, DstParameterIndex: INT, pDstSwizzle: LPCSTR 317 ) -> HRESULT, 318 fn GetLastError(&mut self, ppErrorBuffer: *mut *mut ID3DBlob) -> HRESULT, 319 fn GenerateHlsl(&mut self, uFlags: UINT, ppBuffer: *mut *mut ID3DBlob) -> HRESULT 320 }} 321