internal/graphicsdriver/directx: refactoring: remove redundant adapter check

This commit is contained in:
Hajime Hoshi 2023-03-29 15:32:49 +09:00
parent 72c9ede592
commit 4779bbc04d

View File

@ -133,8 +133,10 @@ func (g *graphicsInfra) release() {
// appendAdapters appends found adapters to the given adapters.
// Releasing them is the caller's responsibility.
func (g *graphicsInfra) appendAdapters(adapters []*_IDXGIAdapter1, warp bool) ([]*_IDXGIAdapter1, error) {
if warp {
//
// warpForDX12 is valid only for DirectX 12.
func (g *graphicsInfra) appendAdapters(adapters []*_IDXGIAdapter1, warpForDX12 bool) ([]*_IDXGIAdapter1, error) {
if warpForDX12 {
a, err := g.factory.EnumWarpAdapter()
if err != nil {
return nil, err
@ -152,14 +154,6 @@ func (g *graphicsInfra) appendAdapters(adapters []*_IDXGIAdapter1, warp bool) ([
return nil, err
}
desc, err := a.GetDesc1()
if err != nil {
return nil, err
}
if desc.Flags&_DXGI_ADAPTER_FLAG_SOFTWARE != 0 {
continue
}
adapters = append(adapters, a)
}