]> git.notmuchmail.org Git - apitrace/blob - specs/d3d11shader.py
d3dretrace: Recognize IDirect3DDevice9Ex::PresentEx as frame terminator.
[apitrace] / specs / d3d11shader.py
1 ##########################################################################
2 #
3 # Copyright 2012 Jose Fonseca
4 # All Rights Reserved.
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining a copy
7 # of this software and associated documentation files (the "Software"), to deal
8 # in the Software without restriction, including without limitation the rights
9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 # copies of the Software, and to permit persons to whom the Software is
11 # furnished to do so, subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 # THE SOFTWARE.
23 #
24 ##########################################################################/
25
26
27 from d3dcommon import *
28
29
30 ID3D11ShaderReflectionType = Interface("ID3D11ShaderReflectionType", IUnknown)
31 ID3D11ShaderReflectionVariable = Interface("ID3D11ShaderReflectionVariable", IUnknown)
32 ID3D11ShaderReflectionConstantBuffer = Interface("ID3D11ShaderReflectionConstantBuffer", IUnknown)
33 ID3D11ShaderReflection = Interface("ID3D11ShaderReflection", IUnknown)
34
35
36 D3D11_SHADER_VERSION_TYPE = Enum("D3D11_SHADER_VERSION_TYPE", [
37     "D3D11_SHVER_PIXEL_SHADER",
38     "D3D11_SHVER_VERTEX_SHADER",
39     "D3D11_SHVER_GEOMETRY_SHADER",
40     "D3D11_SHVER_HULL_SHADER",
41     "D3D11_SHVER_DOMAIN_SHADER",
42     "D3D11_SHVER_COMPUTE_SHADER",
43 ])
44
45 D3D11_SIGNATURE_PARAMETER_DESC = Struct("D3D11_SIGNATURE_PARAMETER_DESC", [
46     (LPCSTR, "SemanticName"),
47     (UINT, "SemanticIndex"),
48     (UINT, "Register"),
49     (D3D_NAME, "SystemValueType"),
50     (D3D_REGISTER_COMPONENT_TYPE, "ComponentType"),
51     (BYTE, "Mask"),
52     (BYTE, "ReadWriteMask"),
53     (UINT, "Stream"),
54 ])
55
56 D3D11_SHADER_BUFFER_DESC = Struct("D3D11_SHADER_BUFFER_DESC", [
57     (LPCSTR, "Name"),
58     (D3D_CBUFFER_TYPE, "Type"),
59     (UINT, "Variables"),
60     (UINT, "Size"),
61     (UINT, "uFlags"),
62 ])
63
64 D3D11_SHADER_VARIABLE_DESC = Struct("D3D11_SHADER_VARIABLE_DESC", [
65     (LPCSTR, "Name"),
66     (UINT, "StartOffset"),
67     (UINT, "Size"),
68     (UINT, "uFlags"),
69     (LPVOID, "DefaultValue"),
70     (UINT, "StartTexture"),
71     (UINT, "TextureSize"),
72     (UINT, "StartSampler"),
73     (UINT, "SamplerSize"),
74 ])
75
76 D3D11_SHADER_TYPE_DESC = Struct("D3D11_SHADER_TYPE_DESC", [
77     (D3D_SHADER_VARIABLE_CLASS, "Class"),
78     (D3D_SHADER_VARIABLE_TYPE, "Type"),
79     (UINT, "Rows"),
80     (UINT, "Columns"),
81     (UINT, "Elements"),
82     (UINT, "Members"),
83     (UINT, "Offset"),
84     (LPCSTR, "Name"),
85 ])
86
87 D3D11_SHADER_DESC = Struct("D3D11_SHADER_DESC", [
88     (UINT, "Version"),
89     (LPCSTR, "Creator"),
90     (UINT, "Flags"),
91     (UINT, "ConstantBuffers"),
92     (UINT, "BoundResources"),
93     (UINT, "InputParameters"),
94     (UINT, "OutputParameters"),
95     (UINT, "InstructionCount"),
96     (UINT, "TempRegisterCount"),
97     (UINT, "TempArrayCount"),
98     (UINT, "DefCount"),
99     (UINT, "DclCount"),
100     (UINT, "TextureNormalInstructions"),
101     (UINT, "TextureLoadInstructions"),
102     (UINT, "TextureCompInstructions"),
103     (UINT, "TextureBiasInstructions"),
104     (UINT, "TextureGradientInstructions"),
105     (UINT, "FloatInstructionCount"),
106     (UINT, "IntInstructionCount"),
107     (UINT, "UintInstructionCount"),
108     (UINT, "StaticFlowControlCount"),
109     (UINT, "DynamicFlowControlCount"),
110     (UINT, "MacroInstructionCount"),
111     (UINT, "ArrayInstructionCount"),
112     (UINT, "CutInstructionCount"),
113     (UINT, "EmitInstructionCount"),
114     (D3D_PRIMITIVE_TOPOLOGY, "GSOutputTopology"),
115     (UINT, "GSMaxOutputVertexCount"),
116     (D3D_PRIMITIVE, "InputPrimitive"),
117     (UINT, "PatchConstantParameters"),
118     (UINT, "cGSInstanceCount"),
119     (UINT, "cControlPoints"),
120     (D3D_TESSELLATOR_OUTPUT_PRIMITIVE, "HSOutputPrimitive"),
121     (D3D_TESSELLATOR_PARTITIONING, "HSPartitioning"),
122     (D3D_TESSELLATOR_DOMAIN, "TessellatorDomain"),
123     (UINT, "cBarrierInstructions"),
124     (UINT, "cInterlockedInstructions"),
125     (UINT, "cTextureStoreInstructions"),
126 ])
127
128 D3D11_SHADER_INPUT_BIND_DESC = Struct("D3D11_SHADER_INPUT_BIND_DESC", [
129     (LPCSTR, "Name"),
130     (D3D_SHADER_INPUT_TYPE, "Type"),
131     (UINT, "BindPoint"),
132     (UINT, "BindCount"),
133     (UINT, "uFlags"),
134     (D3D_RESOURCE_RETURN_TYPE, "ReturnType"),
135     (D3D_SRV_DIMENSION, "Dimension"),
136     (UINT, "NumSamples"),
137 ])
138
139 ID3D11ShaderReflectionType.methods += [
140     StdMethod(HRESULT, "GetDesc", [Out(Pointer(D3D11_SHADER_TYPE_DESC), "pDesc")], sideeffects=False),
141     StdMethod(ObjPointer(ID3D11ShaderReflectionType), "GetMemberTypeByIndex", [(UINT, "Index")]),
142     StdMethod(ObjPointer(ID3D11ShaderReflectionType), "GetMemberTypeByName", [(LPCSTR, "Name")]),
143     StdMethod(LPCSTR, "GetMemberTypeName", [(UINT, "Index")], sideeffects=False),
144     StdMethod(HRESULT, "IsEqual", [(ObjPointer(ID3D11ShaderReflectionType), "pType")], sideeffects=False),
145     StdMethod(ObjPointer(ID3D11ShaderReflectionType), "GetSubType", []),
146     StdMethod(ObjPointer(ID3D11ShaderReflectionType), "GetBaseClass", []),
147     StdMethod(UINT, "GetNumInterfaces", [], sideeffects=False),
148     StdMethod(ObjPointer(ID3D11ShaderReflectionType), "GetInterfaceByIndex", [(UINT, "uIndex")]),
149     StdMethod(HRESULT, "IsOfType", [(ObjPointer(ID3D11ShaderReflectionType), "pType")], sideeffects=False),
150     StdMethod(HRESULT, "ImplementsInterface", [(ObjPointer(ID3D11ShaderReflectionType), "pBase")], sideeffects=False),
151 ]
152
153 ID3D11ShaderReflectionVariable.methods += [
154     StdMethod(HRESULT, "GetDesc", [Out(Pointer(D3D11_SHADER_VARIABLE_DESC), "pDesc")], sideeffects=False),
155     StdMethod(ObjPointer(ID3D11ShaderReflectionType), "GetType", []),
156     StdMethod(ObjPointer(ID3D11ShaderReflectionConstantBuffer), "GetBuffer", []),
157     StdMethod(UINT, "GetInterfaceSlot", [(UINT, "uArrayIndex")], sideeffects=False),
158 ]
159
160 ID3D11ShaderReflectionConstantBuffer.methods += [
161     StdMethod(HRESULT, "GetDesc", [Out(Pointer(D3D11_SHADER_BUFFER_DESC), "pDesc")], sideeffects=False),
162     StdMethod(ObjPointer(ID3D11ShaderReflectionVariable), "GetVariableByIndex", [(UINT, "Index")]),
163     StdMethod(ObjPointer(ID3D11ShaderReflectionVariable), "GetVariableByName", [(LPCSTR, "Name")]),
164 ]
165
166 ID3D11ShaderReflection.methods += [
167     StdMethod(HRESULT, "GetDesc", [Out(Pointer(D3D11_SHADER_DESC), "pDesc")]),
168     StdMethod(ObjPointer(ID3D11ShaderReflectionConstantBuffer), "GetConstantBufferByIndex", [(UINT, "Index")]),
169     StdMethod(ObjPointer(ID3D11ShaderReflectionConstantBuffer), "GetConstantBufferByName", [(LPCSTR, "Name")]),
170     StdMethod(HRESULT, "GetResourceBindingDesc", [(UINT, "ResourceIndex"), Out(Pointer(D3D11_SHADER_INPUT_BIND_DESC), "pDesc")]),
171     StdMethod(HRESULT, "GetInputParameterDesc", [(UINT, "ParameterIndex"), Out(Pointer(D3D11_SIGNATURE_PARAMETER_DESC), "pDesc")]),
172     StdMethod(HRESULT, "GetOutputParameterDesc", [(UINT, "ParameterIndex"), Out(Pointer(D3D11_SIGNATURE_PARAMETER_DESC), "pDesc")]),
173     StdMethod(HRESULT, "GetPatchConstantParameterDesc", [(UINT, "ParameterIndex"), Out(Pointer(D3D11_SIGNATURE_PARAMETER_DESC), "pDesc")]),
174     StdMethod(ObjPointer(ID3D11ShaderReflectionVariable), "GetVariableByName", [(LPCSTR, "Name")]),
175     StdMethod(HRESULT, "GetResourceBindingDescByName", [(LPCSTR, "Name"), Out(Pointer(D3D11_SHADER_INPUT_BIND_DESC), "pDesc")]),
176     StdMethod(UINT, "GetMovInstructionCount", [], sideeffects=False),
177     StdMethod(UINT, "GetMovcInstructionCount", [], sideeffects=False),
178     StdMethod(UINT, "GetConversionInstructionCount", [], sideeffects=False),
179     StdMethod(UINT, "GetBitwiseInstructionCount", [], sideeffects=False),
180     StdMethod(D3D_PRIMITIVE, "GetGSInputPrimitive", [], sideeffects=False),
181     StdMethod(BOOL, "IsSampleFrequencyShader", [], sideeffects=False),
182     StdMethod(UINT, "GetNumInterfaceSlots", [], sideeffects=False),
183     StdMethod(HRESULT, "GetMinFeatureLevel", [Out(Pointer(D3D_FEATURE_LEVEL), "pLevel")]),
184     StdMethod(UINT, "GetThreadGroupSize", [Out(Pointer(UINT), "pSizeX"), Out(Pointer(UINT), "pSizeY"), Out(Pointer(UINT), "pSizeZ")], sideeffects=False),
185 ]
186