Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
f2ea51d
Morton code tests
Fletterio Mar 23, 2025
8f4e452
Morton codes creating properly
Fletterio Mar 25, 2025
0aedfd9
All tests passing, HLSL compiles fine!
Fletterio Mar 28, 2025
ea42d5b
Rename example
Fletterio Apr 1, 2025
2ba08a4
Add tests for AddCarry and SUbBorrow intrinsics
Fletterio Apr 1, 2025
f00bbf6
Disable intrinsic tests for uSUbBorrow for the time being, start copy…
Fletterio Apr 7, 2025
b2d87c3
Added extensive tests for Morton codes
Fletterio Apr 24, 2025
c68c336
Done with tests
Fletterio Apr 28, 2025
d906bb2
Merged master
Fletterio Apr 28, 2025
f05dec4
Clarifying comment for blocker issue
Fletterio Apr 28, 2025
ea43934
added tests for iridescent bxdfs
keptsecret Aug 27, 2025
ceb40d1
Merge branch 'bxdf_unit_tests' into iridescent_bxdf_tests
keptsecret Aug 28, 2025
91658e3
fix small typo
keptsecret Aug 28, 2025
6b5f3e8
forgot to set parallel execution
keptsecret Aug 28, 2025
9920683
refactor changes to colorspace stuff
keptsecret Aug 28, 2025
8a8f958
Enabled build time shader compilation in example 05
Przemog1 Oct 22, 2025
f1a3ee5
Fix
Przemog1 Oct 22, 2025
e301db5
Updated source file generation of the 05_streamingandbufferdeviceaddr…
Przemog1 Oct 22, 2025
f85ae80
Enabled build time shader compilation in multiple examples
Przemog1 Oct 23, 2025
22f2a17
Fixed project creation of multiple examples
Przemog1 Oct 27, 2025
974d23f
Enabled build time shader compilation in example 10
Przemog1 Oct 28, 2025
eb1e29f
Enabled build time shader compilation in example 71
Przemog1 Oct 28, 2025
e1e8dd6
Replaced `vk::RawBufferLoad` with `vk::PointerBuffer` in example 71
Przemog1 Oct 30, 2025
829ea34
merge bxdf_unit_tests, fix conflicts
keptsecret Nov 3, 2025
c022a23
revert using colorspace mat
keptsecret Nov 4, 2025
f6371c7
a number of minor test fixes, disabled iridescent test temporarily
keptsecret Nov 4, 2025
9d79107
refactor new interaction template
keptsecret Nov 6, 2025
a20e33d
enable tests for iridescent bxdf
keptsecret Nov 7, 2025
a980364
refactor tests, remove todo comments
keptsecret Nov 10, 2025
1e1a008
refactor tests, enable all of them
keptsecret Nov 11, 2025
6d0a3fe
move example from nbl::hlsl namespace, minor fixes
keptsecret Nov 11, 2025
e5f6e18
refactor iridescent bxdf creation
keptsecret Nov 13, 2025
b13fdc7
Merge branch 'master' into mortons
Nov 19, 2025
08c898d
Reindex mortons example from 12 to 73
Nov 27, 2025
7f8dd73
Global variable of hlsl to use NBL_CONSTEXPR_INLINE_NSPC_SCOPE_VAR
Nov 28, 2025
43b8634
Add test for operator-
Dec 1, 2025
ba6641f
Use 1, 1, 1 workgroup dimension
Dec 1, 2025
e830c34
Enable previously failed test because of bug in glm
Dec 1, 2025
4969227
Work on cooperative binary search
deprilula28 Nov 16, 2025
e546428
Patch things for cooperative binary search test
deprilula28 Dec 3, 2025
5886b30
Fix test
deprilula28 Dec 3, 2025
7950663
Remove unecessary leftover file
deprilula28 Dec 3, 2025
eb7d4fe
Removed forced -O3 optimization
Przemog1 Dec 5, 2025
e35e61d
Example 73 to 15 and fix compile error
Dec 5, 2025
2e5642a
Remove example 73 mortons
Dec 8, 2025
197b46a
Enable second test set
Dec 9, 2025
6692311
Delete fillSecondTestValues
Dec 9, 2025
4287ed1
Fix morton test
Dec 10, 2025
6a7b003
Remove unnecessary code
Dec 10, 2025
f012a1a
Add some comment for the reason we have to CTester
Dec 10, 2025
f415e8c
Remove dummy code
Dec 10, 2025
8f72b9e
Fix compiler warning for shader compilation
Dec 11, 2025
3042409
Add back second test to first in commented form
Dec 12, 2025
7011ea0
Fix example 28 to use select instead of ternary_op
Dec 12, 2025
02eed2e
Fix example 28
Dec 12, 2025
1e8372b
Merge pull request #223 from Devsh-Graphics-Programming/precompiled_s…
AnastaZIuk Dec 12, 2025
30b4f52
prefix select with hlsl::
Dec 12, 2025
3e443b1
Add nbl prefix to hlsl::select
Dec 12, 2025
84eb1f7
Merge branch 'master' into mortons
Dec 12, 2025
85b7182
Merge pull request #187 from Devsh-Graphics-Programming/mortons
devshgraphicsprogramming Dec 12, 2025
07d0197
Patch for semantic clarity, remove usage of hlsl keyword named variable
Fletterio Dec 13, 2025
8a20833
refactor slightly
Dec 14, 2025
4ab1de2
Merge pull request #235 from Devsh-Graphics-Programming/touch_up_bina…
devshgraphicsprogramming Dec 14, 2025
4425ec1
ambiguity of `is_same_v` patched up
Dec 15, 2025
54c8ee4
merge master, fix conflicts
keptsecret Dec 16, 2025
061d79a
added test back in
keptsecret Dec 16, 2025
5ffb6bc
forgot to uncomment another transmission iridescent test
keptsecret Dec 16, 2025
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 03_DeviceSelectionAndSharedSources/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class DeviceSelectionAndSharedSourcesApp final : public application_templates::M
}

