diff options
Diffstat (limited to 'examples/cpu-hello-world/main.cpp')
| -rw-r--r-- | examples/cpu-hello-world/main.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/cpu-hello-world/main.cpp b/examples/cpu-hello-world/main.cpp index 460b4698b..fedbf7ebe 100644 --- a/examples/cpu-hello-world/main.cpp +++ b/examples/cpu-hello-world/main.cpp @@ -25,6 +25,7 @@ // This includes a useful small function for setting up the prelude (described more further below). #include "../../source/core/slang-test-tool-util.h" +#include "examples/example-base/example-base.h" // Slang namespace is used for elements support code (like core) which we use here // for ComPtr<> and TestToolUtil @@ -40,6 +41,8 @@ using namespace Slang; #define SLANG_PRELUDE_NAMESPACE CPPPrelude #include "../../prelude/slang-cpp-types.h" +static const ExampleResources resourceBase("cpu-hello-world"); + struct UniformState; static SlangResult _innerMain(int argc, char** argv) @@ -102,7 +105,8 @@ static SlangResult _innerMain(int argc, char** argv) // We will load source code for our translation unit from the file `shader.slang`. // There are also variations of this API for adding source code from application-provided buffers. // - spAddTranslationUnitSourceFile(slangRequest, translationUnitIndex, "shader.slang"); + Slang::String path = resourceBase.resolveResource("shader.slang"); + spAddTranslationUnitSourceFile(slangRequest, translationUnitIndex, path.getBuffer()); // Once all of the input options for the compiler have been specified, // we can invoke `spCompile` to run the compiler and see if any errors |
