Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
60 changes: 59 additions & 1 deletion 14_Mortons/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,62 @@ 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()

if(MSVC)
target_compile_options("${EXECUTABLE_NAME}" PUBLIC "/fp:strict")
else()
target_compile_options("${EXECUTABLE_NAME}" PUBLIC -ffloat-store -frounding-math -fsignaling-nans -ftrapping-math)
endif()

set(OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/auto-gen")
set(DEPENDS
app_resources/common.hlsl
app_resources/testCommon.hlsl
app_resources/testCommon2.hlsl
app_resources/test.comp.hlsl
app_resources/test2.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/test.comp.hlsl",
"KEY": "test",
},
{
"INPUT": "app_resources/test2.comp.hlsl",
"KEY": "test2",
},
]
]=])
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}
)
886 changes: 427 additions & 459 deletions 14_Mortons/CTester.h

Large diffs are not rendered by default.

279 changes: 0 additions & 279 deletions 14_Mortons/ITester.h

This file was deleted.

13 changes: 8 additions & 5 deletions 14_Mortons/app_resources/test.comp.hlsl
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
//// Copyright (C) 2023-2024 - DevSH Graphics Programming Sp. z O.O.
//// This file is part of the "Nabla Engine".
//// For conditions of distribution and use, see copyright notice in nabla.h
#pragma shader_stage(compute)

#include "testCommon.hlsl"
#include "nbl/builtin/hlsl/glsl_compat/core.hlsl"
#include <nbl/builtin/hlsl/glsl_compat/core.hlsl>

[[vk::binding(0, 0)]] RWStructuredBuffer<InputTestValues> inputTestValues;
[[vk::binding(1, 0)]] RWStructuredBuffer<TestValues> outputTestValues;

[numthreads(1, 1, 1)]
[numthreads(256, 1, 1)]
[shader("compute")]
void main(uint3 invocationID : SV_DispatchThreadID)
void main()
{
uint32_t testID = glsl::gl_GlobalInvocationID().x;
fillTestValues(inputTestValues[testID], outputTestValues[testID]);
const uint invID = nbl::hlsl::glsl::gl_GlobalInvocationID().x;
TestExecutor executor;
executor(inputTestValues[invID], outputTestValues[invID]);
}

13 changes: 8 additions & 5 deletions 14_Mortons/app_resources/test2.comp.hlsl
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
//// Copyright (C) 2023-2024 - DevSH Graphics Programming Sp. z O.O.
//// This file is part of the "Nabla Engine".
//// For conditions of distribution and use, see copyright notice in nabla.h
#pragma shader_stage(compute)

#include "testCommon2.hlsl"
#include "nbl/builtin/hlsl/glsl_compat/core.hlsl"
#include <nbl/builtin/hlsl/glsl_compat/core.hlsl>

[[vk::binding(0, 0)]] RWStructuredBuffer<InputTestValues> inputTestValues;
[[vk::binding(1, 0)]] RWStructuredBuffer<TestValues> outputTestValues;

[numthreads(1, 1, 1)]
[numthreads(256, 1, 1)]
[shader("compute")]
void main(uint3 invocationID : SV_DispatchThreadID)
void main()
{
uint32_t testID = glsl::gl_GlobalInvocationID().x;
fillTestValues2(inputTestValues[testID], outputTestValues[testID]);
const uint invID = nbl::hlsl::glsl::gl_GlobalInvocationID().x;
TestExecutor2 executor;
executor(inputTestValues[invID], outputTestValues[invID]);
}

Loading