const auto* metadata = assetBundle.getMetadata();
const auto hlslMetadata = static_cast<const CHLSLMetadata*>(metadata);
const auto hlslMetadata = static_cast<const CHLSLMetadata*>(metadata);
const auto shaderStage = hlslMetadata->shaderStages->front();

// It would be super weird if loading a shader from a file produced more than 1 asset
Expand Down
47 changes: 46 additions & 1 deletion 05_StreamingAndBufferDeviceAddressApp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,49 @@ if(NBL_EMBED_BUILTIN_RESOURCES)
ADD_CUSTOM_BUILTIN_RESOURCES(${_BR_TARGET_} RESOURCES_TO_EMBED "${_SEARCH_DIRECTORIES_}" "${RESOURCE_DIR}" "nbl::this_example::builtin" "${_OUTPUT_DIRECTORY_HEADER_}" "${_OUTPUT_DIRECTORY_SOURCE_}")

LINK_BUILTIN_RESOURCES_TO_TARGET(${EXECUTABLE_NAME} ${_BR_TARGET_})
endif()
endif()

set(OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/auto-gen")
set(DEPENDS
app_resources/common.hlsl
app_resources/shader.comp.hlsl
)
target_sources(${EXECUTABLE_NAME} PRIVATE ${DEPENDS})
set_source_files_properties(${DEPENDS} PROPERTIES HEADER_FILE_ONLY ON)

set(SM 6_8)
set(JSON [=[
[
{
"INPUT": "app_resources/shader.comp.hlsl",
"KEY": "shader",
}
]
]=])
string(CONFIGURE "${JSON}" JSON)

set(COMPILE_OPTIONS
-I "${CMAKE_CURRENT_SOURCE_DIR}"
-T lib_${SM}
)

NBL_CREATE_NSC_COMPILE_RULES(
TARGET ${EXECUTABLE_NAME}SPIRV
LINK_TO ${EXECUTABLE_NAME}
DEPENDS ${DEPENDS}
BINARY_DIR ${OUTPUT_DIRECTORY}
MOUNT_POINT_DEFINE NBL_THIS_EXAMPLE_BUILD_MOUNT_POINT
COMMON_OPTIONS ${COMPILE_OPTIONS}
OUTPUT_VAR KEYS
INCLUDE nbl/this_example/builtin/build/spirv/keys.hpp
NAMESPACE nbl::this_example::builtin::build
INPUTS ${JSON}
)

NBL_CREATE_RESOURCE_ARCHIVE(
NAMESPACE nbl::this_example::builtin::build
TARGET ${EXECUTABLE_NAME}_builtinsBuild
LINK_TO ${EXECUTABLE_NAME}
BIND ${OUTPUT_DIRECTORY}
BUILTINS ${KEYS}
)
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#include "common.hlsl"

// just a small test
#include "nbl/builtin/hlsl/jit/device_capabilities.hlsl"

[[vk::push_constant]] PushConstantData pushConstants;

// does absolutely nothing, a later example will show how it gets used
template<typename capability_traits=nbl::hlsl::jit::device_capabilities_traits>
template<typename capability_traits=DeviceConfigCaps>
void dummyTraitTest() {}

[numthreads(WorkgroupSize,1,1)]
Expand Down
11 changes: 6 additions & 5 deletions 05_StreamingAndBufferDeviceAddressApp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// I've moved out a tiny part of this example into a shared header for reuse, please open and read it.
#include "nbl/application_templates/MonoDeviceApplication.hpp"
#include "nbl/examples/common/BuiltinResourcesApplication.hpp"
#include "nbl/this_example/builtin/build/spirv/keys.hpp"


using namespace nbl;
Expand Down Expand Up @@ -95,15 +96,15 @@ class StreamingAndBufferDeviceAddressApp final : public application_templates::M
{
IAssetLoader::SAssetLoadParams lp = {};
lp.logger = m_logger.get();
lp.workingDirectory = ""; // virtual root
auto assetBundle = m_assetMgr->getAsset("app_resources/shader.comp.hlsl",lp);
lp.workingDirectory = "app_resources"; // virtual root

auto key = nbl::this_example::builtin::build::get_spirv_key<"shader">(m_device.get());
auto assetBundle = m_assetMgr->getAsset(key.data(), lp);
const auto assets = assetBundle.getContents();
if (assets.empty())
return logFail("Could not load shader!");

// lets go straight from ICPUSpecializedShader to IGPUSpecializedShader
const auto shaderSource = IAsset::castDown<IShader>(assets[0]);
shader = m_device->compileShader({shaderSource.get()});
shader = IAsset::castDown<IShader>(assets[0]);
// The down-cast should not fail!
assert(shader);
}
Expand Down
47 changes: 46 additions & 1 deletion 07_StagingAndMultipleQueues/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,49 @@ if(NBL_EMBED_BUILTIN_RESOURCES)
ADD_CUSTOM_BUILTIN_RESOURCES(${_BR_TARGET_} RESOURCES_TO_EMBED "${_SEARCH_DIRECTORIES_}" "${RESOURCE_DIR}" "nbl::this_example::builtin" "${_OUTPUT_DIRECTORY_HEADER_}" "${_OUTPUT_DIRECTORY_SOURCE_}")

LINK_BUILTIN_RESOURCES_TO_TARGET(${EXECUTABLE_NAME} ${_BR_TARGET_})
endif()
endif()

set(OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/auto-gen")
set(DEPENDS
app_resources/common.hlsl
app_resources/comp_shader.hlsl
)
target_sources(${EXECUTABLE_NAME} PRIVATE ${DEPENDS})
set_source_files_properties(${DEPENDS} PROPERTIES HEADER_FILE_ONLY ON)

set(SM 6_8)
set(JSON [=[
[
{
"INPUT": "app_resources/comp_shader.hlsl",
"KEY": "comp_shader",
}
]
]=])
string(CONFIGURE "${JSON}" JSON)

set(COMPILE_OPTIONS
-I "${CMAKE_CURRENT_SOURCE_DIR}"
-T lib_${SM}
)

NBL_CREATE_NSC_COMPILE_RULES(
TARGET ${EXECUTABLE_NAME}SPIRV
LINK_TO ${EXECUTABLE_NAME}
DEPENDS ${DEPENDS}
BINARY_DIR ${OUTPUT_DIRECTORY}
MOUNT_POINT_DEFINE NBL_THIS_EXAMPLE_BUILD_MOUNT_POINT
COMMON_OPTIONS ${COMPILE_OPTIONS}
OUTPUT_VAR KEYS
INCLUDE nbl/this_example/builtin/build/spirv/keys.hpp
NAMESPACE nbl::this_example::builtin::build
INPUTS ${JSON}
)

NBL_CREATE_RESOURCE_ARCHIVE(
NAMESPACE nbl::this_example::builtin::build
TARGET ${EXECUTABLE_NAME}_builtinsBuild
LINK_TO ${EXECUTABLE_NAME}
BIND ${OUTPUT_DIRECTORY}
BUILTINS ${KEYS}
)
6 changes: 3 additions & 3 deletions 07_StagingAndMultipleQueues/app_resources/common.hlsl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "nbl/builtin/hlsl/cpp_compat.hlsl"

NBL_CONSTEXPR uint32_t WorkgroupSizeX = 16;
NBL_CONSTEXPR uint32_t WorkgroupSizeY = 16;
NBL_CONSTEXPR uint32_t WorkgroupSize = WorkgroupSizeX*WorkgroupSizeY;
NBL_CONSTEXPR_INLINE_NSPC_SCOPE_VAR uint32_t WorkgroupSizeX = 16;
NBL_CONSTEXPR_INLINE_NSPC_SCOPE_VAR uint32_t WorkgroupSizeY = 16;
NBL_CONSTEXPR_INLINE_NSPC_SCOPE_VAR uint32_t WorkgroupSize = WorkgroupSizeX*WorkgroupSizeY;

static const uint32_t FRAMES_IN_FLIGHT = 3u;

Expand Down
44 changes: 28 additions & 16 deletions 07_StagingAndMultipleQueues/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// I've moved out a tiny part of this example into a shared header for reuse, please open and read it.
#include "nbl/examples/examples.hpp"
#include "nbl/this_example/builtin/build/spirv/keys.hpp"

using namespace nbl;
using namespace nbl::core;
Expand Down Expand Up @@ -189,7 +190,7 @@ class StagingAndMultipleQueuesApp final : public application_templates::BasicMul
for (uint32_t imageIdx = 0; imageIdx < IMAGE_CNT; ++imageIdx)
{
const auto imagePathToLoad = imagesToLoad[imageIdx];
auto cpuImage = loadFistAssetInBundle<ICPUImage>(imagePathToLoad);
auto cpuImage = loadImageAsset(imagePathToLoad);
if (!cpuImage)
logFailAndTerminate("Failed to load image from path %s",ILogger::ELL_ERROR,imagePathToLoad);

Expand Down Expand Up @@ -279,17 +280,10 @@ class StagingAndMultipleQueuesApp final : public application_templates::BasicMul
}

// LOAD SHADER FROM FILE
smart_refctd_ptr<IShader> source;
{
source = loadFistAssetInBundle<IShader>("../app_resources/comp_shader.hlsl");
}
smart_refctd_ptr<IShader> shader = loadPreCompiledShader<"comp_shader">(); // "../app_resources/comp_shader.hlsl"

if (!source)
logFailAndTerminate("Could not create a CPU shader!");

core::smart_refctd_ptr<IShader> shader = m_device->compileShader({ source.get() });
if(!shader)
logFailAndTerminate("Could not compile shader to spirv!");
if (!shader)
logFailAndTerminate("Could not load the precompiled shader!");

// CREATE COMPUTE PIPELINE
SPushConstantRange pc[1];
Expand Down Expand Up @@ -534,21 +528,39 @@ class StagingAndMultipleQueuesApp final : public application_templates::BasicMul

return false;
}

template<typename AssetType>
core::smart_refctd_ptr<AssetType> loadFistAssetInBundle(const std::string& path)

core::smart_refctd_ptr<ICPUImage> loadImageAsset(const std::string& path)
{
IAssetLoader::SAssetLoadParams lp;
SAssetBundle bundle = m_assetMgr->getAsset(path, lp);
if (bundle.getContents().empty())
logFailAndTerminate("Couldn't load an asset.",ILogger::ELL_ERROR);
logFailAndTerminate("Couldn't load an image.",ILogger::ELL_ERROR);

auto asset = IAsset::castDown<AssetType>(bundle.getContents()[0]);
auto asset = IAsset::castDown<ICPUImage>(bundle.getContents()[0]);
if (!asset)
logFailAndTerminate("Incorrect asset loaded.",ILogger::ELL_ERROR);

return asset;
}

template<core::StringLiteral ShaderKey>
core::smart_refctd_ptr<IShader> loadPreCompiledShader()
{
IAssetLoader::SAssetLoadParams lp;
lp.logger = m_logger.get();
lp.workingDirectory = "app_resources";

auto key = nbl::this_example::builtin::build::get_spirv_key<ShaderKey>(m_device.get());
SAssetBundle bundle = m_assetMgr->getAsset(key.data(), lp);
if (bundle.getContents().empty())
logFailAndTerminate("Couldn't load a shader.", ILogger::ELL_ERROR);

auto asset = IAsset::castDown<IShader>(bundle.getContents()[0]);
if (!asset)
logFailAndTerminate("Incorrect asset loaded.", ILogger::ELL_ERROR);

return asset;
}
};

