From 0e71a6d40d2ccdc9e6bb861e7bbdb9479dbec636 Mon Sep 17 00:00:00 2001 From: venkataram-nv Date: Mon, 1 Jul 2024 10:08:04 -0700 Subject: Resource searching for examples (#4518) --- examples/triangle/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'examples/triangle/main.cpp') diff --git a/examples/triangle/main.cpp b/examples/triangle/main.cpp index bd6542b38..90589c157 100644 --- a/examples/triangle/main.cpp +++ b/examples/triangle/main.cpp @@ -42,6 +42,8 @@ using namespace gfx; using namespace Slang; +static const ExampleResources resourceBase("triangle"); + // For the purposes of a small example, we will define the vertex data for a // single triangle directly in the source file. It should be easy to extend // this example to load data from an external source, if desired. @@ -112,7 +114,8 @@ gfx::Result loadShaderProgram( // already been loaded previously, that would be used directly. // ComPtr diagnosticsBlob; - slang::IModule* module = slangSession->loadModule("shaders", diagnosticsBlob.writeRef()); + Slang::String path = resourceBase.resolveResource("shaders.slang"); + slang::IModule* module = slangSession->loadModule(path.getBuffer(), diagnosticsBlob.writeRef()); diagnoseIfNeeded(diagnosticsBlob); if(!module) return SLANG_FAIL; -- cgit v1.2.3