Skip to content

Commit 1dcf842

Browse files
Merge pull request #611 from Devsh-Graphics-Programming/master_to_blit
Blit in HLSL
2 parents c83f4f4 + dfb6ced commit 1dcf842

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2902
-4151
lines changed

cmake/adjust/flags.cmake

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,58 @@
11
include_guard(GLOBAL)
22

3+
include(CheckCCompilerFlag)
4+
include(CheckCXXCompilerFlag)
5+
6+
if(NOT DEFINED _NBL_JOBS_AMOUNT_)
7+
message(WARNING "\"${CMAKE_CURRENT_LIST_FILE}\" included without defined \"_NBL_JOBS_AMOUNT_\", setting it to \"1\"")
8+
set(_NBL_JOBS_AMOUNT_ 1)
9+
endif()
10+
311
define_property(TARGET PROPERTY NBL_CONFIGURATION_MAP
412
BRIEF_DOCS "Stores configuration map for a target, it will evaluate to the configuration it's mapped to"
513
)
614

7-
macro(_NBL_IMPL_GET_FLAGS_PROFILE_)
8-
if(MSVC)
9-
include("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/template/windows/msvc.cmake")
10-
elseif(ANDROID)
11-
include("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/template/unix/android.cmake")
12-
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
13-
include("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/template/unix/gnu.cmake")
14-
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
15-
include("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/template/unix/clang.cmake")
16-
else()
17-
message(WARNING "UNTESTED COMPILER DETECTED, EXPECT WRONG OPTIMIZATION FLAGS! SUBMIT ISSUE ON GITHUB https://github.com/Devsh-Graphics-Programming/Nabla/issues")
18-
endif()
19-
endmacro()
15+
function(NBL_REQUEST_COMPILE_OPTION_SUPPORT _NBL_COMPILE_OPTION_)
16+
set(NBL_COMPILE_OPTION "${_NBL_COMPILE_OPTION_}")
2017

21-
function(NBL_EXT_P_APPEND_COMPILE_OPTIONS NBL_LIST_NAME MAP_RELEASE MAP_RELWITHDEBINFO MAP_DEBUG)
22-
_NBL_IMPL_GET_FLAGS_PROFILE_()
23-
18+
foreach(COMPILER IN ITEMS c cxx)
19+
string(TOUPPER "${COMPILER}" COMPILER_UPPER)
20+
21+
string(REGEX REPLACE "[-=:;/.]" "_" flag_signature "${NBL_COMPILE_OPTION}")
22+
set(flag_var "__${COMPILER_UPPER}_Flag_${flag_signature}")
23+
24+
if(COMPILER STREQUAL "c")
25+
check_c_compiler_flag("${NBL_COMPILE_OPTION}" ${flag_var})
26+
elseif(COMPILER STREQUAL "cxx")
27+
check_cxx_compiler_flag("${NBL_COMPILE_OPTION}" ${flag_var})
28+
endif()
29+
30+
if(${flag_var})
31+
message(STATUS "Enabled \"${NBL_COMPILE_OPTION}\" ${COMPILER_UPPER} compile option for Nabla projects!")
32+
set(NBL_${COMPILER_UPPER}_COMPILE_OPTIONS "${NBL_${COMPILER_UPPER}_COMPILE_OPTIONS};${NBL_COMPILE_OPTION}" PARENT_SCOPE)
33+
else()
34+
message(STATUS "Disabled \"${NBL_COMPILE_OPTION}\" ${COMPILER_UPPER} compile option for Nabla projects! (no support)")
35+
endif()
36+
endforeach()
37+
endfunction()
38+
39+
option(NBL_REQUEST_SSE_4_2 "Request compilation with SSE 4.2 instruction set enabled for Nabla projects" ON)
40+
option(NBL_REQUEST_SSE_AXV2 "Request compilation with SSE Intel Advanced Vector Extensions 2 for Nabla projects" ON)
41+
42+
# profiles
43+
if(MSVC)
44+
include("${CMAKE_CURRENT_LIST_DIR}/template/windows/msvc.cmake")
45+
elseif(ANDROID)
46+
include("${CMAKE_CURRENT_LIST_DIR}/template/unix/android.cmake")
47+
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
48+
include("${CMAKE_CURRENT_LIST_DIR}/template/unix/gnu.cmake")
49+
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
50+
include("${CMAKE_CURRENT_LIST_DIR}/template/unix/clang.cmake")
51+
else()
52+
message(WARNING "UNTESTED COMPILER DETECTED, EXPECT WRONG OPTIMIZATION FLAGS! SUBMIT ISSUE ON GITHUB https://github.com/Devsh-Graphics-Programming/Nabla/issues")
53+
endif()
54+
55+
function(NBL_EXT_P_APPEND_COMPILE_OPTIONS NBL_LIST_NAME MAP_RELEASE MAP_RELWITHDEBINFO MAP_DEBUG)
2456
macro(NBL_MAP_CONFIGURATION NBL_CONFIG_FROM NBL_CONFIG_TO)
2557
string(TOUPPER "${NBL_CONFIG_FROM}" NBL_CONFIG_FROM_U)
2658
string(TOUPPER "${NBL_CONFIG_TO}" NBL_CONFIG_TO_U)
@@ -82,8 +114,6 @@ function(nbl_adjust_flags)
82114

