mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
treat Windows error values as uint32 instead of windows.Handle
The error value are defined as windows.Handle (64bit) in golang.org/x/sys/windows, but an actual type should be HRESULT (32bit). This causes an issue that a returning value from a Windows API was recognized as a non-zero error value though the value was not an error, when the value's lower 32-bits are all zero. See also https://github.com/golang/go/issues/48736#issuecomment-1143993096 Updates #2113
This commit is contained in:
parent
b900f83a01
commit
4a684c4195
@ -338,7 +338,7 @@ func (d *iDirectInput8W) CreateDevice(rguid *windows.GUID, lplpDirectInputDevice
|
|||||||
uintptr(unsafe.Pointer(d)),
|
uintptr(unsafe.Pointer(d)),
|
||||||
uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lplpDirectInputDevice)), uintptr(pUnkOuter),
|
uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lplpDirectInputDevice)), uintptr(pUnkOuter),
|
||||||
0, 0)
|
0, 0)
|
||||||
if windows.Handle(r) != _DI_OK {
|
if uint32(r) != _DI_OK {
|
||||||
return fmt.Errorf("gamepad: IDirectInput8::CreateDevice failed: %w", directInputError(syscall.Errno(r)))
|
return fmt.Errorf("gamepad: IDirectInput8::CreateDevice failed: %w", directInputError(syscall.Errno(r)))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -349,7 +349,7 @@ func (d *iDirectInput8W) EnumDevices(dwDevType uint32, lpCallback uintptr, pvRef
|
|||||||
uintptr(unsafe.Pointer(d)),
|
uintptr(unsafe.Pointer(d)),
|
||||||
uintptr(dwDevType), lpCallback, uintptr(pvRef), uintptr(dwFlags),
|
uintptr(dwDevType), lpCallback, uintptr(pvRef), uintptr(dwFlags),
|
||||||
0)
|
0)
|
||||||
if windows.Handle(r) != _DI_OK {
|
if uint32(r) != _DI_OK {
|
||||||
return fmt.Errorf("gamepad: IDirectInput8::EnumDevices failed: %w", directInputError(syscall.Errno(r)))
|
return fmt.Errorf("gamepad: IDirectInput8::EnumDevices failed: %w", directInputError(syscall.Errno(r)))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -397,7 +397,7 @@ type iDirectInputDevice8W_Vtbl struct {
|
|||||||
|
|
||||||
func (d *iDirectInputDevice8W) Acquire() error {
|
func (d *iDirectInputDevice8W) Acquire() error {
|
||||||
r, _, _ := syscall.Syscall(d.vtbl.Acquire, 1, uintptr(unsafe.Pointer(d)), 0, 0)
|
r, _, _ := syscall.Syscall(d.vtbl.Acquire, 1, uintptr(unsafe.Pointer(d)), 0, 0)
|
||||||
if windows.Handle(r) != _DI_OK && windows.Handle(r) != _SI_FALSE {
|
if uint32(r) != _DI_OK && uint32(r) != _SI_FALSE {
|
||||||
return fmt.Errorf("gamepad: IDirectInputDevice8::Acquire failed: %w", directInputError(syscall.Errno(r)))
|
return fmt.Errorf("gamepad: IDirectInputDevice8::Acquire failed: %w", directInputError(syscall.Errno(r)))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -408,7 +408,7 @@ func (d *iDirectInputDevice8W) EnumObjects(lpCallback uintptr, pvRef unsafe.Poin
|
|||||||
uintptr(unsafe.Pointer(d)),
|
uintptr(unsafe.Pointer(d)),
|
||||||
lpCallback, uintptr(pvRef), uintptr(dwFlags),
|
lpCallback, uintptr(pvRef), uintptr(dwFlags),
|
||||||
0, 0)
|
0, 0)
|
||||||
if windows.Handle(r) != _DI_OK {
|
if uint32(r) != _DI_OK {
|
||||||
return fmt.Errorf("gamepad: IDirectInputDevice8::EnumObjects failed: %w", directInputError(syscall.Errno(r)))
|
return fmt.Errorf("gamepad: IDirectInputDevice8::EnumObjects failed: %w", directInputError(syscall.Errno(r)))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -416,7 +416,7 @@ func (d *iDirectInputDevice8W) EnumObjects(lpCallback uintptr, pvRef unsafe.Poin
|
|||||||
|
|
||||||
func (d *iDirectInputDevice8W) GetCapabilities(lpDIDevCaps *_DIDEVCAPS) error {
|
func (d *iDirectInputDevice8W) GetCapabilities(lpDIDevCaps *_DIDEVCAPS) error {
|
||||||
r, _, _ := syscall.Syscall(d.vtbl.GetCapabilities, 2, uintptr(unsafe.Pointer(d)), uintptr(unsafe.Pointer(lpDIDevCaps)), 0)
|
r, _, _ := syscall.Syscall(d.vtbl.GetCapabilities, 2, uintptr(unsafe.Pointer(d)), uintptr(unsafe.Pointer(lpDIDevCaps)), 0)
|
||||||
if windows.Handle(r) != _DI_OK {
|
if uint32(r) != _DI_OK {
|
||||||
return fmt.Errorf("gamepad: IDirectInputDevice8::GetCapabilities failed: %w", directInputError(syscall.Errno(r)))
|
return fmt.Errorf("gamepad: IDirectInputDevice8::GetCapabilities failed: %w", directInputError(syscall.Errno(r)))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -424,7 +424,7 @@ func (d *iDirectInputDevice8W) GetCapabilities(lpDIDevCaps *_DIDEVCAPS) error {
|
|||||||
|
|
||||||
func (d *iDirectInputDevice8W) GetDeviceState(cbData uint32, lpvData unsafe.Pointer) error {
|
func (d *iDirectInputDevice8W) GetDeviceState(cbData uint32, lpvData unsafe.Pointer) error {
|
||||||
r, _, _ := syscall.Syscall(d.vtbl.GetDeviceState, 3, uintptr(unsafe.Pointer(d)), uintptr(cbData), uintptr(lpvData))
|
r, _, _ := syscall.Syscall(d.vtbl.GetDeviceState, 3, uintptr(unsafe.Pointer(d)), uintptr(cbData), uintptr(lpvData))
|
||||||
if windows.Handle(r) != _DI_OK {
|
if uint32(r) != _DI_OK {
|
||||||
return fmt.Errorf("gamepad: IDirectInputDevice8::GetDeviceState failed: %w", directInputError(syscall.Errno(r)))
|
return fmt.Errorf("gamepad: IDirectInputDevice8::GetDeviceState failed: %w", directInputError(syscall.Errno(r)))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -432,7 +432,7 @@ func (d *iDirectInputDevice8W) GetDeviceState(cbData uint32, lpvData unsafe.Poin
|
|||||||
|
|
||||||
func (d *iDirectInputDevice8W) Poll() error {
|
func (d *iDirectInputDevice8W) Poll() error {
|
||||||
r, _, _ := syscall.Syscall(d.vtbl.Poll, 1, uintptr(unsafe.Pointer(d)), 0, 0)
|
r, _, _ := syscall.Syscall(d.vtbl.Poll, 1, uintptr(unsafe.Pointer(d)), 0, 0)
|
||||||
if windows.Handle(r) != _DI_OK && windows.Handle(r) != _DI_NOEFFECT {
|
if uint32(r) != _DI_OK && uint32(r) != _DI_NOEFFECT {
|
||||||
return fmt.Errorf("gamepad: IDirectInputDevice8::Poll failed: %w", directInputError(syscall.Errno(r)))
|
return fmt.Errorf("gamepad: IDirectInputDevice8::Poll failed: %w", directInputError(syscall.Errno(r)))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -445,7 +445,7 @@ func (d *iDirectInputDevice8W) Release() uint32 {
|
|||||||
|
|
||||||
func (d *iDirectInputDevice8W) SetDataFormat(lpdf *_DIDATAFORMAT) error {
|
func (d *iDirectInputDevice8W) SetDataFormat(lpdf *_DIDATAFORMAT) error {
|
||||||
r, _, _ := syscall.Syscall(d.vtbl.SetDataFormat, 2, uintptr(unsafe.Pointer(d)), uintptr(unsafe.Pointer(lpdf)), 0)
|
r, _, _ := syscall.Syscall(d.vtbl.SetDataFormat, 2, uintptr(unsafe.Pointer(d)), uintptr(unsafe.Pointer(lpdf)), 0)
|
||||||
if windows.Handle(r) != _DI_OK {
|
if uint32(r) != _DI_OK {
|
||||||
return fmt.Errorf("gamepad: IDirectInputDevice8::SetDataFormat failed: %w", directInputError(syscall.Errno(r)))
|
return fmt.Errorf("gamepad: IDirectInputDevice8::SetDataFormat failed: %w", directInputError(syscall.Errno(r)))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -453,7 +453,7 @@ func (d *iDirectInputDevice8W) SetDataFormat(lpdf *_DIDATAFORMAT) error {
|
|||||||
|
|
||||||
func (d *iDirectInputDevice8W) SetProperty(rguidProp uintptr, pdiph *_DIPROPHEADER) error {
|
func (d *iDirectInputDevice8W) SetProperty(rguidProp uintptr, pdiph *_DIPROPHEADER) error {
|
||||||
r, _, _ := syscall.Syscall(d.vtbl.SetProperty, 3, uintptr(unsafe.Pointer(d)), rguidProp, uintptr(unsafe.Pointer(pdiph)))
|
r, _, _ := syscall.Syscall(d.vtbl.SetProperty, 3, uintptr(unsafe.Pointer(d)), rguidProp, uintptr(unsafe.Pointer(pdiph)))
|
||||||
if windows.Handle(r) != _DI_OK && windows.Handle(r) != _DI_PROPNOEFFECT {
|
if uint32(r) != _DI_OK && uint32(r) != _DI_PROPNOEFFECT {
|
||||||
return fmt.Errorf("gamepad: IDirectInputDevice8::SetProperty failed: %w", directInputError(syscall.Errno(r)))
|
return fmt.Errorf("gamepad: IDirectInputDevice8::SetProperty failed: %w", directInputError(syscall.Errno(r)))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -1071,7 +1071,7 @@ func _DragQueryPoint(hDrop _HDROP) (_POINT, bool) {
|
|||||||
|
|
||||||
func _DwmEnableBlurBehindWindow(hWnd windows.HWND, pBlurBehind *_DWM_BLURBEHIND) error {
|
func _DwmEnableBlurBehindWindow(hWnd windows.HWND, pBlurBehind *_DWM_BLURBEHIND) error {
|
||||||
r, _, e := procDwmEnableBlurBehindWindow.Call(uintptr(hWnd), uintptr(unsafe.Pointer(pBlurBehind)))
|
r, _, e := procDwmEnableBlurBehindWindow.Call(uintptr(hWnd), uintptr(unsafe.Pointer(pBlurBehind)))
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return fmt.Errorf("glfwwin: DwmEnableBlurBehindWindow failed: %w", e)
|
return fmt.Errorf("glfwwin: DwmEnableBlurBehindWindow failed: %w", e)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -1081,7 +1081,7 @@ func _DwmGetColorizationColor() (uint32, bool, error) {
|
|||||||
var colorization uint32
|
var colorization uint32
|
||||||
var opaqueBlend int32
|
var opaqueBlend int32
|
||||||
r, _, e := procDwmGetColorizationColor.Call(uintptr(unsafe.Pointer(&colorization)), uintptr(unsafe.Pointer(&opaqueBlend)))
|
r, _, e := procDwmGetColorizationColor.Call(uintptr(unsafe.Pointer(&colorization)), uintptr(unsafe.Pointer(&opaqueBlend)))
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return 0, false, fmt.Errorf("glfwwin: DwmGetColorizationColor failed: %w", e)
|
return 0, false, fmt.Errorf("glfwwin: DwmGetColorizationColor failed: %w", e)
|
||||||
}
|
}
|
||||||
return colorization, opaqueBlend != 0, nil
|
return colorization, opaqueBlend != 0, nil
|
||||||
@ -1089,7 +1089,7 @@ func _DwmGetColorizationColor() (uint32, bool, error) {
|
|||||||
|
|
||||||
func _DwmFlush() error {
|
func _DwmFlush() error {
|
||||||
r, _, e := procDwmFlush.Call()
|
r, _, e := procDwmFlush.Call()
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return fmt.Errorf("glfwwin: DwmFlush failed: %w", e)
|
return fmt.Errorf("glfwwin: DwmFlush failed: %w", e)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -1098,7 +1098,7 @@ func _DwmFlush() error {
|
|||||||
func _DwmIsCompositionEnabled() (bool, error) {
|
func _DwmIsCompositionEnabled() (bool, error) {
|
||||||
var enabled int32
|
var enabled int32
|
||||||
r, _, e := procDwmIsCompositionEnabled.Call(uintptr(unsafe.Pointer(&enabled)))
|
r, _, e := procDwmIsCompositionEnabled.Call(uintptr(unsafe.Pointer(&enabled)))
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return false, fmt.Errorf("glfwwin: DwmIsCompositionEnabled failed: %w", e)
|
return false, fmt.Errorf("glfwwin: DwmIsCompositionEnabled failed: %w", e)
|
||||||
}
|
}
|
||||||
return enabled != 0, nil
|
return enabled != 0, nil
|
||||||
@ -1302,7 +1302,7 @@ func _GetMonitorInfoW_Ex(hMonitor _HMONITOR) (_MONITORINFOEXW, bool) {
|
|||||||
|
|
||||||
func _GetDpiForMonitor(hmonitor _HMONITOR, dpiType _MONITOR_DPI_TYPE) (dpiX, dpiY uint32, err error) {
|
func _GetDpiForMonitor(hmonitor _HMONITOR, dpiType _MONITOR_DPI_TYPE) (dpiX, dpiY uint32, err error) {
|
||||||
r, _, e := procGetDpiForMonitor.Call(uintptr(hmonitor), uintptr(dpiType), uintptr(unsafe.Pointer(&dpiX)), uintptr(unsafe.Pointer(&dpiY)))
|
r, _, e := procGetDpiForMonitor.Call(uintptr(hmonitor), uintptr(dpiType), uintptr(unsafe.Pointer(&dpiX)), uintptr(unsafe.Pointer(&dpiY)))
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return 0, 0, fmt.Errorf("glfwwin: GetDpiForMonitor failed: %w", e)
|
return 0, 0, fmt.Errorf("glfwwin: GetDpiForMonitor failed: %w", e)
|
||||||
}
|
}
|
||||||
return dpiX, dpiY, nil
|
return dpiX, dpiY, nil
|
||||||
@ -1599,7 +1599,7 @@ func _SetProcessDPIAware() bool {
|
|||||||
|
|
||||||
func _SetProcessDpiAwareness(value _PROCESS_DPI_AWARENESS) error {
|
func _SetProcessDpiAwareness(value _PROCESS_DPI_AWARENESS) error {
|
||||||
r, _, e := procSetProcessDpiAwareness.Call(uintptr(value))
|
r, _, e := procSetProcessDpiAwareness.Call(uintptr(value))
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return fmt.Errorf("glfwwin: SetProcessDpiAwareness failed: %w", e)
|
return fmt.Errorf("glfwwin: SetProcessDpiAwareness failed: %w", e)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -893,10 +893,10 @@ var (
|
|||||||
|
|
||||||
func _D3D12CreateDevice(pAdapter unsafe.Pointer, minimumFeatureLevel _D3D_FEATURE_LEVEL, riid *windows.GUID, ppDevice *unsafe.Pointer) error {
|
func _D3D12CreateDevice(pAdapter unsafe.Pointer, minimumFeatureLevel _D3D_FEATURE_LEVEL, riid *windows.GUID, ppDevice *unsafe.Pointer) error {
|
||||||
r, _, _ := procD3D12CreateDevice.Call(uintptr(pAdapter), uintptr(minimumFeatureLevel), uintptr(unsafe.Pointer(riid)), uintptr(unsafe.Pointer(ppDevice)))
|
r, _, _ := procD3D12CreateDevice.Call(uintptr(pAdapter), uintptr(minimumFeatureLevel), uintptr(unsafe.Pointer(riid)), uintptr(unsafe.Pointer(ppDevice)))
|
||||||
if ppDevice == nil && windows.Handle(r) != windows.S_FALSE {
|
if ppDevice == nil && uint32(r) != uint32(windows.S_FALSE) {
|
||||||
return fmt.Errorf("directx: D3D12CreateDevice failed: %w", windows.Errno(r))
|
return fmt.Errorf("directx: D3D12CreateDevice failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
if ppDevice != nil && windows.Handle(r) != windows.S_OK {
|
if ppDevice != nil && uint32(r) != uint32(windows.S_OK) {
|
||||||
return fmt.Errorf("directx: D3D12CreateDevice failed: %w", windows.Errno(r))
|
return fmt.Errorf("directx: D3D12CreateDevice failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -905,7 +905,7 @@ func _D3D12CreateDevice(pAdapter unsafe.Pointer, minimumFeatureLevel _D3D_FEATUR
|
|||||||
func _D3D12GetDebugInterface() (*_ID3D12Debug, error) {
|
func _D3D12GetDebugInterface() (*_ID3D12Debug, error) {
|
||||||
var debug *_ID3D12Debug
|
var debug *_ID3D12Debug
|
||||||
r, _, _ := procD3D12GetDebugInterface.Call(uintptr(unsafe.Pointer(&_IID_ID3D12Debug)), uintptr(unsafe.Pointer(&debug)))
|
r, _, _ := procD3D12GetDebugInterface.Call(uintptr(unsafe.Pointer(&_IID_ID3D12Debug)), uintptr(unsafe.Pointer(&debug)))
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return nil, fmt.Errorf("directx: D3D12GetDebugInterface failed: %w", windows.Errno(r))
|
return nil, fmt.Errorf("directx: D3D12GetDebugInterface failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return debug, nil
|
return debug, nil
|
||||||
@ -915,7 +915,7 @@ func _D3D12SerializeRootSignature(pRootSignature *_D3D12_ROOT_SIGNATURE_DESC, ve
|
|||||||
var blob *_ID3DBlob
|
var blob *_ID3DBlob
|
||||||
var errorBlob *_ID3DBlob
|
var errorBlob *_ID3DBlob
|
||||||
r, _, _ := procD3D12SerializeRootSignature.Call(uintptr(unsafe.Pointer(pRootSignature)), uintptr(version), uintptr(unsafe.Pointer(&blob)), uintptr(unsafe.Pointer(&errorBlob)))
|
r, _, _ := procD3D12SerializeRootSignature.Call(uintptr(unsafe.Pointer(pRootSignature)), uintptr(version), uintptr(unsafe.Pointer(&blob)), uintptr(unsafe.Pointer(&errorBlob)))
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
if errorBlob != nil {
|
if errorBlob != nil {
|
||||||
defer errorBlob.Release()
|
defer errorBlob.Release()
|
||||||
return nil, fmt.Errorf("directx: D3D12SerializeRootSignature failed: %s: %w", errorBlob.String(), windows.Errno(r))
|
return nil, fmt.Errorf("directx: D3D12SerializeRootSignature failed: %s: %w", errorBlob.String(), windows.Errno(r))
|
||||||
@ -927,7 +927,7 @@ func _D3D12SerializeRootSignature(pRootSignature *_D3D12_ROOT_SIGNATURE_DESC, ve
|
|||||||
|
|
||||||
func _D3D12XboxCreateDevice(pAdapter unsafe.Pointer, pParameters *_D3D12XBOX_CREATE_DEVICE_PARAMETERS, riid *windows.GUID, ppDevice *unsafe.Pointer) error {
|
func _D3D12XboxCreateDevice(pAdapter unsafe.Pointer, pParameters *_D3D12XBOX_CREATE_DEVICE_PARAMETERS, riid *windows.GUID, ppDevice *unsafe.Pointer) error {
|
||||||
r, _, _ := procD3D12XboxCreateDevice.Call(uintptr(pAdapter), uintptr(unsafe.Pointer(pParameters)), uintptr(unsafe.Pointer(riid)), uintptr(unsafe.Pointer(ppDevice)))
|
r, _, _ := procD3D12XboxCreateDevice.Call(uintptr(pAdapter), uintptr(unsafe.Pointer(pParameters)), uintptr(unsafe.Pointer(riid)), uintptr(unsafe.Pointer(ppDevice)))
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return fmt.Errorf("directx: D3D12XboxCreateDevice failed: %w", windows.Errno(r))
|
return fmt.Errorf("directx: D3D12XboxCreateDevice failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -955,7 +955,7 @@ func _D3DCompile(srcData []byte, sourceName string, pDefines []_D3D_SHADER_MACRO
|
|||||||
runtime.KeepAlive(sourceNameBytes)
|
runtime.KeepAlive(sourceNameBytes)
|
||||||
runtime.KeepAlive(entryPointBytes)
|
runtime.KeepAlive(entryPointBytes)
|
||||||
runtime.KeepAlive(targetBytes)
|
runtime.KeepAlive(targetBytes)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
if errorMsgs != nil {
|
if errorMsgs != nil {
|
||||||
defer errorMsgs.Release()
|
defer errorMsgs.Release()
|
||||||
return nil, fmt.Errorf("directx: D3DCompile failed: %s: %w", errorMsgs.String(), windows.Errno(r))
|
return nil, fmt.Errorf("directx: D3DCompile failed: %s: %w", errorMsgs.String(), windows.Errno(r))
|
||||||
@ -968,7 +968,7 @@ func _D3DCompile(srcData []byte, sourceName string, pDefines []_D3D_SHADER_MACRO
|
|||||||
func _CreateDXGIFactory2(flags uint32) (*_IDXGIFactory4, error) {
|
func _CreateDXGIFactory2(flags uint32) (*_IDXGIFactory4, error) {
|
||||||
var factory *_IDXGIFactory4
|
var factory *_IDXGIFactory4
|
||||||
r, _, _ := procCreateDXGIFactory2.Call(uintptr(flags), uintptr(unsafe.Pointer(&_IID_IDXGIFactory4)), uintptr(unsafe.Pointer(&factory)))
|
r, _, _ := procCreateDXGIFactory2.Call(uintptr(flags), uintptr(unsafe.Pointer(&_IID_IDXGIFactory4)), uintptr(unsafe.Pointer(&factory)))
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return nil, fmt.Errorf("directx: CreateDXGIFactory2 failed: %w", windows.Errno(r))
|
return nil, fmt.Errorf("directx: CreateDXGIFactory2 failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return factory, nil
|
return factory, nil
|
||||||
@ -1110,7 +1110,7 @@ func (i *_ID3D12CommandAllocator) Release() {
|
|||||||
|
|
||||||
func (i *_ID3D12CommandAllocator) Reset() error {
|
func (i *_ID3D12CommandAllocator) Reset() error {
|
||||||
r, _, _ := syscall.Syscall(i.vtbl.Reset, 1, uintptr(unsafe.Pointer(i)), 0, 0)
|
r, _, _ := syscall.Syscall(i.vtbl.Reset, 1, uintptr(unsafe.Pointer(i)), 0, 0)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return fmt.Errorf("directx: ID3D12CommandAllocator::Reset failed: %w", windows.Errno(r))
|
return fmt.Errorf("directx: ID3D12CommandAllocator::Reset failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -1153,7 +1153,7 @@ func (i *_ID3D12CommandQueue) Signal(signal *_ID3D12Fence, value uint64) error {
|
|||||||
r, _, _ := syscall.Syscall(i.vtbl.Signal, 3, uintptr(unsafe.Pointer(i)),
|
r, _, _ := syscall.Syscall(i.vtbl.Signal, 3, uintptr(unsafe.Pointer(i)),
|
||||||
uintptr(unsafe.Pointer(signal)), uintptr(value))
|
uintptr(unsafe.Pointer(signal)), uintptr(value))
|
||||||
runtime.KeepAlive(signal)
|
runtime.KeepAlive(signal)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return fmt.Errorf("directx: ID3D12CommandQueue::Signal failed: %w", windows.Errno(r))
|
return fmt.Errorf("directx: ID3D12CommandQueue::Signal failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -1222,7 +1222,7 @@ type _ID3D12DebugCommandList_Vtbl struct {
|
|||||||
|
|
||||||
func (i *_ID3D12DebugCommandList) SetFeatureMask(mask _D3D12_DEBUG_FEATURE) error {
|
func (i *_ID3D12DebugCommandList) SetFeatureMask(mask _D3D12_DEBUG_FEATURE) error {
|
||||||
r, _, _ := syscall.Syscall(i.vtbl.SetFeatureMask, 2, uintptr(unsafe.Pointer(i)), uintptr(mask), 0)
|
r, _, _ := syscall.Syscall(i.vtbl.SetFeatureMask, 2, uintptr(unsafe.Pointer(i)), uintptr(mask), 0)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return fmt.Errorf("directx: ID3D12DebugCommandList::SetFeatureMask failed: %w", windows.Errno(r))
|
return fmt.Errorf("directx: ID3D12DebugCommandList::SetFeatureMask failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -1323,7 +1323,7 @@ func (i *_ID3D12Device) CreateCommandAllocator(typ _D3D12_COMMAND_LIST_TYPE) (*_
|
|||||||
r, _, _ := syscall.Syscall6(i.vtbl.CreateCommandAllocator, 4, uintptr(unsafe.Pointer(i)),
|
r, _, _ := syscall.Syscall6(i.vtbl.CreateCommandAllocator, 4, uintptr(unsafe.Pointer(i)),
|
||||||
uintptr(typ), uintptr(unsafe.Pointer(&_IID_ID3D12CommandAllocator)), uintptr(unsafe.Pointer(&commandAllocator)),
|
uintptr(typ), uintptr(unsafe.Pointer(&_IID_ID3D12CommandAllocator)), uintptr(unsafe.Pointer(&commandAllocator)),
|
||||||
0, 0)
|
0, 0)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return nil, fmt.Errorf("directx: ID3D12Device::CreateCommandAllocator failed: %w", windows.Errno(r))
|
return nil, fmt.Errorf("directx: ID3D12Device::CreateCommandAllocator failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return commandAllocator, nil
|
return commandAllocator, nil
|
||||||
@ -1337,7 +1337,7 @@ func (i *_ID3D12Device) CreateCommandList(nodeMask uint32, typ _D3D12_COMMAND_LI
|
|||||||
uintptr(unsafe.Pointer(&commandList)), 0, 0)
|
uintptr(unsafe.Pointer(&commandList)), 0, 0)
|
||||||
runtime.KeepAlive(pCommandAllocator)
|
runtime.KeepAlive(pCommandAllocator)
|
||||||
runtime.KeepAlive(pInitialState)
|
runtime.KeepAlive(pInitialState)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return nil, fmt.Errorf("directx: ID3D12Device::CreateCommandList failed: %w", windows.Errno(r))
|
return nil, fmt.Errorf("directx: ID3D12Device::CreateCommandList failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return commandList, nil
|
return commandList, nil
|
||||||
@ -1352,7 +1352,7 @@ func (i *_ID3D12Device) CreateCommittedResource(pHeapProperties *_D3D12_HEAP_PRO
|
|||||||
runtime.KeepAlive(pHeapProperties)
|
runtime.KeepAlive(pHeapProperties)
|
||||||
runtime.KeepAlive(pDesc)
|
runtime.KeepAlive(pDesc)
|
||||||
runtime.KeepAlive(pOptimizedClearValue)
|
runtime.KeepAlive(pOptimizedClearValue)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return nil, fmt.Errorf("directx: ID3D12Device::CreateCommittedResource failed: %w", windows.Errno(r))
|
return nil, fmt.Errorf("directx: ID3D12Device::CreateCommittedResource failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return resource, nil
|
return resource, nil
|
||||||
@ -1364,7 +1364,7 @@ func (i *_ID3D12Device) CreateCommandQueue(desc *_D3D12_COMMAND_QUEUE_DESC) (*_I
|
|||||||
uintptr(unsafe.Pointer(desc)), uintptr(unsafe.Pointer(&_IID_ID3D12CommandQueue)), uintptr(unsafe.Pointer(&commandQueue)),
|
uintptr(unsafe.Pointer(desc)), uintptr(unsafe.Pointer(&_IID_ID3D12CommandQueue)), uintptr(unsafe.Pointer(&commandQueue)),
|
||||||
0, 0)
|
0, 0)
|
||||||
runtime.KeepAlive(desc)
|
runtime.KeepAlive(desc)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return nil, fmt.Errorf("directx: ID3D12Device::CreateCommandQueue failed: %w", windows.Errno(r))
|
return nil, fmt.Errorf("directx: ID3D12Device::CreateCommandQueue failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return commandQueue, nil
|
return commandQueue, nil
|
||||||
@ -1382,7 +1382,7 @@ func (i *_ID3D12Device) CreateDescriptorHeap(desc *_D3D12_DESCRIPTOR_HEAP_DESC)
|
|||||||
uintptr(unsafe.Pointer(desc)), uintptr(unsafe.Pointer(&_IID_ID3D12DescriptorHeap)), uintptr(unsafe.Pointer(&descriptorHeap)),
|
uintptr(unsafe.Pointer(desc)), uintptr(unsafe.Pointer(&_IID_ID3D12DescriptorHeap)), uintptr(unsafe.Pointer(&descriptorHeap)),
|
||||||
0, 0)
|
0, 0)
|
||||||
runtime.KeepAlive(desc)
|
runtime.KeepAlive(desc)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return nil, fmt.Errorf("directx: ID3D12Device::CreateDescriptorHeap failed: %w", windows.Errno(r))
|
return nil, fmt.Errorf("directx: ID3D12Device::CreateDescriptorHeap failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return descriptorHeap, nil
|
return descriptorHeap, nil
|
||||||
@ -1402,7 +1402,7 @@ func (i *_ID3D12Device) CreateFence(initialValue uint64, flags _D3D12_FENCE_FLAG
|
|||||||
r, _, _ := syscall.Syscall6(i.vtbl.CreateFence, 5, uintptr(unsafe.Pointer(i)),
|
r, _, _ := syscall.Syscall6(i.vtbl.CreateFence, 5, uintptr(unsafe.Pointer(i)),
|
||||||
uintptr(initialValue), uintptr(flags), uintptr(unsafe.Pointer(&_IID_ID3D12Fence)), uintptr(unsafe.Pointer(&fence)),
|
uintptr(initialValue), uintptr(flags), uintptr(unsafe.Pointer(&_IID_ID3D12Fence)), uintptr(unsafe.Pointer(&fence)),
|
||||||
0)
|
0)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return nil, fmt.Errorf("directx: ID3D12Device::CreateFence failed: %w", windows.Errno(r))
|
return nil, fmt.Errorf("directx: ID3D12Device::CreateFence failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return fence, nil
|
return fence, nil
|
||||||
@ -1414,7 +1414,7 @@ func (i *_ID3D12Device) CreateGraphicsPipelineState(pDesc *_D3D12_GRAPHICS_PIPEL
|
|||||||
uintptr(unsafe.Pointer(pDesc)), uintptr(unsafe.Pointer(&_IID_ID3D12PipelineState)), uintptr(unsafe.Pointer(&pipelineState)),
|
uintptr(unsafe.Pointer(pDesc)), uintptr(unsafe.Pointer(&_IID_ID3D12PipelineState)), uintptr(unsafe.Pointer(&pipelineState)),
|
||||||
0, 0)
|
0, 0)
|
||||||
runtime.KeepAlive(pDesc)
|
runtime.KeepAlive(pDesc)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return nil, fmt.Errorf("directx: ID3D12Device::CreateGraphicsPipelineState failed: %w", windows.Errno(r))
|
return nil, fmt.Errorf("directx: ID3D12Device::CreateGraphicsPipelineState failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return pipelineState, nil
|
return pipelineState, nil
|
||||||
@ -1433,7 +1433,7 @@ func (i *_ID3D12Device) CreateRootSignature(nodeMask uint32, pBlobWithRootSignat
|
|||||||
r, _, _ := syscall.Syscall6(i.vtbl.CreateRootSignature, 6, uintptr(unsafe.Pointer(i)),
|
r, _, _ := syscall.Syscall6(i.vtbl.CreateRootSignature, 6, uintptr(unsafe.Pointer(i)),
|
||||||
uintptr(nodeMask), pBlobWithRootSignature, blobLengthInBytes,
|
uintptr(nodeMask), pBlobWithRootSignature, blobLengthInBytes,
|
||||||
uintptr(unsafe.Pointer(&_IID_ID3D12RootSignature)), uintptr(unsafe.Pointer(&signature)))
|
uintptr(unsafe.Pointer(&_IID_ID3D12RootSignature)), uintptr(unsafe.Pointer(&signature)))
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return nil, fmt.Errorf("directx: ID3D12Device::CreateRootSignature failed: %w", windows.Errno(r))
|
return nil, fmt.Errorf("directx: ID3D12Device::CreateRootSignature failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return signature, nil
|
return signature, nil
|
||||||
@ -1470,7 +1470,7 @@ func (i *_ID3D12Device) GetDescriptorHandleIncrementSize(descriptorHeapType _D3D
|
|||||||
|
|
||||||
func (i *_ID3D12Device) GetDeviceRemovedReason() error {
|
func (i *_ID3D12Device) GetDeviceRemovedReason() error {
|
||||||
r, _, _ := syscall.Syscall(i.vtbl.GetDeviceRemovedReason, 1, uintptr(unsafe.Pointer(i)), 0, 0)
|
r, _, _ := syscall.Syscall(i.vtbl.GetDeviceRemovedReason, 1, uintptr(unsafe.Pointer(i)), 0, 0)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return fmt.Errorf("directx: ID3D12Device::GetDeviceRemovedReason failed: %w", windows.Errno(r))
|
return fmt.Errorf("directx: ID3D12Device::GetDeviceRemovedReason failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -1509,7 +1509,7 @@ func (i *_ID3D12Fence) SetEventOnCompletion(value uint64, hEvent windows.Handle)
|
|||||||
// TODO: Does this work on a 32bit machine?
|
// TODO: Does this work on a 32bit machine?
|
||||||
r, _, _ := syscall.Syscall(i.vtbl.SetEventOnCompletion, 3, uintptr(unsafe.Pointer(i)),
|
r, _, _ := syscall.Syscall(i.vtbl.SetEventOnCompletion, 3, uintptr(unsafe.Pointer(i)),
|
||||||
uintptr(value), uintptr(hEvent))
|
uintptr(value), uintptr(hEvent))
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return fmt.Errorf("directx: ID3D12Fence::SetEventOnCompletion failed: %w", windows.Errno(r))
|
return fmt.Errorf("directx: ID3D12Fence::SetEventOnCompletion failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -1600,7 +1600,7 @@ func (i *_ID3D12GraphicsCommandList) ClearRenderTargetView(pRenderTargetView _D3
|
|||||||
|
|
||||||
func (i *_ID3D12GraphicsCommandList) Close() error {
|
func (i *_ID3D12GraphicsCommandList) Close() error {
|
||||||
r, _, _ := syscall.Syscall(i.vtbl.Close, 1, uintptr(unsafe.Pointer(i)), 0, 0)
|
r, _, _ := syscall.Syscall(i.vtbl.Close, 1, uintptr(unsafe.Pointer(i)), 0, 0)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return fmt.Errorf("directx: ID3D12GraphicsCommandList::Close failed: %w", windows.Errno(r))
|
return fmt.Errorf("directx: ID3D12GraphicsCommandList::Close failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -1665,7 +1665,7 @@ func (i *_ID3D12GraphicsCommandList) QueryInterface(riid *windows.GUID, ppvObjec
|
|||||||
r, _, _ := syscall.Syscall(i.vtbl.QueryInterface, 3, uintptr(unsafe.Pointer(i)),
|
r, _, _ := syscall.Syscall(i.vtbl.QueryInterface, 3, uintptr(unsafe.Pointer(i)),
|
||||||
uintptr(unsafe.Pointer(riid)), uintptr(unsafe.Pointer(ppvObject)))
|
uintptr(unsafe.Pointer(riid)), uintptr(unsafe.Pointer(ppvObject)))
|
||||||
runtime.KeepAlive(riid)
|
runtime.KeepAlive(riid)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return fmt.Errorf("directx: ID3D12GraphicsCommandList::QueryInterface failed: %w", windows.Errno(r))
|
return fmt.Errorf("directx: ID3D12GraphicsCommandList::QueryInterface failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -1680,7 +1680,7 @@ func (i *_ID3D12GraphicsCommandList) Reset(pAllocator *_ID3D12CommandAllocator,
|
|||||||
uintptr(unsafe.Pointer(pAllocator)), uintptr(unsafe.Pointer(pInitialState)))
|
uintptr(unsafe.Pointer(pAllocator)), uintptr(unsafe.Pointer(pInitialState)))
|
||||||
runtime.KeepAlive(pAllocator)
|
runtime.KeepAlive(pAllocator)
|
||||||
runtime.KeepAlive(pInitialState)
|
runtime.KeepAlive(pInitialState)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return fmt.Errorf("directx: ID3D12GraphicsCommandList::Reset failed: %w", windows.Errno(r))
|
return fmt.Errorf("directx: ID3D12GraphicsCommandList::Reset failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -1786,7 +1786,7 @@ func (i *_ID3D12Resource) Map(subresource uint32, pReadRange *_D3D12_RANGE) (uns
|
|||||||
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 uint32(r) != uint32(windows.S_OK) {
|
||||||
return nil, fmt.Errorf("directx: ID3D12Resource::Map failed: %w", windows.Errno(r))
|
return nil, fmt.Errorf("directx: ID3D12Resource::Map failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return data, nil
|
return data, nil
|
||||||
@ -1800,7 +1800,7 @@ func (i *_ID3D12Resource) Unmap(subresource uint32, pWrittenRange *_D3D12_RANGE)
|
|||||||
r, _, _ := syscall.Syscall(i.vtbl.Unmap, 3, uintptr(unsafe.Pointer(i)),
|
r, _, _ := syscall.Syscall(i.vtbl.Unmap, 3, uintptr(unsafe.Pointer(i)),
|
||||||
uintptr(subresource), uintptr(unsafe.Pointer(pWrittenRange)))
|
uintptr(subresource), uintptr(unsafe.Pointer(pWrittenRange)))
|
||||||
runtime.KeepAlive(pWrittenRange)
|
runtime.KeepAlive(pWrittenRange)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return fmt.Errorf("directx: ID3D12Resource::Unmap failed: %w", windows.Errno(r))
|
return fmt.Errorf("directx: ID3D12Resource::Unmap failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -1869,7 +1869,7 @@ func (i *_IDXGIAdapter1) Release() {
|
|||||||
func (i *_IDXGIAdapter1) GetDesc1() (*_DXGI_ADAPTER_DESC1, error) {
|
func (i *_IDXGIAdapter1) GetDesc1() (*_DXGI_ADAPTER_DESC1, error) {
|
||||||
var desc _DXGI_ADAPTER_DESC1
|
var desc _DXGI_ADAPTER_DESC1
|
||||||
r, _, _ := syscall.Syscall(i.vtbl.GetDesc1, 2, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(&desc)), 0)
|
r, _, _ := syscall.Syscall(i.vtbl.GetDesc1, 2, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(&desc)), 0)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return nil, fmt.Errorf("directx: IDXGIAdapter1::GetDesc1 failed: %w", windows.Errno(r))
|
return nil, fmt.Errorf("directx: IDXGIAdapter1::GetDesc1 failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return &desc, nil
|
return &desc, nil
|
||||||
@ -1918,7 +1918,7 @@ func (i *_IDXGIFactory4) CreateSwapChainForComposition(pDevice unsafe.Pointer, p
|
|||||||
uintptr(unsafe.Pointer(pRestrictToOutput)), uintptr(unsafe.Pointer(&swapChain)), 0)
|
uintptr(unsafe.Pointer(pRestrictToOutput)), uintptr(unsafe.Pointer(&swapChain)), 0)
|
||||||
runtime.KeepAlive(pDesc)
|
runtime.KeepAlive(pDesc)
|
||||||
runtime.KeepAlive(pRestrictToOutput)
|
runtime.KeepAlive(pRestrictToOutput)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return nil, fmt.Errorf("directx: IDXGIFactory4::CreateSwapChainForComposition failed: %w", windows.Errno(r))
|
return nil, fmt.Errorf("directx: IDXGIFactory4::CreateSwapChainForComposition failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return swapChain, nil
|
return swapChain, nil
|
||||||
@ -1933,7 +1933,7 @@ func (i *_IDXGIFactory4) CreateSwapChainForHwnd(pDevice unsafe.Pointer, hWnd win
|
|||||||
runtime.KeepAlive(pDesc)
|
runtime.KeepAlive(pDesc)
|
||||||
runtime.KeepAlive(pFullscreenDesc)
|
runtime.KeepAlive(pFullscreenDesc)
|
||||||
runtime.KeepAlive(pRestrictToOutput)
|
runtime.KeepAlive(pRestrictToOutput)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return nil, fmt.Errorf("directx: IDXGIFactory4::CreateSwapChainForHwnd failed: %w", windows.Errno(r))
|
return nil, fmt.Errorf("directx: IDXGIFactory4::CreateSwapChainForHwnd failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return swapChain, nil
|
return swapChain, nil
|
||||||
@ -1942,7 +1942,7 @@ func (i *_IDXGIFactory4) CreateSwapChainForHwnd(pDevice unsafe.Pointer, hWnd win
|
|||||||
func (i *_IDXGIFactory4) EnumAdapters1(adapter uint32) (*_IDXGIAdapter1, error) {
|
func (i *_IDXGIFactory4) EnumAdapters1(adapter uint32) (*_IDXGIAdapter1, error) {
|
||||||
var ptr *_IDXGIAdapter1
|
var ptr *_IDXGIAdapter1
|
||||||
r, _, _ := syscall.Syscall(i.vtbl.EnumAdapters1, 3, uintptr(unsafe.Pointer(i)), uintptr(adapter), uintptr(unsafe.Pointer(&ptr)))
|
r, _, _ := syscall.Syscall(i.vtbl.EnumAdapters1, 3, uintptr(unsafe.Pointer(i)), uintptr(adapter), uintptr(unsafe.Pointer(&ptr)))
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return nil, fmt.Errorf("directx: IDXGIFactory4::EnumAdapters1 failed: %w", windows.Errno(r))
|
return nil, fmt.Errorf("directx: IDXGIFactory4::EnumAdapters1 failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return ptr, nil
|
return ptr, nil
|
||||||
@ -1951,7 +1951,7 @@ func (i *_IDXGIFactory4) EnumAdapters1(adapter uint32) (*_IDXGIAdapter1, error)
|
|||||||
func (i *_IDXGIFactory4) EnumWarpAdapter() (*_IDXGIAdapter1, error) {
|
func (i *_IDXGIFactory4) EnumWarpAdapter() (*_IDXGIAdapter1, error) {
|
||||||
var ptr *_IDXGIAdapter1
|
var ptr *_IDXGIAdapter1
|
||||||
r, _, _ := syscall.Syscall(i.vtbl.EnumWarpAdapter, 3, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(&_IID_IDXGIAdapter1)), uintptr(unsafe.Pointer(&ptr)))
|
r, _, _ := syscall.Syscall(i.vtbl.EnumWarpAdapter, 3, uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(&_IID_IDXGIAdapter1)), uintptr(unsafe.Pointer(&ptr)))
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return nil, fmt.Errorf("directx: IDXGIFactory4::EnumWarpAdapter failed: %w", windows.Errno(r))
|
return nil, fmt.Errorf("directx: IDXGIFactory4::EnumWarpAdapter failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return ptr, nil
|
return ptr, nil
|
||||||
@ -2104,7 +2104,7 @@ func (i *_IDXGISwapChain4) GetBuffer(buffer uint32) (*_ID3D12Resource, error) {
|
|||||||
r, _, _ := syscall.Syscall6(i.vtbl.GetBuffer, 4, uintptr(unsafe.Pointer(i)),
|
r, _, _ := syscall.Syscall6(i.vtbl.GetBuffer, 4, uintptr(unsafe.Pointer(i)),
|
||||||
uintptr(buffer), uintptr(unsafe.Pointer(&_IID_ID3D12Resource)), uintptr(unsafe.Pointer(&resource)),
|
uintptr(buffer), uintptr(unsafe.Pointer(&_IID_ID3D12Resource)), uintptr(unsafe.Pointer(&resource)),
|
||||||
0, 0)
|
0, 0)
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return nil, fmt.Errorf("directx: IDXGISwapChain4::GetBuffer failed: %w", windows.Errno(r))
|
return nil, fmt.Errorf("directx: IDXGISwapChain4::GetBuffer failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return resource, nil
|
return resource, nil
|
||||||
@ -2117,7 +2117,7 @@ func (i *_IDXGISwapChain4) GetCurrentBackBufferIndex() uint32 {
|
|||||||
|
|
||||||
func (i *_IDXGISwapChain4) Present(syncInterval uint32, flags uint32) error {
|
func (i *_IDXGISwapChain4) Present(syncInterval uint32, flags uint32) error {
|
||||||
r, _, _ := syscall.Syscall(i.vtbl.Present, 3, uintptr(unsafe.Pointer(i)), uintptr(syncInterval), uintptr(flags))
|
r, _, _ := syscall.Syscall(i.vtbl.Present, 3, uintptr(unsafe.Pointer(i)), uintptr(syncInterval), uintptr(flags))
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return fmt.Errorf("directx: IDXGISwapChain4::Present failed: %w", windows.Errno(r))
|
return fmt.Errorf("directx: IDXGISwapChain4::Present failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -2127,7 +2127,7 @@ func (i *_IDXGISwapChain4) ResizeBuffers(bufferCount uint32, width uint32, heigh
|
|||||||
r, _, _ := syscall.Syscall6(i.vtbl.ResizeBuffers, 6,
|
r, _, _ := syscall.Syscall6(i.vtbl.ResizeBuffers, 6,
|
||||||
uintptr(unsafe.Pointer(i)), uintptr(bufferCount), uintptr(width),
|
uintptr(unsafe.Pointer(i)), uintptr(bufferCount), uintptr(width),
|
||||||
uintptr(height), uintptr(newFormat), uintptr(swapChainFlags))
|
uintptr(height), uintptr(newFormat), uintptr(swapChainFlags))
|
||||||
if windows.Handle(r) != windows.S_OK {
|
if uint32(r) != uint32(windows.S_OK) {
|
||||||
return fmt.Errorf("directx: IDXGISwapChain4::ResizeBuffers failed: %w", windows.Errno(r))
|
return fmt.Errorf("directx: IDXGISwapChain4::ResizeBuffers failed: %w", windows.Errno(r))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user