From 0075f154b6d764474d37085a582faee653d61cb5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Sat, 14 Apr 2012 20:25:52 +0100 Subject: [PATCH] Properly (un)wrap array arguments. --- retrace/retrace.py | 23 +------- specs/d3d10.py | 72 ++++++++++++------------- specs/d3d11.py | 132 ++++++++++++++++++++++----------------------- specs/stdapi.py | 120 +++++++++++++++++++++++++---------------- wrappers/trace.py | 96 +++++++++++++++++---------------- 5 files changed, 230 insertions(+), 213 deletions(-) diff --git a/retrace/retrace.py b/retrace/retrace.py index 369c13b..8198b0a 100644 --- a/retrace/retrace.py +++ b/retrace/retrace.py @@ -41,25 +41,6 @@ class UnsupportedType(Exception): pass -class MutableRebuilder(stdapi.Rebuilder): - '''Type visitor which derives a mutable type.''' - - def visitConst(self, const): - # Strip out const qualifier - return const.type - - def visitAlias(self, alias): - # Tear the alias on type changes - type = self.visit(alias.type) - if type is alias.type: - return alias - return type - - def visitReference(self, reference): - # Strip out references - return reference.type - - def lookupHandle(handle, value): if handle.key is None: return "__%s_map[%s]" % (handle.name, value) @@ -372,7 +353,7 @@ class Retracer: print ' (void)_allocator;' success = True for arg in function.args: - arg_type = MutableRebuilder().visit(arg.type) + arg_type = arg.type.mutable() print ' %s %s;' % (arg_type, arg.name) rvalue = 'call.arg(%u)' % (arg.index,) lvalue = arg.name @@ -393,7 +374,7 @@ class Retracer: def swizzleValues(self, function): for arg in function.args: if arg.output: - arg_type = MutableRebuilder().visit(arg.type) + arg_type = arg.type.mutable() rvalue = 'call.arg(%u)' % (arg.index,) lvalue = arg.name try: diff --git a/specs/d3d10.py b/specs/d3d10.py index 5119904..474437d 100644 --- a/specs/d3d10.py +++ b/specs/d3d10.py @@ -689,7 +689,7 @@ ID3D10Multithread = Interface("ID3D10Multithread", IUnknown) ID3D10DeviceChild.methods += [ Method(Void, "GetDevice", [Out(Pointer(Pointer(ID3D10Device)), "ppDevice")]), Method(HRESULT, "GetPrivateData", [(REFGUID, "guid"), Out(Pointer(UINT), "pDataSize"), Out(OpaquePointer(Void), "pData")]), - Method(HRESULT, "SetPrivateData", [(REFGUID, "guid"), (UINT, "DataSize"), (OpaquePointer(Const(Void)), "pData")]), + Method(HRESULT, "SetPrivateData", [(REFGUID, "guid"), (UINT, "DataSize"), (OpaqueBlob(Const(Void), "DataSize"), "pData")]), Method(HRESULT, "SetPrivateDataInterface", [(REFGUID, "guid"), (OpaquePointer(Const(IUnknown)), "pData")]), ] @@ -771,31 +771,31 @@ ID3D10Query.methods += [ ] ID3D10Device.methods += [ - Method(Void, "VSSetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(OpaquePointer(ID3D10Buffer)), "NumBuffers"), "ppConstantBuffers")]), - Method(Void, "PSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(OpaquePointer(ID3D10ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]), + Method(Void, "VSSetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(Pointer(ID3D10Buffer)), "NumBuffers"), "ppConstantBuffers")]), + Method(Void, "PSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(Pointer(ID3D10ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]), Method(Void, "PSSetShader", [(Pointer(ID3D10PixelShader), "pPixelShader")]), - Method(Void, "PSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(OpaquePointer(ID3D10SamplerState)), "NumSamplers"), "ppSamplers")]), + Method(Void, "PSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(Pointer(ID3D10SamplerState)), "NumSamplers"), "ppSamplers")]), Method(Void, "VSSetShader", [(Pointer(ID3D10VertexShader), "pVertexShader")]), Method(Void, "DrawIndexed", [(UINT, "IndexCount"), (UINT, "StartIndexLocation"), (INT, "BaseVertexLocation")]), Method(Void, "Draw", [(UINT, "VertexCount"), (UINT, "StartVertexLocation")]), - Method(Void, "PSSetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(OpaquePointer(ID3D10Buffer)), "NumBuffers"), "ppConstantBuffers")]), + Method(Void, "PSSetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(Pointer(ID3D10Buffer)), "NumBuffers"), "ppConstantBuffers")]), Method(Void, "IASetInputLayout", [(Pointer(ID3D10InputLayout), "pInputLayout")]), - Method(Void, "IASetVertexBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(OpaquePointer(ID3D10Buffer)), "NumBuffers"), "ppVertexBuffers"), (Array(Const(UINT), "NumBuffers"), "pStrides"), (Array(Const(UINT), "NumBuffers"), "pOffsets")]), - Method(Void, "IASetIndexBuffer", [(OpaquePointer(ID3D10Buffer), "pIndexBuffer"), (DXGI_FORMAT, "Format"), (UINT, "Offset")]), + Method(Void, "IASetVertexBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(Pointer(ID3D10Buffer)), "NumBuffers"), "ppVertexBuffers"), (Array(Const(UINT), "NumBuffers"), "pStrides"), (Array(Const(UINT), "NumBuffers"), "pOffsets")]), + Method(Void, "IASetIndexBuffer", [(Pointer(ID3D10Buffer), "pIndexBuffer"), (DXGI_FORMAT, "Format"), (UINT, "Offset")]), Method(Void, "DrawIndexedInstanced", [(UINT, "IndexCountPerInstance"), (UINT, "InstanceCount"), (UINT, "StartIndexLocation"), (INT, "BaseVertexLocation"), (UINT, "StartInstanceLocation")]), Method(Void, "DrawInstanced", [(UINT, "VertexCountPerInstance"), (UINT, "InstanceCount"), (UINT, "StartVertexLocation"), (UINT, "StartInstanceLocation")]), - Method(Void, "GSSetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(OpaquePointer(ID3D10Buffer)), "NumBuffers"), "ppConstantBuffers")]), + Method(Void, "GSSetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(Pointer(ID3D10Buffer)), "NumBuffers"), "ppConstantBuffers")]), Method(Void, "GSSetShader", [(Pointer(ID3D10GeometryShader), "pShader")]), Method(Void, "IASetPrimitiveTopology", [(D3D10_PRIMITIVE_TOPOLOGY, "Topology")]), - Method(Void, "VSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(OpaquePointer(ID3D10ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]), - Method(Void, "VSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(OpaquePointer(ID3D10SamplerState)), "NumSamplers"), "ppSamplers")]), + Method(Void, "VSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(Pointer(ID3D10ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]), + Method(Void, "VSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(Pointer(ID3D10SamplerState)), "NumSamplers"), "ppSamplers")]), Method(Void, "SetPredication", [(Pointer(ID3D10Predicate), "pPredicate"), (BOOL, "PredicateValue")]), - Method(Void, "GSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(OpaquePointer(ID3D10ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]), - Method(Void, "GSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(OpaquePointer(ID3D10SamplerState)), "NumSamplers"), "ppSamplers")]), - Method(Void, "OMSetRenderTargets", [(UINT, "NumViews"), (Array(Const(OpaquePointer(ID3D10RenderTargetView)), "NumViews"), "ppRenderTargetViews"), (Pointer(ID3D10DepthStencilView), "pDepthStencilView")]), + Method(Void, "GSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(Pointer(ID3D10ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]), + Method(Void, "GSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(Pointer(ID3D10SamplerState)), "NumSamplers"), "ppSamplers")]), + Method(Void, "OMSetRenderTargets", [(UINT, "NumViews"), (Array(Const(Pointer(ID3D10RenderTargetView)), "NumViews"), "ppRenderTargetViews"), (Pointer(ID3D10DepthStencilView), "pDepthStencilView")]), Method(Void, "OMSetBlendState", [(Pointer(ID3D10BlendState), "pBlendState"), (Array(Const(FLOAT), 4), "BlendFactor"), (UINT, "SampleMask")]), Method(Void, "OMSetDepthStencilState", [(Pointer(ID3D10DepthStencilState), "pDepthStencilState"), (UINT, "StencilRef")]), - Method(Void, "SOSetTargets", [(UINT, "NumBuffers"), (Array(Const(OpaquePointer(ID3D10Buffer)), "NumBuffers"), "ppSOTargets"), (Array(Const(UINT), "NumBuffers"), "pOffsets")]), + Method(Void, "SOSetTargets", [(UINT, "NumBuffers"), (Array(Const(Pointer(ID3D10Buffer)), "NumBuffers"), "ppSOTargets"), (Array(Const(UINT), "NumBuffers"), "pOffsets")]), Method(Void, "DrawAuto", []), Method(Void, "RSSetState", [(Pointer(ID3D10RasterizerState), "pRasterizerState")]), Method(Void, "RSSetViewports", [(UINT, "NumViewports"), (Array(Const(D3D10_VIEWPORT), "NumViewports"), "pViewports")]), @@ -803,31 +803,31 @@ ID3D10Device.methods += [ Method(Void, "CopySubresourceRegion", [(Pointer(ID3D10Resource), "pDstResource"), (UINT, "DstSubresource"), (UINT, "DstX"), (UINT, "DstY"), (UINT, "DstZ"), (Pointer(ID3D10Resource), "pSrcResource"), (UINT, "SrcSubresource"), (Pointer(Const(D3D10_BOX)), "pSrcBox")]), Method(Void, "CopyResource", [(Pointer(ID3D10Resource), "pDstResource"), (Pointer(ID3D10Resource), "pSrcResource")]), Method(Void, "UpdateSubresource", [(Pointer(ID3D10Resource), "pDstResource"), (UINT, "DstSubresource"), (Pointer(Const(D3D10_BOX)), "pDstBox"), (OpaquePointer(Const(Void)), "pSrcData"), (UINT, "SrcRowPitch"), (UINT, "SrcDepthPitch")]), - Method(Void, "ClearRenderTargetView", [(OpaquePointer(ID3D10RenderTargetView), "pRenderTargetView"), (Array(Const(FLOAT), 4), "ColorRGBA")]), + Method(Void, "ClearRenderTargetView", [(Pointer(ID3D10RenderTargetView), "pRenderTargetView"), (Array(Const(FLOAT), 4), "ColorRGBA")]), Method(Void, "ClearDepthStencilView", [(Pointer(ID3D10DepthStencilView), "pDepthStencilView"), (D3D10_CLEAR_FLAG, "ClearFlags"), (FLOAT, "Depth"), (UINT8, "Stencil")]), - Method(Void, "GenerateMips", [(OpaquePointer(ID3D10ShaderResourceView), "pShaderResourceView")]), + Method(Void, "GenerateMips", [(Pointer(ID3D10ShaderResourceView), "pShaderResourceView")]), Method(Void, "ResolveSubresource", [(Pointer(ID3D10Resource), "pDstResource"), (UINT, "DstSubresource"), (Pointer(ID3D10Resource), "pSrcResource"), (UINT, "SrcSubresource"), (DXGI_FORMAT, "Format")]), - Method(Void, "VSGetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), Out(Array(OpaquePointer(ID3D10Buffer), "NumBuffers"), "ppConstantBuffers")]), - Method(Void, "PSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), Out(Array(OpaquePointer(ID3D10ShaderResourceView), "NumViews"), "ppShaderResourceViews")]), + Method(Void, "VSGetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), Out(Array(Pointer(ID3D10Buffer), "NumBuffers"), "ppConstantBuffers")]), + Method(Void, "PSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), Out(Array(Pointer(ID3D10ShaderResourceView), "NumViews"), "ppShaderResourceViews")]), Method(Void, "PSGetShader", [Out(Pointer(Pointer(ID3D10PixelShader)), "ppPixelShader")]), - Method(Void, "PSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), Out(Array(OpaquePointer(ID3D10SamplerState), "NumSamplers"), "ppSamplers")]), + Method(Void, "PSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), Out(Array(Pointer(ID3D10SamplerState), "NumSamplers"), "ppSamplers")]), Method(Void, "VSGetShader", [Out(Pointer(Pointer(ID3D10VertexShader)), "ppVertexShader")]), - Method(Void, "PSGetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), Out(Array(OpaquePointer(ID3D10Buffer), "NumBuffers"), "ppConstantBuffers")]), + Method(Void, "PSGetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), Out(Array(Pointer(ID3D10Buffer), "NumBuffers"), "ppConstantBuffers")]), Method(Void, "IAGetInputLayout", [Out(Pointer(Pointer(ID3D10InputLayout)), "ppInputLayout")]), - Method(Void, "IAGetVertexBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), Out(Array(OpaquePointer(ID3D10Buffer), "NumBuffers"), "ppVertexBuffers"), Out(Array(UINT, "NumBuffers"), "pStrides"), Out(Array(UINT, "NumBuffers"), "pOffsets")]), - Method(Void, "IAGetIndexBuffer", [Out(Pointer(OpaquePointer(ID3D10Buffer)), "pIndexBuffer"), Out(Pointer(DXGI_FORMAT), "Format"), Out(Pointer(UINT), "Offset")]), - Method(Void, "GSGetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), Out(Array(OpaquePointer(ID3D10Buffer), "NumBuffers"), "ppConstantBuffers")]), + Method(Void, "IAGetVertexBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), Out(Array(Pointer(ID3D10Buffer), "NumBuffers"), "ppVertexBuffers"), Out(Array(UINT, "NumBuffers"), "pStrides"), Out(Array(UINT, "NumBuffers"), "pOffsets")]), + Method(Void, "IAGetIndexBuffer", [Out(Pointer(Pointer(ID3D10Buffer)), "pIndexBuffer"), Out(Pointer(DXGI_FORMAT), "Format"), Out(Pointer(UINT), "Offset")]), + Method(Void, "GSGetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), Out(Array(Pointer(ID3D10Buffer), "NumBuffers"), "ppConstantBuffers")]), Method(Void, "GSGetShader", [Out(Pointer(Pointer(ID3D10GeometryShader)), "ppGeometryShader")]), Method(Void, "IAGetPrimitiveTopology", [Out(Pointer(D3D10_PRIMITIVE_TOPOLOGY), "pTopology")]), - Method(Void, "VSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), Out(Array(OpaquePointer(ID3D10ShaderResourceView), "NumViews"), "ppShaderResourceViews")]), - Method(Void, "VSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), Out(Array(OpaquePointer(ID3D10SamplerState), "NumSamplers"), "ppSamplers")]), + Method(Void, "VSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), Out(Array(Pointer(ID3D10ShaderResourceView), "NumViews"), "ppShaderResourceViews")]), + Method(Void, "VSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), Out(Array(Pointer(ID3D10SamplerState), "NumSamplers"), "ppSamplers")]), Method(Void, "GetPredication", [Out(Pointer(Pointer(ID3D10Predicate)), "ppPredicate"), Out(Pointer(BOOL), "pPredicateValue")]), - Method(Void, "GSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), Out(Array(OpaquePointer(ID3D10ShaderResourceView), "NumViews"), "ppShaderResourceViews")]), - Method(Void, "GSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), Out(Array(OpaquePointer(ID3D10SamplerState), "NumSamplers"), "ppSamplers")]), - Method(Void, "OMGetRenderTargets", [(UINT, "NumViews"), Out(Array(OpaquePointer(ID3D10RenderTargetView), "NumViews"), "ppRenderTargetViews"), Out(Pointer(Pointer(ID3D10DepthStencilView)), "ppDepthStencilView")]), + Method(Void, "GSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), Out(Array(Pointer(ID3D10ShaderResourceView), "NumViews"), "ppShaderResourceViews")]), + Method(Void, "GSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), Out(Array(Pointer(ID3D10SamplerState), "NumSamplers"), "ppSamplers")]), + Method(Void, "OMGetRenderTargets", [(UINT, "NumViews"), Out(Array(Pointer(ID3D10RenderTargetView), "NumViews"), "ppRenderTargetViews"), Out(Pointer(Pointer(ID3D10DepthStencilView)), "ppDepthStencilView")]), Method(Void, "OMGetBlendState", [Out(Pointer(Pointer(ID3D10BlendState)), "ppBlendState"), Out(Array(FLOAT, 4), "BlendFactor"), Out(Pointer(UINT), "pSampleMask")]), Method(Void, "OMGetDepthStencilState", [Out(Pointer(Pointer(ID3D10DepthStencilState)), "ppDepthStencilState"), Out(Pointer(UINT), "pStencilRef")]), - Method(Void, "SOGetTargets", [(UINT, "NumBuffers"), Out(Array(OpaquePointer(ID3D10Buffer), "NumBuffers"), "ppSOTargets"), Out(Array(UINT, "NumBuffers"), "pOffsets")]), + Method(Void, "SOGetTargets", [(UINT, "NumBuffers"), Out(Array(Pointer(ID3D10Buffer), "NumBuffers"), "ppSOTargets"), Out(Array(UINT, "NumBuffers"), "pOffsets")]), Method(Void, "RSGetState", [Out(Pointer(Pointer(ID3D10RasterizerState)), "ppRasterizerState")]), Method(Void, "RSGetViewports", [Out(Pointer(UINT), "NumViewports"), Out(Array(D3D10_VIEWPORT, "*NumViewports"), "pViewports")]), Method(Void, "RSGetScissorRects", [Out(Pointer(UINT), "NumRects"), Out(Array(D3D10_RECT, "*NumRects"), "pRects")]), @@ -835,26 +835,26 @@ ID3D10Device.methods += [ Method(HRESULT, "SetExceptionMode", [(D3D10_RAISE_FLAG, "RaiseFlags")]), Method(D3D10_RAISE_FLAG, "GetExceptionMode", []), Method(HRESULT, "GetPrivateData", [(REFGUID, "guid"), Out(Pointer(UINT), "pDataSize"), Out(OpaquePointer(Void), "pData")]), - Method(HRESULT, "SetPrivateData", [(REFGUID, "guid"), (UINT, "DataSize"), (OpaquePointer(Const(Void)), "pData")]), + Method(HRESULT, "SetPrivateData", [(REFGUID, "guid"), (UINT, "DataSize"), (OpaqueBlob(Const(Void), "DataSize"), "pData")]), Method(HRESULT, "SetPrivateDataInterface", [(REFGUID, "guid"), (OpaquePointer(Const(IUnknown)), "pData")]), Method(Void, "ClearState", []), Method(Void, "Flush", []), - Method(HRESULT, "CreateBuffer", [(Pointer(Const(D3D10_BUFFER_DESC)), "pDesc"), (Pointer(Const(D3D10_SUBRESOURCE_DATA)), "pInitialData"), Out(Pointer(OpaquePointer(ID3D10Buffer)), "ppBuffer")]), + Method(HRESULT, "CreateBuffer", [(Pointer(Const(D3D10_BUFFER_DESC)), "pDesc"), (Pointer(Const(D3D10_SUBRESOURCE_DATA)), "pInitialData"), Out(Pointer(Pointer(ID3D10Buffer)), "ppBuffer")]), Method(HRESULT, "CreateTexture1D", [(Pointer(Const(D3D10_TEXTURE1D_DESC)), "pDesc"), (Pointer(Const(D3D10_SUBRESOURCE_DATA)), "pInitialData"), Out(Pointer(Pointer(ID3D10Texture1D)), "ppTexture1D")]), Method(HRESULT, "CreateTexture2D", [(Pointer(Const(D3D10_TEXTURE2D_DESC)), "pDesc"), (Pointer(Const(D3D10_SUBRESOURCE_DATA)), "pInitialData"), Out(Pointer(Pointer(ID3D10Texture2D)), "ppTexture2D")]), Method(HRESULT, "CreateTexture3D", [(Pointer(Const(D3D10_TEXTURE3D_DESC)), "pDesc"), (Pointer(Const(D3D10_SUBRESOURCE_DATA)), "pInitialData"), Out(Pointer(Pointer(ID3D10Texture3D)), "ppTexture3D")]), - Method(HRESULT, "CreateShaderResourceView", [(Pointer(ID3D10Resource), "pResource"), (Pointer(Const(D3D10_SHADER_RESOURCE_VIEW_DESC)), "pDesc"), Out(Pointer(OpaquePointer(ID3D10ShaderResourceView)), "ppSRView")]), - Method(HRESULT, "CreateRenderTargetView", [(Pointer(ID3D10Resource), "pResource"), (Pointer(Const(D3D10_RENDER_TARGET_VIEW_DESC)), "pDesc"), Out(Pointer(OpaquePointer(ID3D10RenderTargetView)), "ppRTView")]), + Method(HRESULT, "CreateShaderResourceView", [(Pointer(ID3D10Resource), "pResource"), (Pointer(Const(D3D10_SHADER_RESOURCE_VIEW_DESC)), "pDesc"), Out(Pointer(Pointer(ID3D10ShaderResourceView)), "ppSRView")]), + Method(HRESULT, "CreateRenderTargetView", [(Pointer(ID3D10Resource), "pResource"), (Pointer(Const(D3D10_RENDER_TARGET_VIEW_DESC)), "pDesc"), Out(Pointer(Pointer(ID3D10RenderTargetView)), "ppRTView")]), Method(HRESULT, "CreateDepthStencilView", [(Pointer(ID3D10Resource), "pResource"), (Pointer(Const(D3D10_DEPTH_STENCIL_VIEW_DESC)), "pDesc"), Out(Pointer(Pointer(ID3D10DepthStencilView)), "ppDepthStencilView")]), - Method(HRESULT, "CreateInputLayout", [(Pointer(Const(D3D10_INPUT_ELEMENT_DESC)), "pInputElementDescs"), (UINT, "NumElements"), (Blob(Const(Void), "BytecodeLength"), "pShaderBytecodeWithInputSignature"), (SIZE_T, "BytecodeLength"), Out(Pointer(Pointer(ID3D10InputLayout)), "ppInputLayout")]), + Method(HRESULT, "CreateInputLayout", [(Array(Const(D3D10_INPUT_ELEMENT_DESC), "NumElements"), "pInputElementDescs"), (UINT, "NumElements"), (Blob(Const(Void), "BytecodeLength"), "pShaderBytecodeWithInputSignature"), (SIZE_T, "BytecodeLength"), Out(Pointer(Pointer(ID3D10InputLayout)), "ppInputLayout")]), Method(HRESULT, "CreateVertexShader", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), Out(Pointer(Pointer(ID3D10VertexShader)), "ppVertexShader")]), Method(HRESULT, "CreateGeometryShader", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), Out(Pointer(Pointer(ID3D10GeometryShader)), "ppGeometryShader")]), - Method(HRESULT, "CreateGeometryShaderWithStreamOutput", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), (Pointer(Const(D3D10_SO_DECLARATION_ENTRY)), "pSODeclaration"), (UINT, "NumEntries"), (UINT, "OutputStreamStride"), Out(Pointer(Pointer(ID3D10GeometryShader)), "ppGeometryShader")]), + Method(HRESULT, "CreateGeometryShaderWithStreamOutput", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), (Array(Const(D3D10_SO_DECLARATION_ENTRY), "NumEntries"), "pSODeclaration"), (UINT, "NumEntries"), (UINT, "OutputStreamStride"), Out(Pointer(Pointer(ID3D10GeometryShader)), "ppGeometryShader")]), Method(HRESULT, "CreatePixelShader", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), Out(Pointer(Pointer(ID3D10PixelShader)), "ppPixelShader")]), Method(HRESULT, "CreateBlendState", [(Pointer(Const(D3D10_BLEND_DESC)), "pBlendStateDesc"), Out(Pointer(Pointer(ID3D10BlendState)), "ppBlendState")]), Method(HRESULT, "CreateDepthStencilState", [(Pointer(Const(D3D10_DEPTH_STENCIL_DESC)), "pDepthStencilDesc"), Out(Pointer(Pointer(ID3D10DepthStencilState)), "ppDepthStencilState")]), Method(HRESULT, "CreateRasterizerState", [(Pointer(Const(D3D10_RASTERIZER_DESC)), "pRasterizerDesc"), Out(Pointer(Pointer(ID3D10RasterizerState)), "ppRasterizerState")]), - Method(HRESULT, "CreateSamplerState", [(Pointer(Const(D3D10_SAMPLER_DESC)), "pSamplerDesc"), Out(Pointer(OpaquePointer(ID3D10SamplerState)), "ppSamplerState")]), + Method(HRESULT, "CreateSamplerState", [(Pointer(Const(D3D10_SAMPLER_DESC)), "pSamplerDesc"), Out(Pointer(Pointer(ID3D10SamplerState)), "ppSamplerState")]), Method(HRESULT, "CreateQuery", [(Pointer(Const(D3D10_QUERY_DESC)), "pQueryDesc"), Out(Pointer(Pointer(ID3D10Query)), "ppQuery")]), Method(HRESULT, "CreatePredicate", [(Pointer(Const(D3D10_QUERY_DESC)), "pPredicateDesc"), Out(Pointer(Pointer(ID3D10Predicate)), "ppPredicate")]), Method(HRESULT, "CreateCounter", [(Pointer(Const(D3D10_COUNTER_DESC)), "pCounterDesc"), Out(Pointer(Pointer(ID3D10Counter)), "ppCounter")]), diff --git a/specs/d3d11.py b/specs/d3d11.py index 6371529..3a09296 100644 --- a/specs/d3d11.py +++ b/specs/d3d11.py @@ -1057,45 +1057,45 @@ D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS = Struct('D3D11_FEATURE_DATA_D3D10_X ]) ID3D11DeviceContext.methods += [ - StdMethod(Void, 'VSSetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Pointer(Const(Pointer(ID3D11Buffer))), 'ppConstantBuffers')]), - StdMethod(Void, 'PSSetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), (Pointer(Const(Pointer(ID3D11ShaderResourceView))), 'ppShaderResourceViews')]), - StdMethod(Void, 'PSSetShader', [(Pointer(ID3D11PixelShader), 'pPixelShader'), (Pointer(Const(Pointer(ID3D11ClassInstance))), 'ppClassInstances'), (UINT, 'NumClassInstances')]), - StdMethod(Void, 'PSSetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), (Pointer(Const(Pointer(ID3D11SamplerState))), 'ppSamplers')]), - StdMethod(Void, 'VSSetShader', [(Pointer(ID3D11VertexShader), 'pVertexShader'), (Pointer(Const(Pointer(ID3D11ClassInstance))), 'ppClassInstances'), (UINT, 'NumClassInstances')]), + StdMethod(Void, 'VSSetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Array(Const(Pointer(ID3D11Buffer)), 'NumBuffers'), 'ppConstantBuffers')]), + StdMethod(Void, 'PSSetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), (Array(Const(Pointer(ID3D11ShaderResourceView)), 'NumViews'), 'ppShaderResourceViews')]), + StdMethod(Void, 'PSSetShader', [(Pointer(ID3D11PixelShader), 'pPixelShader'), (Array(Const(Pointer(ID3D11ClassInstance)), 'NumClassInstances'), 'ppClassInstances'), (UINT, 'NumClassInstances')]), + StdMethod(Void, 'PSSetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), (Array(Const(Pointer(ID3D11SamplerState)), 'NumSamplers'), 'ppSamplers')]), + StdMethod(Void, 'VSSetShader', [(Pointer(ID3D11VertexShader), 'pVertexShader'), (Array(Const(Pointer(ID3D11ClassInstance)), 'NumClassInstances'), 'ppClassInstances'), (UINT, 'NumClassInstances')]), StdMethod(Void, 'DrawIndexed', [(UINT, 'IndexCount'), (UINT, 'StartIndexLocation'), (INT, 'BaseVertexLocation')]), StdMethod(Void, 'Draw', [(UINT, 'VertexCount'), (UINT, 'StartVertexLocation')]), StdMethod(HRESULT, 'Map', [(Pointer(ID3D11Resource), 'pResource'), (UINT, 'Subresource'), (D3D11_MAP, 'MapType'), (D3D11_MAP_FLAG, 'MapFlags'), Out(Pointer(D3D11_MAPPED_SUBRESOURCE), 'pMappedResource')]), StdMethod(Void, 'Unmap', [(Pointer(ID3D11Resource), 'pResource'), (UINT, 'Subresource')]), - StdMethod(Void, 'PSSetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Pointer(Const(Pointer(ID3D11Buffer))), 'ppConstantBuffers')]), + StdMethod(Void, 'PSSetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Array(Const(Pointer(ID3D11Buffer)), 'NumBuffers'), 'ppConstantBuffers')]), StdMethod(Void, 'IASetInputLayout', [(Pointer(ID3D11InputLayout), 'pInputLayout')]), - StdMethod(Void, 'IASetVertexBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Pointer(Const(Pointer(ID3D11Buffer))), 'ppVertexBuffers'), (Pointer(Const(UINT)), 'pStrides'), (Pointer(Const(UINT)), 'pOffsets')]), + StdMethod(Void, 'IASetVertexBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Array(Const(Pointer(ID3D11Buffer)), 'NumBuffers'), 'ppVertexBuffers'), (Pointer(Const(UINT)), 'pStrides'), (Pointer(Const(UINT)), 'pOffsets')]), StdMethod(Void, 'IASetIndexBuffer', [(Pointer(ID3D11Buffer), 'pIndexBuffer'), (DXGI_FORMAT, 'Format'), (UINT, 'Offset')]), StdMethod(Void, 'DrawIndexedInstanced', [(UINT, 'IndexCountPerInstance'), (UINT, 'InstanceCount'), (UINT, 'StartIndexLocation'), (INT, 'BaseVertexLocation'), (UINT, 'StartInstanceLocation')]), StdMethod(Void, 'DrawInstanced', [(UINT, 'VertexCountPerInstance'), (UINT, 'InstanceCount'), (UINT, 'StartVertexLocation'), (UINT, 'StartInstanceLocation')]), - StdMethod(Void, 'GSSetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Pointer(Const(Pointer(ID3D11Buffer))), 'ppConstantBuffers')]), - StdMethod(Void, 'GSSetShader', [(Pointer(ID3D11GeometryShader), 'pShader'), (Pointer(Const(Pointer(ID3D11ClassInstance))), 'ppClassInstances'), (UINT, 'NumClassInstances')]), + StdMethod(Void, 'GSSetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Array(Const(Pointer(ID3D11Buffer)), 'NumBuffers'), 'ppConstantBuffers')]), + StdMethod(Void, 'GSSetShader', [(Pointer(ID3D11GeometryShader), 'pShader'), (Array(Const(Pointer(ID3D11ClassInstance)), 'NumClassInstances'), 'ppClassInstances'), (UINT, 'NumClassInstances')]), StdMethod(Void, 'IASetPrimitiveTopology', [(D3D11_PRIMITIVE_TOPOLOGY, 'Topology')]), - StdMethod(Void, 'VSSetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), (Pointer(Const(Pointer(ID3D11ShaderResourceView))), 'ppShaderResourceViews')]), - StdMethod(Void, 'VSSetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), (Pointer(Const(Pointer(ID3D11SamplerState))), 'ppSamplers')]), + StdMethod(Void, 'VSSetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), (Array(Const(Pointer(ID3D11ShaderResourceView)), 'NumViews'), 'ppShaderResourceViews')]), + StdMethod(Void, 'VSSetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), (Array(Const(Pointer(ID3D11SamplerState)), 'NumSamplers'), 'ppSamplers')]), StdMethod(Void, 'Begin', [(Pointer(ID3D11Asynchronous), 'pAsync')]), StdMethod(Void, 'End', [(Pointer(ID3D11Asynchronous), 'pAsync')]), StdMethod(HRESULT, 'GetData', [(Pointer(ID3D11Asynchronous), 'pAsync'), Out(OpaqueBlob(Void, 'DataSize'), 'pData'), (UINT, 'DataSize'), (D3D11_ASYNC_GETDATA_FLAG, 'GetDataFlags')]), StdMethod(Void, 'SetPredication', [(Pointer(ID3D11Predicate), 'pPredicate'), (BOOL, 'PredicateValue')]), - StdMethod(Void, 'GSSetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), (Pointer(Const(Pointer(ID3D11ShaderResourceView))), 'ppShaderResourceViews')]), - StdMethod(Void, 'GSSetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), (Pointer(Const(Pointer(ID3D11SamplerState))), 'ppSamplers')]), - StdMethod(Void, 'OMSetRenderTargets', [(UINT, 'NumViews'), (Pointer(Const(Pointer(ID3D11RenderTargetView))), 'ppRenderTargetViews'), (Pointer(ID3D11DepthStencilView), 'pDepthStencilView')]), - StdMethod(Void, 'OMSetRenderTargetsAndUnorderedAccessViews', [(UINT, 'NumRTVs'), (Pointer(Const(Pointer(ID3D11RenderTargetView))), 'ppRenderTargetViews'), (Pointer(ID3D11DepthStencilView), 'pDepthStencilView'), (UINT, 'UAVStartSlot'), (UINT, 'NumUAVs'), (Pointer(Const(Pointer(ID3D11UnorderedAccessView))), 'ppUnorderedAccessViews'), (Pointer(Const(UINT)), 'pUAVInitialCounts')]), + StdMethod(Void, 'GSSetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), (Array(Const(Pointer(ID3D11ShaderResourceView)), 'NumViews'), 'ppShaderResourceViews')]), + StdMethod(Void, 'GSSetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), (Array(Const(Pointer(ID3D11SamplerState)), 'NumSamplers'), 'ppSamplers')]), + StdMethod(Void, 'OMSetRenderTargets', [(UINT, 'NumViews'), (Array(Const(Pointer(ID3D11RenderTargetView)), 'NumViews'), 'ppRenderTargetViews'), (Pointer(ID3D11DepthStencilView), 'pDepthStencilView')]), + StdMethod(Void, 'OMSetRenderTargetsAndUnorderedAccessViews', [(UINT, 'NumRTVs'), (Array(Const(Pointer(ID3D11RenderTargetView)), 'NumRTVs'), 'ppRenderTargetViews'), (Pointer(ID3D11DepthStencilView), 'pDepthStencilView'), (UINT, 'UAVStartSlot'), (UINT, 'NumUAVs'), (Array(Const(Pointer(ID3D11UnorderedAccessView)), 'NumUAVs'), 'ppUnorderedAccessViews'), (Pointer(Const(UINT)), 'pUAVInitialCounts')]), StdMethod(Void, 'OMSetBlendState', [(Pointer(ID3D11BlendState), 'pBlendState'), (Array(Const(FLOAT), 4), 'BlendFactor'), (UINT, 'SampleMask')]), StdMethod(Void, 'OMSetDepthStencilState', [(Pointer(ID3D11DepthStencilState), 'pDepthStencilState'), (UINT, 'StencilRef')]), - StdMethod(Void, 'SOSetTargets', [(UINT, 'NumBuffers'), (Pointer(Const(Pointer(ID3D11Buffer))), 'ppSOTargets'), (Pointer(Const(UINT)), 'pOffsets')]), + StdMethod(Void, 'SOSetTargets', [(UINT, 'NumBuffers'), (Array(Const(Pointer(ID3D11Buffer)), 'NumBuffers'), 'ppSOTargets'), (Pointer(Const(UINT)), 'pOffsets')]), StdMethod(Void, 'DrawAuto', []), StdMethod(Void, 'DrawIndexedInstancedIndirect', [(Pointer(ID3D11Buffer), 'pBufferForArgs'), (UINT, 'AlignedByteOffsetForArgs')]), StdMethod(Void, 'DrawInstancedIndirect', [(Pointer(ID3D11Buffer), 'pBufferForArgs'), (UINT, 'AlignedByteOffsetForArgs')]), StdMethod(Void, 'Dispatch', [(UINT, 'ThreadGroupCountX'), (UINT, 'ThreadGroupCountY'), (UINT, 'ThreadGroupCountZ')]), StdMethod(Void, 'DispatchIndirect', [(Pointer(ID3D11Buffer), 'pBufferForArgs'), (UINT, 'AlignedByteOffsetForArgs')]), StdMethod(Void, 'RSSetState', [(Pointer(ID3D11RasterizerState), 'pRasterizerState')]), - StdMethod(Void, 'RSSetViewports', [(UINT, 'NumViewports'), (Pointer(Const(D3D11_VIEWPORT)), 'pViewports')]), - StdMethod(Void, 'RSSetScissorRects', [(UINT, 'NumRects'), (Pointer(Const(D3D11_RECT)), 'pRects')]), + StdMethod(Void, 'RSSetViewports', [(UINT, 'NumViewports'), (Array(Const(D3D11_VIEWPORT), 'NumViewports'), 'pViewports')]), + StdMethod(Void, 'RSSetScissorRects', [(UINT, 'NumRects'), (Array(Const(D3D11_RECT), 'NumRects'), 'pRects')]), StdMethod(Void, 'CopySubresourceRegion', [(Pointer(ID3D11Resource), 'pDstResource'), (UINT, 'DstSubresource'), (UINT, 'DstX'), (UINT, 'DstY'), (UINT, 'DstZ'), (Pointer(ID3D11Resource), 'pSrcResource'), (UINT, 'SrcSubresource'), (Pointer(Const(D3D11_BOX)), 'pSrcBox')]), StdMethod(Void, 'CopyResource', [(Pointer(ID3D11Resource), 'pDstResource'), (Pointer(ID3D11Resource), 'pSrcResource')]), StdMethod(Void, 'UpdateSubresource', [(Pointer(ID3D11Resource), 'pDstResource'), (UINT, 'DstSubresource'), (Pointer(Const(D3D11_BOX)), 'pDstBox'), (OpaquePointer(Const(Void)), 'pSrcData'), (UINT, 'SrcRowPitch'), (UINT, 'SrcDepthPitch')]), @@ -1109,57 +1109,57 @@ ID3D11DeviceContext.methods += [ StdMethod(FLOAT, 'GetResourceMinLOD', [(Pointer(ID3D11Resource), 'pResource')]), StdMethod(Void, 'ResolveSubresource', [(Pointer(ID3D11Resource), 'pDstResource'), (UINT, 'DstSubresource'), (Pointer(ID3D11Resource), 'pSrcResource'), (UINT, 'SrcSubresource'), (DXGI_FORMAT, 'Format')]), StdMethod(Void, 'ExecuteCommandList', [(Pointer(ID3D11CommandList), 'pCommandList'), (BOOL, 'RestoreContextState')]), - StdMethod(Void, 'HSSetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), (Pointer(Const(Pointer(ID3D11ShaderResourceView))), 'ppShaderResourceViews')]), - StdMethod(Void, 'HSSetShader', [(Pointer(ID3D11HullShader), 'pHullShader'), (Pointer(Const(Pointer(ID3D11ClassInstance))), 'ppClassInstances'), (UINT, 'NumClassInstances')]), - StdMethod(Void, 'HSSetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), (Pointer(Const(Pointer(ID3D11SamplerState))), 'ppSamplers')]), - StdMethod(Void, 'HSSetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Pointer(Const(Pointer(ID3D11Buffer))), 'ppConstantBuffers')]), - StdMethod(Void, 'DSSetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), (Pointer(Const(Pointer(ID3D11ShaderResourceView))), 'ppShaderResourceViews')]), - StdMethod(Void, 'DSSetShader', [(Pointer(ID3D11DomainShader), 'pDomainShader'), (Pointer(Const(Pointer(ID3D11ClassInstance))), 'ppClassInstances'), (UINT, 'NumClassInstances')]), - StdMethod(Void, 'DSSetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), (Pointer(Const(Pointer(ID3D11SamplerState))), 'ppSamplers')]), - StdMethod(Void, 'DSSetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Pointer(Const(Pointer(ID3D11Buffer))), 'ppConstantBuffers')]), - StdMethod(Void, 'CSSetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), (Pointer(Const(Pointer(ID3D11ShaderResourceView))), 'ppShaderResourceViews')]), - StdMethod(Void, 'CSSetUnorderedAccessViews', [(UINT, 'StartSlot'), (UINT, 'NumUAVs'), (Pointer(Const(Pointer(ID3D11UnorderedAccessView))), 'ppUnorderedAccessViews'), (Pointer(Const(UINT)), 'pUAVInitialCounts')]), - StdMethod(Void, 'CSSetShader', [(Pointer(ID3D11ComputeShader), 'pComputeShader'), (Pointer(Const(Pointer(ID3D11ClassInstance))), 'ppClassInstances'), (UINT, 'NumClassInstances')]), - StdMethod(Void, 'CSSetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), (Pointer(Const(Pointer(ID3D11SamplerState))), 'ppSamplers')]), - StdMethod(Void, 'CSSetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Pointer(Const(Pointer(ID3D11Buffer))), 'ppConstantBuffers')]), - StdMethod(Void, 'VSGetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), Out(Pointer(Pointer(ID3D11Buffer)), 'ppConstantBuffers')]), - StdMethod(Void, 'PSGetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), Out(Pointer(Pointer(ID3D11ShaderResourceView)), 'ppShaderResourceViews')]), - StdMethod(Void, 'PSGetShader', [Out(Pointer(Pointer(ID3D11PixelShader)), 'ppPixelShader'), Out(Pointer(Pointer(ID3D11ClassInstance)), 'ppClassInstances'), Out(Pointer(UINT), 'pNumClassInstances')]), - StdMethod(Void, 'PSGetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), Out(Pointer(Pointer(ID3D11SamplerState)), 'ppSamplers')]), - StdMethod(Void, 'VSGetShader', [Out(Pointer(Pointer(ID3D11VertexShader)), 'ppVertexShader'), Out(Pointer(Pointer(ID3D11ClassInstance)), 'ppClassInstances'), Out(Pointer(UINT), 'pNumClassInstances')]), - StdMethod(Void, 'PSGetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), Out(Pointer(Pointer(ID3D11Buffer)), 'ppConstantBuffers')]), + StdMethod(Void, 'HSSetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), (Array(Const(Pointer(ID3D11ShaderResourceView)), 'NumViews'), 'ppShaderResourceViews')]), + StdMethod(Void, 'HSSetShader', [(Pointer(ID3D11HullShader), 'pHullShader'), (Array(Const(Pointer(ID3D11ClassInstance)), 'NumClassInstances'), 'ppClassInstances'), (UINT, 'NumClassInstances')]), + StdMethod(Void, 'HSSetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), (Array(Const(Pointer(ID3D11SamplerState)), 'NumSamplers'), 'ppSamplers')]), + StdMethod(Void, 'HSSetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Array(Const(Pointer(ID3D11Buffer)), 'NumBuffers'), 'ppConstantBuffers')]), + StdMethod(Void, 'DSSetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), (Array(Const(Pointer(ID3D11ShaderResourceView)), 'NumViews'), 'ppShaderResourceViews')]), + StdMethod(Void, 'DSSetShader', [(Pointer(ID3D11DomainShader), 'pDomainShader'), (Array(Const(Pointer(ID3D11ClassInstance)), 'NumClassInstances'), 'ppClassInstances'), (UINT, 'NumClassInstances')]), + StdMethod(Void, 'DSSetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), (Array(Const(Pointer(ID3D11SamplerState)), 'NumSamplers'), 'ppSamplers')]), + StdMethod(Void, 'DSSetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Array(Const(Pointer(ID3D11Buffer)), 'NumBuffers'), 'ppConstantBuffers')]), + StdMethod(Void, 'CSSetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), (Array(Const(Pointer(ID3D11ShaderResourceView)), 'NumViews'), 'ppShaderResourceViews')]), + StdMethod(Void, 'CSSetUnorderedAccessViews', [(UINT, 'StartSlot'), (UINT, 'NumUAVs'), (Array(Const(Pointer(ID3D11UnorderedAccessView)), 'NumUAVs'), 'ppUnorderedAccessViews'), (Pointer(Const(UINT)), 'pUAVInitialCounts')]), + StdMethod(Void, 'CSSetShader', [(Pointer(ID3D11ComputeShader), 'pComputeShader'), (Array(Const(Pointer(ID3D11ClassInstance)), 'NumClassInstances'), 'ppClassInstances'), (UINT, 'NumClassInstances')]), + StdMethod(Void, 'CSSetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), (Array(Const(Pointer(ID3D11SamplerState)), 'NumSamplers'), 'ppSamplers')]), + StdMethod(Void, 'CSSetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Array(Const(Pointer(ID3D11Buffer)), 'NumBuffers'), 'ppConstantBuffers')]), + StdMethod(Void, 'VSGetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Array(Pointer(ID3D11Buffer), 'NumBuffers'), 'ppConstantBuffers')]), + StdMethod(Void, 'PSGetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), (Array(Pointer(ID3D11ShaderResourceView), 'NumViews'), 'ppShaderResourceViews')]), + StdMethod(Void, 'PSGetShader', [Out(Pointer(Pointer(ID3D11PixelShader)), 'ppPixelShader'), Out(Array(Pointer(ID3D11ClassInstance), '*pNumClassInstances'), 'ppClassInstances'), Out(Pointer(UINT), 'pNumClassInstances')]), + StdMethod(Void, 'PSGetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), (Array(Pointer(ID3D11SamplerState), 'NumSamplers'), 'ppSamplers')]), + StdMethod(Void, 'VSGetShader', [Out(Pointer(Pointer(ID3D11VertexShader)), 'ppVertexShader'), Out(Array(Pointer(ID3D11ClassInstance), '*pNumClassInstances'), 'ppClassInstances'), Out(Pointer(UINT), 'pNumClassInstances')]), + StdMethod(Void, 'PSGetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Array(Pointer(ID3D11Buffer), 'NumBuffers'), 'ppConstantBuffers')]), StdMethod(Void, 'IAGetInputLayout', [Out(Pointer(Pointer(ID3D11InputLayout)), 'ppInputLayout')]), - StdMethod(Void, 'IAGetVertexBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), Out(Pointer(Pointer(ID3D11Buffer)), 'ppVertexBuffers'), Out(Pointer(UINT), 'pStrides'), Out(Pointer(UINT), 'pOffsets')]), + StdMethod(Void, 'IAGetVertexBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Array(Pointer(ID3D11Buffer), 'NumBuffers'), 'ppVertexBuffers'), Out(Pointer(UINT), 'pStrides'), Out(Pointer(UINT), 'pOffsets')]), StdMethod(Void, 'IAGetIndexBuffer', [Out(Pointer(Pointer(ID3D11Buffer)), 'pIndexBuffer'), Out(Pointer(DXGI_FORMAT), 'Format'), Out(Pointer(UINT), 'Offset')]), - StdMethod(Void, 'GSGetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), Out(Pointer(Pointer(ID3D11Buffer)), 'ppConstantBuffers')]), - StdMethod(Void, 'GSGetShader', [Out(Pointer(Pointer(ID3D11GeometryShader)), 'ppGeometryShader'), Out(Pointer(Pointer(ID3D11ClassInstance)), 'ppClassInstances'), Out(Pointer(UINT), 'pNumClassInstances')]), + StdMethod(Void, 'GSGetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Array(Pointer(ID3D11Buffer), 'NumBuffers'), 'ppConstantBuffers')]), + StdMethod(Void, 'GSGetShader', [Out(Pointer(Pointer(ID3D11GeometryShader)), 'ppGeometryShader'), Out(Array(Pointer(ID3D11ClassInstance), '*pNumClassInstances'), 'ppClassInstances'), Out(Pointer(UINT), 'pNumClassInstances')]), StdMethod(Void, 'IAGetPrimitiveTopology', [Out(Pointer(D3D11_PRIMITIVE_TOPOLOGY), 'pTopology')]), - StdMethod(Void, 'VSGetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), Out(Pointer(Pointer(ID3D11ShaderResourceView)), 'ppShaderResourceViews')]), - StdMethod(Void, 'VSGetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), Out(Pointer(Pointer(ID3D11SamplerState)), 'ppSamplers')]), + StdMethod(Void, 'VSGetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), (Array(Pointer(ID3D11ShaderResourceView), 'NumViews'), 'ppShaderResourceViews')]), + StdMethod(Void, 'VSGetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), (Array(Pointer(ID3D11SamplerState), 'NumSamplers'), 'ppSamplers')]), StdMethod(Void, 'GetPredication', [Out(Pointer(Pointer(ID3D11Predicate)), 'ppPredicate'), Out(Pointer(BOOL), 'pPredicateValue')]), - StdMethod(Void, 'GSGetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), Out(Pointer(Pointer(ID3D11ShaderResourceView)), 'ppShaderResourceViews')]), - StdMethod(Void, 'GSGetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), Out(Pointer(Pointer(ID3D11SamplerState)), 'ppSamplers')]), - StdMethod(Void, 'OMGetRenderTargets', [(UINT, 'NumViews'), Out(Pointer(Pointer(ID3D11RenderTargetView)), 'ppRenderTargetViews'), Out(Pointer(Pointer(ID3D11DepthStencilView)), 'ppDepthStencilView')]), - StdMethod(Void, 'OMGetRenderTargetsAndUnorderedAccessViews', [(UINT, 'NumRTVs'), Out(Pointer(Pointer(ID3D11RenderTargetView)), 'ppRenderTargetViews'), Out(Pointer(Pointer(ID3D11DepthStencilView)), 'ppDepthStencilView'), (UINT, 'UAVStartSlot'), (UINT, 'NumUAVs'), Out(Pointer(Pointer(ID3D11UnorderedAccessView)), 'ppUnorderedAccessViews')]), + StdMethod(Void, 'GSGetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), (Array(Pointer(ID3D11ShaderResourceView), 'NumViews'), 'ppShaderResourceViews')]), + StdMethod(Void, 'GSGetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), (Array(Pointer(ID3D11SamplerState), 'NumSamplers'), 'ppSamplers')]), + StdMethod(Void, 'OMGetRenderTargets', [(UINT, 'NumViews'), (Array(Pointer(ID3D11RenderTargetView), 'NumViews'), 'ppRenderTargetViews'), Out(Pointer(Pointer(ID3D11DepthStencilView)), 'ppDepthStencilView')]), + StdMethod(Void, 'OMGetRenderTargetsAndUnorderedAccessViews', [(UINT, 'NumRTVs'), (Array(Pointer(ID3D11RenderTargetView), 'NumRTVs'), 'ppRenderTargetViews'), Out(Pointer(Pointer(ID3D11DepthStencilView)), 'ppDepthStencilView'), (UINT, 'UAVStartSlot'), (UINT, 'NumUAVs'), (Array(Pointer(ID3D11UnorderedAccessView), 'NumUAVs'), 'ppUnorderedAccessViews')]), StdMethod(Void, 'OMGetBlendState', [Out(Pointer(Pointer(ID3D11BlendState)), 'ppBlendState'), Out(Array(FLOAT, 4), 'BlendFactor'), Out(Pointer(UINT), 'pSampleMask')]), StdMethod(Void, 'OMGetDepthStencilState', [Out(Pointer(Pointer(ID3D11DepthStencilState)), 'ppDepthStencilState'), Out(Pointer(UINT), 'pStencilRef')]), - StdMethod(Void, 'SOGetTargets', [(UINT, 'NumBuffers'), Out(Pointer(Pointer(ID3D11Buffer)), 'ppSOTargets')]), + StdMethod(Void, 'SOGetTargets', [(UINT, 'NumBuffers'), (Array(Pointer(ID3D11Buffer), 'NumBuffers'), 'ppSOTargets')]), StdMethod(Void, 'RSGetState', [Out(Pointer(Pointer(ID3D11RasterizerState)), 'ppRasterizerState')]), - StdMethod(Void, 'RSGetViewports', [Out(Pointer(UINT), 'pNumViewports'), Out(Pointer(D3D11_VIEWPORT), 'pViewports')]), - StdMethod(Void, 'RSGetScissorRects', [Out(Pointer(UINT), 'pNumRects'), Out(Pointer(D3D11_RECT), 'pRects')]), - StdMethod(Void, 'HSGetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), Out(Pointer(Pointer(ID3D11ShaderResourceView)), 'ppShaderResourceViews')]), - StdMethod(Void, 'HSGetShader', [Out(Pointer(Pointer(ID3D11HullShader)), 'ppHullShader'), Out(Pointer(Pointer(ID3D11ClassInstance)), 'ppClassInstances'), Out(Pointer(UINT), 'pNumClassInstances')]), - StdMethod(Void, 'HSGetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), Out(Pointer(Pointer(ID3D11SamplerState)), 'ppSamplers')]), - StdMethod(Void, 'HSGetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), Out(Pointer(Pointer(ID3D11Buffer)), 'ppConstantBuffers')]), - StdMethod(Void, 'DSGetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), Out(Pointer(Pointer(ID3D11ShaderResourceView)), 'ppShaderResourceViews')]), - StdMethod(Void, 'DSGetShader', [Out(Pointer(Pointer(ID3D11DomainShader)), 'ppDomainShader'), Out(Pointer(Pointer(ID3D11ClassInstance)), 'ppClassInstances'), Out(Pointer(UINT), 'pNumClassInstances')]), - StdMethod(Void, 'DSGetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), Out(Pointer(Pointer(ID3D11SamplerState)), 'ppSamplers')]), - StdMethod(Void, 'DSGetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), Out(Pointer(Pointer(ID3D11Buffer)), 'ppConstantBuffers')]), - StdMethod(Void, 'CSGetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), Out(Pointer(Pointer(ID3D11ShaderResourceView)), 'ppShaderResourceViews')]), - StdMethod(Void, 'CSGetUnorderedAccessViews', [(UINT, 'StartSlot'), (UINT, 'NumUAVs'), Out(Pointer(Pointer(ID3D11UnorderedAccessView)), 'ppUnorderedAccessViews')]), - StdMethod(Void, 'CSGetShader', [Out(Pointer(Pointer(ID3D11ComputeShader)), 'ppComputeShader'), Out(Pointer(Pointer(ID3D11ClassInstance)), 'ppClassInstances'), Out(Pointer(UINT), 'pNumClassInstances')]), - StdMethod(Void, 'CSGetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), Out(Pointer(Pointer(ID3D11SamplerState)), 'ppSamplers')]), - StdMethod(Void, 'CSGetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), Out(Pointer(Pointer(ID3D11Buffer)), 'ppConstantBuffers')]), + StdMethod(Void, 'RSGetViewports', [Out(Pointer(UINT), 'pNumViewports'), Out(Array(D3D11_VIEWPORT, '*pNumViewports'), 'pViewports')]), + StdMethod(Void, 'RSGetScissorRects', [Out(Pointer(UINT), 'pNumRects'), Out(Array(D3D11_RECT, '*pNumRects'), 'pRects')]), + StdMethod(Void, 'HSGetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), (Array(Pointer(ID3D11ShaderResourceView), 'NumViews'), 'ppShaderResourceViews')]), + StdMethod(Void, 'HSGetShader', [Out(Pointer(Pointer(ID3D11HullShader)), 'ppHullShader'), Out(Array(Pointer(ID3D11ClassInstance), '*pNumClassInstances'), 'ppClassInstances'), Out(Pointer(UINT), 'pNumClassInstances')]), + StdMethod(Void, 'HSGetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), (Array(Pointer(ID3D11SamplerState), 'NumSamplers'), 'ppSamplers')]), + StdMethod(Void, 'HSGetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Array(Pointer(ID3D11Buffer), 'NumBuffers'), 'ppConstantBuffers')]), + StdMethod(Void, 'DSGetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), (Array(Pointer(ID3D11ShaderResourceView), 'NumViews'), 'ppShaderResourceViews')]), + StdMethod(Void, 'DSGetShader', [Out(Pointer(Pointer(ID3D11DomainShader)), 'ppDomainShader'), Out(Array(Pointer(ID3D11ClassInstance), '*pNumClassInstances'), 'ppClassInstances'), Out(Pointer(UINT), 'pNumClassInstances')]), + StdMethod(Void, 'DSGetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), (Array(Pointer(ID3D11SamplerState), 'NumSamplers'), 'ppSamplers')]), + StdMethod(Void, 'DSGetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Array(Pointer(ID3D11Buffer), 'NumBuffers'), 'ppConstantBuffers')]), + StdMethod(Void, 'CSGetShaderResources', [(UINT, 'StartSlot'), (UINT, 'NumViews'), (Array(Pointer(ID3D11ShaderResourceView), 'NumViews'), 'ppShaderResourceViews')]), + StdMethod(Void, 'CSGetUnorderedAccessViews', [(UINT, 'StartSlot'), (UINT, 'NumUAVs'), (Array(Pointer(ID3D11UnorderedAccessView), 'NumUAVs'), 'ppUnorderedAccessViews')]), + StdMethod(Void, 'CSGetShader', [Out(Pointer(Pointer(ID3D11ComputeShader)), 'ppComputeShader'), Out(Array(Pointer(ID3D11ClassInstance), '*pNumClassInstances'), 'ppClassInstances'), Out(Pointer(UINT), 'pNumClassInstances')]), + StdMethod(Void, 'CSGetSamplers', [(UINT, 'StartSlot'), (UINT, 'NumSamplers'), (Array(Pointer(ID3D11SamplerState), 'NumSamplers'), 'ppSamplers')]), + StdMethod(Void, 'CSGetConstantBuffers', [(UINT, 'StartSlot'), (UINT, 'NumBuffers'), (Array(Pointer(ID3D11Buffer), 'NumBuffers'), 'ppConstantBuffers')]), StdMethod(Void, 'ClearState', []), StdMethod(Void, 'Flush', []), StdMethod(D3D11_DEVICE_CONTEXT_TYPE, 'GetType', []), @@ -1184,10 +1184,10 @@ ID3D11Device.methods += [ StdMethod(HRESULT, 'CreateUnorderedAccessView', [(Pointer(ID3D11Resource), 'pResource'), (Pointer(Const(D3D11_UNORDERED_ACCESS_VIEW_DESC)), 'pDesc'), Out(Pointer(Pointer(ID3D11UnorderedAccessView)), 'ppUAView')]), StdMethod(HRESULT, 'CreateRenderTargetView', [(Pointer(ID3D11Resource), 'pResource'), (Pointer(Const(D3D11_RENDER_TARGET_VIEW_DESC)), 'pDesc'), Out(Pointer(Pointer(ID3D11RenderTargetView)), 'ppRTView')]), StdMethod(HRESULT, 'CreateDepthStencilView', [(Pointer(ID3D11Resource), 'pResource'), (Pointer(Const(D3D11_DEPTH_STENCIL_VIEW_DESC)), 'pDesc'), Out(Pointer(Pointer(ID3D11DepthStencilView)), 'ppDepthStencilView')]), - StdMethod(HRESULT, 'CreateInputLayout', [(Pointer(Const(D3D11_INPUT_ELEMENT_DESC)), 'pInputElementDescs'), (UINT, 'NumElements'), (Blob(Const(Void), 'BytecodeLength'), 'pShaderBytecodeWithInputSignature'), (SIZE_T, 'BytecodeLength'), Out(Pointer(Pointer(ID3D11InputLayout)), 'ppInputLayout')]), + StdMethod(HRESULT, 'CreateInputLayout', [(Array(Const(D3D11_INPUT_ELEMENT_DESC), 'NumElements'), 'pInputElementDescs'), (UINT, 'NumElements'), (Blob(Const(Void), 'BytecodeLength'), 'pShaderBytecodeWithInputSignature'), (SIZE_T, 'BytecodeLength'), Out(Pointer(Pointer(ID3D11InputLayout)), 'ppInputLayout')]), StdMethod(HRESULT, 'CreateVertexShader', [(Blob(Const(Void), 'BytecodeLength'), 'pShaderBytecode'), (SIZE_T, 'BytecodeLength'), (Pointer(ID3D11ClassLinkage), 'pClassLinkage'), Out(Pointer(Pointer(ID3D11VertexShader)), 'ppVertexShader')]), StdMethod(HRESULT, 'CreateGeometryShader', [(Blob(Const(Void), 'BytecodeLength'), 'pShaderBytecode'), (SIZE_T, 'BytecodeLength'), (Pointer(ID3D11ClassLinkage), 'pClassLinkage'), Out(Pointer(Pointer(ID3D11GeometryShader)), 'ppGeometryShader')]), - StdMethod(HRESULT, 'CreateGeometryShaderWithStreamOutput', [(Blob(Const(Void), 'BytecodeLength'), 'pShaderBytecode'), (SIZE_T, 'BytecodeLength'), (Pointer(Const(D3D11_SO_DECLARATION_ENTRY)), 'pSODeclaration'), (UINT, 'NumEntries'), (Pointer(Const(UINT)), 'pBufferStrides'), (UINT, 'NumStrides'), (UINT, 'RasterizedStream'), (Pointer(ID3D11ClassLinkage), 'pClassLinkage'), Out(Pointer(Pointer(ID3D11GeometryShader)), 'ppGeometryShader')]), + StdMethod(HRESULT, 'CreateGeometryShaderWithStreamOutput', [(Blob(Const(Void), 'BytecodeLength'), 'pShaderBytecode'), (SIZE_T, 'BytecodeLength'), (Array(Const(D3D11_SO_DECLARATION_ENTRY), 'NumEntries'), 'pSODeclaration'), (UINT, 'NumEntries'), (Array(Const(UINT), 'NumStrides'), 'pBufferStrides'), (UINT, 'NumStrides'), (UINT, 'RasterizedStream'), (Pointer(ID3D11ClassLinkage), 'pClassLinkage'), Out(Pointer(Pointer(ID3D11GeometryShader)), 'ppGeometryShader')]), StdMethod(HRESULT, 'CreatePixelShader', [(Blob(Const(Void), 'BytecodeLength'), 'pShaderBytecode'), (SIZE_T, 'BytecodeLength'), (Pointer(ID3D11ClassLinkage), 'pClassLinkage'), Out(Pointer(Pointer(ID3D11PixelShader)), 'ppPixelShader')]), StdMethod(HRESULT, 'CreateHullShader', [(Blob(Const(Void), 'BytecodeLength'), 'pShaderBytecode'), (SIZE_T, 'BytecodeLength'), (Pointer(ID3D11ClassLinkage), 'pClassLinkage'), Out(Pointer(Pointer(ID3D11HullShader)), 'ppHullShader')]), StdMethod(HRESULT, 'CreateDomainShader', [(Blob(Const(Void), 'BytecodeLength'), 'pShaderBytecode'), (SIZE_T, 'BytecodeLength'), (Pointer(ID3D11ClassLinkage), 'pClassLinkage'), Out(Pointer(Pointer(ID3D11DomainShader)), 'ppDomainShader')]), @@ -1221,8 +1221,8 @@ ID3D11Device.methods += [ d3d11 = API("d3d11") d3d11.addFunctions([ - StdFunction(HRESULT, 'D3D11CreateDevice', [(Pointer(IDXGIAdapter), 'pAdapter'), (D3D_DRIVER_TYPE, 'DriverType'), (HMODULE, 'Software'), (D3D11_CREATE_DEVICE_FLAG, 'Flags'), (Pointer(Const(D3D_FEATURE_LEVEL)), 'pFeatureLevels'), (UINT, 'FeatureLevels'), (UINT, 'SDKVersion'), Out(Pointer(Pointer(ID3D11Device)), 'ppDevice'), Out(Pointer(D3D_FEATURE_LEVEL), 'pFeatureLevel'), Out(Pointer(Pointer(ID3D11DeviceContext)), 'ppImmediateContext')]), - StdFunction(HRESULT, 'D3D11CreateDeviceAndSwapChain', [(Pointer(IDXGIAdapter), 'pAdapter'), (D3D_DRIVER_TYPE, 'DriverType'), (HMODULE, 'Software'), (D3D11_CREATE_DEVICE_FLAG, 'Flags'), (Pointer(Const(D3D_FEATURE_LEVEL)), 'pFeatureLevels'), (UINT, 'FeatureLevels'), (UINT, 'SDKVersion'), (Pointer(Const(DXGI_SWAP_CHAIN_DESC)), 'pSwapChainDesc'), Out(Pointer(Pointer(IDXGISwapChain)), 'ppSwapChain'), Out(Pointer(Pointer(ID3D11Device)), 'ppDevice'), Out(Pointer(D3D_FEATURE_LEVEL), 'pFeatureLevel'), Out(Pointer(Pointer(ID3D11DeviceContext)), 'ppImmediateContext')]), + StdFunction(HRESULT, 'D3D11CreateDevice', [(Pointer(IDXGIAdapter), 'pAdapter'), (D3D_DRIVER_TYPE, 'DriverType'), (HMODULE, 'Software'), (D3D11_CREATE_DEVICE_FLAG, 'Flags'), (Array(Const(D3D_FEATURE_LEVEL), 'FeatureLevels'), 'pFeatureLevels'), (UINT, 'FeatureLevels'), (UINT, 'SDKVersion'), Out(Pointer(Pointer(ID3D11Device)), 'ppDevice'), Out(Pointer(D3D_FEATURE_LEVEL), 'pFeatureLevel'), Out(Pointer(Pointer(ID3D11DeviceContext)), 'ppImmediateContext')]), + StdFunction(HRESULT, 'D3D11CreateDeviceAndSwapChain', [(Pointer(IDXGIAdapter), 'pAdapter'), (D3D_DRIVER_TYPE, 'DriverType'), (HMODULE, 'Software'), (D3D11_CREATE_DEVICE_FLAG, 'Flags'), (Array(Const(D3D_FEATURE_LEVEL), 'FeatureLevels'), 'pFeatureLevels'), (UINT, 'FeatureLevels'), (UINT, 'SDKVersion'), (Pointer(Const(DXGI_SWAP_CHAIN_DESC)), 'pSwapChainDesc'), Out(Pointer(Pointer(IDXGISwapChain)), 'ppSwapChain'), Out(Pointer(Pointer(ID3D11Device)), 'ppDevice'), Out(Pointer(D3D_FEATURE_LEVEL), 'pFeatureLevel'), Out(Pointer(Pointer(ID3D11DeviceContext)), 'ppImmediateContext')]), ]) d3d11.addInterfaces([ diff --git a/specs/stdapi.py b/specs/stdapi.py index 2057124..2e4e5d8 100644 --- a/specs/stdapi.py +++ b/specs/stdapi.py @@ -68,6 +68,12 @@ class Type: def visit(self, visitor, *args, **kwargs): raise NotImplementedError + def mutable(self): + '''Return a mutable version of this type. + + Convenience wrapper around MutableRebuilder.''' + visitor = MutableRebuilder() + return visitor.visit(self) class _Void(Type): @@ -667,84 +673,108 @@ class Rebuilder(Visitor): return Polymorphic(defaultType, switchExpr, switchTypes) -class Collector(Visitor): - '''Visitor which collects all unique types as it traverses them.''' +class MutableRebuilder(Rebuilder): + '''Type visitor which derives a mutable type.''' - def __init__(self): - self.__visited = set() - self.types = [] + def visitConst(self, const): + # Strip out const qualifier + return const.type + + def visitAlias(self, alias): + # Tear the alias on type changes + type = self.visit(alias.type) + if type is alias.type: + return alias + return type + + def visitReference(self, reference): + # Strip out references + return reference.type - def visit(self, type): - if type in self.__visited: - return - self.__visited.add(type) - Visitor.visit(self, type) - self.types.append(type) - def visitVoid(self, literal): +class Traverser(Visitor): + '''Visitor which all types.''' + + def visitVoid(self, void, *args, **kwargs): pass - def visitLiteral(self, literal): + def visitLiteral(self, literal, *args, **kwargs): pass - def visitString(self, string): + def visitString(self, string, *args, **kwargs): pass - def visitConst(self, const): - self.visit(const.type) + def visitConst(self, const, *args, **kwargs): + self.visit(const.type, *args, **kwargs) - def visitStruct(self, struct): + def visitStruct(self, struct, *args, **kwargs): for type, name in struct.members: - self.visit(type) + self.visit(type, *args, **kwargs) - def visitArray(self, array): - self.visit(array.type) + def visitArray(self, array, *args, **kwargs): + self.visit(array.type, *args, **kwargs) - def visitBlob(self, array): + def visitBlob(self, array, *args, **kwargs): pass - def visitEnum(self, enum): + def visitEnum(self, enum, *args, **kwargs): pass - def visitBitmask(self, bitmask): - self.visit(bitmask.type) + def visitBitmask(self, bitmask, *args, **kwargs): + self.visit(bitmask.type, *args, **kwargs) - def visitPointer(self, pointer): - self.visit(pointer.type) + def visitPointer(self, pointer, *args, **kwargs): + self.visit(pointer.type, *args, **kwargs) - def visitIntPointer(self, pointer): + def visitIntPointer(self, pointer, *args, **kwargs): pass - def visitObjPointer(self, pointer): - self.visit(pointer.type) + def visitObjPointer(self, pointer, *args, **kwargs): + self.visit(pointer.type, *args, **kwargs) - def visitLinearPointer(self, pointer): - self.visit(pointer.type) + def visitLinearPointer(self, pointer, *args, **kwargs): + self.visit(pointer.type, *args, **kwargs) - def visitReference(self, reference): - self.visit(reference.type) + def visitReference(self, reference, *args, **kwargs): + self.visit(reference.type, *args, **kwargs) - def visitHandle(self, handle): - self.visit(handle.type) + def visitHandle(self, handle, *args, **kwargs): + self.visit(handle.type, *args, **kwargs) - def visitAlias(self, alias): - self.visit(alias.type) + def visitAlias(self, alias, *args, **kwargs): + self.visit(alias.type, *args, **kwargs) - def visitOpaque(self, opaque): + def visitOpaque(self, opaque, *args, **kwargs): pass - def visitInterface(self, interface): + def visitInterface(self, interface, *args, **kwargs): if interface.base is not None: - self.visit(interface.base) + self.visit(interface.base, *args, **kwargs) for method in interface.iterMethods(): for arg in method.args: - self.visit(arg.type) - self.visit(method.type) + self.visit(arg.type, *args, **kwargs) + self.visit(method.type, *args, **kwargs) - def visitPolymorphic(self, polymorphic): - self.visit(polymorphic.defaultType) + def visitPolymorphic(self, polymorphic, *args, **kwargs): + self.visit(polymorphic.defaultType, *args, **kwargs) for expr, type in polymorphic.switchTypes: - self.visit(type) + self.visit(type, *args, **kwargs) + + +class Collector(Traverser): + '''Visitor which collects all unique types as it traverses them.''' + + def __init__(self): + self.__visited = set() + self.types = [] + + def visit(self, type): + if type in self.__visited: + return + self.__visited.add(type) + Visitor.visit(self, type) + self.types.append(type) + class API: diff --git a/wrappers/trace.py b/wrappers/trace.py index e2e11ec..ef86f8c 100644 --- a/wrappers/trace.py +++ b/wrappers/trace.py @@ -245,70 +245,53 @@ class ValueSerializer(stdapi.Visitor): print ' _write__%s(%s, %s);' % (polymorphic.tag, polymorphic.switchExpr, instance) -class ValueWrapper(stdapi.Visitor): - '''Type visitor which will generate the code to wrap an instance. +class WrapDecider(stdapi.Traverser): + '''Type visitor which will decide wheter this type will need wrapping or not. - Wrapping is necessary mostly for interfaces, however interface pointers can - appear anywhere inside complex types. + For complex types (arrays, structures), we need to know this before hand. ''' - def visitVoid(self, type, instance): + def __init__(self): + self.needsWrapping = False + + def visitVoid(self, void): raise NotImplementedError - def visitLiteral(self, type, instance): + def visitLinearPointer(self, void): pass - def visitString(self, type, instance): - pass + def visitInterface(self, interface): + self.needsWrapping = True - def visitConst(self, type, instance): - pass + +class ValueWrapper(stdapi.Traverser): + '''Type visitor which will generate the code to wrap an instance. + + Wrapping is necessary mostly for interfaces, however interface pointers can + appear anywhere inside complex types. + ''' def visitStruct(self, struct, instance): for type, name in struct.members: self.visit(type, "(%s).%s" % (instance, name)) def visitArray(self, array, instance): - # XXX: actually it is possible to return an array of pointers - pass - - def visitBlob(self, blob, instance): - pass - - def visitEnum(self, enum, instance): - pass - - def visitBitmask(self, bitmask, instance): - pass + print " if (%s) {" % instance + print " for (size_t _i = 0, _s = %s; _i < _s; ++_i) {" % array.length + self.visit(array.type, instance + "[_i]") + print " }" + print " }" def visitPointer(self, pointer, instance): print " if (%s) {" % instance self.visit(pointer.type, "*" + instance) print " }" - def visitIntPointer(self, pointer, instance): - pass - def visitObjPointer(self, pointer, instance): print " if (%s) {" % instance self.visit(pointer.type, "*" + instance) print " }" - def visitLinearPointer(self, pointer, instance): - pass - - def visitReference(self, reference, instance): - self.visit(reference.type, instance) - - def visitHandle(self, handle, instance): - self.visit(handle.type, instance) - - def visitAlias(self, alias, instance): - self.visit(alias.type, instance) - - def visitOpaque(self, opaque, instance): - pass - def visitInterface(self, interface, instance): assert instance.startswith('*') instance = instance[1:] @@ -318,17 +301,33 @@ class ValueWrapper(stdapi.Visitor): def visitPolymorphic(self, type, instance): # XXX: There might be polymorphic values that need wrapping in the future - pass + raise NotImplementedError class ValueUnwrapper(ValueWrapper): '''Reverse of ValueWrapper.''' + allocated = False + + def visitArray(self, array, instance): + if self.allocated or isinstance(instance, stdapi.Interface): + return ValueWrapper.visitArray(self, array, instance) + elem_type = array.type.mutable() + print " if (%s && %s) {" % (instance, array.length) + print " %s * _t = static_cast<%s *>(alloca(%s * sizeof *_t));" % (elem_type, elem_type, array.length) + print " for (size_t _i = 0, _s = %s; _i < _s; ++_i) {" % array.length + print " _t[_i] = %s[_i];" % instance + self.allocated = True + self.visit(array.type, "_t[_i]") + print " }" + print " %s = _t;" % instance + print " }" + def visitInterface(self, interface, instance): assert instance.startswith('*') instance = instance[1:] print r' if (%s) {' % instance - print r' %s *pWrapper = static_cast<%s*>(%s);' % (getWrapperInterfaceName(interface), getWrapperInterfaceName(interface), instance) + print r' const %s *pWrapper = static_cast(%s);' % (getWrapperInterfaceName(interface), getWrapperInterfaceName(interface), instance) print r' if (pWrapper && pWrapper->m_dwMagic == 0xd8365d6c) {' print r' %s = pWrapper->m_pInstance;' % (instance,) print r' } else {' @@ -468,13 +467,20 @@ class Tracer: def unwrapRet(self, function, instance): self.unwrapValue(function.type, instance) + def needsWrapping(self, type): + visitor = WrapDecider() + visitor.visit(type) + return visitor.needsWrapping + def wrapValue(self, type, instance): - visitor = ValueWrapper() - visitor.visit(type, instance) + if self.needsWrapping(type): + visitor = ValueWrapper() + visitor.visit(type, instance) def unwrapValue(self, type, instance): - visitor = ValueUnwrapper() - visitor.visit(type, instance) + if self.needsWrapping(type): + visitor = ValueUnwrapper() + visitor.visit(type, instance) def declareWrapperInterface(self, interface): print "class %s : public %s " % (getWrapperInterfaceName(interface), interface.name) -- 2.45.2