internal/graphicsdriver/directx: bug fix: a software adaptor was unexpectedly chosen

Closes #2459
This commit is contained in:
Hajime Hoshi 2022-11-16 15:46:12 +09:00
parent 4c389c1752
commit c7c9500ba6

View File

@ -247,9 +247,8 @@ func (g *Graphics) initializeDesktop(useWARP bool, useDebugLayer bool) (ferr err
return err return err
} }
defer a.Release() defer a.Release()
adapter = a
desc, err := adapter.GetDesc1() desc, err := a.GetDesc1()
if err != nil { if err != nil {
return err return err
} }
@ -259,9 +258,11 @@ func (g *Graphics) initializeDesktop(useWARP bool, useDebugLayer bool) (ferr err
// Test D3D12CreateDevice without creating an actual device. // Test D3D12CreateDevice without creating an actual device.
// Ebitengine itself doesn't require the features level 12 and 11 should be enough, // Ebitengine itself doesn't require the features level 12 and 11 should be enough,
// but some old cards don't work well (#2447). Specify the level 12 here. // but some old cards don't work well (#2447). Specify the level 12 here.
if _, err := _D3D12CreateDevice(unsafe.Pointer(adapter), _D3D_FEATURE_LEVEL_12_0, &_IID_ID3D12Device, false); err != nil { if _, err := _D3D12CreateDevice(unsafe.Pointer(a), _D3D_FEATURE_LEVEL_12_0, &_IID_ID3D12Device, false); err != nil {
continue continue
} }
adapter = a
break break
} }
} }