Skip to content

Commit

Permalink
AtlasEngine: Properly detect shader model 4 support (#13994)
Browse files Browse the repository at this point in the history
Direct3D 10.0 and 10.1 only have optional support for shader model 4.
This commit fixes our assumption that it's always present by checking
`ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x` first.

Closes #13985

## Validation Steps Performed
* Set feature level to 10.1 via `dxcpl`
* `CheckFeatureSupport` is called and doesn't throw ✅
  • Loading branch information
lhecker authored Sep 14, 2022
1 parent 2f0a93d commit e2b2d9b
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/renderer/atlas/AtlasEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,16 +639,30 @@ void AtlasEngine::_createResources()
}
#endif // NDEBUG

const auto featureLevel = _r.device->GetFeatureLevel();

{
wil::com_ptr<IDXGIAdapter1> dxgiAdapter;
THROW_IF_FAILED(_r.device.query<IDXGIObject>()->GetParent(__uuidof(dxgiAdapter), dxgiAdapter.put_void()));
THROW_IF_FAILED(dxgiAdapter->GetParent(__uuidof(_r.dxgiFactory), _r.dxgiFactory.put_void()));

DXGI_ADAPTER_DESC1 desc;
THROW_IF_FAILED(dxgiAdapter->GetDesc1(&desc));
_r.d2dMode = debugForceD2DMode || featureLevel < D3D_FEATURE_LEVEL_10_0 || WI_IsAnyFlagSet(desc.Flags, DXGI_ADAPTER_FLAG_REMOTE | DXGI_ADAPTER_FLAG_SOFTWARE);
_r.d2dMode = debugForceD2DMode || WI_IsAnyFlagSet(desc.Flags, DXGI_ADAPTER_FLAG_REMOTE | DXGI_ADAPTER_FLAG_SOFTWARE);
}

const auto featureLevel = _r.device->GetFeatureLevel();

if (featureLevel < D3D_FEATURE_LEVEL_10_0)
{
_r.d2dMode = true;
}
else if (featureLevel < D3D_FEATURE_LEVEL_11_0)
{
D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS options;
THROW_IF_FAILED(_r.device->CheckFeatureSupport(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &options, sizeof(options)));
if (!options.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x)
{
_r.d2dMode = true;
}
}

if (!_r.d2dMode)
Expand Down

0 comments on commit e2b2d9b

Please sign in to comment.