mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-11 02:23:15 +01:00
Revert "internal/graphicsdriver/directx: bug fix: ID3D12Resource::Map sometimes needs retrying"
This reverts commit a9afacc8c6
.
Reason: The true culprit was #2117. #2116 was not a bug.
Updates #2116
Updates #2117
This commit is contained in:
parent
a9afacc8c6
commit
b3ddeb6456
@ -1727,24 +1727,14 @@ func (i *iD3D12Resource1) GetGPUVirtualAddress() _D3D12_GPU_VIRTUAL_ADDRESS {
|
|||||||
return _D3D12_GPU_VIRTUAL_ADDRESS(r)
|
return _D3D12_GPU_VIRTUAL_ADDRESS(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *iD3D12Resource1) Map(subresource uint32, pReadRange *_D3D12_RANGE) (uintptr, error) {
|
func (i *iD3D12Resource1) Map(subresource uint32, pReadRange *_D3D12_RANGE) (unsafe.Pointer, error) {
|
||||||
var retryCount int
|
var data unsafe.Pointer
|
||||||
retry:
|
|
||||||
var data uintptr
|
|
||||||
r, _, _ := syscall.Syscall6(i.vtbl.Map, 4, uintptr(unsafe.Pointer(i)),
|
r, _, _ := syscall.Syscall6(i.vtbl.Map, 4, uintptr(unsafe.Pointer(i)),
|
||||||
uintptr(subresource), uintptr(unsafe.Pointer(pReadRange)), uintptr(unsafe.Pointer(&data)),
|
uintptr(subresource), uintptr(unsafe.Pointer(pReadRange)), uintptr(unsafe.Pointer(&data)),
|
||||||
0, 0)
|
0, 0)
|
||||||
runtime.KeepAlive(pReadRange)
|
runtime.KeepAlive(pReadRange)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if windows.Handle(r) != windows.S_OK {
|
||||||
return 0, fmt.Errorf("directx: ID3D12Resource1::Map failed: %w", windows.Errno(r))
|
return nil, fmt.Errorf("directx: ID3D12Resource1::Map failed: %w", windows.Errno(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
|
return data, nil
|
||||||
}
|
}
|
||||||
|
@ -1531,19 +1531,19 @@ func (i *Image) ensureDepthStencilView(device *iD3D12Device) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyFloat32s(dst uintptr, src []float32) {
|
func copyFloat32s(dst unsafe.Pointer, src []float32) {
|
||||||
var dsts []float32
|
var dsts []float32
|
||||||
h := (*reflect.SliceHeader)(unsafe.Pointer(&dsts))
|
h := (*reflect.SliceHeader)(unsafe.Pointer(&dsts))
|
||||||
h.Data = dst
|
h.Data = uintptr(dst)
|
||||||
h.Len = len(src)
|
h.Len = len(src)
|
||||||
h.Cap = len(src)
|
h.Cap = len(src)
|
||||||
copy(dsts, src)
|
copy(dsts, src)
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyUint16s(dst uintptr, src []uint16) {
|
func copyUint16s(dst unsafe.Pointer, src []uint16) {
|
||||||
var dsts []uint16
|
var dsts []uint16
|
||||||
h := (*reflect.SliceHeader)(unsafe.Pointer(&dsts))
|
h := (*reflect.SliceHeader)(unsafe.Pointer(&dsts))
|
||||||
h.Data = dst
|
h.Data = uintptr(dst)
|
||||||
h.Len = len(src)
|
h.Len = len(src)
|
||||||
h.Cap = len(src)
|
h.Cap = len(src)
|
||||||
copy(dsts, src)
|
copy(dsts, src)
|
||||||
|
Loading…
Reference in New Issue
Block a user