NBL_MAIN_FUNC(StagingAndMultipleQueuesApp)
67 changes: 67 additions & 0 deletions 10_CountingSort/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,70 @@ if(NBL_EMBED_BUILTIN_RESOURCES)

LINK_BUILTIN_RESOURCES_TO_TARGET(${EXECUTABLE_NAME} ${_BR_TARGET_})
endif()

set(OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/auto-gen")
set(DEPENDS
app_resources/common.hlsl
app_resources/prefix_sum_shader.comp.hlsl
app_resources/scatter_shader.comp.hlsl
)
target_sources(${EXECUTABLE_NAME} PRIVATE ${DEPENDS})
set_source_files_properties(${DEPENDS} PROPERTIES HEADER_FILE_ONLY ON)

set(SM 6_8)
set(REQUIRED_CAPS [=[
{
"kind": "limits",
"name": "maxComputeWorkGroupInvocations",
"type": "uint32_t",
"values": [256,512,1024]
},
{
"kind": "limits",
"name": "maxComputeSharedMemorySize",
"type": "uint32_t",
"values": [16384, 32768, 65536]
}
]=])

set(JSON [=[
[
{
"INPUT": "app_resources/prefix_sum_shader.comp.hlsl",
"KEY": "prefix_sum_shader",
"CAPS": [${REQUIRED_CAPS}]
},
{
"INPUT": "app_resources/scatter_shader.comp.hlsl",
"KEY": "scatter_shader",
"CAPS": [${REQUIRED_CAPS}]
}
]
]=])
string(CONFIGURE "${JSON}" JSON)

set(COMPILE_OPTIONS
-I "${CMAKE_CURRENT_SOURCE_DIR}"
-T lib_${SM}
)

NBL_CREATE_NSC_COMPILE_RULES(
TARGET ${EXECUTABLE_NAME}SPIRV
LINK_TO ${EXECUTABLE_NAME}
DEPENDS ${DEPENDS}
BINARY_DIR ${OUTPUT_DIRECTORY}
MOUNT_POINT_DEFINE NBL_THIS_EXAMPLE_BUILD_MOUNT_POINT
COMMON_OPTIONS ${COMPILE_OPTIONS}
OUTPUT_VAR KEYS
INCLUDE nbl/this_example/builtin/build/spirv/keys.hpp
NAMESPACE nbl::this_example::builtin::build
INPUTS ${JSON}
)

NBL_CREATE_RESOURCE_ARCHIVE(
NAMESPACE nbl::this_example::builtin::build
TARGET ${EXECUTABLE_NAME}_builtinsBuild
LINK_TO ${EXECUTABLE_NAME}
BIND ${OUTPUT_DIRECTORY}
BUILTINS ${KEYS}
)
6 changes: 6 additions & 0 deletions 10_CountingSort/app_resources/common.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ using namespace nbl::hlsl;
#ifdef __HLSL_VERSION
#include "nbl/builtin/hlsl/bda/bda_accessor.hlsl"

static const uint32_t WorkgroupSize = DeviceConfigCaps::maxComputeWorkGroupInvocations;
static const uint32_t MaxBucketCount = (DeviceConfigCaps::maxComputeSharedMemorySize / sizeof(uint32_t)) / 2;
static const uint32_t BucketCount = (MaxBucketCount > 3000) ? 3000 : MaxBucketCount;

using Ptr = bda::__ptr<uint32_t>;
using PtrAccessor = BdaAccessor<uint32_t>;

Expand Down Expand Up @@ -54,6 +58,8 @@ uint32_t3 glsl::gl_WorkGroupSize()
{
return uint32_t3(WorkgroupSize, 1, 1);
}


#endif

#endif
Loading