Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
182 commits
Select commit Hold shift + click to select a range
cdcc9ad
Initial commit
Fletterio Mar 21, 2025
8e84558
Merge branch 'concepts_fix' into mortons
Fletterio Mar 21, 2025
d33fab5
Merge branch 'concepts_fix' into mortons
Fletterio Mar 21, 2025
5fe6c08
CHeckpoint before master merge
Fletterio Mar 23, 2025
f18b2fa
Checkpoint before merging new type_traits change
Fletterio Mar 24, 2025
7d86cba
Merge branch 'master' into mortons
Fletterio Mar 24, 2025
4ebc555
Works, but throws DXC warning
Fletterio Mar 24, 2025
55a2ef6
Added concept for valid morton dimensions
Fletterio Mar 24, 2025
f516256
Creation from vector working as intended
Fletterio Mar 25, 2025
534d81b
Added some extra macro specifiers, vector truncation with no warnings…
Fletterio Mar 26, 2025
6256390
Add safe copile-time vector truncation and some function specifiers f…
Fletterio Mar 26, 2025
246cefc
Morton class done!
Fletterio Mar 27, 2025
1c7f791
Remove some leftover commented code
Fletterio Mar 27, 2025
5088799
Remove leaking macro
Fletterio Mar 27, 2025
e25a35c
Bugfixes with arithmetic
Fletterio Mar 28, 2025
0d9dd4a
Checkpoint, have to check why vector compat isn't working
Fletterio Apr 1, 2025
89d2bf2
Refactor morton class, get new conversion running
Fletterio Apr 2, 2025
de4d0fb
Add new classes for encoding/decoding of mortn codes
Fletterio Apr 3, 2025
799420e
Fix conversion operators
Fletterio Apr 4, 2025
52323bc
Finish the rest of comparison ops and we're done!
Fletterio Apr 5, 2025
b6b7003
Final Mortons
Fletterio Apr 7, 2025
60ff99a
Clean up the emulated int code, fix some constant creation in the mor…
Fletterio Apr 8, 2025
5560162
Addressing latest PR review. Generic overloads for of different func…
Fletterio Apr 8, 2025
e50c56b
Bunch of emulated int64 fixes regarding creation, comparison operator…
Fletterio Apr 9, 2025
b1de9c3
Fix automatic specialize macro in cpp compat intrinsics, add intrins…
Fletterio Apr 9, 2025
ea8cd43
Checkpoint: adding a bunch of operators to emulated vector types
Fletterio Apr 11, 2025
53a5f6a
Vectorized encode/decode for better pipelining
Fletterio Apr 11, 2025
cf52d9c
Adress the last of PR review changes: vectorize more operators, add a…
Fletterio Apr 14, 2025
f954522
Removed `NBL_CONSTEXPR_INLINE_FUNC` macro, replaced all usages with
Fletterio Apr 24, 2025
2d0ffba
Fix the last of the operators
Fletterio Apr 28, 2025
68edc32
Change examples test submodule for master merge
Fletterio Apr 28, 2025
5013c89
Merged master
Fletterio Apr 28, 2025
e5da351
Resolved conflicts, cherry picked 9381491
AnastaZIuk Oct 22, 2025
d7da234
Updated examples
Przemog1 Oct 24, 2025
9e4c75e
cap kind args
AnastaZIuk Oct 10, 2025
639e2d4
fix a bug after my NSC rules update
AnastaZIuk Oct 10, 2025
baa6b4a
Resolved conflicts, cherry-picked e3129939c8253ec04525bdb726578cfe61b…
AnastaZIuk Oct 10, 2025
0bd968e
fix a bug after my NSC rules update
AnastaZIuk Oct 10, 2025
0c57c4e
Resolved conflicts, cherry-picked 93814913e84eb86e4c625d9e32d83221c62…
AnastaZIuk Oct 22, 2025
15a91b4
Updated examples
Przemog1 Oct 27, 2025
33e7428
Update examples
Przemog1 Oct 29, 2025
b4ce8f6
Updated examples
Przemog1 Oct 30, 2025
c53668c
Merge branch 'master' into mortons
Nov 19, 2025
977c7dd
Add constexpr to _static_cast
Nov 20, 2025
3294d04
Change NBL_CONSTEXPR_STATIC_FUNC to NBL_CONSTEXPR_STATIC
Nov 20, 2025
e2401c6
Add template<> to signify specialization
Nov 20, 2025
07f7a4a
Remove duplicate partial specialization.
Nov 20, 2025
42baa6c
Change NBL_CONSTEXPR_STATIC_FUNC to NBL_CONSTEXPR_STATIC
Nov 20, 2025
22e78eb
Fix concatenation of 'operator' and OP with '##' since operatorOP is …
Nov 20, 2025
8daf855
'equals' to 'equal'
Nov 20, 2025
831244f
Pass vec by value not ref
Nov 20, 2025
a560180
Use truncate to truncate
Nov 20, 2025
e320ed8
Make morton compile
Nov 22, 2025
83d27c9
NBL_CONSTEXPR_INLINE_VAR for template constexpr variable
Nov 27, 2025
c496916
Promote and Truncate take vector and scalar by value and the rest by …
Nov 28, 2025
d7bd053
Remove promote and truncate comment about specialization
Nov 28, 2025
3f3a23e
Add comment to rename log2
Nov 28, 2025
8dcdfdd
Change dimension type from uint16_t to int32_t
Nov 28, 2025
92cd9e7
Redefine some macro
Nov 28, 2025
7f6d8b8
use const instead of static const for local variable in hlsl
Nov 28, 2025
1d9ce20
Rename NBL_CONSTEXPR_INLINE to NBL_CONSTEXPR_INLINE_NSPC_SCOPE_VAR
Nov 28, 2025
1eded12
Refactor emulated_integral_64
Dec 1, 2025
aa9e24d
Add unary_minus_operator class
Dec 1, 2025
6683cd5
Remove commented code on emulated/vector_t.hlsl
Dec 1, 2025
21a5765
update dxc to https://github.com/Devsh-Graphics-Programming/DirectXSh…
AnastaZIuk Dec 1, 2025
cdb6ad7
Unify all Truncate specializaton for vector type
Dec 1, 2025
a9e1078
Resolved conflicts cherry-picked from the `unified_testing_interface`…
Przemog1 Dec 1, 2025
1e7ea64
Removed from the `to_string` function specialization of types not pre…
Przemog1 Dec 1, 2025
c365240
Fix promote.hlsl and reduce the amount of specialization for Promote
Dec 1, 2025
e674772
add `nbl::system::to_string` utility function
devshgraphicsprogramming Dec 1, 2025
d39adec
Resolved conflicts, merged master
Przemog1 Dec 1, 2025
407051c
Merge pull request #958 from Devsh-Graphics-Programming/system_to_string
Przemog1 Dec 1, 2025
ec1d674
Make promote constrainable
Dec 1, 2025
51e35cf
equal to _equal
Dec 1, 2025
062ce7b
Remove some constraint in morton::code::create
Dec 1, 2025
6c82428
Remove NBL_CONSTEXPR_STATIC_INLINE_VAR macro
Dec 2, 2025
ca2ac6f
Remove Bit count constraint on some of Transcoder method due to redun…
Dec 2, 2025
4c9635d
Use cpp syntax instead of portable macro wherever possible
Dec 2, 2025
fbfde73
change quaternion struct name to match what it will be
keptsecret Dec 2, 2025
856f828
merge master, fix conflicts
keptsecret Dec 2, 2025
23292bd
Fix morton code constraint
Dec 3, 2025
33a3247
Make sure NBL_VALID_EXPRESSION works outside the `nbl::hlsl` namespace
devshgraphicsprogramming Dec 3, 2025
1e637c4
"Fix" `SelectIsCallable` its really HLSL's fault as a language
devshgraphicsprogramming Dec 3, 2025
5da522e
Add assert in morton code creation
Dec 3, 2025
812ae7b
Fix is_emulating concepts
Dec 3, 2025
341d6cd
Move storage_t to common_inc
Dec 3, 2025
2fd2cba
Rename ImitationIntegral64Scalar to EmulatedIntegral64Scalar
Dec 3, 2025
1255d1c
Fix extent and remove duplicated extent specialization
Dec 3, 2025
527129f
Remove redundant extent
Dec 3, 2025
ed696ef
Fix unary_minus_operator
Dec 3, 2025
4da1fb8
Fix redundant extent specialization
Dec 3, 2025
14636d3
update examples submodule
karimsayedre Dec 3, 2025
402b823
Replace [[unroll]] with NBL_UNROLL
Dec 4, 2025
99b25ff
Allow promote to work between emulated type and non emulated type
Dec 4, 2025
07918be
Merge branch 'master' into hlsl_path_tracer_example_no_quat
keptsecret Dec 4, 2025
37d5c5a
removed temp fix for mix_helper require
keptsecret Dec 4, 2025
70a88fa
Refactor unary operator in hlsl functionals
Dec 4, 2025
ded5d8f
Fix misplaced #endif in functional.hlsl
Dec 4, 2025
17d0717
Fix ternary_operation
Dec 4, 2025
791b2b9
Improve some comment
Dec 4, 2025
8f548f6
Updated DXC
Przemog1 Dec 4, 2025
ac2070e
Remove NBL_ASSERT
Dec 4, 2025
49a5d2b
Merge branch 'imguizmo-lights' into solid-angle-vis
karimsayedre Dec 4, 2025
727d201
Merge branch 'master' into mortons
Dec 4, 2025
a4dabdf
Simplify mix helper by using select_helper in some specialization
Dec 4, 2025
6971906
fixes more nan problems + a few bugs in iridescent fresnel
keptsecret Dec 5, 2025
98d8151
Merge pull request #957 from Devsh-Graphics-Programming/dxc_12_01_2025
AnastaZIuk Dec 5, 2025
cb68928
fixes iridescent fresnel under transmission
keptsecret Dec 5, 2025
76ed66c
fix wrong get refraction eta in iridescent transmission
keptsecret Dec 5, 2025
265100c
Extended NBL_CREATE_NSC_COMPILE_RULES function, now it creates precom…
Przemog1 Dec 5, 2025
45ab693
Resolved conflicts, merged master
Przemog1 Dec 5, 2025
6887419
updated examples submodule
karimsayedre Dec 6, 2025
f32ddd2
Update examples submodule
karimsayedre Dec 6, 2025
4a8f4dc
quantized sequence packing data
keptsecret Dec 8, 2025
1a32ed2
Remove NBL_ASSERT usage
Dec 8, 2025
1832059
update examples submodule
karimsayedre Dec 8, 2025
b79bf8f
update examples submodule
karimsayedre Dec 8, 2025
49a017a
update examples submodule
karimsayedre Dec 8, 2025
b8688be
templated quantized sequence
keptsecret Dec 9, 2025
2146003
Merge branch 'master' into hlsl_path_tracer_example_no_quat
keptsecret Dec 9, 2025
38bbf04
latest example
keptsecret Dec 9, 2025
fae7a80
quantized sequence decode
keptsecret Dec 9, 2025
e23538c
quantized sequence get/set values by index, simplify decode func spec…
keptsecret Dec 10, 2025
6e9160e
quantized sequence encode should right shift input, changed scramble …
keptsecret Dec 10, 2025
4a399fb
Fix verifyAnyBitIntegral
Dec 10, 2025
8456936
Fixed bug in the `promote_affine` function
Przemog1 Dec 10, 2025
6f0d012
added decode variant for scramble before decode
keptsecret Dec 11, 2025
3d53866
Merge branch 'master' into hlsl_path_tracer_example_no_quat
keptsecret Dec 11, 2025
c5c1dc2
Remove const specifier for parameters in ternary operator
Dec 11, 2025
9b2780f
Improve select implementation to use spirv intrinsics instead of branch
Dec 11, 2025
8871175
Refactor select_helper to use intrinsics if possible
Dec 11, 2025
bbbeeea
Revert previous changes, instead make it clear that the function is i…
Dec 11, 2025
258e491
Reverse the order of template argument of select and select_helper
Dec 11, 2025
c6462d1
some minor fixes to quantized sequence set, decode
keptsecret Dec 12, 2025
ba6e1ec
Fix complex identity macro
Dec 12, 2025
87e2cff
Fixed keys
Przemog1 Dec 12, 2025
34b1de4
Fix default blit_blit.comp.hlsl
Dec 12, 2025
67e6e50
Fix ternary operator
Dec 12, 2025
5698cf0
Add missing include
Dec 12, 2025
5e6615f
Merge pull request #944 from Devsh-Graphics-Programming/precompiled_s…
AnastaZIuk Dec 12, 2025
7d9611d
Fix mix partial specialization
Dec 12, 2025
174fb82
Merge branch 'master' into mortons
Dec 12, 2025
e44a8fb
Fixed nsc command line arguments
Przemog1 Dec 12, 2025
b803f83
fix missing built-in
devshgraphicsprogramming Dec 12, 2025
3c1a4a3
Merge pull request #860 from Devsh-Graphics-Programming/mortons
devshgraphicsprogramming Dec 12, 2025
d61989f
post merge submodule pointer update
Dec 14, 2025
a30f083
fix quantized sequence mask being too small, assert conditions
keptsecret Dec 15, 2025
073a9f3
merge master, fix conflicts
keptsecret Dec 15, 2025
7d16cb2
fixed problems from merging master
keptsecret Dec 15, 2025
965e028
fix decode scramble key, shifting discard bits in quantization
keptsecret Dec 15, 2025
cfd5500
fix z component storing too many bits in quantized sequence in vec2 d…
keptsecret Dec 15, 2025
7da0bda
get latest glm
Dec 15, 2025
290478d
update gli now
Dec 15, 2025
5b634dd
fixed example 22
Dec 15, 2025
53ff444
mix_helper requirements include bool vectors
keptsecret Dec 16, 2025
5055713
fix iridescent oriented eta bug
keptsecret Dec 16, 2025
3f3b5c9
partitionRandVar stores leftProb, fix minor bugs
keptsecret Dec 16, 2025
db454c0
plain const for vector types
keptsecret Dec 16, 2025
c353ab3
fixes to iridescent fresnel, moved getOrientedEtaRcp to dielectric fr…
keptsecret Dec 16, 2025
04f1c76
adjust mix_helper calling select requirements
keptsecret Dec 16, 2025
94a778f
restore regular triangle stuff, refactor usage
keptsecret Dec 16, 2025
9e4a16c
minor changes to rwmc usage
keptsecret Dec 16, 2025
62c79b4
remove storing texture inside local var of ResolveAccessorAdaptor
keptsecret Dec 16, 2025
5075c63
removed accessor, user should provide accessor that matches concept
keptsecret Dec 16, 2025
90007e6
fix formatting, name
keptsecret Dec 16, 2025
3d36c13
added more things to precompute
keptsecret Dec 16, 2025
62f2c99
changes to splatting params precompute for the last time
keptsecret Dec 16, 2025
f3f60c6
check that eta type of dielectric fresnels should be monochrome
keptsecret Dec 16, 2025
b4d957d
Change `Compile flag error` to `Compile flag warning`
devshgraphicsprogramming Dec 16, 2025
dfcae2d
Merge remote-tracking branch 'remotes/origin/master' into hlsl_path_t…
Dec 16, 2025
957c3c4
Merge pull request #966 from Devsh-Graphics-Programming/hlsl_path_tra…
devshgraphicsprogramming Dec 16, 2025
e714c24
RandomSampler can give floats now, ranged and [0, 1), also update exa…
karimsayedre Dec 17, 2025
6741c75
update examples submodules
karimsayedre Dec 17, 2025
92545a5
update examples submodule
karimsayedre Dec 17, 2025
32de44d
Create docs for NSC prebuilds
AnastaZIuk Dec 18, 2025
2537049
Remove duplicate partial specialization for truncate and emulated_vec
Dec 19, 2025
3f5b2c3
Merge pull request #968 from Devsh-Graphics-Programming/hotfix_promot…
devshgraphicsprogramming Dec 19, 2025
993032c
update examples submodule
karimsayedre Dec 20, 2025
6ab99fa
Updated DXC
Przemog1 Dec 20, 2025
3f9007a
Merge branch 'master' into solid-angle-vis
karimsayedre Dec 23, 2025
af7574a
include `tgmath.hlsl` in `functions.hlsl`, update examples_tests
karimsayedre Dec 31, 2025
27aad5c
Added `SRasterizationParams` to the full screen triangle pipeline cre…
karimsayedre Jan 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rdparty/dxc/dxc
Submodule dxc updated 259 files
2 changes: 1 addition & 1 deletion 3rdparty/gli
Submodule gli updated 1 files
+1 −1 gli/core/format.inl
2 changes: 1 addition & 1 deletion 3rdparty/glm
Submodule glm updated 1153 files
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ include(ExternalProject)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/toolchains/android/build.cmake)

