Rename CMakeLists variables NXT_* to DAWN_*
This commit is contained in:
parent
4828d92df3
commit
f1ded9bea2
|
@ -13,7 +13,7 @@ install:
|
||||||
build_script:
|
build_script:
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- cmake -DNXT_USE_WERROR=1 -DNXT_ENABLE_VULKAN=1 ..
|
- cmake -DDAWN_USE_WERROR=1 -DDAWN_ENABLE_VULKAN=1 ..
|
||||||
- cmake --build . -- /verbosity:minimal
|
- cmake --build . -- /verbosity:minimal
|
||||||
|
|
||||||
# TODO(cwallez@chromium.org) test on more than Debug.
|
# TODO(cwallez@chromium.org) test on more than Debug.
|
||||||
|
|
|
@ -65,7 +65,7 @@ script:
|
||||||
- mkdir -p build
|
- mkdir -p build
|
||||||
- cd build
|
- cd build
|
||||||
- cmake --version
|
- cmake --version
|
||||||
- cmake -G "Ninja" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DNXT_USE_WERROR=1 -DNXT_ENABLE_VULKAN=$BUILD_VULKAN ..
|
- cmake -G "Ninja" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DDAWN_USE_WERROR=1 -DDAWN_ENABLE_VULKAN=$BUILD_VULKAN ..
|
||||||
- cmake --build .
|
- cmake --build .
|
||||||
|
|
||||||
# Test
|
# Test
|
||||||
|
|
120
CMakeLists.txt
120
CMakeLists.txt
|
@ -32,7 +32,7 @@ endif()
|
||||||
# Configuration options
|
# Configuration options
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
option(NXT_USE_WERROR "Treat warnings as error (useful for CI)" 0)
|
option(DAWN_USE_WERROR "Treat warnings as error (useful for CI)" 0)
|
||||||
|
|
||||||
# Default values for the backend-enabling options
|
# Default values for the backend-enabling options
|
||||||
set(ENABLE_D3D12 OFF)
|
set(ENABLE_D3D12 OFF)
|
||||||
|
@ -43,114 +43,114 @@ elseif(APPLE)
|
||||||
set(ENABLE_METAL ON)
|
set(ENABLE_METAL ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(NXT_ENABLE_D3D12 "Enable compilation of the D3D12 backend" ${ENABLE_D3D12})
|
option(DAWN_ENABLE_D3D12 "Enable compilation of the D3D12 backend" ${ENABLE_D3D12})
|
||||||
option(NXT_ENABLE_METAL "Enable compilation of the Metal backend" ${ENABLE_METAL})
|
option(DAWN_ENABLE_METAL "Enable compilation of the Metal backend" ${ENABLE_METAL})
|
||||||
option(NXT_ENABLE_NULL "Enable compilation of the Null backend" ON)
|
option(DAWN_ENABLE_NULL "Enable compilation of the Null backend" ON)
|
||||||
option(NXT_ENABLE_OPENGL "Enable compilation of the OpenGL backend" ON)
|
option(DAWN_ENABLE_OPENGL "Enable compilation of the OpenGL backend" ON)
|
||||||
option(NXT_ENABLE_VULKAN "Enable compilation of the Vulkan backend" OFF)
|
option(DAWN_ENABLE_VULKAN "Enable compilation of the Vulkan backend" OFF)
|
||||||
option(NXT_ALWAYS_ASSERT "Enable assertions on all build types" OFF)
|
option(DAWN_ALWAYS_ASSERT "Enable assertions on all build types" OFF)
|
||||||
option(NXT_USE_CPP17 "Use some optional C++17 features for compile-time checks" OFF)
|
option(DAWN_USE_CPP17 "Use some optional C++17 features for compile-time checks" OFF)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Precompute compile flags and defines, functions to set them
|
# Precompute compile flags and defines, functions to set them
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
set(NXT_FLAGS "")
|
set(DAWN_FLAGS "")
|
||||||
set(NXT_DEFS "")
|
set(DAWN_DEFS "")
|
||||||
set(NXT_INTERNAL_FLAGS "")
|
set(DAWN_INTERNAL_FLAGS "")
|
||||||
set(NXT_INTERNAL_DEFS "")
|
set(DAWN_INTERNAL_DEFS "")
|
||||||
set(NXT_GENERATED_FLAGS "")
|
set(DAWN_GENERATED_FLAGS "")
|
||||||
|
|
||||||
set(NXT_ENABLE_ASSERTS $<OR:$<CONFIG:Debug>,$<BOOL:${NXT_ALWAYS_ASSERT}>>)
|
set(DAWN_ENABLE_ASSERTS $<OR:$<CONFIG:Debug>,$<BOOL:${DAWN_ALWAYS_ASSERT}>>)
|
||||||
|
|
||||||
list(APPEND NXT_DEFS $<${NXT_ENABLE_ASSERTS}:NXT_ENABLE_ASSERTS>)
|
list(APPEND DAWN_DEFS $<${DAWN_ENABLE_ASSERTS}:DAWN_ENABLE_ASSERTS>)
|
||||||
|
|
||||||
if (NXT_USE_CPP17)
|
if (DAWN_USE_CPP17)
|
||||||
list(APPEND NXT_INTERNAL_DEFS "NXT_CPP_VERSION=17")
|
list(APPEND DAWN_INTERNAL_DEFS "DAWN_CPP_VERSION=17")
|
||||||
else()
|
else()
|
||||||
list(APPEND NXT_INTERNAL_DEFS "NXT_CPP_VERSION=14")
|
list(APPEND DAWN_INTERNAL_DEFS "DAWN_CPP_VERSION=14")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NXT_ENABLE_D3D12)
|
if (DAWN_ENABLE_D3D12)
|
||||||
list(APPEND NXT_INTERNAL_DEFS "NXT_ENABLE_BACKEND_D3D12")
|
list(APPEND DAWN_INTERNAL_DEFS "DAWN_ENABLE_BACKEND_D3D12")
|
||||||
endif()
|
endif()
|
||||||
if (NXT_ENABLE_METAL)
|
if (DAWN_ENABLE_METAL)
|
||||||
list(APPEND NXT_INTERNAL_DEFS "NXT_ENABLE_BACKEND_METAL")
|
list(APPEND DAWN_INTERNAL_DEFS "DAWN_ENABLE_BACKEND_METAL")
|
||||||
endif()
|
endif()
|
||||||
if (NXT_ENABLE_NULL)
|
if (DAWN_ENABLE_NULL)
|
||||||
list(APPEND NXT_INTERNAL_DEFS "NXT_ENABLE_BACKEND_NULL")
|
list(APPEND DAWN_INTERNAL_DEFS "DAWN_ENABLE_BACKEND_NULL")
|
||||||
endif()
|
endif()
|
||||||
if (NXT_ENABLE_OPENGL)
|
if (DAWN_ENABLE_OPENGL)
|
||||||
list(APPEND NXT_INTERNAL_DEFS "NXT_ENABLE_BACKEND_OPENGL")
|
list(APPEND DAWN_INTERNAL_DEFS "DAWN_ENABLE_BACKEND_OPENGL")
|
||||||
endif()
|
endif()
|
||||||
if (NXT_ENABLE_VULKAN)
|
if (DAWN_ENABLE_VULKAN)
|
||||||
list(APPEND NXT_INTERNAL_DEFS "NXT_ENABLE_BACKEND_VULKAN")
|
list(APPEND DAWN_INTERNAL_DEFS "DAWN_ENABLE_BACKEND_VULKAN")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
# Define NOMINMAX to prevent conflicts between std::min/max and the min/max macros in WinDef.h
|
# Define NOMINMAX to prevent conflicts between std::min/max and the min/max macros in WinDef.h
|
||||||
list(APPEND NXT_DEFS "NOMINMAX")
|
list(APPEND DAWN_DEFS "NOMINMAX")
|
||||||
# Avoid Windows.h including a lot of headers
|
# Avoid Windows.h including a lot of headers
|
||||||
list(APPEND NXT_DEFS "WIN32_LEAN_AND_MEAN")
|
list(APPEND DAWN_DEFS "WIN32_LEAN_AND_MEAN")
|
||||||
# Remove compile error where the mock NXT creates too many sections for the old obj format.
|
# Remove compile error where the mock NXT creates too many sections for the old obj format.
|
||||||
list(APPEND NXT_FLAGS "/bigobj")
|
list(APPEND DAWN_FLAGS "/bigobj")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
list(APPEND NXT_FLAGS "/std:c++14")
|
list(APPEND DAWN_FLAGS "/std:c++14")
|
||||||
list(APPEND NXT_FLAGS "/EHsc")
|
list(APPEND DAWN_FLAGS "/EHsc")
|
||||||
list(APPEND NXT_INTERNAL_FLAGS "/W4")
|
list(APPEND DAWN_INTERNAL_FLAGS "/W4")
|
||||||
# Allow declarations hiding members as it is used all over NXT
|
# Allow declarations hiding members as it is used all over NXT
|
||||||
list(APPEND NXT_INTERNAL_FLAGS "/wd4458")
|
list(APPEND DAWN_INTERNAL_FLAGS "/wd4458")
|
||||||
list(APPEND NXT_INTERNAL_FLAGS "/wd4996") # Allow deprecated functions like strncpy
|
list(APPEND DAWN_INTERNAL_FLAGS "/wd4996") # Allow deprecated functions like strncpy
|
||||||
|
|
||||||
list(APPEND NXT_GENERATED_FLAGS "/wd4702") # Allow unreachable code
|
list(APPEND DAWN_GENERATED_FLAGS "/wd4702") # Allow unreachable code
|
||||||
list(APPEND NXT_GENERATED_FLAGS "/wd4189") # Allow unused variable
|
list(APPEND DAWN_GENERATED_FLAGS "/wd4189") # Allow unused variable
|
||||||
|
|
||||||
if(NXT_USE_WERROR)
|
if(DAWN_USE_WERROR)
|
||||||
list(APPEND NXT_INTERNAL_FLAGS "/WX")
|
list(APPEND DAWN_INTERNAL_FLAGS "/WX")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
# Activate C++14 only on C++ files, not C files.
|
# Activate C++14 only on C++ files, not C files.
|
||||||
list(APPEND NXT_FLAGS "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:-std=c++14>")
|
list(APPEND DAWN_FLAGS "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:-std=c++14>")
|
||||||
# enable -Wold-style-cast on C++
|
# enable -Wold-style-cast on C++
|
||||||
list(APPEND NXT_FLAGS "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:-Wold-style-cast>")
|
list(APPEND DAWN_FLAGS "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:-Wold-style-cast>")
|
||||||
list(APPEND NXT_FLAGS "-fPIC")
|
list(APPEND DAWN_FLAGS "-fPIC")
|
||||||
|
|
||||||
list(APPEND NXT_INTERNAL_FLAGS "-Wall" "-Wextra")
|
list(APPEND DAWN_INTERNAL_FLAGS "-Wall" "-Wextra")
|
||||||
list(APPEND NXT_INTERNAL_FLAGS "-pedantic")
|
list(APPEND DAWN_INTERNAL_FLAGS "-pedantic")
|
||||||
list(APPEND NXT_GENERATED_FLAGS "-Wno-unused-variable" "-Wno-unused-function")
|
list(APPEND DAWN_GENERATED_FLAGS "-Wno-unused-variable" "-Wno-unused-function")
|
||||||
|
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
# don't break the build on older clang versions
|
# don't break the build on older clang versions
|
||||||
list(APPEND NXT_INTERNAL_FLAGS "-Wno-error=unknown-warning-option")
|
list(APPEND DAWN_INTERNAL_FLAGS "-Wno-error=unknown-warning-option")
|
||||||
# GCC's conversion warnings are less useful than clang's
|
# GCC's conversion warnings are less useful than clang's
|
||||||
list(APPEND NXT_INTERNAL_FLAGS "-Wconversion" "-Wno-sign-conversion")
|
list(APPEND DAWN_INTERNAL_FLAGS "-Wconversion" "-Wno-sign-conversion")
|
||||||
# disable a clang-only -pedantic warning
|
# disable a clang-only -pedantic warning
|
||||||
list(APPEND NXT_INTERNAL_FLAGS "-Wno-gnu-zero-variadic-macro-arguments")
|
list(APPEND DAWN_INTERNAL_FLAGS "-Wno-gnu-zero-variadic-macro-arguments")
|
||||||
# additional potentially useful warnings (feel free to remove if they prove un-useful)
|
# additional potentially useful warnings (feel free to remove if they prove un-useful)
|
||||||
list(APPEND NXT_INTERNAL_FLAGS "-Wextra-semi")
|
list(APPEND DAWN_INTERNAL_FLAGS "-Wextra-semi")
|
||||||
list(APPEND NXT_INTERNAL_FLAGS "-Wstrict-aliasing")
|
list(APPEND DAWN_INTERNAL_FLAGS "-Wstrict-aliasing")
|
||||||
list(APPEND NXT_INTERNAL_FLAGS "-Wunreachable-code")
|
list(APPEND DAWN_INTERNAL_FLAGS "-Wunreachable-code")
|
||||||
list(APPEND NXT_GENERATED_FLAGS "-Wno-unreachable-code")
|
list(APPEND DAWN_GENERATED_FLAGS "-Wno-unreachable-code")
|
||||||
# Probably okay to enable if we establish a field naming convention:
|
# Probably okay to enable if we establish a field naming convention:
|
||||||
#list(APPEND NXT_INTERNAL_FLAGS "-Wshadow")
|
#list(APPEND DAWN_INTERNAL_FLAGS "-Wshadow")
|
||||||
endif()
|
endif()
|
||||||
if(NXT_USE_WERROR)
|
if(DAWN_USE_WERROR)
|
||||||
list(APPEND NXT_INTERNAL_FLAGS "-Werror")
|
list(APPEND DAWN_INTERNAL_FLAGS "-Werror")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
function(NXTExternalTarget folder target)
|
function(NXTExternalTarget folder target)
|
||||||
set_property(TARGET ${target} APPEND PROPERTY COMPILE_OPTIONS ${NXT_FLAGS})
|
set_property(TARGET ${target} APPEND PROPERTY COMPILE_OPTIONS ${DAWN_FLAGS})
|
||||||
set_property(TARGET ${target} APPEND PROPERTY COMPILE_DEFINITIONS ${NXT_DEFS})
|
set_property(TARGET ${target} APPEND PROPERTY COMPILE_DEFINITIONS ${DAWN_DEFS})
|
||||||
set_property(TARGET ${target} PROPERTY FOLDER "nxt/${folder}")
|
set_property(TARGET ${target} PROPERTY FOLDER "nxt/${folder}")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(NXTInternalTarget folder target)
|
function(NXTInternalTarget folder target)
|
||||||
NXTExternalTarget("${folder}" ${target})
|
NXTExternalTarget("${folder}" ${target})
|
||||||
set_property(TARGET ${target} APPEND PROPERTY COMPILE_OPTIONS ${NXT_INTERNAL_FLAGS})
|
set_property(TARGET ${target} APPEND PROPERTY COMPILE_OPTIONS ${DAWN_INTERNAL_FLAGS})
|
||||||
set_property(TARGET ${target} APPEND PROPERTY COMPILE_DEFINITIONS ${NXT_INTERNAL_DEFS})
|
set_property(TARGET ${target} APPEND PROPERTY COMPILE_DEFINITIONS ${DAWN_INTERNAL_DEFS})
|
||||||
|
|
||||||
# Group the target sources by folder to have folders show in Visual Studio
|
# Group the target sources by folder to have folders show in Visual Studio
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
|
|
|
@ -43,13 +43,13 @@ enum class CmdBufType {
|
||||||
|
|
||||||
// Default to D3D12, Metal, Vulkan, OpenGL in that order as D3D12 and Metal are the preferred on
|
// Default to D3D12, Metal, Vulkan, OpenGL in that order as D3D12 and Metal are the preferred on
|
||||||
// their respective platforms, and Vulkan is preferred to OpenGL
|
// their respective platforms, and Vulkan is preferred to OpenGL
|
||||||
#if defined(NXT_ENABLE_BACKEND_D3D12)
|
#if defined(DAWN_ENABLE_BACKEND_D3D12)
|
||||||
static utils::BackendType backendType = utils::BackendType::D3D12;
|
static utils::BackendType backendType = utils::BackendType::D3D12;
|
||||||
#elif defined(NXT_ENABLE_BACKEND_METAL)
|
#elif defined(DAWN_ENABLE_BACKEND_METAL)
|
||||||
static utils::BackendType backendType = utils::BackendType::Metal;
|
static utils::BackendType backendType = utils::BackendType::Metal;
|
||||||
#elif defined(NXT_ENABLE_BACKEND_OPENGL)
|
#elif defined(DAWN_ENABLE_BACKEND_OPENGL)
|
||||||
static utils::BackendType backendType = utils::BackendType::OpenGL;
|
static utils::BackendType backendType = utils::BackendType::OpenGL;
|
||||||
#elif defined(NXT_ENABLE_BACKEND_VULKAN)
|
#elif defined(DAWN_ENABLE_BACKEND_VULKAN)
|
||||||
static utils::BackendType backendType = utils::BackendType::Vulkan;
|
static utils::BackendType backendType = utils::BackendType::Vulkan;
|
||||||
#else
|
#else
|
||||||
#error
|
#error
|
||||||
|
|
|
@ -62,7 +62,7 @@ function(Generate)
|
||||||
)
|
)
|
||||||
|
|
||||||
NXTInternalTarget("${G_FOLDER}" ${G_LIB_NAME})
|
NXTInternalTarget("${G_FOLDER}" ${G_LIB_NAME})
|
||||||
set_property(TARGET ${G_LIB_NAME} APPEND PROPERTY COMPILE_OPTIONS ${NXT_GENERATED_FLAGS})
|
set_property(TARGET ${G_LIB_NAME} APPEND PROPERTY COMPILE_OPTIONS ${DAWN_GENERATED_FLAGS})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
set(GENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
|
set(GENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
|
||||||
|
|
|
@ -51,7 +51,7 @@ endfunction()
|
||||||
# OpenGL Backend
|
# OpenGL Backend
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
if (NXT_ENABLE_OPENGL)
|
if (DAWN_ENABLE_OPENGL)
|
||||||
GenerateProcTable(opengl)
|
GenerateProcTable(opengl)
|
||||||
target_link_libraries(opengl_autogen glfw glad)
|
target_link_libraries(opengl_autogen glfw glad)
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ endif()
|
||||||
# Null Backend
|
# Null Backend
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
if (NXT_ENABLE_NULL)
|
if (DAWN_ENABLE_NULL)
|
||||||
GenerateProcTable(null)
|
GenerateProcTable(null)
|
||||||
|
|
||||||
list(APPEND BACKEND_SOURCES
|
list(APPEND BACKEND_SOURCES
|
||||||
|
@ -109,7 +109,7 @@ endif()
|
||||||
# Metal Backend
|
# Metal Backend
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
if (NXT_ENABLE_METAL)
|
if (DAWN_ENABLE_METAL)
|
||||||
GenerateProcTable(metal)
|
GenerateProcTable(metal)
|
||||||
target_link_libraries(metal_autogen "-framework QuartzCore" "-framework Metal")
|
target_link_libraries(metal_autogen "-framework QuartzCore" "-framework Metal")
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ endif()
|
||||||
# D3D12 Backend
|
# D3D12 Backend
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
if (NXT_ENABLE_D3D12)
|
if (DAWN_ENABLE_D3D12)
|
||||||
GenerateProcTable(d3d12)
|
GenerateProcTable(d3d12)
|
||||||
|
|
||||||
# WIN10_SDK_PATH will be something like C:\Program Files (x86)\Windows Kits\10
|
# WIN10_SDK_PATH will be something like C:\Program Files (x86)\Windows Kits\10
|
||||||
|
@ -269,7 +269,7 @@ endif()
|
||||||
# Vulkan Backend
|
# Vulkan Backend
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
if (NXT_ENABLE_VULKAN)
|
if (DAWN_ENABLE_VULKAN)
|
||||||
GenerateProcTable(vulkan)
|
GenerateProcTable(vulkan)
|
||||||
target_include_directories(vulkan_autogen PUBLIC ${VULKAN_HEADERS_INCLUDE_DIR})
|
target_include_directories(vulkan_autogen PUBLIC ${VULKAN_HEADERS_INCLUDE_DIR})
|
||||||
|
|
||||||
|
@ -392,18 +392,18 @@ add_library(nxt_backend STATIC ${BACKEND_SOURCES})
|
||||||
NXTInternalTarget("backend" nxt_backend)
|
NXTInternalTarget("backend" nxt_backend)
|
||||||
target_link_libraries(nxt_backend nxt_common glfw glad spirv_cross)
|
target_link_libraries(nxt_backend nxt_common glfw glad spirv_cross)
|
||||||
|
|
||||||
if (NXT_ENABLE_D3D12)
|
if (DAWN_ENABLE_D3D12)
|
||||||
target_link_libraries(nxt_backend d3d12_autogen)
|
target_link_libraries(nxt_backend d3d12_autogen)
|
||||||
endif()
|
endif()
|
||||||
if (NXT_ENABLE_METAL)
|
if (DAWN_ENABLE_METAL)
|
||||||
target_link_libraries(nxt_backend metal_autogen)
|
target_link_libraries(nxt_backend metal_autogen)
|
||||||
endif()
|
endif()
|
||||||
if (NXT_ENABLE_NULL)
|
if (DAWN_ENABLE_NULL)
|
||||||
target_link_libraries(nxt_backend null_autogen)
|
target_link_libraries(nxt_backend null_autogen)
|
||||||
endif()
|
endif()
|
||||||
if (NXT_ENABLE_OPENGL)
|
if (DAWN_ENABLE_OPENGL)
|
||||||
target_link_libraries(nxt_backend opengl_autogen)
|
target_link_libraries(nxt_backend opengl_autogen)
|
||||||
endif()
|
endif()
|
||||||
if (NXT_ENABLE_VULKAN)
|
if (DAWN_ENABLE_VULKAN)
|
||||||
target_link_libraries(nxt_backend vulkan_autogen)
|
target_link_libraries(nxt_backend vulkan_autogen)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace backend { namespace d3d12 {
|
||||||
ComPtr<IDXGIFactory4> factory;
|
ComPtr<IDXGIFactory4> factory;
|
||||||
|
|
||||||
uint32_t dxgiFactoryFlags = 0;
|
uint32_t dxgiFactoryFlags = 0;
|
||||||
#if defined(NXT_ENABLE_ASSERTS)
|
#if defined(DAWN_ENABLE_ASSERTS)
|
||||||
// Enable the debug layer (requires the Graphics Tools "optional feature").
|
// Enable the debug layer (requires the Graphics Tools "optional feature").
|
||||||
{
|
{
|
||||||
ComPtr<ID3D12Debug> debugController;
|
ComPtr<ID3D12Debug> debugController;
|
||||||
|
@ -91,7 +91,7 @@ namespace backend { namespace d3d12 {
|
||||||
DXGI_DEBUG_RLO_FLAGS(DXGI_DEBUG_RLO_ALL));
|
DXGI_DEBUG_RLO_FLAGS(DXGI_DEBUG_RLO_ALL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // defined(NXT_ENABLE_ASSERTS)
|
#endif // defined(DAWN_ENABLE_ASSERTS)
|
||||||
|
|
||||||
ASSERT_SUCCESS(CreateDXGIFactory2(dxgiFactoryFlags, IID_PPV_ARGS(&factory)));
|
ASSERT_SUCCESS(CreateDXGIFactory2(dxgiFactoryFlags, IID_PPV_ARGS(&factory)));
|
||||||
return factory;
|
return factory;
|
||||||
|
|
|
@ -19,9 +19,9 @@
|
||||||
#include <dxgi1_4.h>
|
#include <dxgi1_4.h>
|
||||||
#include <wrl.h>
|
#include <wrl.h>
|
||||||
|
|
||||||
#if defined(NXT_ENABLE_ASSERTS)
|
#if defined(DAWN_ENABLE_ASSERTS)
|
||||||
# include <dxgidebug.h>
|
# include <dxgidebug.h>
|
||||||
#endif // defined(NXT_ENABLE_ASSERTS)
|
#endif // defined(DAWN_ENABLE_ASSERTS)
|
||||||
|
|
||||||
using Microsoft::WRL::ComPtr;
|
using Microsoft::WRL::ComPtr;
|
||||||
|
|
||||||
|
|
|
@ -439,7 +439,7 @@ namespace backend { namespace vulkan {
|
||||||
usedKnobs->renderDocCapture = true;
|
usedKnobs->renderDocCapture = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(NXT_ENABLE_ASSERTS)
|
#if defined(DAWN_ENABLE_ASSERTS)
|
||||||
if (mGlobalInfo.standardValidation) {
|
if (mGlobalInfo.standardValidation) {
|
||||||
layersToRequest.push_back(kLayerNameLunargStandardValidation);
|
layersToRequest.push_back(kLayerNameLunargStandardValidation);
|
||||||
usedKnobs->standardValidation = true;
|
usedKnobs->standardValidation = true;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#ifndef COMMON_VULKANPLATFORM_H_
|
#ifndef COMMON_VULKANPLATFORM_H_
|
||||||
#define COMMON_VULKANPLATFORM_H_
|
#define COMMON_VULKANPLATFORM_H_
|
||||||
|
|
||||||
#if !defined(NXT_ENABLE_BACKEND_VULKAN)
|
#if !defined(DAWN_ENABLE_BACKEND_VULKAN)
|
||||||
# error "vulkan_platform.h included without the Vulkan backend enabled"
|
# error "vulkan_platform.h included without the Vulkan backend enabled"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -54,13 +54,13 @@ typedef struct {
|
||||||
nxtTextureUsageBit textureUsage;
|
nxtTextureUsageBit textureUsage;
|
||||||
} nxtSwapChainImplementation;
|
} nxtSwapChainImplementation;
|
||||||
|
|
||||||
#if defined(NXT_ENABLE_BACKEND_D3D12) && defined(__cplusplus)
|
#if defined(DAWN_ENABLE_BACKEND_D3D12) && defined(__cplusplus)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
nxtDevice device = nullptr;
|
nxtDevice device = nullptr;
|
||||||
} nxtWSIContextD3D12;
|
} nxtWSIContextD3D12;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(NXT_ENABLE_BACKEND_METAL) && defined(__OBJC__)
|
#if defined(DAWN_ENABLE_BACKEND_METAL) && defined(__OBJC__)
|
||||||
#import <Metal/Metal.h>
|
#import <Metal/Metal.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -68,12 +68,12 @@ typedef struct {
|
||||||
} nxtWSIContextMetal;
|
} nxtWSIContextMetal;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NXT_ENABLE_BACKEND_OPENGL
|
#ifdef DAWN_ENABLE_BACKEND_OPENGL
|
||||||
typedef struct {
|
typedef struct {
|
||||||
} nxtWSIContextGL;
|
} nxtWSIContextGL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NXT_ENABLE_BACKEND_VULKAN
|
#ifdef DAWN_ENABLE_BACKEND_VULKAN
|
||||||
typedef struct {
|
typedef struct {
|
||||||
} nxtWSIContextVulkan;
|
} nxtWSIContextVulkan;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -60,7 +60,7 @@ list(APPEND UNITTEST_SOURCES
|
||||||
${TESTS_DIR}/UnittestsMain.cpp
|
${TESTS_DIR}/UnittestsMain.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if (NXT_ENABLE_D3D12)
|
if (DAWN_ENABLE_D3D12)
|
||||||
list(APPEND UNITTEST_SOURCES
|
list(APPEND UNITTEST_SOURCES
|
||||||
${UNITTESTS_DIR}/d3d12/CopySplitTests.cpp
|
${UNITTESTS_DIR}/d3d12/CopySplitTests.cpp
|
||||||
)
|
)
|
||||||
|
|
|
@ -392,16 +392,16 @@ std::ostream &operator<<(std::ostream& stream, BackendType backend) {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
bool IsBackendAvailable(BackendType type) {
|
bool IsBackendAvailable(BackendType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
#if defined(NXT_ENABLE_BACKEND_D3D12)
|
#if defined(DAWN_ENABLE_BACKEND_D3D12)
|
||||||
case D3D12Backend:
|
case D3D12Backend:
|
||||||
#endif
|
#endif
|
||||||
#if defined(NXT_ENABLE_BACKEND_METAL)
|
#if defined(DAWN_ENABLE_BACKEND_METAL)
|
||||||
case MetalBackend:
|
case MetalBackend:
|
||||||
#endif
|
#endif
|
||||||
#if defined(NXT_ENABLE_BACKEND_OPENGL)
|
#if defined(DAWN_ENABLE_BACKEND_OPENGL)
|
||||||
case OpenGLBackend:
|
case OpenGLBackend:
|
||||||
#endif
|
#endif
|
||||||
#if defined(NXT_ENABLE_BACKEND_VULKAN)
|
#if defined(DAWN_ENABLE_BACKEND_VULKAN)
|
||||||
case VulkanBackend:
|
case VulkanBackend:
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -18,19 +18,19 @@
|
||||||
|
|
||||||
namespace utils {
|
namespace utils {
|
||||||
|
|
||||||
#if defined(NXT_ENABLE_BACKEND_D3D12)
|
#if defined(DAWN_ENABLE_BACKEND_D3D12)
|
||||||
BackendBinding* CreateD3D12Binding();
|
BackendBinding* CreateD3D12Binding();
|
||||||
#endif
|
#endif
|
||||||
#if defined(NXT_ENABLE_BACKEND_METAL)
|
#if defined(DAWN_ENABLE_BACKEND_METAL)
|
||||||
BackendBinding* CreateMetalBinding();
|
BackendBinding* CreateMetalBinding();
|
||||||
#endif
|
#endif
|
||||||
#if defined(NXT_ENABLE_BACKEND_NULL)
|
#if defined(DAWN_ENABLE_BACKEND_NULL)
|
||||||
BackendBinding* CreateNullBinding();
|
BackendBinding* CreateNullBinding();
|
||||||
#endif
|
#endif
|
||||||
#if defined(NXT_ENABLE_BACKEND_OPENGL)
|
#if defined(DAWN_ENABLE_BACKEND_OPENGL)
|
||||||
BackendBinding* CreateOpenGLBinding();
|
BackendBinding* CreateOpenGLBinding();
|
||||||
#endif
|
#endif
|
||||||
#if defined(NXT_ENABLE_BACKEND_VULKAN)
|
#if defined(DAWN_ENABLE_BACKEND_VULKAN)
|
||||||
BackendBinding* CreateVulkanBinding();
|
BackendBinding* CreateVulkanBinding();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -40,27 +40,27 @@ namespace utils {
|
||||||
|
|
||||||
BackendBinding* CreateBinding(BackendType type) {
|
BackendBinding* CreateBinding(BackendType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
#if defined(NXT_ENABLE_BACKEND_D3D12)
|
#if defined(DAWN_ENABLE_BACKEND_D3D12)
|
||||||
case BackendType::D3D12:
|
case BackendType::D3D12:
|
||||||
return CreateD3D12Binding();
|
return CreateD3D12Binding();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(NXT_ENABLE_BACKEND_METAL)
|
#if defined(DAWN_ENABLE_BACKEND_METAL)
|
||||||
case BackendType::Metal:
|
case BackendType::Metal:
|
||||||
return CreateMetalBinding();
|
return CreateMetalBinding();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(NXT_ENABLE_BACKEND_NULL)
|
#if defined(DAWN_ENABLE_BACKEND_NULL)
|
||||||
case BackendType::Null:
|
case BackendType::Null:
|
||||||
return CreateNullBinding();
|
return CreateNullBinding();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(NXT_ENABLE_BACKEND_OPENGL)
|
#if defined(DAWN_ENABLE_BACKEND_OPENGL)
|
||||||
case BackendType::OpenGL:
|
case BackendType::OpenGL:
|
||||||
return CreateOpenGLBinding();
|
return CreateOpenGLBinding();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(NXT_ENABLE_BACKEND_VULKAN)
|
#if defined(DAWN_ENABLE_BACKEND_VULKAN)
|
||||||
case BackendType::Vulkan:
|
case BackendType::Vulkan:
|
||||||
return CreateVulkanBinding();
|
return CreateVulkanBinding();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,31 +23,31 @@ list(APPEND UTILS_SOURCES
|
||||||
${UTILS_DIR}/SystemUtils.h
|
${UTILS_DIR}/SystemUtils.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if (NXT_ENABLE_D3D12)
|
if (DAWN_ENABLE_D3D12)
|
||||||
list(APPEND UTILS_SOURCES
|
list(APPEND UTILS_SOURCES
|
||||||
${UTILS_DIR}/D3D12Binding.cpp
|
${UTILS_DIR}/D3D12Binding.cpp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NXT_ENABLE_METAL)
|
if (DAWN_ENABLE_METAL)
|
||||||
list(APPEND UTILS_SOURCES
|
list(APPEND UTILS_SOURCES
|
||||||
${UTILS_DIR}/MetalBinding.mm
|
${UTILS_DIR}/MetalBinding.mm
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NXT_ENABLE_NULL)
|
if (DAWN_ENABLE_NULL)
|
||||||
list(APPEND UTILS_SOURCES
|
list(APPEND UTILS_SOURCES
|
||||||
${UTILS_DIR}/NullBinding.cpp
|
${UTILS_DIR}/NullBinding.cpp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NXT_ENABLE_OPENGL)
|
if (DAWN_ENABLE_OPENGL)
|
||||||
list(APPEND UTILS_SOURCES
|
list(APPEND UTILS_SOURCES
|
||||||
${UTILS_DIR}/OpenGLBinding.cpp
|
${UTILS_DIR}/OpenGLBinding.cpp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NXT_ENABLE_VULKAN)
|
if (DAWN_ENABLE_VULKAN)
|
||||||
list(APPEND UTILS_SOURCES
|
list(APPEND UTILS_SOURCES
|
||||||
${UTILS_DIR}/VulkanBinding.cpp
|
${UTILS_DIR}/VulkanBinding.cpp
|
||||||
)
|
)
|
||||||
|
|
|
@ -105,7 +105,7 @@ set(SPIRV_CROSS_SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
set(NEED_SPIRV_CROSS_GLSL OFF)
|
set(NEED_SPIRV_CROSS_GLSL OFF)
|
||||||
if (NXT_ENABLE_D3D12)
|
if (DAWN_ENABLE_D3D12)
|
||||||
list(APPEND SPIRV_CROSS_SOURCES
|
list(APPEND SPIRV_CROSS_SOURCES
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_hlsl.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_hlsl.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_hlsl.hpp
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_hlsl.hpp
|
||||||
|
@ -113,7 +113,7 @@ if (NXT_ENABLE_D3D12)
|
||||||
set(NEED_SPIRV_CROSS_GLSL ON)
|
set(NEED_SPIRV_CROSS_GLSL ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NXT_ENABLE_METAL)
|
if (DAWN_ENABLE_METAL)
|
||||||
list(APPEND SPIRV_CROSS_SOURCES
|
list(APPEND SPIRV_CROSS_SOURCES
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_msl.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_msl.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_msl.hpp
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_msl.hpp
|
||||||
|
@ -121,7 +121,7 @@ if (NXT_ENABLE_METAL)
|
||||||
set(NEED_SPIRV_CROSS_GLSL ON)
|
set(NEED_SPIRV_CROSS_GLSL ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NXT_ENABLE_OPENGL OR NEED_SPIRV_CROSS_GLSL)
|
if (DAWN_ENABLE_OPENGL OR NEED_SPIRV_CROSS_GLSL)
|
||||||
list(APPEND SPIRV_CROSS_SOURCES
|
list(APPEND SPIRV_CROSS_SOURCES
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_glsl.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_glsl.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_glsl.hpp
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_glsl.hpp
|
||||||
|
|
Loading…
Reference in New Issue