1 // Licensed under the Apache License, Version 2.0 2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license 3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. 4 // All files in the project carrying such notice may not be copied, modified, or distributed 5 // except according to those terms 6 use shared::minwindef::{BYTE, LPVOID, UINT}; 7 use um::d3d10::{D3D10_PRIMITIVE_TOPOLOGY, D3D10_SRV_DIMENSION}; 8 use um::d3dcommon::{ 9 D3D_CBUFFER_TYPE, D3D_INCLUDE_TYPE, D3D_NAME, D3D_REGISTER_COMPONENT_TYPE, 10 D3D_RESOURCE_RETURN_TYPE, D3D_SHADER_CBUFFER_FLAGS, D3D_SHADER_INPUT_FLAGS, 11 D3D_SHADER_INPUT_TYPE, D3D_SHADER_MACRO, D3D_SHADER_VARIABLE_CLASS, D3D_SHADER_VARIABLE_FLAGS, 12 D3D_SHADER_VARIABLE_TYPE, ID3DInclude, 13 }; 14 use um::unknwnbase::{IUnknown, IUnknownVtbl}; 15 use um::winnt::{HRESULT, LPCSTR}; 16 pub const D3D10_SHADER_DEBUG: UINT = 1 << 0; 17 pub const D3D10_SHADER_SKIP_VALIDATION: UINT = 1 << 1; 18 pub const D3D10_SHADER_SKIP_OPTIMIZATION: UINT = 1 << 2; 19 pub const D3D10_SHADER_PACK_MATRIX_ROW_MAJOR: UINT = 1 << 3; 20 pub const D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR: UINT = 1 << 4; 21 pub const D3D10_SHADER_PARTIAL_PRECISION: UINT = 1 << 5; 22 pub const D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT: UINT = 1 << 6; 23 pub const D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT: UINT = 1 << 7; 24 pub const D3D10_SHADER_NO_PRESHADER: UINT = 1 << 8; 25 pub const D3D10_SHADER_AVOID_FLOW_CONTROL: UINT = 1 << 9; 26 pub const D3D10_SHADER_PREFER_FLOW_CONTROL: UINT = 1 << 10; 27 pub const D3D10_SHADER_ENABLE_STRICTNESS: UINT = 1 << 11; 28 pub const D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY: UINT = 1 << 12; 29 pub const D3D10_SHADER_IEEE_STRICTNESS: UINT = 1 << 13; 30 pub const D3D10_SHADER_WARNINGS_ARE_ERRORS: UINT = 1 << 18; 31 pub const D3D10_SHADER_RESOURCES_MAY_ALIAS: UINT = 1 << 19; 32 pub const D3D10_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES: UINT = 1 << 20; 33 pub const D3D10_ALL_RESOURCES_BOUND: UINT = 1 << 21; 34 pub const D3D10_SHADER_OPTIMIZATION_LEVEL0: UINT = 1 << 14; 35 pub const D3D10_SHADER_OPTIMIZATION_LEVEL1: UINT = 0; 36 pub const D3D10_SHADER_OPTIMIZATION_LEVEL2: UINT = (1 << 14) | (1 << 15); 37 pub const D3D10_SHADER_OPTIMIZATION_LEVEL3: UINT = 1 << 15; 38 pub const D3D10_SHADER_FLAGS2_FORCE_ROOT_SIGNATURE_LATEST: UINT = 0; 39 pub const D3D10_SHADER_FLAGS2_FORCE_ROOT_SIGNATURE_1_0: UINT = 1 << 4; 40 pub const D3D10_SHADER_FLAGS2_FORCE_ROOT_SIGNATURE_1_1: UINT = 1 << 5; 41 pub type D3D10_SHADER_MACRO = D3D_SHADER_MACRO; 42 pub type LPD3D10_SHADER_MACRO = *mut D3D10_SHADER_MACRO; 43 pub type D3D10_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS; 44 pub type LPD3D10_SHADER_VARIABLE_CLASS = *mut D3D10_SHADER_VARIABLE_CLASS; 45 pub type D3D10_SHADER_VARIABLE_FLAGS = D3D_SHADER_VARIABLE_FLAGS; 46 pub type LPD3D10_SHADER_VARIABLE_FLAGS = *mut D3D10_SHADER_VARIABLE_FLAGS; 47 pub type D3D10_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE; 48 pub type LPD3D10_SHADER_VARIABLE_TYPE = *mut D3D10_SHADER_VARIABLE_TYPE; 49 pub type D3D10_SHADER_INPUT_FLAGS = D3D_SHADER_INPUT_FLAGS; 50 pub type LPD3D10_SHADER_INPUT_FLAGS = *mut D3D10_SHADER_INPUT_FLAGS; 51 pub type D3D10_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE; 52 pub type LPD3D10_SHADER_INPUT_TYPE = *mut D3D10_SHADER_INPUT_TYPE; 53 pub type D3D10_SHADER_CBUFFER_FLAGS = D3D_SHADER_CBUFFER_FLAGS; 54 pub type LPD3D10_SHADER_CBUFFER_FLAGS = *mut D3D10_SHADER_CBUFFER_FLAGS; 55 pub type D3D10_CBUFFER_TYPE = D3D_CBUFFER_TYPE; 56 pub type LPD3D10_CBUFFER_TYPE = *mut D3D10_CBUFFER_TYPE; 57 pub type D3D10_NAME = D3D_NAME; 58 pub type D3D10_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE; 59 pub type D3D10_REGISTER_COMPONENT_TYPE = D3D_REGISTER_COMPONENT_TYPE; 60 pub type D3D10_INCLUDE_TYPE = D3D_INCLUDE_TYPE; 61 pub type ID3D10Include = ID3DInclude; 62 pub type LPD3D10INCLUDE = *mut ID3DInclude; 63 // const IID_ID3D10Include: IID = IID_ID3DInclude; 64 STRUCT!{struct D3D10_SHADER_DESC { 65 Version: UINT, 66 Creator: LPCSTR, 67 Flags: UINT, 68 ConstantBuffers: UINT, 69 BoundResources: UINT, 70 InputParameters: UINT, 71 OutputParameters: UINT, 72 InstructionCount: UINT, 73 TempRegisterCount: UINT, 74 TempArrayCount: UINT, 75 DefCount: UINT, 76 DclCount: UINT, 77 TextureNormalInstructions: UINT, 78 TextureLoadInstructions: UINT, 79 TextureCompInstructions: UINT, 80 TextureBiasInstructions: UINT, 81 TextureGradientInstructions: UINT, 82 FloatInstructionCount: UINT, 83 IntInstructionCount: UINT, 84 UintInstructionCount: UINT, 85 StaticFlowControlCount: UINT, 86 DynamicFlowControlCount: UINT, 87 MacroInstructionCount: UINT, 88 ArrayInstructionCount: UINT, 89 CutInstructionCount: UINT, 90 EmitInstructionCount: UINT, 91 GSOutputTopology: D3D10_PRIMITIVE_TOPOLOGY, 92 GSMaxOutputVertexCount: UINT, 93 }} 94 STRUCT!{struct D3D10_SHADER_BUFFER_DESC { 95 Name: LPCSTR, 96 Type: D3D10_CBUFFER_TYPE, 97 Variables: UINT, 98 Size: UINT, 99 uFlags: UINT, 100 }} 101 STRUCT!{struct D3D10_SHADER_VARIABLE_DESC { 102 Name: LPCSTR, 103 StartOffset: UINT, 104 Size: UINT, 105 uFlags: UINT, 106 DefaultValue: LPVOID, 107 }} 108 STRUCT!{struct D3D10_SHADER_TYPE_DESC { 109 Class: D3D10_SHADER_VARIABLE_CLASS, 110 Type: D3D10_SHADER_VARIABLE_TYPE, 111 Rows: UINT, 112 Columns: UINT, 113 Elements: UINT, 114 Members: UINT, 115 Offset: UINT, 116 }} 117 STRUCT!{struct D3D10_SHADER_INPUT_BIND_DESC { 118 Name: LPCSTR, 119 Type: D3D10_SHADER_INPUT_TYPE, 120 BindPoint: UINT, 121 BindCount: UINT, 122 uFlags: UINT, 123 ReturnType: D3D10_RESOURCE_RETURN_TYPE, 124 Dimension: D3D10_SRV_DIMENSION, 125 NumSamples: UINT, 126 }} 127 STRUCT!{struct D3D10_SIGNATURE_PARAMETER_DESC { 128 SemanticName: LPCSTR, 129 SemanticIndex: UINT, 130 Register: UINT, 131 SystemValueType: D3D10_NAME, 132 ComponentType: D3D10_REGISTER_COMPONENT_TYPE, 133 Mask: BYTE, 134 ReadWriteMask: BYTE, 135 }} 136 pub type LPD3D10SHADERREFLECTIONTYPE = *mut ID3D10ShaderReflectionType; 137 DEFINE_GUID!{IID_ID3D10ShaderReflectionType, 138 0xc530ad7d, 0x9b16, 0x4395, 0xa9, 0x79, 0xba, 0x2e, 0xcf, 0xf8, 0x3a, 0xdd} 139 RIDL!{#[uuid(0xc530ad7d, 0x9b16, 0x4395, 0xa9, 0x79, 0xba, 0x2e, 0xcf, 0xf8, 0x3a, 0xdd)] 140 interface ID3D10ShaderReflectionType(ID3D10ShaderReflectionTypeVtbl) { 141 fn GetDesc( 142 pDesc: *mut D3D10_SHADER_TYPE_DESC, 143 ) -> HRESULT, 144 fn GetMemberTypeByIndex( 145 Index: UINT, 146 ) -> *mut ID3D10ShaderReflectionType, 147 fn GetMemberTypeByName( 148 Name: LPCSTR, 149 ) -> *mut ID3D10ShaderReflectionType, 150 fn GetMemberTypeName( 151 Index: UINT, 152 ) -> LPCSTR, 153 }} 154 pub type LPD3D10SHADERREFLECTIONVARIABLE = *mut ID3D10ShaderReflectionVariable; 155 DEFINE_GUID!{IID_ID3D10ShaderReflectionVariable, 156 0x1bf63c95, 0x2650, 0x405d, 0x99, 0xc1, 0x36, 0x36, 0xbd, 0x1d, 0xa0, 0xa1} 157 RIDL!{#[uuid(0x1bf63c95, 0x2650, 0x405d, 0x99, 0xc1, 0x36, 0x36, 0xbd, 0x1d, 0xa0, 0xa1)] 158 interface ID3D10ShaderReflectionVariable(ID3D10ShaderReflectionVariableVtbl) { 159 fn GetDesc( 160 pDesc: *mut D3D10_SHADER_VARIABLE_DESC, 161 ) -> HRESULT, 162 fn GetType() -> *mut ID3D10ShaderReflectionType, 163 }} 164 pub type LPD3D10SHADERREFLECTIONCONSTANTBUFFER = *mut ID3D10ShaderReflectionConstantBuffer; 165 DEFINE_GUID!{IID_ID3D10ShaderReflectionConstantBuffer, 166 0x66c66a94, 0xdddd, 0x4b62, 0xa6, 0x6a, 0xf0, 0xda, 0x33, 0xc2, 0xb4, 0xd0} 167 RIDL!{#[uuid(0x66c66a94, 0xdddd, 0x4b62, 0xa6, 0x6a, 0xf0, 0xda, 0x33, 0xc2, 0xb4, 0xd0)] 168 interface ID3D10ShaderReflectionConstantBuffer(ID3D10ShaderReflectionConstantBufferVtbl) { 169 fn GetDesc( 170 pDesc: *mut D3D10_SHADER_BUFFER_DESC, 171 ) -> HRESULT, 172 fn GetVariableByIndex( 173 Index: UINT, 174 ) -> *mut ID3D10ShaderReflectionVariable, 175 fn GetVariableByName( 176 Name: LPCSTR, 177 ) -> *mut ID3D10ShaderReflectionVariable, 178 }} 179 pub type LPD3D10SHADERREFLECTION = *mut ID3D10ShaderReflection; 180 DEFINE_GUID!{IID_ID3D10ShaderReflection, 181 0xd40e20b6, 0xf8f7, 0x42ad, 0xab, 0x20, 0x4b, 0xaf, 0x8f, 0x15, 0xdf, 0xaa} 182 RIDL!{#[uuid(0xd40e20b6, 0xf8f7, 0x42ad, 0xab, 0x20, 0x4b, 0xaf, 0x8f, 0x15, 0xdf, 0xaa)] 183 interface ID3D10ShaderReflection(ID3D10ShaderReflectionVtbl): IUnknown(IUnknownVtbl) { 184 fn GetDesc( 185 pDesc: *mut D3D10_SHADER_DESC, 186 ) -> HRESULT, 187 fn GetConstantBufferByIndex( 188 Index: UINT, 189 ) -> *mut ID3D10ShaderReflectionConstantBuffer, 190 fn GetConstantBufferByName( 191 Name: LPCSTR, 192 ) -> *mut ID3D10ShaderReflectionConstantBuffer, 193 fn GetResourceBindingDesc( 194 ResourceIndex: UINT, 195 pDesc: *mut D3D10_SHADER_INPUT_BIND_DESC, 196 ) -> HRESULT, 197 fn GetInputParameterDesc( 198 ParameterIndex: UINT, 199 pDesc: *mut D3D10_SIGNATURE_PARAMETER_DESC, 200 ) -> HRESULT, 201 fn GetOutputParameterDesc( 202 ParameterIndex: UINT, 203 pDesc: *mut D3D10_SIGNATURE_PARAMETER_DESC, 204 ) -> HRESULT, 205 }} 206 // TODO Some functions 207