diff --git a/.github/workflows/vettools/main.go b/.github/workflows/vettools/main.go index 54df97cd2..e274d9f14 100644 --- a/.github/workflows/vettools/main.go +++ b/.github/workflows/vettools/main.go @@ -1,4 +1,4 @@ -// Copyright 2021 The Ebiten Authors +// Copyright 2022 The Ebiten Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package main import ( "os" - "runtime" "github.com/kisielk/errcheck/errcheck" "golang.org/x/tools/go/analysis/multichecker" @@ -24,19 +23,9 @@ import ( ) func main() { - GOOS, ok := os.LookupEnv("GOOS") - if !ok { - GOOS = runtime.GOOS + filename := ".errcheck_excludes" + if _, err := os.Stat(filename); err == nil { + errcheck.Analyzer.Flags.Set("exclude", filename) } - - for _, filename := range []string{ - ".errcheck_excludes", - ".errcheck_excludes_" + GOOS, - } { - if _, err := os.Stat(filename); err == nil { - errcheck.Analyzer.Flags.Set("exclude", filename) - } - } - multichecker.Main(atomicalign.Analyzer, errcheck.Analyzer) } diff --git a/internal/graphicsdriver/directx/.errcheck_excludes_windows b/internal/graphicsdriver/directx/.errcheck_excludes_windows deleted file mode 100644 index ac490e942..000000000 --- a/internal/graphicsdriver/directx/.errcheck_excludes_windows +++ /dev/null @@ -1,4 +0,0 @@ -syscall.Syscall -syscall.Syscall6 -syscall.Syscall9 -syscall.Syscall12 diff --git a/internal/graphicsdriver/directx/api_microsoftgdk_windows.go b/internal/graphicsdriver/directx/api_microsoftgdk_windows.go index 121104864..4e5a97f1e 100644 --- a/internal/graphicsdriver/directx/api_microsoftgdk_windows.go +++ b/internal/graphicsdriver/directx/api_microsoftgdk_windows.go @@ -55,8 +55,8 @@ package directx // void Ebitengine_ID3D12GraphicsCommandList_OMSetStencilRef(void* i, uint32_t stencilRef) { // static_cast(i)->OMSetStencilRef(stencilRef); // } -// void Ebitengine_ID3D12GraphicsCommandList_Release(void* i) { -// static_cast(i)->Release(); +// uint32_t Ebitengine_ID3D12GraphicsCommandList_Release(void* i) { +// return static_cast(static_cast(i)->Release()); // } // uintptr_t Ebitengine_ID3D12GraphicsCommandList_Reset(void* i, void* pAllocator, void* pInitialState) { // auto r = static_cast(i)->Reset(static_cast(pAllocator), static_cast(pInitialState)); @@ -97,7 +97,7 @@ package directx // void Ebitengine_ID3D12GraphicsCommandList_IASetVertexBuffers(void* i, uint32_t startSlot, uint32_t numViews, void* pViews); // void Ebitengine_ID3D12GraphicsCommandList_OMSetRenderTargets(void* i, uint32_t numRenderTargetDescriptors, void* pRenderTargetDescriptors, int rtsSingleHandleToDescriptorRange, void* pDepthStencilDescriptor); // void Ebitengine_ID3D12GraphicsCommandList_OMSetStencilRef(void* i, uint32_t stencilRef); -// void Ebitengine_ID3D12GraphicsCommandList_Release(void* i); +// uint32_t Ebitengine_ID3D12GraphicsCommandList_Release(void* i); // uintptr_t Ebitengine_ID3D12GraphicsCommandList_Reset(void* i, void* pAllocator, void* pInitialState); // void Ebitengine_ID3D12GraphicsCommandList_ResourceBarrier(void* i, uint32_t numBarriers, void* pBarriers); // void Ebitengine_ID3D12GraphicsCommandList_RSSetViewports(void* i, uint32_t numViewports, void* pViewports); @@ -175,8 +175,8 @@ func _ID3D12GraphicsCommandList_OMSetStencilRef(i *_ID3D12GraphicsCommandList, s C.Ebitengine_ID3D12GraphicsCommandList_OMSetStencilRef(unsafe.Pointer(i), C.uint32_t(stencilRef)) } -func _ID3D12GraphicsCommandList_Release(i *_ID3D12GraphicsCommandList) { - C.Ebitengine_ID3D12GraphicsCommandList_Release(unsafe.Pointer(i)) +func _ID3D12GraphicsCommandList_Release(i *_ID3D12GraphicsCommandList) uint32 { + return uint32(C.Ebitengine_ID3D12GraphicsCommandList_Release(unsafe.Pointer(i))) } func _ID3D12GraphicsCommandList_Reset(i *_ID3D12GraphicsCommandList, pAllocator *_ID3D12CommandAllocator, pInitialState *_ID3D12PipelineState) uintptr { diff --git a/internal/graphicsdriver/directx/api_notmicrosoftgdk_windows.go b/internal/graphicsdriver/directx/api_notmicrosoftgdk_windows.go index 94e2938e5..226f4aadb 100644 --- a/internal/graphicsdriver/directx/api_notmicrosoftgdk_windows.go +++ b/internal/graphicsdriver/directx/api_notmicrosoftgdk_windows.go @@ -61,7 +61,7 @@ func _ID3D12GraphicsCommandList_OMSetStencilRef(i *_ID3D12GraphicsCommandList, s panic("not implemented") } -func _ID3D12GraphicsCommandList_Release(i *_ID3D12GraphicsCommandList) { +func _ID3D12GraphicsCommandList_Release(i *_ID3D12GraphicsCommandList) uint32 { panic("not implemented") } diff --git a/internal/graphicsdriver/directx/api_windows.go b/internal/graphicsdriver/directx/api_windows.go index f6d22ee29..012069e05 100644 --- a/internal/graphicsdriver/directx/api_windows.go +++ b/internal/graphicsdriver/directx/api_windows.go @@ -1248,8 +1248,9 @@ type _ID3D12CommandAllocator_Vtbl struct { Reset uintptr } -func (i *_ID3D12CommandAllocator) Release() { - syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) +func (i *_ID3D12CommandAllocator) Release() uint32 { + r, _, _ := syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) + return uint32(r) } func (i *_ID3D12CommandAllocator) Reset() error { @@ -1304,7 +1305,7 @@ type _ID3D12CommandQueue_Vtbl struct { } func (i *_ID3D12CommandQueue) ExecuteCommandLists(ppCommandLists []*_ID3D12GraphicsCommandList) { - syscall.Syscall(i.vtbl.ExecuteCommandLists, 3, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall(i.vtbl.ExecuteCommandLists, 3, uintptr(unsafe.Pointer(i)), uintptr(len(ppCommandLists)), uintptr(unsafe.Pointer(&ppCommandLists[0]))) runtime.KeepAlive(ppCommandLists) } @@ -1335,8 +1336,9 @@ func (i *_ID3D12CommandQueue) Signal(signal *_ID3D12Fence, value uint64) error { return nil } -func (i *_ID3D12CommandQueue) Release() { - syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) +func (i *_ID3D12CommandQueue) Release() uint32 { + r, _, _ := syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) + return uint32(r) } type _ID3D12Debug struct { @@ -1356,11 +1358,12 @@ func (i *_ID3D12Debug) As(debug **_ID3D12Debug3) { } func (i *_ID3D12Debug) EnableDebugLayer() { - syscall.Syscall(i.vtbl.EnableDebugLayer, 1, uintptr(unsafe.Pointer(i)), 0, 0) + _, _, _ = syscall.Syscall(i.vtbl.EnableDebugLayer, 1, uintptr(unsafe.Pointer(i)), 0, 0) } -func (i *_ID3D12Debug) Release() { - syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) +func (i *_ID3D12Debug) Release() uint32 { + r, _, _ := syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) + return uint32(r) } type _ID3D12Debug3 struct { @@ -1379,7 +1382,7 @@ type _ID3D12Debug3_Vtbl struct { } func (i *_ID3D12Debug3) SetEnableGPUBasedValidation(enable bool) { - syscall.Syscall(i.vtbl.SetEnableGPUBasedValidation, 2, uintptr(unsafe.Pointer(i)), boolToUintptr(enable), 0) + _, _, _ = syscall.Syscall(i.vtbl.SetEnableGPUBasedValidation, 2, uintptr(unsafe.Pointer(i)), boolToUintptr(enable), 0) } type _ID3D12DebugCommandList struct { @@ -1470,8 +1473,9 @@ func (i *_ID3D12DescriptorHeap) GetGPUDescriptorHandleForHeapStart() (_D3D12_GPU return handle, nil } -func (i *_ID3D12DescriptorHeap) Release() { - syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) +func (i *_ID3D12DescriptorHeap) Release() uint32 { + r, _, _ := syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) + return uint32(r) } type _ID3D12Device struct { @@ -1642,7 +1646,7 @@ func (i *_ID3D12Device) CreateCommandQueue(desc *_D3D12_COMMAND_QUEUE_DESC) (*_I } func (i *_ID3D12Device) CreateConstantBufferView(pDesc *_D3D12_CONSTANT_BUFFER_VIEW_DESC, destDescriptor _D3D12_CPU_DESCRIPTOR_HANDLE) { - syscall.Syscall(i.vtbl.CreateConstantBufferView, 3, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall(i.vtbl.CreateConstantBufferView, 3, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(pDesc)), destDescriptor.ptr) runtime.KeepAlive(pDesc) } @@ -1663,7 +1667,7 @@ func (i *_ID3D12Device) CreateDepthStencilView(pResource *_ID3D12Resource, pDesc if pDesc != nil { panic("directx: D3D12_DEPTH_STENCIL_VIEW_DESC is not implemented yet (especially for 32bit machine)") } - syscall.Syscall6(i.vtbl.CreateDepthStencilView, 4, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall6(i.vtbl.CreateDepthStencilView, 4, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(pResource)), uintptr(unsafe.Pointer(pDesc)), destDescriptor.ptr, 0, 0) runtime.KeepAlive(pResource) @@ -1701,7 +1705,7 @@ func (i *_ID3D12Device) CreateGraphicsPipelineState(pDesc *_D3D12_GRAPHICS_PIPEL } func (i *_ID3D12Device) CreateRenderTargetView(pResource *_ID3D12Resource, pDesc *_D3D12_RENDER_TARGET_VIEW_DESC, destDescriptor _D3D12_CPU_DESCRIPTOR_HANDLE) { - syscall.Syscall6(i.vtbl.CreateRenderTargetView, 4, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall6(i.vtbl.CreateRenderTargetView, 4, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(pResource)), uintptr(unsafe.Pointer(pDesc)), destDescriptor.ptr, 0, 0) runtime.KeepAlive(pResource) @@ -1720,13 +1724,13 @@ func (i *_ID3D12Device) CreateRootSignature(nodeMask uint32, pBlobWithRootSignat } func (i *_ID3D12Device) CreateSampler(pDesc *_D3D12_SAMPLER_DESC, destDescriptor _D3D12_CPU_DESCRIPTOR_HANDLE) { - syscall.Syscall(i.vtbl.CreateSampler, 3, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall(i.vtbl.CreateSampler, 3, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(pDesc)), destDescriptor.ptr) runtime.KeepAlive(pDesc) } func (i *_ID3D12Device) CreateShaderResourceView(pResource *_ID3D12Resource, pDesc *_D3D12_SHADER_RESOURCE_VIEW_DESC, destDescriptor _D3D12_CPU_DESCRIPTOR_HANDLE) { - syscall.Syscall6(i.vtbl.CreateShaderResourceView, 4, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall6(i.vtbl.CreateShaderResourceView, 4, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(pResource)), uintptr(unsafe.Pointer(pDesc)), destDescriptor.ptr, 0, 0) runtime.KeepAlive(pResource) @@ -1735,12 +1739,12 @@ func (i *_ID3D12Device) CreateShaderResourceView(pResource *_ID3D12Resource, pDe func (i *_ID3D12Device) GetCopyableFootprints(pResourceDesc *_D3D12_RESOURCE_DESC, firstSubresource uint32, numSubresources uint32, baseOffset uint64) (layouts _D3D12_PLACED_SUBRESOURCE_FOOTPRINT, numRows uint, rowSizeInBytes uint64, totalBytes uint64) { if is64bit { - syscall.Syscall9(i.vtbl.GetCopyableFootprints, 9, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall9(i.vtbl.GetCopyableFootprints, 9, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(pResourceDesc)), uintptr(firstSubresource), uintptr(numSubresources), uintptr(baseOffset), uintptr(unsafe.Pointer(&layouts)), uintptr(unsafe.Pointer(&numRows)), uintptr(unsafe.Pointer(&rowSizeInBytes)), uintptr(unsafe.Pointer(&totalBytes))) } else { - syscall.Syscall12(i.vtbl.GetCopyableFootprints, 10, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall12(i.vtbl.GetCopyableFootprints, 10, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(pResourceDesc)), uintptr(firstSubresource), uintptr(numSubresources), uintptr(baseOffset), uintptr(baseOffset>>32), uintptr(unsafe.Pointer(&layouts)), uintptr(unsafe.Pointer(&numRows)), uintptr(unsafe.Pointer(&rowSizeInBytes)), uintptr(unsafe.Pointer(&totalBytes)), @@ -1831,8 +1835,9 @@ func (i *_ID3D12Fence) GetCompletedValue() uint64 { } } -func (i *_ID3D12Fence) Release() { - syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) +func (i *_ID3D12Fence) Release() uint32 { + r, _, _ := syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) + return uint32(r) } func (i *_ID3D12Fence) SetEventOnCompletion(value uint64, hEvent windows.Handle) error { @@ -1926,7 +1931,7 @@ func (i *_ID3D12GraphicsCommandList) ClearDepthStencilView(depthStencilView _D3D if len(rects) > 0 { pRects = &rects[0] } - syscall.Syscall9(i.vtbl.ClearDepthStencilView, 7, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall9(i.vtbl.ClearDepthStencilView, 7, uintptr(unsafe.Pointer(i)), depthStencilView.ptr, uintptr(clearFlags), uintptr(math.Float32bits(depth)), uintptr(stencil), uintptr(len(rects)), uintptr(unsafe.Pointer(pRects)), 0, 0) @@ -1942,7 +1947,7 @@ func (i *_ID3D12GraphicsCommandList) ClearRenderTargetView(pRenderTargetView _D3 if len(rects) > 0 { pRects = &rects[0] } - syscall.Syscall6(i.vtbl.ClearRenderTargetView, 5, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall6(i.vtbl.ClearRenderTargetView, 5, uintptr(unsafe.Pointer(i)), pRenderTargetView.ptr, uintptr(unsafe.Pointer(&colorRGBA[0])), uintptr(len(rects)), uintptr(unsafe.Pointer(pRects)), 0) } @@ -1967,7 +1972,7 @@ func (i *_ID3D12GraphicsCommandList) CopyTextureRegion_PlacedFootPrint_Subresour if microsoftgdk.IsXbox() { _ID3D12GraphicsCommandList_CopyTextureRegion(i, unsafe.Pointer(pDst), dstX, dstY, dstZ, unsafe.Pointer(pSrc), pSrcBox) } else { - syscall.Syscall9(i.vtbl.CopyTextureRegion, 7, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall9(i.vtbl.CopyTextureRegion, 7, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(pDst)), uintptr(dstX), uintptr(dstY), uintptr(dstZ), uintptr(unsafe.Pointer(pSrc)), uintptr(unsafe.Pointer(pSrcBox)), 0, 0) @@ -1981,7 +1986,7 @@ func (i *_ID3D12GraphicsCommandList) CopyTextureRegion_SubresourceIndex_PlacedFo if microsoftgdk.IsXbox() { _ID3D12GraphicsCommandList_CopyTextureRegion(i, unsafe.Pointer(pDst), dstX, dstY, dstZ, unsafe.Pointer(pSrc), pSrcBox) } else { - syscall.Syscall9(i.vtbl.CopyTextureRegion, 7, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall9(i.vtbl.CopyTextureRegion, 7, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(pDst)), uintptr(dstX), uintptr(dstY), uintptr(dstZ), uintptr(unsafe.Pointer(pSrc)), uintptr(unsafe.Pointer(pSrcBox)), 0, 0) @@ -1996,7 +2001,7 @@ func (i *_ID3D12GraphicsCommandList) DrawIndexedInstanced(indexCountPerInstance _ID3D12GraphicsCommandList_DrawIndexedInstanced(i, indexCountPerInstance, instanceCount, startIndexLocation, baseVertexLocation, startInstanceLocation) return } - syscall.Syscall6(i.vtbl.DrawIndexedInstanced, 6, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall6(i.vtbl.DrawIndexedInstanced, 6, uintptr(unsafe.Pointer(i)), uintptr(indexCountPerInstance), uintptr(instanceCount), uintptr(startIndexLocation), uintptr(baseVertexLocation), uintptr(startInstanceLocation)) } @@ -2004,7 +2009,7 @@ func (i *_ID3D12GraphicsCommandList) IASetIndexBuffer(pView *_D3D12_INDEX_BUFFER if microsoftgdk.IsXbox() { _ID3D12GraphicsCommandList_IASetIndexBuffer(i, pView) } else { - syscall.Syscall(i.vtbl.IASetIndexBuffer, 2, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall(i.vtbl.IASetIndexBuffer, 2, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(pView)), 0) } runtime.KeepAlive(pView) @@ -2015,7 +2020,7 @@ func (i *_ID3D12GraphicsCommandList) IASetPrimitiveTopology(primitiveTopology _D _ID3D12GraphicsCommandList_IASetPrimitiveTopology(i, primitiveTopology) return } - syscall.Syscall(i.vtbl.IASetPrimitiveTopology, 2, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall(i.vtbl.IASetPrimitiveTopology, 2, uintptr(unsafe.Pointer(i)), uintptr(primitiveTopology), 0) } @@ -2028,7 +2033,7 @@ func (i *_ID3D12GraphicsCommandList) IASetVertexBuffers(startSlot uint32, views if len(views) > 0 { pViews = &views[0] } - syscall.Syscall6(i.vtbl.IASetVertexBuffers, 4, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall6(i.vtbl.IASetVertexBuffers, 4, uintptr(unsafe.Pointer(i)), uintptr(startSlot), uintptr(len(views)), uintptr(unsafe.Pointer(pViews)), 0, 0) } @@ -2043,7 +2048,7 @@ func (i *_ID3D12GraphicsCommandList) OMSetRenderTargets(renderTargetDescriptors if len(renderTargetDescriptors) > 0 { pRenderTargetDescriptors = &renderTargetDescriptors[0] } - syscall.Syscall6(i.vtbl.OMSetRenderTargets, 5, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall6(i.vtbl.OMSetRenderTargets, 5, uintptr(unsafe.Pointer(i)), uintptr(len(renderTargetDescriptors)), uintptr(unsafe.Pointer(pRenderTargetDescriptors)), boolToUintptr(rtsSingleHandleToDescriptorRange), uintptr(unsafe.Pointer(pDepthStencilDescriptor)), 0) } @@ -2056,15 +2061,15 @@ func (i *_ID3D12GraphicsCommandList) OMSetStencilRef(stencilRef uint32) { _ID3D12GraphicsCommandList_OMSetStencilRef(i, stencilRef) return } - syscall.Syscall(i.vtbl.OMSetStencilRef, 2, uintptr(unsafe.Pointer(i)), uintptr(stencilRef), 0) + _, _, _ = syscall.Syscall(i.vtbl.OMSetStencilRef, 2, uintptr(unsafe.Pointer(i)), uintptr(stencilRef), 0) } -func (i *_ID3D12GraphicsCommandList) Release() { +func (i *_ID3D12GraphicsCommandList) Release() uint32 { if microsoftgdk.IsXbox() { - _ID3D12GraphicsCommandList_Release(i) - return + return _ID3D12GraphicsCommandList_Release(i) } - syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) + r, _, _ := syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) + return uint32(r) } func (i *_ID3D12GraphicsCommandList) Reset(pAllocator *_ID3D12CommandAllocator, pInitialState *_ID3D12PipelineState) error { @@ -2091,7 +2096,7 @@ func (i *_ID3D12GraphicsCommandList) ResourceBarrier(barriers []_D3D12_RESOURCE_ if len(barriers) > 0 { pBarriers = &barriers[0] } - syscall.Syscall(i.vtbl.ResourceBarrier, 3, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall(i.vtbl.ResourceBarrier, 3, uintptr(unsafe.Pointer(i)), uintptr(len(barriers)), uintptr(unsafe.Pointer(pBarriers))) } runtime.KeepAlive(barriers) @@ -2105,7 +2110,7 @@ func (i *_ID3D12GraphicsCommandList) RSSetViewports(viewports []_D3D12_VIEWPORT) if len(viewports) > 0 { pViewports = &viewports[0] } - syscall.Syscall(i.vtbl.RSSetViewports, 3, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall(i.vtbl.RSSetViewports, 3, uintptr(unsafe.Pointer(i)), uintptr(len(viewports)), uintptr(unsafe.Pointer(pViewports))) } runtime.KeepAlive(viewports) @@ -2119,7 +2124,7 @@ func (i *_ID3D12GraphicsCommandList) RSSetScissorRects(rects []_D3D12_RECT) { if len(rects) > 0 { pRects = &rects[0] } - syscall.Syscall(i.vtbl.RSSetScissorRects, 3, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall(i.vtbl.RSSetScissorRects, 3, uintptr(unsafe.Pointer(i)), uintptr(len(rects)), uintptr(unsafe.Pointer(pRects))) } runtime.KeepAlive(rects) @@ -2133,7 +2138,7 @@ func (i *_ID3D12GraphicsCommandList) SetDescriptorHeaps(descriptorHeaps []*_ID3D if len(descriptorHeaps) > 0 { ppDescriptorHeaps = &descriptorHeaps[0] } - syscall.Syscall(i.vtbl.SetDescriptorHeaps, 3, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall(i.vtbl.SetDescriptorHeaps, 3, uintptr(unsafe.Pointer(i)), uintptr(len(descriptorHeaps)), uintptr(unsafe.Pointer(ppDescriptorHeaps))) } runtime.KeepAlive(descriptorHeaps) @@ -2145,10 +2150,10 @@ func (i *_ID3D12GraphicsCommandList) SetGraphicsRootDescriptorTable(rootParamete return } if is64bit { - syscall.Syscall(i.vtbl.SetGraphicsRootDescriptorTable, 3, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall(i.vtbl.SetGraphicsRootDescriptorTable, 3, uintptr(unsafe.Pointer(i)), uintptr(rootParameterIndex), uintptr(baseDescriptor.ptr)) } else { - syscall.Syscall6(i.vtbl.SetGraphicsRootDescriptorTable, 4, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall6(i.vtbl.SetGraphicsRootDescriptorTable, 4, uintptr(unsafe.Pointer(i)), uintptr(rootParameterIndex), uintptr(baseDescriptor.ptr), uintptr(baseDescriptor.ptr>>32), 0, 0) } } @@ -2157,7 +2162,7 @@ func (i *_ID3D12GraphicsCommandList) SetGraphicsRootSignature(pRootSignature *_I if microsoftgdk.IsXbox() { _ID3D12GraphicsCommandList_SetGraphicsRootSignature(i, pRootSignature) } else { - syscall.Syscall(i.vtbl.SetGraphicsRootSignature, 2, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall(i.vtbl.SetGraphicsRootSignature, 2, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(pRootSignature)), 0) } runtime.KeepAlive(pRootSignature) @@ -2167,7 +2172,7 @@ func (i *_ID3D12GraphicsCommandList) SetPipelineState(pPipelineState *_ID3D12Pip if microsoftgdk.IsXbox() { _ID3D12GraphicsCommandList_SetPipelineState(i, pPipelineState) } else { - syscall.Syscall(i.vtbl.SetPipelineState, 2, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall(i.vtbl.SetPipelineState, 2, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(pPipelineState)), 0) } runtime.KeepAlive(pPipelineState) @@ -2190,8 +2195,9 @@ type _ID3D12PipelineState_Vtbl struct { GetCachedBlob uintptr } -func (i *_ID3D12PipelineState) Release() { - syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) +func (i *_ID3D12PipelineState) Release() uint32 { + r, _, _ := syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) + return uint32(r) } type _ID3D12Resource struct { @@ -2217,7 +2223,7 @@ type _ID3D12Resource_Vtbl struct { func (i *_ID3D12Resource) GetDesc() _D3D12_RESOURCE_DESC { var resourceDesc _D3D12_RESOURCE_DESC - syscall.Syscall(i.vtbl.GetDesc, 2, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(&resourceDesc)), 0) + _, _, _ = syscall.Syscall(i.vtbl.GetDesc, 2, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(&resourceDesc)), 0) return resourceDesc } @@ -2242,12 +2248,13 @@ func (i *_ID3D12Resource) Map(subresource uint32, pReadRange *_D3D12_RANGE) (uin return data, nil } -func (i *_ID3D12Resource) Release() { - syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) +func (i *_ID3D12Resource) Release() uint32 { + r, _, _ := syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) + return uint32(r) } func (i *_ID3D12Resource) Unmap(subresource uint32, pWrittenRange *_D3D12_RANGE) { - syscall.Syscall(i.vtbl.Unmap, 3, uintptr(unsafe.Pointer(i)), + _, _, _ = syscall.Syscall(i.vtbl.Unmap, 3, uintptr(unsafe.Pointer(i)), uintptr(subresource), uintptr(unsafe.Pointer(pWrittenRange))) runtime.KeepAlive(pWrittenRange) } @@ -2277,8 +2284,9 @@ func (i *_ID3DBlob) GetBufferSize() uintptr { return r } -func (i *_ID3DBlob) Release() { - syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) +func (i *_ID3DBlob) Release() uint32 { + r, _, _ := syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) + return uint32(r) } func (i *_ID3DBlob) String() string { @@ -2316,8 +2324,9 @@ func (i *_IDXGIAdapter) EnumOutputs(output uint32) (*_IDXGIOutput, error) { return pOutput, nil } -func (i *_IDXGIAdapter) Release() { - syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) +func (i *_IDXGIAdapter) Release() uint32 { + r, _, _ := syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) + return uint32(r) } type _IDXGIAdapter1 struct { @@ -2339,8 +2348,9 @@ type _IDXGIAdapter1_Vtbl struct { GetDesc1 uintptr } -func (i *_IDXGIAdapter1) Release() { - syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) +func (i *_IDXGIAdapter1) Release() uint32 { + r, _, _ := syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) + return uint32(r) } func (i *_IDXGIAdapter1) GetDesc1() (*_DXGI_ADAPTER_DESC1, error) { @@ -2381,8 +2391,9 @@ func (i *_IDXGIDevice) GetAdapter() (*_IDXGIAdapter, error) { return adapter, nil } -func (i *_IDXGIDevice) Release() { - syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) +func (i *_IDXGIDevice) Release() uint32 { + r, _, _ := syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) + return uint32(r) } type _IDXGIFactory4 struct { @@ -2485,8 +2496,9 @@ func (i *_IDXGIFactory4) QueryInterface(riid *windows.GUID) (unsafe.Pointer, err return v, nil } -func (i *_IDXGIFactory4) Release() { - syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) +func (i *_IDXGIFactory4) Release() uint32 { + r, _, _ := syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) + return uint32(r) } type _IDXGIFactory5 struct { @@ -2537,8 +2549,9 @@ func (i *_IDXGIFactory5) CheckFeatureSupport(feature _DXGI_FEATURE, pFeatureSupp return nil } -func (i *_IDXGIFactory5) Release() { - syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) +func (i *_IDXGIFactory5) Release() uint32 { + r, _, _ := syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) + return uint32(r) } type _IDXGIOutput struct { @@ -2568,8 +2581,9 @@ type _IDXGIOutput_Vtbl struct { GetFrameStatistics uintptr } -func (i *_IDXGIOutput) Release() { - syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) +func (i *_IDXGIOutput) Release() uint32 { + r, _, _ := syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) + return uint32(r) } type _ID3D12RootSignature struct { @@ -2588,8 +2602,9 @@ type _ID3D12RootSignature_Vtbl struct { GetDevice uintptr } -func (i *_ID3D12RootSignature) Release() { - syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) +func (i *_ID3D12RootSignature) Release() uint32 { + r, _, _ := syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) + return uint32(r) } type _IDXGISwapChain1 struct { @@ -2721,6 +2736,7 @@ func (i *_IDXGISwapChain4) ResizeBuffers(bufferCount uint32, width uint32, heigh return nil } -func (i *_IDXGISwapChain4) Release() { - syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) +func (i *_IDXGISwapChain4) Release() uint32 { + r, _, _ := syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0) + return uint32(r) }