internal/graphicsdriver/directx: revert some commits for feture levels

This reverts these commits

* a4d20094d7
* ed88559a50
* cc82ad19a1

Reason: As the default feature level becomes 11 again, we don't need the
environment variable EBITENGINE_DIRECTX_FEATURE_LEVEL for v2.4.

Updates #2466
Updates #2486
This commit is contained in:
Hajime Hoshi 2022-12-09 15:54:22 +09:00
parent 3ce436f5ff
commit 1fc08d3d61
3 changed files with 4 additions and 31 deletions

4
doc.go
View File

@ -81,10 +81,6 @@
// "warp": Use WARP (i.e. software rendering). // "warp": Use WARP (i.e. software rendering).
// "debug": Use a debug layer. // "debug": Use a debug layer.
// //
// `EBITENGINE_DIRECTX_FEATURE_LEVEL` environment variable specifies DirectX feature level.
// The possible values are "11_0", "11_1", "12_0", "12_1", and "12_2".
// The default value is "11_0".
//
// # Build tags // # Build tags
// //
// `ebitenginedebug` outputs a log of graphics commands. This is useful to know what happens in Ebitengine. In general, the // `ebitenginedebug` outputs a log of graphics commands. This is useful to know what happens in Ebitengine. In general, the

View File

@ -76,10 +76,6 @@ type _D3D_FEATURE_LEVEL int32
const ( const (
_D3D_FEATURE_LEVEL_11_0 _D3D_FEATURE_LEVEL = 0xb000 _D3D_FEATURE_LEVEL_11_0 _D3D_FEATURE_LEVEL = 0xb000
_D3D_FEATURE_LEVEL_11_1 _D3D_FEATURE_LEVEL = 0xb100
_D3D_FEATURE_LEVEL_12_0 _D3D_FEATURE_LEVEL = 0xc000
_D3D_FEATURE_LEVEL_12_1 _D3D_FEATURE_LEVEL = 0xc100
_D3D_FEATURE_LEVEL_12_2 _D3D_FEATURE_LEVEL = 0xc200
) )
type _D3D_PRIMITIVE_TOPOLOGY int32 type _D3D_PRIMITIVE_TOPOLOGY int32

View File

@ -181,24 +181,6 @@ func (g *Graphics) initialize() (ferr error) {
} }
} }
// Specify the level 11 by default.
// Some old cards don't work well with the default feature level (#2447, #2486).
var featureLevel _D3D_FEATURE_LEVEL = _D3D_FEATURE_LEVEL_11_0
if env := os.Getenv("EBITENGINE_DIRECTX_FEATURE_LEVEL"); env != "" {
switch env {
case "11_0":
featureLevel = _D3D_FEATURE_LEVEL_11_0
case "11_1":
featureLevel = _D3D_FEATURE_LEVEL_11_1
case "12_0":
featureLevel = _D3D_FEATURE_LEVEL_12_0
case "12_1":
featureLevel = _D3D_FEATURE_LEVEL_12_1
case "12_2":
featureLevel = _D3D_FEATURE_LEVEL_12_2
}
}
// Initialize not only a device but also other members like a fence. // Initialize not only a device but also other members like a fence.
// Even if initializing a device succeeds, initializing a fence might fail (#2142). // Even if initializing a device succeeds, initializing a fence might fail (#2142).
@ -207,15 +189,14 @@ func (g *Graphics) initialize() (ferr error) {
return err return err
} }
} else { } else {
if err := g.initializeDesktop(useWARP, useDebugLayer, featureLevel); err != nil { if err := g.initializeDesktop(useWARP, useDebugLayer); err != nil {
return err return err
} }
} }
return nil return nil
} }
func (g *Graphics) initializeDesktop(useWARP bool, useDebugLayer bool, featureLevel _D3D_FEATURE_LEVEL) (ferr error) { func (g *Graphics) initializeDesktop(useWARP bool, useDebugLayer bool) (ferr error) {
if err := d3d12.Load(); err != nil { if err := d3d12.Load(); err != nil {
return err return err
} }
@ -282,7 +263,7 @@ func (g *Graphics) initializeDesktop(useWARP bool, useDebugLayer bool, featureLe
continue continue
} }
// Test D3D12CreateDevice without creating an actual device. // Test D3D12CreateDevice without creating an actual device.
if _, err := _D3D12CreateDevice(unsafe.Pointer(a), featureLevel, &_IID_ID3D12Device, false); err != nil { if _, err := _D3D12CreateDevice(unsafe.Pointer(a), _D3D_FEATURE_LEVEL_11_0, &_IID_ID3D12Device, false); err != nil {
continue continue
} }
@ -295,7 +276,7 @@ func (g *Graphics) initializeDesktop(useWARP bool, useDebugLayer bool, featureLe
return errors.New("directx: DirectX 12 is not supported") return errors.New("directx: DirectX 12 is not supported")
} }
d, err := _D3D12CreateDevice(unsafe.Pointer(adapter), featureLevel, &_IID_ID3D12Device, true) d, err := _D3D12CreateDevice(unsafe.Pointer(adapter), _D3D_FEATURE_LEVEL_11_0, &_IID_ID3D12Device, true)
if err != nil { if err != nil {
return err return err
} }