mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
internal/graphicsdriver/directx: refactoring: reduce indentations
This commit is contained in:
parent
fe5c3354fc
commit
549e6120b5
@ -173,18 +173,26 @@ func (g *graphics12) initializeDesktop(useWARP bool, useDebugLayer bool, feature
|
||||
}()
|
||||
|
||||
var adapter *_IDXGIAdapter1
|
||||
if len(adapters) > 0 {
|
||||
if useWARP {
|
||||
if useWARP {
|
||||
if len(adapters) > 0 {
|
||||
adapter = adapters[0]
|
||||
} else {
|
||||
for _, a := range adapters {
|
||||
// Test D3D12CreateDevice without creating an actual device.
|
||||
if _, err := _D3D12CreateDevice(unsafe.Pointer(a), featureLevel, &_IID_ID3D12Device, false); err != nil {
|
||||
continue
|
||||
}
|
||||
adapter = a
|
||||
break
|
||||
}
|
||||
} else {
|
||||
for _, a := range adapters {
|
||||
desc, err := a.GetDesc1()
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
if desc.Flags&_DXGI_ADAPTER_FLAG_SOFTWARE != 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
// Test D3D12CreateDevice without creating an actual device.
|
||||
if _, err := _D3D12CreateDevice(unsafe.Pointer(a), featureLevel, &_IID_ID3D12Device, false); err != nil {
|
||||
continue
|
||||
}
|
||||
adapter = a
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user