83115
list(APPEND _NBL_OPTIONS_IMPL_ TARGET)
84116
cmake_parse_arguments(NBL "" "" "${_NBL_OPTIONS_IMPL_}" ${ARGN})
85-
86-
_NBL_IMPL_GET_FLAGS_PROFILE_()
87117

88118
# TARGET mode
89119
if(NBL_TARGET)

cmake/adjust/template/unix/android.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
include_guard(GLOBAL)
2+
13
include("${CMAKE_CURRENT_LIST_DIR}/common.cmake")
24

35
# Debug

cmake/adjust/template/unix/clang.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
include_guard(GLOBAL)
2+
13
include("${CMAKE_CURRENT_LIST_DIR}/common.cmake")
24

35
# Debug

cmake/adjust/template/unix/common.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1+
include_guard(GLOBAL)
2+
13
option(NBL_SANITIZE_THREAD OFF)
4+
option(NBL_REQUEST_F16C "Request compilation with F16C enabled for Nabla projects" ON)
5+
6+
# https://en.wikipedia.org/wiki/F16C
7+
# support for converting between half-precision and standard IEEE single-precision floating-point formats
8+
if(NBL_REQUEST_F16C)
9+
NBL_REQUEST_COMPILE_OPTION_SUPPORT("-mf16c")
10+
endif()
211

312
# Debug
413
set(NBL_C_DEBUG_COMPILE_OPTIONS

cmake/adjust/template/unix/gnu.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
include_guard(GLOBAL)
2+
13
include("${CMAKE_CURRENT_LIST_DIR}/common.cmake")
24

35
# Debug

cmake/adjust/template/windows/msvc.cmake

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
if(NOT DEFINED _NBL_JOBS_AMOUNT_)
2-
message(WARNING "\"${CMAKE_CURRENT_LIST_FILE}\" included without defined \"_NBL_JOBS_AMOUNT_\", setting it to \"1\"")
3-
set(_NBL_JOBS_AMOUNT_ 1)
1+
include_guard(GLOBAL)
2+
3+
# https://learn.microsoft.com/en-us/cpp/build/reference/arch-x64?view=msvc-170
4+
5+
# The default instruction set is SSE2 if no /arch option is specified.
6+
if(NBL_REQUEST_SSE_4_2)
7+
NBL_REQUEST_COMPILE_OPTION_SUPPORT("/arch:SSE4.2")
48
endif()
59

6-
# notes:
7-
# /arch:sse3 or anything like this is not needed on x64 on MSVC for enabling sse3 instructions
10+
# Enables Intel Advanced Vector Extensions 2.
11+
if(NBL_REQUEST_SSE_AXV2)
12+
NBL_REQUEST_COMPILE_OPTION_SUPPORT("/arch:AVX2")
13+
endif()
814

915
# Debug
1016
set(NBL_C_DEBUG_COMPILE_OPTIONS
@@ -50,10 +56,6 @@ set(NBL_RELWITHDEBINFO_COMPILE_OPTIONS
5056
$<$<COMPILE_LANGUAGE:C>:${NBL_C_RELWITHDEBINFO_COMPILE_OPTIONS}>
5157
)
5258

53-
# Global
54-
unset(NBL_C_COMPILE_OPTIONS)
55-
unset(NBL_CXX_COMPILE_OPTIONS)
56-
5759
if(NBL_SANITIZE_ADDRESS)
5860
list(APPEND NBL_C_COMPILE_OPTIONS /fsanitize=address)
5961
list(APPEND NBL_CXX_COMPILE_OPTIONS ${NBL_C_COMPILE_OPTIONS})

examples_tests

include/nbl/asset/ICPUSampler.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class ICPUSampler : public ISampler, public IAsset
4545
break;
4646
case ISampler::ETC_MIRROR_CLAMP_TO_EDGE:
4747
texelCoord[i] = core::clamp<int32_t,int32_t>(texelCoord[i],-int32_t(mipExtent[i]),mipExtent[i]+mipLastCoord[i]);
48+
[[fallthrough]];
4849
case ISampler::ETC_MIRROR:
4950
{
5051
int32_t repeatID = (originalWasNegative+texelCoord[i])/int32_t(mipExtent[i]);

include/nbl/asset/IMeshBuffer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#ifndef _NBL_ASSET_I_MESH_BUFFER_H_INCLUDED_
55
#define _NBL_ASSET_I_MESH_BUFFER_H_INCLUDED_
66

7-
#include "nbl/core/shapes/AABB.h"
87

98
#include "nbl/asset/IRenderpassIndependentPipeline.h"
109
#include "nbl/asset/ECommonEnums.h"

include/nbl/asset/asset.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,5 @@
7777
//VT
7878
// #include "nbl/asset/utils/CCPUMeshPackerV1.h"
7979
// #include "nbl/asset/utils/CCPUMeshPackerV2.h"
80-
#include "nbl/asset/utils/ICPUVirtualTexture.h"
8180

8281
#endif

0 commit comments

Comments
 (0)