22// This file is part of the "Nabla Engine".
33// For conditions of distribution and use, see copyright notice in nabla.h
44
5+ #include " nbl/this_example/builtin/build/spirv/keys.hpp"
6+
57#include " nbl/examples/examples.hpp"
68
79using namespace nbl ;
@@ -44,15 +46,6 @@ class FFT_Test final : public application_templates::MonoDeviceApplication, publ
4446 smart_refctd_ptr<ISemaphore> m_timeline;
4547 uint64_t semaphorValue = 0 ;
4648
47- inline core::smart_refctd_ptr<asset::IShader> createShader (
48- const char * includeMainName)
49- {
50- std::string prelude = " #include \" " ;
51- auto hlslShader = core::make_smart_refctd_ptr<IShader>((prelude + includeMainName + " \"\n " ).c_str (), IShader::E_CONTENT_TYPE::ECT_HLSL, includeMainName);
52- assert (hlslShader);
53- return m_device->compileShader ({ hlslShader.get () });
54- }
55-
5649public:
5750 // Yay thanks to multiple inheritance we cannot forward ctors anymore
5851 FFT_Test (const path& _localInputCWD, const path& _localOutputCWD, const path& _sharedInputCWD, const path& _sharedOutputCWD) :
@@ -67,28 +60,23 @@ class FFT_Test final : public application_templates::MonoDeviceApplication, publ
6760 if (!asset_base_t::onAppInitialized (std::move (system)))
6861 return false ;
6962
70- // this time we load a shader directly from a file
7163 smart_refctd_ptr<IShader> shader;
72- /* {
64+ {
7365 IAssetLoader::SAssetLoadParams lp = {};
7466 lp.logger = m_logger.get ();
75- lp.workingDirectory = ""; // virtual root
76- auto assetBundle = m_assetMgr->getAsset("app_resources/shader.comp.hlsl", lp);
67+ lp.workingDirectory = " app_resources" ; // virtual root
68+ auto key = nbl::this_example::builtin::build::get_spirv_key<" shader" >(m_device.get ());
69+ auto assetBundle = m_assetMgr->getAsset (key.data (), lp);
7770 const auto assets = assetBundle.getContents ();
7871 if (assets.empty ())
7972 return logFail (" Could not load shader!" );
8073
8174 // Cast down the asset to its proper type
82- auto source = IAsset::castDown<IShader>(assets[0]);
83- // The down-cast should not fail!
84- assert(source);
85-
86- // Compile directly to SPIR-V Shader
87- shader = m_device->compileShader({ source.get() });
75+ shader = IAsset::castDown<IShader>(assets[0 ]);
76+
8877 if (!shader)
89- return logFail("Creation of a SPIR-V Shader from HLSL Shader source failed!");
90- }*/
91- shader = createShader (" app_resources/shader.comp.hlsl" );
78+ return logFail (" Invalid shader!" );
79+ }
9280
9381 // Create massive upload/download buffers
9482 constexpr uint32_t DownstreamBufferSize = sizeof (scalar_t ) << 23 ;
0 commit comments