summaryrefslogtreecommitdiffstats
path: root/examples/cpu-com-example/main.cpp
diff options
context:
space:
mode:
authorvenkataram-nv <vedavamadath@nvidia.com>2024-07-01 10:08:04 -0700
committerGitHub <noreply@github.com>2024-07-01 10:08:04 -0700
commit0e71a6d40d2ccdc9e6bb861e7bbdb9479dbec636 (patch)
tree4d43b38d7c1de52caba5e48e118021dced1ac7a8 /examples/cpu-com-example/main.cpp
parentd276ea3558e2ac0672a3340301d2dec6d5cf321b (diff)
Resource searching for examples (#4518)
Diffstat (limited to 'examples/cpu-com-example/main.cpp')
-rw-r--r--examples/cpu-com-example/main.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/cpu-com-example/main.cpp b/examples/cpu-com-example/main.cpp
index dedbf69f5..d75822e72 100644
--- a/examples/cpu-com-example/main.cpp
+++ b/examples/cpu-com-example/main.cpp
@@ -9,11 +9,14 @@
// 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
using namespace Slang;
+static const ExampleResources resourceBase("cpu-com-example");
+
// For the moment we have to explicitly write the Slang COM interface in C++ code. It *MUST* match
// the interface in the slang source
// As it stands all interfaces need to derive from ISlangUnknown (or IUnknown).
@@ -79,7 +82,8 @@ static SlangResult _innerMain(int argc, char** argv)
const int translationUnitIndex = request->addTranslationUnit(SLANG_SOURCE_LANGUAGE_SLANG, nullptr);
// Set the source file for the translation unit
- request->addTranslationUnitSourceFile(translationUnitIndex, "shader.slang");
+ Slang::String path = resourceBase.resolveResource("shader.slang");
+ request->addTranslationUnitSourceFile(translationUnitIndex, path.getBuffer());
const SlangResult compileRes = request->compile();