1 #undef INTERFACE 2 /* 3 * Copyright 2009 Henri Verbeet for CodeWeavers 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 18 * 19 */ 20 21 #ifndef __WINE_D3D10SHADER_H 22 #define __WINE_D3D10SHADER_H 23 24 #include "d3d10.h" 25 26 #define D3D10_SHADER_DEBUG 0x0001 27 #define D3D10_SHADER_SKIP_VALIDATION 0x0002 28 #define D3D10_SHADER_SKIP_OPTIMIZATION 0x0004 29 #define D3D10_SHADER_PACK_MATRIX_ROW_MAJOR 0x0008 30 #define D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR 0x0010 31 #define D3D10_SHADER_PARTIAL_PRECISION 0x0020 32 #define D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT 0x0040 33 #define D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT 0x0080 34 #define D3D10_SHADER_NO_PRESHADER 0x0100 35 #define D3D10_SHADER_AVOID_FLOW_CONTROL 0x0200 36 #define D3D10_SHADER_PREFER_FLOW_CONTROL 0x0400 37 #define D3D10_SHADER_ENABLE_STRICTNESS 0x0800 38 #define D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY 0x1000 39 #define D3D10_SHADER_IEEE_STRICTNESS 0x2000 40 #define D3D10_SHADER_WARNINGS_ARE_ERRORS 0x40000 41 42 #define D3D10_SHADER_OPTIMIZATION_LEVEL0 0x4000 43 #define D3D10_SHADER_OPTIMIZATION_LEVEL1 0x0000 44 #define D3D10_SHADER_OPTIMIZATION_LEVEL2 0xC000 45 #define D3D10_SHADER_OPTIMIZATION_LEVEL3 0x8000 46 47 /* These are defined as version-neutral in d3dcommon.h */ 48 typedef D3D_SHADER_MACRO D3D10_SHADER_MACRO; 49 typedef D3D_SHADER_MACRO *LPD3D10_SHADER_MACRO; 50 51 typedef D3D_SHADER_VARIABLE_CLASS D3D10_SHADER_VARIABLE_CLASS; 52 typedef D3D_SHADER_VARIABLE_CLASS *LPD3D10_SHADER_VARIABLE_CLASS; 53 54 typedef D3D_CBUFFER_TYPE D3D10_CBUFFER_TYPE; 55 typedef D3D_CBUFFER_TYPE *LPD3D10_CBUFFER_TYPE; 56 57 typedef D3D_REGISTER_COMPONENT_TYPE D3D10_REGISTER_COMPONENT_TYPE; 58 59 typedef D3D_RESOURCE_RETURN_TYPE D3D10_RESOURCE_RETURN_TYPE; 60 61 typedef D3D_NAME D3D10_NAME; 62 63 typedef D3D_SHADER_INPUT_TYPE D3D10_SHADER_INPUT_TYPE; 64 typedef D3D_SHADER_INPUT_TYPE *LPD3D10_SHADER_INPUT_TYPE; 65 66 typedef D3D_SHADER_VARIABLE_TYPE D3D10_SHADER_VARIABLE_TYPE; 67 typedef D3D_SHADER_VARIABLE_TYPE *LPD3D10_SHADER_VARIABLE_TYPE; 68 69 typedef D3D_INCLUDE_TYPE D3D10_INCLUDE_TYPE; 70 typedef ID3DInclude ID3D10Include; 71 typedef ID3DInclude *LPD3D10INCLUDE; 72 #define IID_ID3D10Include IID_ID3DInclude 73 74 typedef struct _D3D10_SHADER_INPUT_BIND_DESC 75 { 76 LPCSTR Name; 77 D3D10_SHADER_INPUT_TYPE Type; 78 UINT BindPoint; 79 UINT BindCount; 80 UINT uFlags; 81 D3D10_RESOURCE_RETURN_TYPE ReturnType; 82 D3D10_SRV_DIMENSION Dimension; 83 UINT NumSamples; 84 } D3D10_SHADER_INPUT_BIND_DESC; 85 86 typedef struct _D3D10_SIGNATURE_PARAMETER_DESC 87 { 88 LPCSTR SemanticName; 89 UINT SemanticIndex; 90 UINT Register; 91 D3D10_NAME SystemValueType; 92 D3D10_REGISTER_COMPONENT_TYPE ComponentType; 93 BYTE Mask; 94 BYTE ReadWriteMask; 95 } D3D10_SIGNATURE_PARAMETER_DESC; 96 97 typedef struct _D3D10_SHADER_DESC 98 { 99 UINT Version; 100 LPCSTR Creator; 101 UINT Flags; 102 UINT ConstantBuffers; 103 UINT BoundResources; 104 UINT InputParameters; 105 UINT OutputParameters; 106 UINT InstructionCount; 107 UINT TempRegisterCount; 108 UINT TempArrayCount; 109 UINT DefCount; 110 UINT DclCount; 111 UINT TextureNormalInstructions; 112 UINT TextureLoadInstructions; 113 UINT TextureCompInstructions; 114 UINT TextureBiasInstructions; 115 UINT TextureGradientInstructions; 116 UINT FloatInstructionCount; 117 UINT IntInstructionCount; 118 UINT UintInstructionCount; 119 UINT StaticFlowControlCount; 120 UINT DynamicFlowControlCount; 121 UINT MacroInstructionCount; 122 UINT ArrayInstructionCount; 123 UINT CutInstructionCount; 124 UINT EmitInstructionCount; 125 D3D10_PRIMITIVE_TOPOLOGY GSOutputTopology; 126 UINT GSMaxOutputVertexCount; 127 } D3D10_SHADER_DESC; 128 129 typedef struct _D3D10_SHADER_BUFFER_DESC 130 { 131 LPCSTR Name; 132 D3D10_CBUFFER_TYPE Type; 133 UINT Variables; 134 UINT Size; 135 UINT uFlags; 136 } D3D10_SHADER_BUFFER_DESC; 137 138 typedef struct _D3D10_SHADER_VARIABLE_DESC 139 { 140 LPCSTR Name; 141 UINT StartOffset; 142 UINT Size; 143 UINT uFlags; 144 LPVOID DefaultValue; 145 } D3D10_SHADER_VARIABLE_DESC; 146 147 typedef struct _D3D10_SHADER_TYPE_DESC 148 { 149 D3D10_SHADER_VARIABLE_CLASS Class; 150 D3D10_SHADER_VARIABLE_TYPE Type; 151 UINT Rows; 152 UINT Columns; 153 UINT Elements; 154 UINT Members; 155 UINT Offset; 156 } D3D10_SHADER_TYPE_DESC; 157 158 DEFINE_GUID(IID_ID3D10ShaderReflectionType, 0xc530ad7d, 0x9b16, 0x4395, 0xa9, 0x79, 0xba, 0x2e, 0xcf, 0xf8, 0x3a, 0xdd); 159 160 #define INTERFACE ID3D10ShaderReflectionType 161 DECLARE_INTERFACE(ID3D10ShaderReflectionType) 162 { 163 STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_TYPE_DESC *desc) PURE; 164 STDMETHOD_(struct ID3D10ShaderReflectionType *, GetMemberTypeByIndex)(THIS_ UINT index) PURE; 165 STDMETHOD_(struct ID3D10ShaderReflectionType *, GetMemberTypeByName)(THIS_ LPCSTR name) PURE; 166 STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ UINT index) PURE; 167 }; 168 #undef INTERFACE 169 170 DEFINE_GUID(IID_ID3D10ShaderReflectionVariable, 0x1bf63c95, 0x2650, 0x405d, 0x99, 0xc1, 0x36, 0x36, 0xbd, 0x1d, 0xa0, 0xa1); 171 172 #define INTERFACE ID3D10ShaderReflectionVariable 173 DECLARE_INTERFACE(ID3D10ShaderReflectionVariable) 174 { 175 STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_VARIABLE_DESC *desc) PURE; 176 STDMETHOD_(struct ID3D10ShaderReflectionType *, GetType)(THIS) PURE; 177 }; 178 #undef INTERFACE 179 180 DEFINE_GUID(IID_ID3D10ShaderReflectionConstantBuffer, 0x66c66a94, 0xdddd, 0x4b62, 0xa6, 0x6a, 0xf0, 0xda, 0x33, 0xc2, 0xb4, 0xd0); 181 182 #define INTERFACE ID3D10ShaderReflectionConstantBuffer 183 DECLARE_INTERFACE(ID3D10ShaderReflectionConstantBuffer) 184 { 185 STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_BUFFER_DESC *desc) PURE; 186 STDMETHOD_(struct ID3D10ShaderReflectionVariable *, GetVariableByIndex)(THIS_ UINT index) PURE; 187 STDMETHOD_(struct ID3D10ShaderReflectionVariable *, GetVariableByName)(THIS_ LPCSTR name) PURE; 188 }; 189 #undef INTERFACE 190 191 DEFINE_GUID(IID_ID3D10ShaderReflection, 0xd40e20b6, 0xf8f7, 0x42ad, 0xab, 0x20, 0x4b, 0xaf, 0x8f, 0x15, 0xdf, 0xaa); 192 193 #define INTERFACE ID3D10ShaderReflection 194 DECLARE_INTERFACE_(ID3D10ShaderReflection, IUnknown) 195 { 196 /* IUnknown methods */ 197 STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *object) PURE; 198 STDMETHOD_(ULONG, AddRef)(THIS) PURE; 199 STDMETHOD_(ULONG, Release)(THIS) PURE; 200 /* ID3D10ShaderReflection methods */ 201 STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_DESC *desc) PURE; 202 STDMETHOD_(struct ID3D10ShaderReflectionConstantBuffer *, GetConstantBufferByIndex)(THIS_ UINT index) PURE; 203 STDMETHOD_(struct ID3D10ShaderReflectionConstantBuffer *, GetConstantBufferByName)(THIS_ LPCSTR name) PURE; 204 STDMETHOD(GetResourceBindingDesc)(THIS_ UINT index, D3D10_SHADER_INPUT_BIND_DESC *desc) PURE; 205 STDMETHOD(GetInputParameterDesc)(THIS_ UINT index, D3D10_SIGNATURE_PARAMETER_DESC *desc) PURE; 206 STDMETHOD(GetOutputParameterDesc)(THIS_ UINT index, D3D10_SIGNATURE_PARAMETER_DESC *desc) PURE; 207 }; 208 #undef INTERFACE 209 210 211 #ifdef __cplusplus 212 extern "C" { 213 #endif 214 215 HRESULT WINAPI D3D10CompileShader(LPCSTR data, SIZE_T data_size, LPCSTR filename, 216 const D3D10_SHADER_MACRO *defines, ID3D10Include *include, LPCSTR entrypoint, 217 LPCSTR profile, UINT flags, ID3D10Blob **shader, ID3D10Blob **error_messages); 218 HRESULT WINAPI D3D10DisassembleShader(const void *data, SIZE_T data_size, 219 WINBOOL color_code, const char *comments, ID3D10Blob **disassembly); 220 LPCSTR WINAPI D3D10GetVertexShaderProfile(ID3D10Device *device); 221 LPCSTR WINAPI D3D10GetGeometryShaderProfile(ID3D10Device *device); 222 LPCSTR WINAPI D3D10GetPixelShaderProfile(ID3D10Device *device); 223 224 HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10ShaderReflection **reflector); 225 HRESULT WINAPI D3D10GetInputSignatureBlob(const void *data, SIZE_T data_size, ID3D10Blob **blob); 226 HRESULT WINAPI D3D10GetOutputSignatureBlob(const void *data, SIZE_T data_size, ID3D10Blob **blob); 227 HRESULT WINAPI D3D10GetInputAndOutputSignatureBlob(const void *data, SIZE_T data_size, ID3D10Blob **blob); 228 HRESULT WINAPI D3D10GetShaderDebugInfo(const void *data, SIZE_T data_size, ID3D10Blob **blob); 229 230 #ifdef __cplusplus 231 } 232 #endif 233 234 #endif /* __WINE_D3D10SHADER_H */ 235