Skip to content

Commit

Permalink
use directx-headers
Browse files Browse the repository at this point in the history
delete idea
  • Loading branch information
2A5F committed Nov 25, 2024
1 parent 24565d1 commit 6d79d6a
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 28 deletions.
4 changes: 2 additions & 2 deletions Graphics/Archiver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ PRIVATE
)

if(D3D11_SUPPORTED)
target_link_libraries(Diligent-Archiver-static PRIVATE Diligent-GraphicsEngineD3D11-static)
target_link_libraries(Diligent-Archiver-static PRIVATE Diligent-GraphicsEngineD3D11-static DirectX-Headers)
target_include_directories(Diligent-Archiver-static PRIVATE ../GraphicsEngineD3D11/include)
endif()

if(D3D12_SUPPORTED)
target_link_libraries(Diligent-Archiver-static PRIVATE Diligent-GraphicsEngineD3D12-static)
target_link_libraries(Diligent-Archiver-static PRIVATE Diligent-GraphicsEngineD3D12-static DirectX-Headers)
target_include_directories(Diligent-Archiver-static PRIVATE ../GraphicsEngineD3D12/include)
endif()

Expand Down
3 changes: 2 additions & 1 deletion Graphics/GraphicsEngineD3D11/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ PRIVATE
Diligent-GraphicsEngineD3DBase
Diligent-TargetPlatform
Diligent-Common
Diligent-ShaderTools
Diligent-ShaderTools
DirectX-Headers
dxgi.lib
d3d11.lib
d3dcompiler.lib
Expand Down
2 changes: 2 additions & 0 deletions Graphics/GraphicsEngineD3D11/include/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@

#include "PlatformDefinitions.h"

#include "directx/d3dcommon.h"

#if PLATFORM_WIN32
# ifndef D3D11_VERSION
# define D3D11_VERSION 2
Expand Down
2 changes: 0 additions & 2 deletions Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@ static const ShaderVersion GetD3D11ShaderModel(D3D_FEATURE_LEVEL d3dDeviceFeatur
// Direct3D11 only supports shader model 5.0 even if the device feature level is
// 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
case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
return (HLSLVersion == ShaderVersion{0, 0}) ?
Expand Down
1 change: 1 addition & 0 deletions Graphics/GraphicsEngineD3D12/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ PRIVATE
Diligent-GraphicsEngineNextGenBase
Diligent-TargetPlatform
Diligent-ShaderTools
DirectX-Headers
dxgi.lib
d3dcompiler.lib
PUBLIC
Expand Down
43 changes: 22 additions & 21 deletions Graphics/GraphicsEngineD3D12/include/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@

#include "WinHPreface.h"

#include <d3d12.h>
#include "directx/d3d12.h"

#include <atlbase.h>

#if USE_D3D12_LOADER
Expand All @@ -44,26 +45,26 @@

#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<D3D_FEATURE_LEVEL>(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>(D3D12_INDIRECT_ARGUMENT_TYPE_UNORDERED_ACCESS_VIEW + 1)
# define D3D12_RAYTRACING_TIER_1_1 static_cast<D3D12_RAYTRACING_TIER>(11)
# define D3D12_HEAP_FLAG_CREATE_NOT_ZEROED D3D12_HEAP_FLAG_NONE
#endif

#ifndef NTDDI_WIN10_19H1 // First defined in Win SDK 10.0.18362.0
enum D3D12_SHADING_RATE
{
};
enum D3D12_SHADING_RATE_COMBINER
{
};

constexpr D3D12_RESOURCE_STATES D3D12_RESOURCE_STATE_SHADING_RATE_SOURCE = static_cast<D3D12_RESOURCE_STATES>(0x1000000);
#endif
// #ifndef NTDDI_WIN10_FE // First defined in Win SDK 10.0.20348.0
// constexpr D3D_FEATURE_LEVEL D3D_FEATURE_LEVEL_12_2 = static_cast<D3D_FEATURE_LEVEL>(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>(D3D12_INDIRECT_ARGUMENT_TYPE_UNORDERED_ACCESS_VIEW + 1)
// # define D3D12_RAYTRACING_TIER_1_1 static_cast<D3D12_RAYTRACING_TIER>(11)
// # define D3D12_HEAP_FLAG_CREATE_NOT_ZEROED D3D12_HEAP_FLAG_NONE
// #endif
//
// #ifndef NTDDI_WIN10_19H1 // First defined in Win SDK 10.0.18362.0
// enum D3D12_SHADING_RATE
// {
// };
// enum D3D12_SHADING_RATE_COMBINER
// {
// };
//
// constexpr D3D12_RESOURCE_STATES D3D12_RESOURCE_STATE_SHADING_RATE_SOURCE = static_cast<D3D12_RESOURCE_STATES>(0x1000000);
// #endif

#include "PlatformDefinitions.h"
#include "Errors.hpp"
Expand Down
1 change: 1 addition & 0 deletions Graphics/GraphicsEngineD3DBase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ target_link_libraries(Diligent-GraphicsEngineD3DBase
PRIVATE
Diligent-BuildSettings
Diligent-ShaderTools
DirectX-Headers
PUBLIC
Diligent-GraphicsEngine
Diligent-GraphicsEngineD3DBaseInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ class EngineFactoryD3DBase : public EngineFactoryBase<BaseInterface>
default: UNEXPECTED("unknown feature level 11.", Uint32{MinVersion.Minor});
}
break;
# if defined(_WIN32_WINNT_WIN10) && (_WIN32_WINNT >= _WIN32_WINNT_WIN10)
case 12:
switch (MinVersion.Minor)
{
Expand All @@ -299,7 +298,6 @@ class EngineFactoryD3DBase : public EngineFactoryBase<BaseInterface>
default: UNEXPECTED("unknown feature level 12.", Uint32{MinVersion.Minor});
}
break;
# endif
default:
UNEXPECTED("Unknown major version of the feature level");
}
Expand Down
4 changes: 4 additions & 0 deletions ThirdParty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ if (GL_SUPPORTED AND (PLATFORM_WIN32 OR PLATFORM_LINUX OR PLATFORM_MACOS) AND (N
install(FILES glew/LICENSE.txt DESTINATION "Licenses/ThirdParty/${DILIGENT_CORE_DIR}" RENAME GLEW-License.txt)
endif()

if (D3D11_SUPPORTED OR D3D12_SUPPORTED)
add_subdirectory(DirectX-Headers)
endif ()

if (VULKAN_SUPPORTED)
if (NOT TARGET Vulkan::Headers)
# Manually add the Vulkan-Headers target as this is all we need and the
Expand Down

0 comments on commit 6d79d6a

Please sign in to comment.