From: José Fonseca Date: Fri, 4 May 2012 10:49:19 +0000 (+0100) Subject: Trace all d3d10.dll functions. X-Git-Url: https://git.cworth.org/git?p=apitrace;a=commitdiff_plain;h=467a42ac831785ae02386ed2f17f3ad14fe824cb Trace all d3d10.dll functions. --- diff --git a/specs/d3d10.py b/specs/d3d10.py index defad5a..d2b42ce 100644 --- a/specs/d3d10.py +++ b/specs/d3d10.py @@ -897,3 +897,11 @@ ID3D10Multithread.methods += [ Method(BOOL, "GetMultithreadProtected", []), ] + +d3d10 = API("d3d10") + + +from d3d10sdklayers import * +import d3d10misc +import d3d10shader +import d3d10effect diff --git a/specs/d3d10_1.py b/specs/d3d10_1.py index e426772..5703a2f 100644 --- a/specs/d3d10_1.py +++ b/specs/d3d10_1.py @@ -26,17 +26,8 @@ """d3d10_1.h""" from winapi import * -from d3d10sdklayers import * from d3d10 import * -ID3D10Blob = Interface("ID3D10Blob", IUnknown) -LPD3D10BLOB = ObjPointer(ID3D10Blob) - -ID3D10Blob.methods += [ - Method(LPVOID, "GetBufferPointer", []), - Method(SIZE_T, "GetBufferSize", []), -] - D3D10_DRIVER_TYPE = Enum("D3D10_DRIVER_TYPE", [ "D3D10_DRIVER_TYPE_HARDWARE", "D3D10_DRIVER_TYPE_REFERENCE", diff --git a/specs/d3d10effect.py b/specs/d3d10effect.py new file mode 100644 index 0000000..57746aa --- /dev/null +++ b/specs/d3d10effect.py @@ -0,0 +1,384 @@ +########################################################################## +# +# Copyright 2012 Jose Fonseca +# All Rights Reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +##########################################################################/ + + +from d3d10 import * + +from d3d10shader import * + + +ID3D10StateBlock = Interface("ID3D10StateBlock", IUnknown) +ID3D10EffectType = Interface("ID3D10EffectType") +ID3D10EffectVariable = Interface("ID3D10EffectVariable") +ID3D10EffectScalarVariable = Interface("ID3D10EffectScalarVariable", ID3D10EffectVariable) +ID3D10EffectVectorVariable = Interface("ID3D10EffectVectorVariable", ID3D10EffectVariable) +ID3D10EffectMatrixVariable = Interface("ID3D10EffectMatrixVariable", ID3D10EffectVariable) +ID3D10EffectStringVariable = Interface("ID3D10EffectStringVariable", ID3D10EffectVariable) +ID3D10EffectShaderResourceVariable = Interface("ID3D10EffectShaderResourceVariable", ID3D10EffectVariable) +ID3D10EffectRenderTargetViewVariable = Interface("ID3D10EffectRenderTargetViewVariable", ID3D10EffectVariable) +ID3D10EffectDepthStencilViewVariable = Interface("ID3D10EffectDepthStencilViewVariable", ID3D10EffectVariable) +ID3D10EffectConstantBuffer = Interface("ID3D10EffectConstantBuffer", ID3D10EffectVariable) +ID3D10EffectShaderVariable = Interface("ID3D10EffectShaderVariable", ID3D10EffectVariable) +ID3D10EffectBlendVariable = Interface("ID3D10EffectBlendVariable", ID3D10EffectVariable) +ID3D10EffectDepthStencilVariable = Interface("ID3D10EffectDepthStencilVariable", ID3D10EffectVariable) +ID3D10EffectRasterizerVariable = Interface("ID3D10EffectRasterizerVariable", ID3D10EffectVariable) +ID3D10EffectSamplerVariable = Interface("ID3D10EffectSamplerVariable", ID3D10EffectVariable) +ID3D10EffectPass = Interface("ID3D10EffectPass") +ID3D10EffectTechnique = Interface("ID3D10EffectTechnique") +ID3D10Effect = Interface("ID3D10Effect", IUnknown) +ID3D10EffectPool = Interface("ID3D10EffectPool", IUnknown) + + +D3D10_DEVICE_STATE_TYPES = Enum("D3D10_DEVICE_STATE_TYPES", [ + "D3D10_DST_SO_BUFFERS", + "D3D10_DST_OM_RENDER_TARGETS", + "D3D10_DST_OM_DEPTH_STENCIL_STATE", + "D3D10_DST_OM_BLEND_STATE", + "D3D10_DST_VS", + "D3D10_DST_VS_SAMPLERS", + "D3D10_DST_VS_SHADER_RESOURCES", + "D3D10_DST_VS_CONSTANT_BUFFERS", + "D3D10_DST_GS", + "D3D10_DST_GS_SAMPLERS", + "D3D10_DST_GS_SHADER_RESOURCES", + "D3D10_DST_GS_CONSTANT_BUFFERS", + "D3D10_DST_PS", + "D3D10_DST_PS_SAMPLERS", + "D3D10_DST_PS_SHADER_RESOURCES", + "D3D10_DST_PS_CONSTANT_BUFFERS", + "D3D10_DST_IA_VERTEX_BUFFERS", + "D3D10_DST_IA_INDEX_BUFFER", + "D3D10_DST_IA_INPUT_LAYOUT", + "D3D10_DST_IA_PRIMITIVE_TOPOLOGY", + "D3D10_DST_RS_VIEWPORTS", + "D3D10_DST_RS_SCISSOR_RECTS", + "D3D10_DST_RS_RASTERIZER_STATE", + "D3D10_DST_PREDICATION", +]) + +D3D10_STATE_BLOCK_MASK = Struct("D3D10_STATE_BLOCK_MASK", [ + (BYTE, "VS"), + (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT)"), "VSSamplers"), + (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)"), "VSShaderResources"), + (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)"), "VSConstantBuffers"), + (BYTE, "GS"), + (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT)"), "GSSamplers"), + (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)"), "GSShaderResources"), + (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)"), "GSConstantBuffers"), + (BYTE, "PS"), + (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT)"), "PSSamplers"), + (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)"), "PSShaderResources"), + (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)"), "PSConstantBuffers"), + (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT)"), "IAVertexBuffers"), + (BYTE, "IAIndexBuffer"), + (BYTE, "IAInputLayout"), + (BYTE, "IAPrimitiveTopology"), + (BYTE, "OMRenderTargets"), + (BYTE, "OMDepthStencilState"), + (BYTE, "OMBlendState"), + (BYTE, "RSViewports"), + (BYTE, "RSScissorRects"), + (BYTE, "RSRasterizerState"), + (BYTE, "SOBuffers"), + (BYTE, "Predication"), +]) + +ID3D10StateBlock.methods += [ + StdMethod(HRESULT, "Capture", []), + StdMethod(HRESULT, "Apply", []), + StdMethod(HRESULT, "ReleaseAllDeviceObjects", []), + StdMethod(HRESULT, "GetDevice", [Out(Pointer(ObjPointer(ID3D10Device)), "ppDevice")]), +] + +D3D10_EFFECT = Flags(UINT, [ + "D3D10_EFFECT_COMPILE_CHILD_EFFECT", + "D3D10_EFFECT_COMPILE_ALLOW_SLOW_OPS", + "D3D10_EFFECT_SINGLE_THREADED", + "D3D10_EFFECT_VARIABLE_POOLED", + "D3D10_EFFECT_VARIABLE_ANNOTATION", + "D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT", +]) + +D3D10_EFFECT_TYPE_DESC = Struct("D3D10_EFFECT_TYPE_DESC", [ + (LPCSTR, "TypeName"), + (D3D10_SHADER_VARIABLE_CLASS, "Class"), + (D3D10_SHADER_VARIABLE_TYPE, "Type"), + (UINT, "Elements"), + (UINT, "Members"), + (UINT, "Rows"), + (UINT, "Columns"), + (UINT, "PackedSize"), + (UINT, "UnpackedSize"), + (UINT, "Stride"), +]) + +ID3D10EffectType.methods += [ + StdMethod(BOOL, "IsValid", []), + StdMethod(HRESULT, "GetDesc", [(Pointer(D3D10_EFFECT_TYPE_DESC), "pDesc")]), + StdMethod(ObjPointer(ID3D10EffectType), "GetMemberTypeByIndex", [(UINT, "Index")]), + StdMethod(ObjPointer(ID3D10EffectType), "GetMemberTypeByName", [(LPCSTR, "Name")]), + StdMethod(ObjPointer(ID3D10EffectType), "GetMemberTypeBySemantic", [(LPCSTR, "Semantic")]), + StdMethod(LPCSTR, "GetMemberName", [(UINT, "Index")]), + StdMethod(LPCSTR, "GetMemberSemantic", [(UINT, "Index")]), +] + +D3D10_EFFECT_VARIABLE_DESC = Struct("D3D10_EFFECT_VARIABLE_DESC", [ + (LPCSTR, "Name"), + (LPCSTR, "Semantic"), + (UINT, "Flags"), + (UINT, "Annotations"), + (UINT, "BufferOffset"), + (UINT, "ExplicitBindPoint"), +]) + +ID3D10EffectVariable.methods += [ + StdMethod(BOOL, "IsValid", []), + StdMethod(ObjPointer(ID3D10EffectType), "GetType", []), + StdMethod(HRESULT, "GetDesc", [Out(Pointer(D3D10_EFFECT_VARIABLE_DESC), "pDesc")]), + StdMethod(ObjPointer(ID3D10EffectVariable), "GetAnnotationByIndex", [(UINT, "Index")]), + StdMethod(ObjPointer(ID3D10EffectVariable), "GetAnnotationByName", [(LPCSTR, "Name")]), + StdMethod(ObjPointer(ID3D10EffectVariable), "GetMemberByIndex", [(UINT, "Index")]), + StdMethod(ObjPointer(ID3D10EffectVariable), "GetMemberByName", [(LPCSTR, "Name")]), + StdMethod(ObjPointer(ID3D10EffectVariable), "GetMemberBySemantic", [(LPCSTR, "Semantic")]), + StdMethod(ObjPointer(ID3D10EffectVariable), "GetElement", [(UINT, "Index")]), + StdMethod(ObjPointer(ID3D10EffectConstantBuffer), "GetParentConstantBuffer", []), + StdMethod(ObjPointer(ID3D10EffectScalarVariable), "AsScalar", []), + StdMethod(ObjPointer(ID3D10EffectVectorVariable), "AsVector", []), + StdMethod(ObjPointer(ID3D10EffectMatrixVariable), "AsMatrix", []), + StdMethod(ObjPointer(ID3D10EffectStringVariable), "AsString", []), + StdMethod(ObjPointer(ID3D10EffectShaderResourceVariable), "AsShaderResource", []), + StdMethod(ObjPointer(ID3D10EffectRenderTargetViewVariable), "AsRenderTargetView", []), + StdMethod(ObjPointer(ID3D10EffectDepthStencilViewVariable), "AsDepthStencilView", []), + StdMethod(ObjPointer(ID3D10EffectConstantBuffer), "AsConstantBuffer", []), + StdMethod(ObjPointer(ID3D10EffectShaderVariable), "AsShader", []), + StdMethod(ObjPointer(ID3D10EffectBlendVariable), "AsBlend", []), + StdMethod(ObjPointer(ID3D10EffectDepthStencilVariable), "AsDepthStencil", []), + StdMethod(ObjPointer(ID3D10EffectRasterizerVariable), "AsRasterizer", []), + StdMethod(ObjPointer(ID3D10EffectSamplerVariable), "AsSampler", []), + StdMethod(HRESULT, "SetRawValue", [(OpaquePointer(Void), "pData"), (UINT, "Offset"), (UINT, "ByteCount")]), + StdMethod(HRESULT, "GetRawValue", [Out(OpaquePointer(Void), "pData"), (UINT, "Offset"), (UINT, "ByteCount")]), +] + +ID3D10EffectScalarVariable.methods += [ + StdMethod(HRESULT, "SetFloat", [(Float, "Value")]), + StdMethod(HRESULT, "GetFloat", [Out(Pointer(Float), "pValue")]), + StdMethod(HRESULT, "SetFloatArray", [(Pointer(Float), "pData"), (UINT, "Offset"), (UINT, "Count")]), + StdMethod(HRESULT, "GetFloatArray", [Out(Pointer(Float), "pData"), (UINT, "Offset"), (UINT, "Count")]), + StdMethod(HRESULT, "SetInt", [(Int, "Value")]), + StdMethod(HRESULT, "GetInt", [Out(Pointer(Int), "pValue")]), + StdMethod(HRESULT, "SetIntArray", [(Pointer(Int), "pData"), (UINT, "Offset"), (UINT, "Count")]), + StdMethod(HRESULT, "GetIntArray", [Out(Pointer(Int), "pData"), (UINT, "Offset"), (UINT, "Count")]), + StdMethod(HRESULT, "SetBool", [(BOOL, "Value")]), + StdMethod(HRESULT, "GetBool", [Out(Pointer(BOOL), "pValue")]), + StdMethod(HRESULT, "SetBoolArray", [(Pointer(BOOL), "pData"), (UINT, "Offset"), (UINT, "Count")]), + StdMethod(HRESULT, "GetBoolArray", [Out(Pointer(BOOL), "pData"), (UINT, "Offset"), (UINT, "Count")]), +] + +ID3D10EffectVectorVariable.methods += [ + StdMethod(HRESULT, "SetBoolVector", [(Pointer(BOOL), "pData")]), + StdMethod(HRESULT, "SetIntVector", [(Pointer(Int), "pData")]), + StdMethod(HRESULT, "SetFloatVector", [(Pointer(Float), "pData")]), + StdMethod(HRESULT, "GetBoolVector", [(Pointer(BOOL), "pData")]), + StdMethod(HRESULT, "GetIntVector", [(Pointer(Int), "pData")]), + StdMethod(HRESULT, "GetFloatVector", [(Pointer(Float), "pData")]), + StdMethod(HRESULT, "SetBoolVectorArray", [(Pointer(BOOL), "pData"), (UINT, "Offset"), (UINT, "Count")]), + StdMethod(HRESULT, "SetIntVectorArray", [(Pointer(Int), "pData"), (UINT, "Offset"), (UINT, "Count")]), + StdMethod(HRESULT, "SetFloatVectorArray", [(Pointer(Float), "pData"), (UINT, "Offset"), (UINT, "Count")]), + StdMethod(HRESULT, "GetBoolVectorArray", [(Pointer(BOOL), "pData"), (UINT, "Offset"), (UINT, "Count")]), + StdMethod(HRESULT, "GetIntVectorArray", [(Pointer(Int), "pData"), (UINT, "Offset"), (UINT, "Count")]), + StdMethod(HRESULT, "GetFloatVectorArray", [(Pointer(Float), "pData"), (UINT, "Offset"), (UINT, "Count")]), +] + +ID3D10EffectMatrixVariable.methods += [ + StdMethod(HRESULT, "SetMatrix", [(Pointer(Float), "pData")]), + StdMethod(HRESULT, "GetMatrix", [(Pointer(Float), "pData")]), + StdMethod(HRESULT, "SetMatrixArray", [(Pointer(Float), "pData"), (UINT, "Offset"), (UINT, "Count")]), + StdMethod(HRESULT, "GetMatrixArray", [(Pointer(Float), "pData"), (UINT, "Offset"), (UINT, "Count")]), + StdMethod(HRESULT, "SetMatrixTranspose", [(Pointer(Float), "pData")]), + StdMethod(HRESULT, "GetMatrixTranspose", [(Pointer(Float), "pData")]), + StdMethod(HRESULT, "SetMatrixTransposeArray", [(Pointer(Float), "pData"), (UINT, "Offset"), (UINT, "Count")]), + StdMethod(HRESULT, "GetMatrixTransposeArray", [(Pointer(Float), "pData"), (UINT, "Offset"), (UINT, "Count")]), +] + +ID3D10EffectStringVariable.methods += [ + StdMethod(HRESULT, "GetString", [Out(Pointer(LPCSTR), "ppString")]), + StdMethod(HRESULT, "GetStringArray", [Out(Pointer(LPCSTR), "ppStrings"), (UINT, "Offset"), (UINT, "Count")]), +] + +ID3D10EffectShaderResourceVariable.methods += [ + StdMethod(HRESULT, "SetResource", [(ObjPointer(ID3D10ShaderResourceView), "pResource")]), + StdMethod(HRESULT, "GetResource", [Out(Pointer(ObjPointer(ID3D10ShaderResourceView)), "ppResource")]), + StdMethod(HRESULT, "SetResourceArray", [(Pointer(ObjPointer(ID3D10ShaderResourceView)), "ppResources"), (UINT, "Offset"), (UINT, "Count")]), + StdMethod(HRESULT, "GetResourceArray", [Out(Pointer(ObjPointer(ID3D10ShaderResourceView)), "ppResources"), (UINT, "Offset"), (UINT, "Count")]), +] + +ID3D10EffectRenderTargetViewVariable.methods += [ + StdMethod(HRESULT, "SetRenderTarget", [(ObjPointer(ID3D10RenderTargetView), "pResource")]), + StdMethod(HRESULT, "GetRenderTarget", [Out(Pointer(ObjPointer(ID3D10RenderTargetView)), "ppResource")]), + StdMethod(HRESULT, "SetRenderTargetArray", [(Pointer(ObjPointer(ID3D10RenderTargetView)), "ppResources"), (UINT, "Offset"), (UINT, "Count")]), + StdMethod(HRESULT, "GetRenderTargetArray", [Out(Pointer(ObjPointer(ID3D10RenderTargetView)), "ppResources"), (UINT, "Offset"), (UINT, "Count")]), +] + +ID3D10EffectDepthStencilViewVariable.methods += [ + StdMethod(HRESULT, "SetDepthStencil", [(ObjPointer(ID3D10DepthStencilView), "pResource")]), + StdMethod(HRESULT, "GetDepthStencil", [Out(Pointer(ObjPointer(ID3D10DepthStencilView)), "ppResource")]), + StdMethod(HRESULT, "SetDepthStencilArray", [(Pointer(ObjPointer(ID3D10DepthStencilView)), "ppResources"), (UINT, "Offset"), (UINT, "Count")]), + StdMethod(HRESULT, "GetDepthStencilArray", [Out(Pointer(ObjPointer(ID3D10DepthStencilView)), "ppResources"), (UINT, "Offset"), (UINT, "Count")]), +] + +ID3D10EffectConstantBuffer.methods += [ + StdMethod(HRESULT, "SetConstantBuffer", [(ObjPointer(ID3D10Buffer), "pConstantBuffer")]), + StdMethod(HRESULT, "GetConstantBuffer", [Out(Pointer(ObjPointer(ID3D10Buffer)), "ppConstantBuffer")]), + StdMethod(HRESULT, "SetTextureBuffer", [(ObjPointer(ID3D10ShaderResourceView), "pTextureBuffer")]), + StdMethod(HRESULT, "GetTextureBuffer", [Out(Pointer(ObjPointer(ID3D10ShaderResourceView)), "ppTextureBuffer")]), +] + +D3D10_EFFECT_SHADER_DESC = Struct("D3D10_EFFECT_SHADER_DESC", [ + (Pointer(Const(BYTE)), "pInputSignature"), + (BOOL, "IsInline"), + (Pointer(Const(BYTE)), "pBytecode"), + (UINT, "BytecodeLength"), + (LPCSTR, "SODecl"), + (UINT, "NumInputSignatureEntries"), + (UINT, "NumOutputSignatureEntries"), +]) + +ID3D10EffectShaderVariable.methods += [ + StdMethod(HRESULT, "GetShaderDesc", [(UINT, "ShaderIndex"), Out(Pointer(D3D10_EFFECT_SHADER_DESC), "pDesc")]), + StdMethod(HRESULT, "GetVertexShader", [(UINT, "ShaderIndex"), Out(Pointer(ObjPointer(ID3D10VertexShader)), "ppVS")]), + StdMethod(HRESULT, "GetGeometryShader", [(UINT, "ShaderIndex"), Out(Pointer(ObjPointer(ID3D10GeometryShader)), "ppGS")]), + StdMethod(HRESULT, "GetPixelShader", [(UINT, "ShaderIndex"), Out(Pointer(ObjPointer(ID3D10PixelShader)), "ppPS")]), + StdMethod(HRESULT, "GetInputSignatureElementDesc", [(UINT, "ShaderIndex"), (UINT, "Element"), Out(Pointer(D3D10_SIGNATURE_PARAMETER_DESC), "pDesc")]), + StdMethod(HRESULT, "GetOutputSignatureElementDesc", [(UINT, "ShaderIndex"), (UINT, "Element"), Out(Pointer(D3D10_SIGNATURE_PARAMETER_DESC), "pDesc")]), +] + +ID3D10EffectBlendVariable.methods += [ + StdMethod(HRESULT, "GetBlendState", [(UINT, "Index"), (Pointer(ObjPointer(ID3D10BlendState)), "ppBlendState")]), + StdMethod(HRESULT, "GetBackingStore", [(UINT, "Index"), (Pointer(D3D10_BLEND_DESC), "pBlendDesc")]), +] + +ID3D10EffectDepthStencilVariable.methods += [ + StdMethod(HRESULT, "GetDepthStencilState", [(UINT, "Index"), Out(Pointer(ObjPointer(ID3D10DepthStencilState)), "ppDepthStencilState")]), + StdMethod(HRESULT, "GetBackingStore", [(UINT, "Index"), Out(Pointer(D3D10_DEPTH_STENCIL_DESC), "pDepthStencilDesc")]), +] + +ID3D10EffectRasterizerVariable.methods += [ + StdMethod(HRESULT, "GetRasterizerState", [(UINT, "Index"), Out(Pointer(ObjPointer(ID3D10RasterizerState)), "ppRasterizerState")]), + StdMethod(HRESULT, "GetBackingStore", [(UINT, "Index"), Out(Pointer(D3D10_RASTERIZER_DESC), "pRasterizerDesc")]), +] + +ID3D10EffectSamplerVariable.methods += [ + StdMethod(HRESULT, "GetSampler", [(UINT, "Index"), Out(Pointer(ObjPointer(ID3D10SamplerState)), "ppSampler")]), + StdMethod(HRESULT, "GetBackingStore", [(UINT, "Index"), Out(Pointer(D3D10_SAMPLER_DESC), "pSamplerDesc")]), +] + +D3D10_PASS_DESC = Struct("D3D10_PASS_DESC", [ + (LPCSTR, "Name"), + (UINT, "Annotations"), + (Pointer(BYTE), "pIAInputSignature"), + (SIZE_T, "IAInputSignatureSize"), + (UINT, "StencilRef"), + (UINT, "SampleMask"), + (Array(FLOAT, 4), "BlendFactor"), +]) + +D3D10_PASS_SHADER_DESC = Struct("D3D10_PASS_SHADER_DESC", [ + (ObjPointer(ID3D10EffectShaderVariable), "pShaderVariable"), + (UINT, "ShaderIndex"), +]) + +ID3D10EffectPass.methods += [ + StdMethod(BOOL, "IsValid", []), + StdMethod(HRESULT, "GetDesc", [(Pointer(D3D10_PASS_DESC), "pDesc")]), + StdMethod(HRESULT, "GetVertexShaderDesc", [(Pointer(D3D10_PASS_SHADER_DESC), "pDesc")]), + StdMethod(HRESULT, "GetGeometryShaderDesc", [(Pointer(D3D10_PASS_SHADER_DESC), "pDesc")]), + StdMethod(HRESULT, "GetPixelShaderDesc", [(Pointer(D3D10_PASS_SHADER_DESC), "pDesc")]), + StdMethod(ObjPointer(ID3D10EffectVariable), "GetAnnotationByIndex", [(UINT, "Index")]), + StdMethod(ObjPointer(ID3D10EffectVariable), "GetAnnotationByName", [(LPCSTR, "Name")]), + StdMethod(HRESULT, "Apply", [(UINT, "Flags")]), + StdMethod(HRESULT, "ComputeStateBlockMask", [Out(Pointer(D3D10_STATE_BLOCK_MASK), "pStateBlockMask")]), +] + +D3D10_TECHNIQUE_DESC = Struct("D3D10_TECHNIQUE_DESC", [ + (LPCSTR, "Name"), + (UINT, "Passes"), + (UINT, "Annotations"), +]) + +ID3D10EffectTechnique.methods += [ + StdMethod(BOOL, "IsValid", []), + StdMethod(HRESULT, "GetDesc", [(Pointer(D3D10_TECHNIQUE_DESC), "pDesc")]), + StdMethod(ObjPointer(ID3D10EffectVariable), "GetAnnotationByIndex", [(UINT, "Index")]), + StdMethod(ObjPointer(ID3D10EffectVariable), "GetAnnotationByName", [(LPCSTR, "Name")]), + StdMethod(ObjPointer(ID3D10EffectPass), "GetPassByIndex", [(UINT, "Index")]), + StdMethod(ObjPointer(ID3D10EffectPass), "GetPassByName", [(LPCSTR, "Name")]), + StdMethod(HRESULT, "ComputeStateBlockMask", [Out(Pointer(D3D10_STATE_BLOCK_MASK), "pStateBlockMask")]), +] + +D3D10_EFFECT_DESC = Struct("D3D10_EFFECT_DESC", [ + (BOOL, "IsChildEffect"), + (UINT, "ConstantBuffers"), + (UINT, "SharedConstantBuffers"), + (UINT, "GlobalVariables"), + (UINT, "SharedGlobalVariables"), + (UINT, "Techniques"), +]) + +ID3D10Effect.methods += [ + StdMethod(BOOL, "IsValid", []), + StdMethod(BOOL, "IsPool", []), + StdMethod(HRESULT, "GetDevice", [Out(Pointer(ObjPointer(ID3D10Device)), "ppDevice")]), + StdMethod(HRESULT, "GetDesc", [Out(Pointer(D3D10_EFFECT_DESC), "pDesc")]), + StdMethod(ObjPointer(ID3D10EffectConstantBuffer), "GetConstantBufferByIndex", [(UINT, "Index")]), + StdMethod(ObjPointer(ID3D10EffectConstantBuffer), "GetConstantBufferByName", [(LPCSTR, "Name")]), + StdMethod(ObjPointer(ID3D10EffectVariable), "GetVariableByIndex", [(UINT, "Index")]), + StdMethod(ObjPointer(ID3D10EffectVariable), "GetVariableByName", [(LPCSTR, "Name")]), + StdMethod(ObjPointer(ID3D10EffectVariable), "GetVariableBySemantic", [(LPCSTR, "Semantic")]), + StdMethod(ObjPointer(ID3D10EffectTechnique), "GetTechniqueByIndex", [(UINT, "Index")]), + StdMethod(ObjPointer(ID3D10EffectTechnique), "GetTechniqueByName", [(LPCSTR, "Name")]), + StdMethod(HRESULT, "Optimize", []), + StdMethod(BOOL, "IsOptimized", []), +] + +ID3D10EffectPool.methods += [ + StdMethod(ObjPointer(ID3D10Effect), "AsEffect", []), +] + + +d3d10.addFunctions([ + StdFunction(HRESULT, "D3D10StateBlockMaskUnion", [(Pointer(D3D10_STATE_BLOCK_MASK), "pA"), (Pointer(D3D10_STATE_BLOCK_MASK), "pB"), Out(Pointer(D3D10_STATE_BLOCK_MASK), "pResult")]), + StdFunction(HRESULT, "D3D10StateBlockMaskIntersect", [(Pointer(D3D10_STATE_BLOCK_MASK), "pA"), (Pointer(D3D10_STATE_BLOCK_MASK), "pB"), Out(Pointer(D3D10_STATE_BLOCK_MASK), "pResult")]), + StdFunction(HRESULT, "D3D10StateBlockMaskDifference", [(Pointer(D3D10_STATE_BLOCK_MASK), "pA"), (Pointer(D3D10_STATE_BLOCK_MASK), "pB"), Out(Pointer(D3D10_STATE_BLOCK_MASK), "pResult")]), + StdFunction(HRESULT, "D3D10StateBlockMaskEnableCapture", [Out(Pointer(D3D10_STATE_BLOCK_MASK), "pMask"), (D3D10_DEVICE_STATE_TYPES, "StateType"), (UINT, "RangeStart"), (UINT, "RangeLength")]), + StdFunction(HRESULT, "D3D10StateBlockMaskDisableCapture", [Out(Pointer(D3D10_STATE_BLOCK_MASK), "pMask"), (D3D10_DEVICE_STATE_TYPES, "StateType"), (UINT, "RangeStart"), (UINT, "RangeLength")]), + StdFunction(HRESULT, "D3D10StateBlockMaskEnableAll", [Out(Pointer(D3D10_STATE_BLOCK_MASK), "pMask")]), + StdFunction(HRESULT, "D3D10StateBlockMaskDisableAll", [Out(Pointer(D3D10_STATE_BLOCK_MASK), "pMask")]), + StdFunction(BOOL, "D3D10StateBlockMaskGetSetting", [(Pointer(D3D10_STATE_BLOCK_MASK), "pMask"), (D3D10_DEVICE_STATE_TYPES, "StateType"), (UINT, "Entry")]), + StdFunction(HRESULT, "D3D10CreateStateBlock", [(ObjPointer(ID3D10Device), "pDevice"), (Pointer(D3D10_STATE_BLOCK_MASK), "pStateBlockMask"), Out(Pointer(ObjPointer(ID3D10StateBlock)), "ppStateBlock")]), + StdFunction(HRESULT, "D3D10CompileEffectFromMemory", [(OpaquePointer(Void), "pData"), (SIZE_T, "DataLength"), (LPCSTR, "pSrcFileName"), (Pointer(Const(D3D10_SHADER_MACRO)), "pDefines"), (LPD3D10INCLUDE, "pInclude"), (UINT, "HLSLFlags"), (UINT, "FXFlags"), Out(Pointer(ObjPointer(ID3D10Blob)), "ppCompiledEffect"), Out(Pointer(ObjPointer(ID3D10Blob)), "ppErrors")]), + StdFunction(HRESULT, "D3D10CreateEffectFromMemory", [(OpaquePointer(Void), "pData"), (SIZE_T, "DataLength"), (UINT, "FXFlags"), (ObjPointer(ID3D10Device), "pDevice"), (ObjPointer(ID3D10EffectPool), "pEffectPool"), Out(Pointer(ObjPointer(ID3D10Effect)), "ppEffect")]), + StdFunction(HRESULT, "D3D10CreateEffectPoolFromMemory", [(OpaquePointer(Void), "pData"), (SIZE_T, "DataLength"), (UINT, "FXFlags"), (ObjPointer(ID3D10Device), "pDevice"), Out(Pointer(ObjPointer(ID3D10EffectPool)), "ppEffectPool")]), + StdFunction(HRESULT, "D3D10DisassembleEffect", [(ObjPointer(ID3D10Effect), "pEffect"), (BOOL, "EnableColorCode"), Out(Pointer(ObjPointer(ID3D10Blob)), "ppDisassembly")]), +]) diff --git a/specs/d3d10misc.py b/specs/d3d10misc.py index 2f6b9f0..6564cc2 100644 --- a/specs/d3d10misc.py +++ b/specs/d3d10misc.py @@ -26,18 +26,9 @@ """d3d10misc.h""" from winapi import * -from d3d10sdklayers import * from d3d10 import * -ID3D10Blob = Interface("ID3D10Blob", IUnknown) -LPD3D10BLOB = ObjPointer(ID3D10Blob) - -ID3D10Blob.methods += [ - Method(LPVOID, "GetBufferPointer", []), - Method(SIZE_T, "GetBufferSize", []), -] - D3D10_DRIVER_TYPE = Enum("D3D10_DRIVER_TYPE", [ "D3D10_DRIVER_TYPE_HARDWARE", "D3D10_DRIVER_TYPE_REFERENCE", @@ -47,12 +38,14 @@ D3D10_DRIVER_TYPE = Enum("D3D10_DRIVER_TYPE", [ ]) -d3d10 = API("d3d10") - d3d10.addFunctions([ StdFunction(HRESULT, "D3D10CreateDevice", [(ObjPointer(IDXGIAdapter), "pAdapter"), (D3D10_DRIVER_TYPE, "DriverType"), (HMODULE, "Software"), (D3D10_CREATE_DEVICE_FLAG, "Flags"), (UINT, "SDKVersion"), Out(Pointer(ObjPointer(ID3D10Device)), "ppDevice")]), StdFunction(HRESULT, "D3D10CreateDeviceAndSwapChain", [(ObjPointer(IDXGIAdapter), "pAdapter"), (D3D10_DRIVER_TYPE, "DriverType"), (HMODULE, "Software"), (D3D10_CREATE_DEVICE_FLAG, "Flags"), (UINT, "SDKVersion"), (Pointer(DXGI_SWAP_CHAIN_DESC), "pSwapChainDesc"), Out(Pointer(ObjPointer(IDXGISwapChain)), "ppSwapChain"), Out(Pointer(ObjPointer(ID3D10Device)), "ppDevice")]), StdFunction(HRESULT, "D3D10CreateBlob", [(SIZE_T, "NumBytes"), Out(Pointer(LPD3D10BLOB), "ppBuffer")]), + + # Undocumented + StdFunction(DWORD, "D3D10GetVersion", []), + StdFunction(DWORD, "D3D10RegisterLayers", []), ]) d3d10.addInterfaces([ @@ -64,3 +57,4 @@ d3d10.addInterfaces([ ID3D10Multithread, ID3D10SwitchToRef, ]) + diff --git a/specs/d3d10shader.py b/specs/d3d10shader.py new file mode 100644 index 0000000..43ea865 --- /dev/null +++ b/specs/d3d10shader.py @@ -0,0 +1,175 @@ +########################################################################## +# +# Copyright 2012 Jose Fonseca +# All Rights Reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +##########################################################################/ + + +from d3dcommon import * +from d3d10 import * + + +D3D10_SHADER = Flags(UINT, [ + "D3D10_SHADER_DEBUG", + "D3D10_SHADER_SKIP_VALIDATION", + "D3D10_SHADER_SKIP_OPTIMIZATION", + "D3D10_SHADER_PACK_MATRIX_ROW_MAJOR", + "D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR", + "D3D10_SHADER_PARTIAL_PRECISION", + "D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT", + "D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT", + "D3D10_SHADER_NO_PRESHADER", + "D3D10_SHADER_AVOID_FLOW_CONTROL", + "D3D10_SHADER_PREFER_FLOW_CONTROL", + "D3D10_SHADER_ENABLE_STRICTNESS", + "D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY", + "D3D10_SHADER_IEEE_STRICTNESS", + "D3D10_SHADER_WARNINGS_ARE_ERRORS", + "D3D10_SHADER_OPTIMIZATION_LEVEL0", + "D3D10_SHADER_OPTIMIZATION_LEVEL1", + "D3D10_SHADER_OPTIMIZATION_LEVEL2", + "D3D10_SHADER_OPTIMIZATION_LEVEL3", +]) + +D3D10_SHADER_DESC = Struct("D3D10_SHADER_DESC", [ + (UINT, "Version"), + (LPCSTR, "Creator"), + (UINT, "Flags"), + (UINT, "ConstantBuffers"), + (UINT, "BoundResources"), + (UINT, "InputParameters"), + (UINT, "OutputParameters"), + (UINT, "InstructionCount"), + (UINT, "TempRegisterCount"), + (UINT, "TempArrayCount"), + (UINT, "DefCount"), + (UINT, "DclCount"), + (UINT, "TextureNormalInstructions"), + (UINT, "TextureLoadInstructions"), + (UINT, "TextureCompInstructions"), + (UINT, "TextureBiasInstructions"), + (UINT, "TextureGradientInstructions"), + (UINT, "FloatInstructionCount"), + (UINT, "IntInstructionCount"), + (UINT, "UintInstructionCount"), + (UINT, "StaticFlowControlCount"), + (UINT, "DynamicFlowControlCount"), + (UINT, "MacroInstructionCount"), + (UINT, "ArrayInstructionCount"), + (UINT, "CutInstructionCount"), + (UINT, "EmitInstructionCount"), + (D3D10_PRIMITIVE_TOPOLOGY, "GSOutputTopology"), + (UINT, "GSMaxOutputVertexCount"), +]) + +D3D10_SHADER_BUFFER_DESC = Struct("D3D10_SHADER_BUFFER_DESC", [ + (LPCSTR, "Name"), + (D3D10_CBUFFER_TYPE, "Type"), + (UINT, "Variables"), + (UINT, "Size"), + (UINT, "uFlags"), +]) + +D3D10_SHADER_VARIABLE_DESC = Struct("D3D10_SHADER_VARIABLE_DESC", [ + (LPCSTR, "Name"), + (UINT, "StartOffset"), + (UINT, "Size"), + (UINT, "uFlags"), + (LPVOID, "DefaultValue"), +]) + +D3D10_SHADER_TYPE_DESC = Struct("D3D10_SHADER_TYPE_DESC", [ + (D3D10_SHADER_VARIABLE_CLASS, "Class"), + (D3D10_SHADER_VARIABLE_TYPE, "Type"), + (UINT, "Rows"), + (UINT, "Columns"), + (UINT, "Elements"), + (UINT, "Members"), + (UINT, "Offset"), +]) + +D3D10_SHADER_INPUT_BIND_DESC = Struct("D3D10_SHADER_INPUT_BIND_DESC", [ + (LPCSTR, "Name"), + (D3D10_SHADER_INPUT_TYPE, "Type"), + (UINT, "BindPoint"), + (UINT, "BindCount"), + (UINT, "uFlags"), + (D3D10_RESOURCE_RETURN_TYPE, "ReturnType"), + (D3D10_SRV_DIMENSION, "Dimension"), + (UINT, "NumSamples"), +]) + +D3D10_SIGNATURE_PARAMETER_DESC = Struct("D3D10_SIGNATURE_PARAMETER_DESC", [ + (LPCSTR, "SemanticName"), + (UINT, "SemanticIndex"), + (UINT, "Register"), + (D3D10_NAME, "SystemValueType"), + (D3D10_REGISTER_COMPONENT_TYPE, "ComponentType"), + (BYTE, "Mask"), + (BYTE, "ReadWriteMask"), +]) + +ID3D10ShaderReflectionType = Interface("ID3D10ShaderReflectionType") +ID3D10ShaderReflectionType.methods += [ + StdMethod(HRESULT, "GetDesc", [(Pointer(D3D10_SHADER_TYPE_DESC), "pDesc")]), + StdMethod(ObjPointer(ID3D10ShaderReflectionType), "GetMemberTypeByIndex", [(UINT, "Index")]), + StdMethod(ObjPointer(ID3D10ShaderReflectionType), "GetMemberTypeByName", [(LPCSTR, "Name")]), + StdMethod(LPCSTR, "GetMemberTypeName", [(UINT, "Index")]), +] + +ID3D10ShaderReflectionVariable = Interface("ID3D10ShaderReflectionVariable") +ID3D10ShaderReflectionVariable.methods += [ + StdMethod(HRESULT, "GetDesc", [Out(Pointer(D3D10_SHADER_VARIABLE_DESC), "pDesc")]), + StdMethod(ObjPointer(ID3D10ShaderReflectionType), "GetType", []), +] + +ID3D10ShaderReflectionConstantBuffer = Interface("ID3D10ShaderReflectionConstantBuffer") +ID3D10ShaderReflectionConstantBuffer.methods += [ + StdMethod(HRESULT, "GetDesc", [Out(Pointer(D3D10_SHADER_BUFFER_DESC), "pDesc")]), + StdMethod(ObjPointer(ID3D10ShaderReflectionVariable), "GetVariableByIndex", [(UINT, "Index")]), + StdMethod(ObjPointer(ID3D10ShaderReflectionVariable), "GetVariableByName", [(LPCSTR, "Name")]), +] + +ID3D10ShaderReflection = Interface("ID3D10ShaderReflection", IUnknown) +ID3D10ShaderReflection.methods += [ + StdMethod(HRESULT, "GetDesc", [Out(Pointer(D3D10_SHADER_DESC), "pDesc")]), + StdMethod(ObjPointer(ID3D10ShaderReflectionConstantBuffer), "GetConstantBufferByIndex", [(UINT, "Index")]), + StdMethod(ObjPointer(ID3D10ShaderReflectionConstantBuffer), "GetConstantBufferByName", [(LPCSTR, "Name")]), + StdMethod(HRESULT, "GetResourceBindingDesc", [(UINT, "ResourceIndex"), Out(Pointer(D3D10_SHADER_INPUT_BIND_DESC), "pDesc")]), + StdMethod(HRESULT, "GetInputParameterDesc", [(UINT, "ParameterIndex"), Out(Pointer(D3D10_SIGNATURE_PARAMETER_DESC), "pDesc")]), + StdMethod(HRESULT, "GetOutputParameterDesc", [(UINT, "ParameterIndex"), Out(Pointer(D3D10_SIGNATURE_PARAMETER_DESC), "pDesc")]), +] + + +d3d10.addFunctions([ + StdFunction(HRESULT, "D3D10CompileShader", [(LPCSTR, "pSrcData"), (SIZE_T, "SrcDataSize"), (LPCSTR, "pFileName"), (Pointer(Const(D3D10_SHADER_MACRO)), "pDefines"), (LPD3D10INCLUDE, "pInclude"), (LPCSTR, "pFunctionName"), (LPCSTR, "pProfile"), (UINT, "Flags"), Out(Pointer(ObjPointer(ID3D10Blob)), "ppShader"), Out(Pointer(ObjPointer(ID3D10Blob)), "ppErrorMsgs")]), + StdFunction(HRESULT, "D3D10DisassembleShader", [(OpaquePointer(Const(Void)), "pShader"), (SIZE_T, "BytecodeLength"), (BOOL, "EnableColorCode"), (LPCSTR, "pComments"), Out(Pointer(ObjPointer(ID3D10Blob)), "ppDisassembly")]), + StdFunction(LPCSTR, "D3D10GetPixelShaderProfile", [(ObjPointer(ID3D10Device), "pDevice")]), + StdFunction(LPCSTR, "D3D10GetVertexShaderProfile", [(ObjPointer(ID3D10Device), "pDevice")]), + StdFunction(LPCSTR, "D3D10GetGeometryShaderProfile", [(ObjPointer(ID3D10Device), "pDevice")]), + StdFunction(HRESULT, "D3D10ReflectShader", [(OpaquePointer(Const(Void)), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), Out(Pointer(ObjPointer(ID3D10ShaderReflection)), "ppReflector")]), + StdFunction(HRESULT, "D3D10PreprocessShader", [(LPCSTR, "pSrcData"), (SIZE_T, "SrcDataSize"), (LPCSTR, "pFileName"), (Pointer(Const(D3D10_SHADER_MACRO)), "pDefines"), (LPD3D10INCLUDE, "pInclude"), Out(Pointer(ObjPointer(ID3D10Blob)), "ppShaderText"), Out(Pointer(ObjPointer(ID3D10Blob)), "ppErrorMsgs")]), + StdFunction(HRESULT, "D3D10GetInputSignatureBlob", [(OpaquePointer(Const(Void)), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), Out(Pointer(ObjPointer(ID3D10Blob)), "ppSignatureBlob")]), + StdFunction(HRESULT, "D3D10GetOutputSignatureBlob", [(OpaquePointer(Const(Void)), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), Out(Pointer(ObjPointer(ID3D10Blob)), "ppSignatureBlob")]), + StdFunction(HRESULT, "D3D10GetInputAndOutputSignatureBlob", [(OpaquePointer(Const(Void)), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), Out(Pointer(ObjPointer(ID3D10Blob)), "ppSignatureBlob")]), + StdFunction(HRESULT, "D3D10GetShaderDebugInfo", [(OpaquePointer(Const(Void)), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), Out(Pointer(ObjPointer(ID3D10Blob)), "ppDebugInfo")]), +]) diff --git a/specs/d3dcommon.py b/specs/d3dcommon.py index af6c5c9..313309e 100644 --- a/specs/d3dcommon.py +++ b/specs/d3dcommon.py @@ -296,7 +296,7 @@ D3D11_SRV_DIMENSION = Enum('D3D11_SRV_DIMENSION', [ 'D3D11_SRV_DIMENSION_BUFFEREX', ]) -D3D_SHADER_MACRO = Struct('D3D_SHADER_MACRO', [ +D3D10_SHADER_MACRO = Struct('D3D10_SHADER_MACRO', [ (LPCSTR, 'Name'), (LPCSTR, 'Definition'), ]) @@ -306,6 +306,7 @@ ID3D10Blob.methods += [ StdMethod(LPVOID, 'GetBufferPointer', []), StdMethod(SIZE_T, 'GetBufferSize', []), ] +LPD3D10BLOB = ObjPointer(ID3D10Blob) D3D_INCLUDE_TYPE = Enum('D3D_INCLUDE_TYPE', [ 'D3D_INCLUDE_LOCAL', @@ -317,6 +318,13 @@ D3D10_INCLUDE_TYPE = Enum('D3D10_INCLUDE_TYPE', [ 'D3D10_INCLUDE_SYSTEM', ]) +ID3D10Include = Interface("ID3D10Include", IUnknown) +ID3D10Include.methods += [ + StdMethod(HRESULT, "Open", [(D3D10_INCLUDE_TYPE, "IncludeType"), (LPCSTR, "pFileName"), (LPCVOID, "pParentData"), (Pointer(LPCVOID), "ppData"), (Pointer(UINT), "pBytes")]), + StdMethod(HRESULT, "Close", [(LPCVOID, "pData")]), +] +LPD3D10INCLUDE = OpaquePointer(ID3D10Include) + D3D_SHADER_VARIABLE_CLASS = Enum('D3D_SHADER_VARIABLE_CLASS', [ 'D3D_SVC_SCALAR', 'D3D_SVC_VECTOR', diff --git a/specs/dxgi.py b/specs/dxgi.py index 2566f5b..4292d29 100644 --- a/specs/dxgi.py +++ b/specs/dxgi.py @@ -44,11 +44,10 @@ IDXGIDevice1 = Interface("IDXGIDevice1", IDXGIDevice) DXGI_USAGE = Flags(UINT, [ - "DXGI_CPU_ACCESS_FIELD", - "DXGI_CPU_ACCESS_NONE", - "DXGI_CPU_ACCESS_DYNAMIC", - "DXGI_CPU_ACCESS_READ_WRITE", - "DXGI_CPU_ACCESS_SCRATCH", + "DXGI_CPU_ACCESS_NONE", # 0 + "DXGI_CPU_ACCESS_SCRATCH", # 3 + "DXGI_CPU_ACCESS_DYNAMIC", # 1 + "DXGI_CPU_ACCESS_READ_WRITE", # 2 "DXGI_USAGE_SHADER_INPUT", "DXGI_USAGE_RENDER_TARGET_OUTPUT", "DXGI_USAGE_BACK_BUFFER", diff --git a/specs/dxgitype.py b/specs/dxgitype.py index e330d14..c6202b5 100644 --- a/specs/dxgitype.py +++ b/specs/dxgitype.py @@ -50,18 +50,6 @@ HRESULT = MAKE_HRESULT([ "DXGI_ERROR_NOT_CURRENTLY_AVAILABLE", "DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED", "DXGI_ERROR_REMOTE_OUTOFMEMORY", - "DXGI_CPU_ACCESS_NONE", - "DXGI_CPU_ACCESS_DYNAMIC", - "DXGI_CPU_ACCESS_READ_WRITE", - "DXGI_CPU_ACCESS_SCRATCH", - "DXGI_CPU_ACCESS_FIELD", - "DXGI_USAGE_SHADER_INPUT", - "DXGI_USAGE_RENDER_TARGET_OUTPUT", - "DXGI_USAGE_BACK_BUFFER", - "DXGI_USAGE_SHARED", - "DXGI_USAGE_READ_ONLY", - "DXGI_USAGE_DISCARD_ON_PRESENT", - "DXGI_USAGE_UNORDERED_ACCESS", ]) diff --git a/specs/scripts/cdecl.py b/specs/scripts/cdecl.py index 3d02d53..8848844 100755 --- a/specs/scripts/cdecl.py +++ b/specs/scripts/cdecl.py @@ -308,25 +308,31 @@ class DeclParser: assert tags[0] == '"' assert tags[-1] == '"' tags = tags[1:-1] - try: - tags, args = tags.split('(') - except ValueError: - pass - assert tags[0] == '_' - assert tags[-1] == '_' - tags = tags[1:-1] - tags = tags.lower() - tags = tags.split('_') - if self.lookahead().startswith('__'): + tags = parse_sal_annotation(tags) + token = self.lookahead() + if token[0] == '_' and (token[1] == '_' or token[-1] == '_'): # Parse __in, __out, etc tags - tag = self.consume()[2:] - args = [] + tag = self.consume() if self.match('('): - self.consume() + tag += self.consume() while not self.match(')'): - self.consume() - self.consume(')') - tags.extend(tag.split('_')) + tag += self.consume() + tag += self.consume(')') + tags.extend(self.parse_sal_annotation(tag)) + return tags + + def parse_sal_annotation(self, tags): + try: + tags, args = tags.split('(') + except ValueError: + pass + assert tags[0] == '_' + if tags[1] == '_': + tags = tags[2:] + if tags[-1] == '_': + tags = tags[1:-1] + tags = tags.lower() + tags = tags.split('_') return tags def parse_named_type(self): @@ -338,7 +344,9 @@ class DeclParser: name = self.consume() if self.match('['): self.consume() - length = self.consume() + length = '' + while not self.match(']'): + length += self.consume() self.consume(']') try: int(length) diff --git a/specs/winapi.py b/specs/winapi.py index 409054d..d2bdca3 100644 --- a/specs/winapi.py +++ b/specs/winapi.py @@ -77,6 +77,7 @@ SIZE_T = Alias("SIZE_T", SizeT) VOID = Void PVOID = OpaquePointer(VOID) LPVOID = PVOID +LPCVOID = OpaquePointer(Const(VOID)) def DECLARE_HANDLE(expr): return Handle(expr, IntPointer(expr)) @@ -203,9 +204,9 @@ HRESULT = MAKE_HRESULT([]) IUnknown = Interface("IUnknown") IUnknown.methods = ( - Method(HRESULT, "QueryInterface", ((REFIID, "riid"), Out(Pointer(ObjPointer(Void)), "ppvObj"))), - Method(ULONG, "AddRef", (), sideeffects=False), - Method(ULONG, "Release", ()), + StdMethod(HRESULT, "QueryInterface", ((REFIID, "riid"), Out(Pointer(ObjPointer(Void)), "ppvObj"))), + StdMethod(ULONG, "AddRef", (), sideeffects=False), + StdMethod(ULONG, "Release", ()), ) diff --git a/wrappers/CMakeLists.txt b/wrappers/CMakeLists.txt index 602932b..af9d913 100644 --- a/wrappers/CMakeLists.txt +++ b/wrappers/CMakeLists.txt @@ -118,9 +118,11 @@ if (WIN32) dlltrace.py trace.py ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py - ${CMAKE_SOURCE_DIR}/specs/d3d10misc.py ${CMAKE_SOURCE_DIR}/specs/d3d10.py + ${CMAKE_SOURCE_DIR}/specs/d3d10misc.py ${CMAKE_SOURCE_DIR}/specs/d3d10sdklayers.py + ${CMAKE_SOURCE_DIR}/specs/d3d10shader.py + ${CMAKE_SOURCE_DIR}/specs/d3d10effect.py ${CMAKE_SOURCE_DIR}/specs/d3dcommon.py ${CMAKE_SOURCE_DIR}/specs/dxgi.py ${CMAKE_SOURCE_DIR}/specs/dxgitype.py diff --git a/wrappers/d3d10.def b/wrappers/d3d10.def index 5482ab5..65d9786 100644 --- a/wrappers/d3d10.def +++ b/wrappers/d3d10.def @@ -1,6 +1,31 @@ -LIBRARY "d3d10" - +LIBRARY "d3d10.dll" EXPORTS - D3D10CreateDevice - D3D10CreateDeviceAndSwapChain - D3D10CreateBlob + D3D10CompileEffectFromMemory + D3D10CompileShader + D3D10CreateBlob + D3D10CreateDevice + D3D10CreateDeviceAndSwapChain + D3D10CreateEffectFromMemory + D3D10CreateEffectPoolFromMemory + D3D10CreateStateBlock + D3D10DisassembleEffect + D3D10DisassembleShader + D3D10GetGeometryShaderProfile + D3D10GetInputAndOutputSignatureBlob + D3D10GetInputSignatureBlob + D3D10GetOutputSignatureBlob + D3D10GetPixelShaderProfile + D3D10GetShaderDebugInfo + D3D10GetVersion + D3D10GetVertexShaderProfile + D3D10PreprocessShader + D3D10ReflectShader + D3D10RegisterLayers + D3D10StateBlockMaskDifference + D3D10StateBlockMaskDisableAll + D3D10StateBlockMaskDisableCapture + D3D10StateBlockMaskEnableAll + D3D10StateBlockMaskEnableCapture + D3D10StateBlockMaskGetSetting + D3D10StateBlockMaskIntersect + D3D10StateBlockMaskUnion diff --git a/wrappers/trace.py b/wrappers/trace.py index fd921ec..e82bd2c 100644 --- a/wrappers/trace.py +++ b/wrappers/trace.py @@ -300,7 +300,7 @@ class ValueWrapper(stdapi.Traverser): if isinstance(elem_type, stdapi.Interface): self.visitInterfacePointer(elem_type, instance) else: - self.visitPointer(self, pointer, instance) + self.visitPointer(pointer, instance) def visitInterface(self, interface, instance): raise NotImplementedError