From ad4ba461dab4e0ab1ed14707a16da4507e12fc07 Mon Sep 17 00:00:00 2001 From: Package Date: Sat, 23 Nov 2024 18:41:03 +0800 Subject: [PATCH 01/10] Add D3D_FEATURE_LEVEL_12_2 --- Graphics/GraphicsEngineD3DBase/include/EngineFactoryD3DBase.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Graphics/GraphicsEngineD3DBase/include/EngineFactoryD3DBase.hpp b/Graphics/GraphicsEngineD3DBase/include/EngineFactoryD3DBase.hpp index 9f096e1f4c..4f9574cf3d 100644 --- a/Graphics/GraphicsEngineD3DBase/include/EngineFactoryD3DBase.hpp +++ b/Graphics/GraphicsEngineD3DBase/include/EngineFactoryD3DBase.hpp @@ -295,6 +295,7 @@ class EngineFactoryD3DBase : public EngineFactoryBase { case 0: VERIFY_EXPR(FeatureLevel == D3D_FEATURE_LEVEL_12_0); break; case 1: VERIFY_EXPR(FeatureLevel == D3D_FEATURE_LEVEL_12_1); break; + case 2: VERIFY_EXPR(FeatureLevel == D3D_FEATURE_LEVEL_12_2); break; default: UNEXPECTED("unknown feature level 12.", Uint32{MinVersion.Minor}); } break; From 609a68da4ffd8b3d7f8d35ba61b8a5e5b13366bc Mon Sep 17 00:00:00 2001 From: U2A5F Date: Mon, 25 Nov 2024 14:17:18 +0800 Subject: [PATCH 02/10] fallback for D3D_FEATURE_LEVEL_12_2 --- Graphics/GraphicsEngineD3D12/include/pch.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Graphics/GraphicsEngineD3D12/include/pch.h b/Graphics/GraphicsEngineD3D12/include/pch.h index d39fcf44b6..600316ffc2 100644 --- a/Graphics/GraphicsEngineD3D12/include/pch.h +++ b/Graphics/GraphicsEngineD3D12/include/pch.h @@ -58,6 +58,10 @@ enum D3D12_SHADING_RATE_COMBINER { }; +#ifndef NTDDI_WIN10_CO // First defined in Win SDK 10.0.22000.0 +# define D3D_FEATURE_LEVEL_12_2 0xc200 +#endif + constexpr D3D12_RESOURCE_STATES D3D12_RESOURCE_STATE_SHADING_RATE_SOURCE = static_cast(0x1000000); #endif From c2a5a4a3b31211d848092fd0d068f3d58f10660c Mon Sep 17 00:00:00 2001 From: U2A5F Date: Mon, 25 Nov 2024 14:34:07 +0800 Subject: [PATCH 03/10] edit D3D_FEATURE_LEVEL_12_2 --- Graphics/GraphicsEngineD3D12/include/pch.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Graphics/GraphicsEngineD3D12/include/pch.h b/Graphics/GraphicsEngineD3D12/include/pch.h index 600316ffc2..6f9dc39f61 100644 --- a/Graphics/GraphicsEngineD3D12/include/pch.h +++ b/Graphics/GraphicsEngineD3D12/include/pch.h @@ -44,6 +44,10 @@ #include "WinHPostface.h" +#ifndef NTDDI_WIN10_CO // First defined in Win SDK 10.0.22000.0 +constexpr D3D_FEATURE_LEVEL D3D_FEATURE_LEVEL_12_2 = static_cast(0xc200); +#endif + #ifndef NTDDI_WIN10_VB // First defined in Win SDK 10.0.19041.0 # define D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH_RAYS static_cast(D3D12_INDIRECT_ARGUMENT_TYPE_UNORDERED_ACCESS_VIEW + 1) # define D3D12_RAYTRACING_TIER_1_1 static_cast(11) @@ -58,10 +62,6 @@ enum D3D12_SHADING_RATE_COMBINER { }; -#ifndef NTDDI_WIN10_CO // First defined in Win SDK 10.0.22000.0 -# define D3D_FEATURE_LEVEL_12_2 0xc200 -#endif - constexpr D3D12_RESOURCE_STATES D3D12_RESOURCE_STATE_SHADING_RATE_SOURCE = static_cast(0x1000000); #endif From f960e663062ee947f4ec51c8be04800d20008c78 Mon Sep 17 00:00:00 2001 From: U2A5F Date: Mon, 25 Nov 2024 14:51:06 +0800 Subject: [PATCH 04/10] missing changes --- Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp | 1 + Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp index d39b70db1c..ff92826dba 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp @@ -60,6 +60,7 @@ static const ShaderVersion GetD3D11ShaderModel(D3D_FEATURE_LEVEL d3dDeviceFeatur // above 11.0 (for example, 11.1 or 12.0). // https://docs.microsoft.com/en-us/windows/win32/direct3d11/overviews-direct3d-11-devices-downlevel-intro#overview-for-each-feature-level #if defined(_WIN32_WINNT_WIN10) && (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + case D3D_FEATURE_LEVEL_12_2: case D3D_FEATURE_LEVEL_12_1: case D3D_FEATURE_LEVEL_12_0: #endif diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp index 9eab35300e..b473f94a0f 100644 --- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp @@ -69,6 +69,7 @@ D3D_FEATURE_LEVEL GetD3DFeatureLevelFromDevice(ID3D12Device* pd3d12Device) { D3D_FEATURE_LEVEL FeatureLevels[] = { + D3D_FEATURE_LEVEL_12_2, D3D_FEATURE_LEVEL_12_1, D3D_FEATURE_LEVEL_12_0, D3D_FEATURE_LEVEL_11_1, @@ -177,6 +178,7 @@ RenderDeviceD3D12Impl::RenderDeviceD3D12Impl(IReferenceCounters* pRefCo auto FeatureLevel = GetD3DFeatureLevelFromDevice(m_pd3d12Device); switch (FeatureLevel) { + case D3D_FEATURE_LEVEL_12_2: m_DeviceInfo.APIVersion = {12, 2}; break; case D3D_FEATURE_LEVEL_12_1: m_DeviceInfo.APIVersion = {12, 1}; break; case D3D_FEATURE_LEVEL_12_0: m_DeviceInfo.APIVersion = {12, 0}; break; case D3D_FEATURE_LEVEL_11_1: m_DeviceInfo.APIVersion = {11, 1}; break; From 69a1722fd63e7b7607f4153f67008bafe641c7e8 Mon Sep 17 00:00:00 2001 From: U2A5F Date: Mon, 25 Nov 2024 16:21:42 +0800 Subject: [PATCH 05/10] NTDDI_WIN10_FE --- Graphics/GraphicsEngineD3D12/include/pch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Graphics/GraphicsEngineD3D12/include/pch.h b/Graphics/GraphicsEngineD3D12/include/pch.h index 6f9dc39f61..2167680c3c 100644 --- a/Graphics/GraphicsEngineD3D12/include/pch.h +++ b/Graphics/GraphicsEngineD3D12/include/pch.h @@ -44,7 +44,7 @@ #include "WinHPostface.h" -#ifndef NTDDI_WIN10_CO // First defined in Win SDK 10.0.22000.0 +#ifndef NTDDI_WIN10_FE // First defined in Win SDK 10.0.20348.0 constexpr D3D_FEATURE_LEVEL D3D_FEATURE_LEVEL_12_2 = static_cast(0xc200); #endif From 04d98d20570bd509939eeb5abbc7f8300dcf2069 Mon Sep 17 00:00:00 2001 From: U2A5F Date: Mon, 25 Nov 2024 23:34:30 +0800 Subject: [PATCH 06/10] Fallback for d3d11 --- Graphics/GraphicsEngineD3D11/include/pch.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Graphics/GraphicsEngineD3D11/include/pch.h b/Graphics/GraphicsEngineD3D11/include/pch.h index cea1eeb5e5..0ecad30ea5 100644 --- a/Graphics/GraphicsEngineD3D11/include/pch.h +++ b/Graphics/GraphicsEngineD3D11/include/pch.h @@ -69,6 +69,10 @@ #include "WinHPostface.h" +#ifndef NTDDI_WIN10_FE // First defined in Win SDK 10.0.20348.0 +constexpr D3D_FEATURE_LEVEL D3D_FEATURE_LEVEL_12_2 = static_cast(0xc200); +#endif + #include "Errors.hpp" #include "RefCntAutoPtr.hpp" #include "DebugUtilities.hpp" From 1ab73fe419defcf528070f5313b3975f39d3e124 Mon Sep 17 00:00:00 2001 From: U2A5F Date: Tue, 26 Nov 2024 12:49:53 +0800 Subject: [PATCH 07/10] Try to eliminate the warning --- Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp | 2 +- Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp index ff92826dba..b2061ba353 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp @@ -54,7 +54,7 @@ static const ShaderVersion HLSLValidateShaderVersion(const ShaderVersion& Versio static const ShaderVersion GetD3D11ShaderModel(D3D_FEATURE_LEVEL d3dDeviceFeatureLevel, const ShaderVersion& HLSLVersion) { - switch (d3dDeviceFeatureLevel) + switch (static_cast(d3dDeviceFeatureLevel)) { // Direct3D11 only supports shader model 5.0 even if the device feature level is // above 11.0 (for example, 11.1 or 12.0). diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp index b473f94a0f..b8b22e3316 100644 --- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp @@ -176,7 +176,7 @@ RenderDeviceD3D12Impl::RenderDeviceD3D12Impl(IReferenceCounters* pRefCo m_DeviceInfo.Features = EnableDeviceFeatures(m_AdapterInfo.Features, EngineCI.Features); auto FeatureLevel = GetD3DFeatureLevelFromDevice(m_pd3d12Device); - switch (FeatureLevel) + switch (static_cast(FeatureLevel)) { case D3D_FEATURE_LEVEL_12_2: m_DeviceInfo.APIVersion = {12, 2}; break; case D3D_FEATURE_LEVEL_12_1: m_DeviceInfo.APIVersion = {12, 1}; break; From 1d4c9fcea748cc58b4e753067d623b8c13433788 Mon Sep 17 00:00:00 2001 From: U2A5F Date: Wed, 27 Nov 2024 15:51:28 +0800 Subject: [PATCH 08/10] Disable warnings on msvc --- Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp | 8 +++++++- .../GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp index b2061ba353..8a37e6d406 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp @@ -54,7 +54,10 @@ static const ShaderVersion HLSLValidateShaderVersion(const ShaderVersion& Versio static const ShaderVersion GetD3D11ShaderModel(D3D_FEATURE_LEVEL d3dDeviceFeatureLevel, const ShaderVersion& HLSLVersion) { - switch (static_cast(d3dDeviceFeatureLevel)) +#ifdef _MSC_VER +# pragma warning(disable 4063) +#endif + switch (d3dDeviceFeatureLevel) { // Direct3D11 only supports shader model 5.0 even if the device feature level is // above 11.0 (for example, 11.1 or 12.0). @@ -84,6 +87,9 @@ static const ShaderVersion GetD3D11ShaderModel(D3D_FEATURE_LEVEL d3dDeviceFeatur UNEXPECTED("Unexpected D3D feature level ", static_cast(d3dDeviceFeatureLevel)); return ShaderVersion{4, 0}; } +#ifdef _MSC_VER +# pragma warning(default 4063) +#endif } ShaderD3D11Impl::ShaderD3D11Impl(IReferenceCounters* pRefCounters, diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp index b8b22e3316..0742662534 100644 --- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp @@ -176,7 +176,10 @@ RenderDeviceD3D12Impl::RenderDeviceD3D12Impl(IReferenceCounters* pRefCo m_DeviceInfo.Features = EnableDeviceFeatures(m_AdapterInfo.Features, EngineCI.Features); auto FeatureLevel = GetD3DFeatureLevelFromDevice(m_pd3d12Device); - switch (static_cast(FeatureLevel)) +#ifdef _MSC_VER +# pragma warning(disable 4063) +#endif + switch (FeatureLevel) { case D3D_FEATURE_LEVEL_12_2: m_DeviceInfo.APIVersion = {12, 2}; break; case D3D_FEATURE_LEVEL_12_1: m_DeviceInfo.APIVersion = {12, 1}; break; @@ -187,6 +190,9 @@ RenderDeviceD3D12Impl::RenderDeviceD3D12Impl(IReferenceCounters* pRefCo case D3D_FEATURE_LEVEL_10_0: m_DeviceInfo.APIVersion = {10, 0}; break; default: UNEXPECTED("Unexpected D3D feature level"); } +#ifdef _MSC_VER +# pragma warning(default 4063) +#endif // Detect maximum shader model. { From d2f331ec098b9de10729d3e608bc40a4c6036cbc Mon Sep 17 00:00:00 2001 From: U2A5F Date: Wed, 27 Nov 2024 16:23:21 +0800 Subject: [PATCH 09/10] #if defined(_MSC_VER) && !defined(NTDDI_WIN10_FE) --- Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp | 4 ++-- Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp index 8a37e6d406..b2dadee2a1 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp @@ -54,7 +54,7 @@ static const ShaderVersion HLSLValidateShaderVersion(const ShaderVersion& Versio static const ShaderVersion GetD3D11ShaderModel(D3D_FEATURE_LEVEL d3dDeviceFeatureLevel, const ShaderVersion& HLSLVersion) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(NTDDI_WIN10_FE) # pragma warning(disable 4063) #endif switch (d3dDeviceFeatureLevel) @@ -87,7 +87,7 @@ static const ShaderVersion GetD3D11ShaderModel(D3D_FEATURE_LEVEL d3dDeviceFeatur UNEXPECTED("Unexpected D3D feature level ", static_cast(d3dDeviceFeatureLevel)); return ShaderVersion{4, 0}; } -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(NTDDI_WIN10_FE) # pragma warning(default 4063) #endif } diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp index 0742662534..cb1b39ff85 100644 --- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp @@ -176,7 +176,7 @@ RenderDeviceD3D12Impl::RenderDeviceD3D12Impl(IReferenceCounters* pRefCo m_DeviceInfo.Features = EnableDeviceFeatures(m_AdapterInfo.Features, EngineCI.Features); auto FeatureLevel = GetD3DFeatureLevelFromDevice(m_pd3d12Device); -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(NTDDI_WIN10_FE) # pragma warning(disable 4063) #endif switch (FeatureLevel) @@ -190,7 +190,7 @@ RenderDeviceD3D12Impl::RenderDeviceD3D12Impl(IReferenceCounters* pRefCo case D3D_FEATURE_LEVEL_10_0: m_DeviceInfo.APIVersion = {10, 0}; break; default: UNEXPECTED("Unexpected D3D feature level"); } -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(NTDDI_WIN10_FE) # pragma warning(default 4063) #endif From 2ae947cbca14f7ae05753ca5d90686f6f678c04e Mon Sep 17 00:00:00 2001 From: U2A5F Date: Wed, 27 Nov 2024 16:27:13 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp | 4 ++-- Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp index b2dadee2a1..85bdfed6f7 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp @@ -55,7 +55,7 @@ static const ShaderVersion HLSLValidateShaderVersion(const ShaderVersion& Versio static const ShaderVersion GetD3D11ShaderModel(D3D_FEATURE_LEVEL d3dDeviceFeatureLevel, const ShaderVersion& HLSLVersion) { #if defined(_MSC_VER) && !defined(NTDDI_WIN10_FE) -# pragma warning(disable 4063) +# pragma warning(disable : 4063) #endif switch (d3dDeviceFeatureLevel) { @@ -88,7 +88,7 @@ static const ShaderVersion GetD3D11ShaderModel(D3D_FEATURE_LEVEL d3dDeviceFeatur return ShaderVersion{4, 0}; } #if defined(_MSC_VER) && !defined(NTDDI_WIN10_FE) -# pragma warning(default 4063) +# pragma warning(default : 4063) #endif } diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp index cb1b39ff85..542287ac1a 100644 --- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp @@ -177,7 +177,7 @@ RenderDeviceD3D12Impl::RenderDeviceD3D12Impl(IReferenceCounters* pRefCo auto FeatureLevel = GetD3DFeatureLevelFromDevice(m_pd3d12Device); #if defined(_MSC_VER) && !defined(NTDDI_WIN10_FE) -# pragma warning(disable 4063) +# pragma warning(disable : 4063) #endif switch (FeatureLevel) { @@ -191,7 +191,7 @@ RenderDeviceD3D12Impl::RenderDeviceD3D12Impl(IReferenceCounters* pRefCo default: UNEXPECTED("Unexpected D3D feature level"); } #if defined(_MSC_VER) && !defined(NTDDI_WIN10_FE) -# pragma warning(default 4063) +# pragma warning(default : 4063) #endif // Detect maximum shader model.