diff options
| author | Yong He <yonghe@outlook.com> | 2021-10-29 09:36:07 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-29 09:36:07 -0700 |
| commit | 4ebbf357e18de77af4fff8a112e8a25b06e3e940 (patch) | |
| tree | ddd7acf91dfcf2fbc475410a6a8922f15fa1dbee /tools/gfx/d3d | |
| parent | d406e72f9a79018155f0442bb74cccaf61c13eb0 (diff) | |
Use detected shader model in gfx/d3d12. (#1996)
* Use detected shader model in gfx/d3d12.
* Enable all d3d12 tests on Github.
* Improve d3d12 software device detection.
* Disable d3d12 tests on github for now.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tools/gfx/d3d')
| -rw-r--r-- | tools/gfx/d3d/d3d-util.cpp | 25 | ||||
| -rw-r--r-- | tools/gfx/d3d/d3d-util.h | 2 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tools/gfx/d3d/d3d-util.cpp b/tools/gfx/d3d/d3d-util.cpp index d73b3f519..84b5de844 100644 --- a/tools/gfx/d3d/d3d-util.cpp +++ b/tools/gfx/d3d/d3d-util.cpp @@ -609,6 +609,31 @@ bool D3DUtil::isUAVBinding(slang::BindingType bindingType) } } +int D3DUtil::getShaderModelFromProfileName(const char* name) +{ + UnownedStringSlice nameSlice(name); + + if (nameSlice.endsWith("5_1")) + return D3D_SHADER_MODEL_5_1; + if (nameSlice.endsWith("6_0")) + return D3D_SHADER_MODEL_6_0; + if (nameSlice.endsWith("6_1")) + return D3D_SHADER_MODEL_6_1; + if (nameSlice.endsWith("6_2")) + return D3D_SHADER_MODEL_6_2; + if (nameSlice.endsWith("6_3")) + return D3D_SHADER_MODEL_6_3; + if (nameSlice.endsWith("6_4")) + return D3D_SHADER_MODEL_6_4; + if (nameSlice.endsWith("6_5")) + return D3D_SHADER_MODEL_6_5; + if (nameSlice.endsWith("6_6")) + return D3D_SHADER_MODEL_6_6; + if (nameSlice.endsWith("6_7")) + return 0x67; + return 0; +} + /* static */SlangResult D3DUtil::findAdapters(DeviceCheckFlags flags, const UnownedStringSlice& adapterName, IDXGIFactory* dxgiFactory, List<ComPtr<IDXGIAdapter>>& outDxgiAdapters) { Slang::String lowerAdapterName = Slang::String(adapterName).toLower(); diff --git a/tools/gfx/d3d/d3d-util.h b/tools/gfx/d3d/d3d-util.h index e570c6ff6..4bca89612 100644 --- a/tools/gfx/d3d/d3d-util.h +++ b/tools/gfx/d3d/d3d-util.h @@ -94,6 +94,8 @@ class D3DUtil static bool isUAVBinding(slang::BindingType bindingType); + static int getShaderModelFromProfileName(const char* profile); + }; #if SLANG_GFX_HAS_DXR_SUPPORT |
