From f69c550992988e9cf2876d5464507edb99121f4f Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 4 Jun 2022 01:10:52 +0900 Subject: [PATCH] internal/graphicsdriver/directx: bug fix: go:nosplit was required for syscallN Updates #2116 Closes #2117 --- internal/graphicsdriver/directx/api_windows.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/internal/graphicsdriver/directx/api_windows.go b/internal/graphicsdriver/directx/api_windows.go index 694849ff7..12b84e8f6 100644 --- a/internal/graphicsdriver/directx/api_windows.go +++ b/internal/graphicsdriver/directx/api_windows.go @@ -38,6 +38,7 @@ func boolToUintptr(v bool) uintptr { return 0 } +//go:nosplit func syscallN(ptr uintptr, args ...uintptr) (r1, r2 uintptr, e windows.Errno) { if ptr == 0 { panic("directx: function pointer must not be 0") @@ -1790,8 +1791,6 @@ func (i *_ID3D12Resource) GetGPUVirtualAddress() _D3D12_GPU_VIRTUAL_ADDRESS { } func (i *_ID3D12Resource) Map(subresource uint32, pReadRange *_D3D12_RANGE) (uintptr, error) { - var retryCount int -retry: var data uintptr r, _, _ := syscallN(i.vtbl.Map, uintptr(unsafe.Pointer(i)), uintptr(subresource), uintptr(unsafe.Pointer(pReadRange)), uintptr(unsafe.Pointer(&data))) @@ -1799,14 +1798,6 @@ retry: if uint32(r) != uint32(windows.S_OK) { return 0, fmt.Errorf("directx: ID3D12Resource::Map failed: HRESULT(%d)", uint32(r)) } - if data == 0 { - // This is very mysterious, but sometimes Map fails especially on tests with Warp and/or Proton (Steam Deck) (#2113). - if retryCount >= 5 { - return 0, fmt.Errorf("directx: ID3D12Resource::Map failed: nothing is mapped") - } - retryCount++ - goto retry - } return data, nil }