project(Nabla
VERSION 0.8.0.1
VERSION 0.9.0.0
HOMEPAGE_URL "https://www.devsh.eu/nabla"
LANGUAGES CXX C
)
Expand Down
175 changes: 120 additions & 55 deletions cmake/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,12 @@ define_property(TARGET PROPERTY NBL_MOUNT_POINT_DEFINES
BRIEF_DOCS "List of preprocessor defines with mount points"
)

option(NSC_DEBUG_EDIF_FILE_BIT "Add \"-fspv-debug=file\" to NSC Debug CLI" ON)
option(NSC_DEBUG_EDIF_SOURCE_BIT "Add \"-fspv-debug=source\" to NSC Debug CLI" OFF)
option(NSC_DEBUG_EDIF_LINE_BIT "Add \"-fspv-debug=line\" to NSC Debug CLI" OFF)
option(NSC_DEBUG_EDIF_TOOL_BIT "Add \"-fspv-debug=tool\" to NSC Debug CLI" ON)
option(NSC_DEBUG_EDIF_NON_SEMANTIC_BIT "Add \"-fspv-debug=vulkan-with-source\" to NSC Debug CLI" OFF)

function(NBL_CREATE_NSC_COMPILE_RULES)
set(COMMENT "this code has been autogenerated with Nabla CMake NBL_CREATE_HLSL_COMPILE_RULES utility")
set(DEVICE_CONFIG_VIEW
Expand Down Expand Up @@ -1178,9 +1184,34 @@ struct DeviceConfigCaps
-enable-16bit-types
-Zpr
-spirv
-fspv-target-env=vulkan1.3
-fspv-target-env=vulkan1.3
-Wshadow
-Wconversion
$<$<CONFIG:Debug>:-O0>
$<$<CONFIG:Release>:-O3>
$<$<CONFIG:RelWithDebInfo>:-O3>
)

