mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/graphicsdriver/directx: bug fix: ID3D12Resource::Unmap does not return an value
Updates #2113
This commit is contained in:
parent
4a684c4195
commit
fb03a1e351
@ -1796,14 +1796,10 @@ func (i *_ID3D12Resource) Release() {
|
||||
syscall.Syscall(i.vtbl.Release, 1, uintptr(unsafe.Pointer(i)), 0, 0)
|
||||
}
|
||||
|
||||
func (i *_ID3D12Resource) Unmap(subresource uint32, pWrittenRange *_D3D12_RANGE) error {
|
||||
r, _, _ := syscall.Syscall(i.vtbl.Unmap, 3, uintptr(unsafe.Pointer(i)),
|
||||
func (i *_ID3D12Resource) Unmap(subresource uint32, pWrittenRange *_D3D12_RANGE) {
|
||||
syscall.Syscall(i.vtbl.Unmap, 3, uintptr(unsafe.Pointer(i)),
|
||||
uintptr(subresource), uintptr(unsafe.Pointer(pWrittenRange)))
|
||||
runtime.KeepAlive(pWrittenRange)
|
||||
if uint32(r) != uint32(windows.S_OK) {
|
||||
return fmt.Errorf("directx: ID3D12Resource::Unmap failed: %w", windows.Errno(r))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type _ID3DBlob struct {
|
||||
|
@ -829,18 +829,14 @@ func (g *Graphics) SetVertices(vertices []float32, indices []uint16) (ferr error
|
||||
return err
|
||||
}
|
||||
copyFloat32s(m, vertices)
|
||||
if err := g.vertices[g.frameIndex][vidx].Unmap(0, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
g.vertices[g.frameIndex][vidx].Unmap(0, nil)
|
||||
|
||||
m, err = g.indices[g.frameIndex][iidx].Map(0, &_D3D12_RANGE{0, 0})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
copyUint16s(m, indices)
|
||||
if err := g.indices[g.frameIndex][iidx].Unmap(0, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
g.indices[g.frameIndex][iidx].Unmap(0, nil)
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -1372,9 +1368,7 @@ func (i *Image) ReadPixels(buf []byte) error {
|
||||
copy(buf[j*i.width*4:(j+1)*i.width*4], dstBytes[j*int(i.layouts.Footprint.RowPitch):])
|
||||
}
|
||||
|
||||
if err := i.readingStagingBuffer.Unmap(0, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
i.readingStagingBuffer.Unmap(0, nil)
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -1430,9 +1424,7 @@ func (i *Image) ReplacePixels(args []*graphicsdriver.ReplacePixelsArgs) error {
|
||||
})
|
||||
}
|
||||
|
||||
if err := i.uploadingStagingBuffer.Unmap(0, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
i.uploadingStagingBuffer.Unmap(0, nil)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -420,9 +420,7 @@ func (p *pipelineStates) useGraphicsPipelineState(device *_ID3D12Device, command
|
||||
}
|
||||
copyFloat32s(m, uniforms)
|
||||
|
||||
if err := cb.Unmap(0, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
cb.Unmap(0, nil)
|
||||
|
||||
commandList.SetPipelineState(pipelineState)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user