internal/graphicsdriver/directx: bug fix: wrong pointer usage

This commit is contained in:
Hajime Hoshi 2022-06-22 01:49:23 +09:00
parent 10af36ee9f
commit 8311ff1e46
2 changed files with 3 additions and 1 deletions

View File

@ -1755,6 +1755,8 @@ func (i *_ID3D12Device) SetFrameIntervalX(pOutputSyncTarget *_IDXGIOutput, lengt
func (i *_ID3D12Device) QueryInterface(riid *windows.GUID, ppvObject *unsafe.Pointer) error {
r, _, _ := syscall.Syscall(i.vtbl.QueryInterface, 3, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(riid)), uintptr(unsafe.Pointer(ppvObject)))
runtime.KeepAlive(riid)
runtime.KeepAlive(ppvObject)
if uint32(r) != uint32(windows.S_OK) {
return fmt.Errorf("directx: ID3D12Device::QueryInterface failed: HRESULT(%d)", uint32(r))
}

View File

@ -289,7 +289,7 @@ func (g *Graphics) initializeXbox(useWARP bool, useDebugLayer bool) (ferr error)
}
var dxgiDevice *_IDXGIDevice
if err := g.device.QueryInterface(&_IID_IDXGIDevice, (*unsafe.Pointer)(unsafe.Pointer(dxgiDevice))); err != nil {
if err := g.device.QueryInterface(&_IID_IDXGIDevice, (*unsafe.Pointer)(unsafe.Pointer(&dxgiDevice))); err != nil {
return err
}
defer dxgiDevice.Release()