File tree Expand file tree Collapse file tree 2 files changed +49
-2
lines changed
05_StreamingAndBufferDeviceAddressApp Expand file tree Collapse file tree 2 files changed +49
-2
lines changed Original file line number Diff line number Diff line change @@ -21,4 +21,48 @@ if(NBL_EMBED_BUILTIN_RESOURCES)
2121 ADD_CUSTOM_BUILTIN_RESOURCES(${_BR_TARGET_} RESOURCES_TO_EMBED "${_SEARCH_DIRECTORIES_} " "${RESOURCE_DIR} " "nbl::this_example::builtin" "${_OUTPUT_DIRECTORY_HEADER_} " "${_OUTPUT_DIRECTORY_SOURCE_} " )
2222
2323 LINK_BUILTIN_RESOURCES_TO_TARGET(${EXECUTABLE_NAME} ${_BR_TARGET_} )
24- endif ()
24+ endif ()
25+
26+ set (OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR} /auto-gen" )
27+ set (DEPENDS
28+ app_resources/common.hlsl
29+ app_resources/shader.comp.hlsl
30+ )
31+
32+ set (JSON [=[
33+ [
34+ {
35+ "INPUT": "app_resources/shader.comp.hlsl",
36+ "KEY": "shader",
37+ }
38+ ]
39+ ]=])
40+ string (CONFIGURE "${JSON} " JSON)
41+
42+ set (COMPILE_OPTIONS
43+ -I "${CMAKE_CURRENT_SOURCE_DIR} "
44+ -O3
45+ -T lib_${SM}
46+ )
47+
48+ NBL_CREATE_NSC_COMPILE_RULES(
49+ TARGET ${EXECUTABLE_NAME} SPIRV
50+ LINK_TO ${EXECUTABLE_NAME}
51+ DEPENDS ${DEPENDS}
52+ BINARY_DIR ${OUTPUT_DIRECTORY}
53+ MOUNT_POINT_DEFINE NBL_THIS_EXAMPLE_BUILD_MOUNT_POINT
54+ COMMON_OPTIONS -I ${CMAKE_CURRENT_SOURCE_DIR}
55+ OUTPUT_VAR KEYS
56+ INCLUDE nbl/this_example/builtin/build /spirv/keys.hpp
57+ NAMESPACE nbl::this_example::builtin::build
58+ INPUTS ${JSON}
59+ )
60+
61+ NBL_CREATE_RESOURCE_ARCHIVE(
62+ NAMESPACE nbl::this_example::builtin::build
63+ TARGET ${EXECUTABLE_NAME} _builtinsBuild
64+ LINK_TO ${EXECUTABLE_NAME}
65+ BIND ${OUTPUT_DIRECTORY}
66+ BUILTINS ${KEYS}
67+ COMMON_OPTIONS ${COMPILE_OPTIONS}
68+ )
Original file line number Diff line number Diff line change 66// I've moved out a tiny part of this example into a shared header for reuse, please open and read it.
77#include " nbl/application_templates/MonoDeviceApplication.hpp"
88#include " nbl/examples/common/BuiltinResourcesApplication.hpp"
9+ #include " nbl/this_example/builtin/build/spirv/keys.hpp"
910
1011
1112using namespace nbl ;
@@ -96,7 +97,9 @@ class StreamingAndBufferDeviceAddressApp final : public application_templates::M
9697 IAssetLoader::SAssetLoadParams lp = {};
9798 lp.logger = m_logger.get ();
9899 lp.workingDirectory = " " ; // virtual root
99- auto assetBundle = m_assetMgr->getAsset (" app_resources/shader.comp.hlsl" ,lp);
100+
101+ auto key = " app_resources/" + nbl::this_example::builtin::build::get_spirv_key<" shader" >(m_device.get ());
102+ auto assetBundle = m_assetMgr->getAsset (key.data (), lp);
100103 const auto assets = assetBundle.getContents ();
101104 if (assets.empty ())
102105 return logFail (" Could not load shader!" );
You can’t perform that action at this time.
0 commit comments