if(NSC_DEBUG_EDIF_FILE_BIT)
list(APPEND REQUIRED_OPTIONS $<$<CONFIG:Debug>:-fspv-debug=file>)
endif()

if(NSC_DEBUG_EDIF_SOURCE_BIT)
list(APPEND REQUIRED_OPTIONS $<$<CONFIG:Debug>:-fspv-debug=source>)
endif()

if(NSC_DEBUG_EDIF_LINE_BIT)
list(APPEND REQUIRED_OPTIONS $<$<CONFIG:Debug>:-fspv-debug=line>)
endif()

if(NSC_DEBUG_EDIF_TOOL_BIT)
list(APPEND REQUIRED_OPTIONS $<$<CONFIG:Debug>:-fspv-debug=tool>)
endif()

if(NSC_DEBUG_EDIF_NON_SEMANTIC_BIT)
list(APPEND REQUIRED_OPTIONS $<$<CONFIG:Debug>:-fspv-debug=vulkan-with-source>)
endif()

if(NOT NBL_EMBED_BUILTIN_RESOURCES)
list(APPEND REQUIRED_OPTIONS
-I "${NBL_ROOT_PATH}/include"
Expand Down Expand Up @@ -1210,12 +1241,12 @@ struct DeviceConfigCaps

get_target_property(HEADER_RULE_GENERATED ${IMPL_TARGET} NBL_HEADER_GENERATED_RULE)
if(NOT HEADER_RULE_GENERATED)
set(INCLUDE_DIR "$<TARGET_PROPERTY:${IMPL_TARGET},BINARY_DIR>/${IMPL_TARGET}/.cmake/include")
set(INCLUDE_DIR "$<TARGET_PROPERTY:${IMPL_TARGET},BINARY_DIR>/${IMPL_TARGET}/.cmake/include/$<CONFIG>")
set(INCLUDE_FILE "${INCLUDE_DIR}/$<TARGET_PROPERTY:${IMPL_TARGET},NBL_HEADER_PATH>")
set(INCLUDE_CONTENT $<TARGET_PROPERTY:${IMPL_TARGET},NBL_HEADER_CONTENT>)

file(GENERATE OUTPUT ${INCLUDE_FILE}
CONTENT ${INCLUDE_CONTENT}
CONTENT $<GENEX_EVAL:${INCLUDE_CONTENT}>
TARGET ${IMPL_TARGET}
)

Expand Down Expand Up @@ -1277,17 +1308,22 @@ namespace @IMPL_NAMESPACE@ {
foreach(INDEX RANGE ${LAST_INDEX})
string(JSON INPUT GET "${IMPL_INPUTS}" ${INDEX} INPUT)
string(JSON BASE_KEY GET "${IMPL_INPUTS}" ${INDEX} KEY)
string(JSON COMPILE_OPTIONS_LENGTH LENGTH "${IMPL_INPUTS}" ${INDEX} COMPILE_OPTIONS)


set(COMPILE_OPTIONS "")
math(EXPR LAST_CO "${COMPILE_OPTIONS_LENGTH} - 1")
foreach(COMP_IDX RANGE 0 ${LAST_CO})
string(JSON COMP_ITEM GET "${IMPL_INPUTS}" ${INDEX} COMPILE_OPTIONS ${COMP_IDX})
list(APPEND COMPILE_OPTIONS "${COMP_ITEM}")
endforeach()
string(JSON HAS_COMPILE_OPTIONS ERROR_VARIABLE ERROR_VAR TYPE "${IMPL_INPUTS}" ${INDEX} COMPILE_OPTIONS)
if(HAS_COMPILE_OPTIONS STREQUAL "ARRAY")
string(JSON COMPILE_OPTIONS_LENGTH LENGTH "${IMPL_INPUTS}" ${INDEX} COMPILE_OPTIONS)
if(NOT COMPILE_OPTIONS_LENGTH EQUAL 0)
math(EXPR LAST_CO "${COMPILE_OPTIONS_LENGTH} - 1")
foreach(COMP_IDX RANGE 0 ${LAST_CO})
string(JSON COMP_ITEM GET "${IMPL_INPUTS}" ${INDEX} COMPILE_OPTIONS ${COMP_IDX})
list(APPEND COMPILE_OPTIONS "${COMP_ITEM}")
endforeach()
endif()
endif()

set(DEPENDS_ON "")
string(JSON HAS_DEPENDS TYPE "${IMPL_INPUTS}" ${INDEX} DEPENDS)
string(JSON HAS_DEPENDS ERROR_VARIABLE ERROR_VAR TYPE "${IMPL_INPUTS}" ${INDEX} DEPENDS)
if(HAS_DEPENDS STREQUAL "ARRAY")
string(JSON DEPENDS_LENGTH LENGTH "${IMPL_INPUTS}" ${INDEX} DEPENDS)
if(NOT DEPENDS_LENGTH EQUAL 0)
Expand All @@ -1305,7 +1341,7 @@ namespace @IMPL_NAMESPACE@ {

set(HAS_CAPS FALSE)
set(CAPS_LENGTH 0)
string(JSON CAPS_TYPE TYPE "${IMPL_INPUTS}" ${INDEX} CAPS)
string(JSON CAPS_TYPE ERROR_VARIABLE ERROR_VAR TYPE "${IMPL_INPUTS}" ${INDEX} CAPS)
if(CAPS_TYPE STREQUAL "ARRAY")
string(JSON CAPS_LENGTH LENGTH "${IMPL_INPUTS}" ${INDEX} CAPS)
if(NOT CAPS_LENGTH EQUAL 0)
Expand All @@ -1323,12 +1359,27 @@ namespace @IMPL_NAMESPACE@ {

set(CAP_NAMES "")
set(CAP_TYPES "")
set(CAP_KINDS "")
if(HAS_CAPS)
math(EXPR LAST_CAP "${CAPS_LENGTH} - 1")
foreach(CAP_IDX RANGE 0 ${LAST_CAP})
string(JSON CAP_KIND ERROR_VARIABLE CAP_TYPE_ERROR GET "${IMPL_INPUTS}" ${INDEX} CAPS ${CAP_IDX} kind)
string(JSON CAP_NAME GET "${IMPL_INPUTS}" ${INDEX} CAPS ${CAP_IDX} name)
string(JSON CAP_TYPE GET "${IMPL_INPUTS}" ${INDEX} CAPS ${CAP_IDX} type)

# -> TODO: improve validation, input should be string
if(CAP_TYPE_ERROR)
set(CAP_KIND limits) # I assume its limit by default (or when invalid value present, currently)
else()
if(NOT CAP_KIND MATCHES "^(limits|features)$")
ERROR_WHILE_PARSING_ITEM(
"Invalid CAP kind \"${CAP_KIND}\" for ${CAP_NAME}\n"
"Allowed kinds are: limits, features"
)
endif()
endif()
# <-

if(NOT CAP_TYPE MATCHES "^(bool|uint16_t|uint32_t|uint64_t)$")
ERROR_WHILE_PARSING_ITEM(
"Invalid CAP type \"${CAP_TYPE}\" for ${CAP_NAME}\n"
Expand Down Expand Up @@ -1366,6 +1417,7 @@ namespace @IMPL_NAMESPACE@ {
set(CAP_VALUES_${CAP_IDX} "${VALUES}")
list(APPEND CAP_NAMES "${CAP_NAME}")
list(APPEND CAP_TYPES "${CAP_TYPE}")
list(APPEND CAP_KINDS "${CAP_KIND}")
endforeach()
endif()

Expand Down Expand Up @@ -1399,68 +1451,81 @@ namespace @IMPL_NAMESPACE@ {
nbl::core::string retval = "@BASE_KEY@";
@RETVAL_EVAL@
retval += ".spv";
return retval;
return "$<CONFIG>/" + retval;
}
}

]=])
unset(RETVAL_EVAL)
foreach(CAP ${CAP_NAMES})
string(CONFIGURE [=[
retval += ".@CAP@_" + std::to_string(limits.@CAP@);
]=] RETVALUE_VIEW @ONLY)
string(APPEND RETVAL_EVAL "${RETVALUE_VIEW}")
endforeach(CAP)
list(LENGTH CAP_NAMES CAP_COUNT)
if(CAP_COUNT GREATER 0)
math(EXPR LAST_CAP "${CAP_COUNT} - 1")
foreach(i RANGE ${LAST_CAP})
list(GET CAP_NAMES ${i} CAP)
list(GET CAP_KINDS ${i} KIND)
string(CONFIGURE [=[
retval += ".@CAP@_" + std::to_string(@KIND@.@CAP@);
]=] RETVALUE_VIEW @ONLY)
string(APPEND RETVAL_EVAL "${RETVALUE_VIEW}")
endforeach()
endif()

string(CONFIGURE "${HEADER_ITEM_VIEW}" HEADER_ITEM_EVAL @ONLY)
set_property(TARGET ${IMPL_TARGET} APPEND_STRING PROPERTY NBL_HEADER_CONTENT "${HEADER_ITEM_EVAL}")

function(GENERATE_KEYS PREFIX CAP_INDEX CAPS_EVAL_PART)
if(NUM_CAPS EQUAL 0 OR CAP_INDEX EQUAL ${NUM_CAPS})
# generate .config file
set(FINAL_KEY "${BASE_KEY}${PREFIX}.spv") # always add ext even if its already there to make sure asset loader always is able to load as IShader

set(TARGET_OUTPUT "${IMPL_BINARY_DIR}/${FINAL_KEY}")
set(CONFIG_FILE "${TARGET_OUTPUT}.config")
set(CONFIG_FILE_TARGET_OUTPUT "${IMPL_BINARY_DIR}/${FINAL_KEY}")
set(CONFIG_FILE "${CONFIG_FILE_TARGET_OUTPUT}.config")
set(CAPS_EVAL "${CAPS_EVAL_PART}")

string(CONFIGURE "${DEVICE_CONFIG_VIEW}" CONFIG_CONTENT @ONLY)
file(WRITE "${CONFIG_FILE}" "${CONFIG_CONTENT}")

set(NBL_NSC_COMPILE_COMMAND
"$<TARGET_FILE:nsc>"
-Fc "${TARGET_OUTPUT}"
${COMPILE_OPTIONS} ${REQUIRED_OPTIONS} ${IMPL_COMMON_OPTIONS}
"${CONFIG_FILE}"
)

add_custom_command(OUTPUT "${TARGET_OUTPUT}"
COMMAND ${NBL_NSC_COMPILE_COMMAND}
DEPENDS ${DEPENDS_ON}
COMMENT "Creating \"${TARGET_OUTPUT}\""
VERBATIM
COMMAND_EXPAND_LISTS
)

set(HEADER_ONLY_LIKE "${CONFIG_FILE}" "${TARGET_INPUT}" "${TARGET_OUTPUT}")
target_sources(${IMPL_TARGET} PRIVATE ${HEADER_ONLY_LIKE})

set_source_files_properties(${HEADER_ONLY_LIKE} PROPERTIES
HEADER_FILE_ONLY ON
VS_TOOL_OVERRIDE None
)

set_source_files_properties("${TARGET_OUTPUT}" PROPERTIES
NBL_SPIRV_REGISTERED_INPUT "${TARGET_INPUT}"
NBL_SPIRV_PERMUTATION_CONFIG "${CONFIG_FILE}"
NBL_SPIRV_BINARY_DIR "${IMPL_BINARY_DIR}"
NBL_SPIRV_ACCESS_KEY "${FINAL_KEY}"
)

set_property(TARGET ${IMPL_TARGET} APPEND PROPERTY NBL_SPIRV_OUTPUTS "${TARGET_OUTPUT}")
# generate keys and commands for compiling shaders
foreach(BUILD_CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})
set(FINAL_KEY_REL_PATH "${BUILD_CONFIGURATION}/${FINAL_KEY}")
set(TARGET_OUTPUT "${IMPL_BINARY_DIR}/${FINAL_KEY_REL_PATH}")

set(NBL_NSC_COMPILE_COMMAND
"$<TARGET_FILE:nsc>"
-Fc "${TARGET_OUTPUT}"
${COMPILE_OPTIONS} ${REQUIRED_OPTIONS} ${IMPL_COMMON_OPTIONS}
"${CONFIG_FILE}"
)

add_custom_command(OUTPUT "${TARGET_OUTPUT}"
COMMAND ${NBL_NSC_COMPILE_COMMAND}
DEPENDS ${DEPENDS_ON}
COMMENT "Creating \"${TARGET_OUTPUT}\""
VERBATIM
COMMAND_EXPAND_LISTS
)

set(HEADER_ONLY_LIKE "${CONFIG_FILE}" "${TARGET_INPUT}" "${TARGET_OUTPUT}")
target_sources(${IMPL_TARGET} PRIVATE ${HEADER_ONLY_LIKE})

set_source_files_properties(${HEADER_ONLY_LIKE} PROPERTIES
HEADER_FILE_ONLY ON
VS_TOOL_OVERRIDE None
)

set_source_files_properties("${TARGET_OUTPUT}" PROPERTIES
NBL_SPIRV_REGISTERED_INPUT "${TARGET_INPUT}"
NBL_SPIRV_PERMUTATION_CONFIG "${CONFIG_FILE}"
NBL_SPIRV_BINARY_DIR "${IMPL_BINARY_DIR}"
NBL_SPIRV_ACCESS_KEY "${FINAL_KEY_REL_PATH}"
)

set_property(TARGET ${IMPL_TARGET} APPEND PROPERTY NBL_SPIRV_OUTPUTS "${TARGET_OUTPUT}")
endforeach()
return()
endif()

list(GET CAP_NAMES ${CAP_INDEX} CURRENT_CAP)
list(GET CAP_TYPES ${CAP_INDEX} CURRENT_TYPE)
list(GET CAP_KINDS ${CAP_INDEX} CURRENT_KIND)
set(VAR_NAME "CAP_VALUES_${CAP_INDEX}")
set(VALUES "${${VAR_NAME}}")

Expand Down Expand Up @@ -1534,4 +1599,4 @@ function(NBL_CREATE_RESOURCE_ARCHIVE)
if(IMPL_LINK_TO)
LINK_BUILTIN_RESOURCES_TO_TARGET(${IMPL_LINK_TO} ${IMPL_TARGET})
endif()
endfunction()
endfunction()
Loading
Loading