mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
internal/graphicsdriver/directx: specify DX level 12
The DirectX initialization passed but crashed later on some old machines supporting the feature level 11 but not 12. This change fixes the issue by changing the required feature level from 11 to 12 so that the initialization fails and OpenGL is used as the fallback. Closes #2447
This commit is contained in:
parent
f885c0db43
commit
2deceaa0af
@ -73,7 +73,7 @@ const (
|
|||||||
type _D3D_FEATURE_LEVEL int32
|
type _D3D_FEATURE_LEVEL int32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
_D3D_FEATURE_LEVEL_11_0 _D3D_FEATURE_LEVEL = 0xb000
|
_D3D_FEATURE_LEVEL_12_0 _D3D_FEATURE_LEVEL = 0xc000
|
||||||
)
|
)
|
||||||
|
|
||||||
type _D3D_PRIMITIVE_TOPOLOGY int32
|
type _D3D_PRIMITIVE_TOPOLOGY int32
|
||||||
|
@ -185,6 +185,7 @@ func (g *Graphics) initialize() (ferr error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +257,9 @@ func (g *Graphics) initializeDesktop(useWARP bool, useDebugLayer bool) (ferr err
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// Test D3D12CreateDevice without creating an actual device.
|
// Test D3D12CreateDevice without creating an actual device.
|
||||||
if _, err := _D3D12CreateDevice(unsafe.Pointer(adapter), _D3D_FEATURE_LEVEL_11_0, &_IID_ID3D12Device, false); err != nil {
|
// 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.
|
||||||
|
if _, err := _D3D12CreateDevice(unsafe.Pointer(adapter), _D3D_FEATURE_LEVEL_12_0, &_IID_ID3D12Device, false); err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
@ -267,7 +270,7 @@ func (g *Graphics) initializeDesktop(useWARP bool, useDebugLayer bool) (ferr err
|
|||||||
return errors.New("directx: DirectX 12 is not supported")
|
return errors.New("directx: DirectX 12 is not supported")
|
||||||
}
|
}
|
||||||
|
|
||||||
d, err := _D3D12CreateDevice(unsafe.Pointer(adapter), _D3D_FEATURE_LEVEL_11_0, &_IID_ID3D12Device, true)
|
d, err := _D3D12CreateDevice(unsafe.Pointer(adapter), _D3D_FEATURE_LEVEL_12_0, &_IID_ID3D12Device, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user