summaryrefslogtreecommitdiff
path: root/examples/shader-toy
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/shader-toy
parentd276ea3558e2ac0672a3340301d2dec6d5cf321b (diff)
Resource searching for examples (#4518)
Diffstat (limited to 'examples/shader-toy')
-rw-r--r--examples/shader-toy/main.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/shader-toy/main.cpp b/examples/shader-toy/main.cpp
index ec161aee8..105c74cc0 100644
--- a/examples/shader-toy/main.cpp
+++ b/examples/shader-toy/main.cpp
@@ -28,6 +28,8 @@ using Slang::ComPtr;
#include <chrono>
+static const ExampleResources resourceBase("shader-toy");
+
using namespace gfx;
// In order to display a shader toy effect using rasterization-based shader
@@ -109,7 +111,8 @@ Result loadShaderProgram(gfx::IDevice* device, ComPtr<gfx::IShaderProgram>& outS
// import shader_toy;
//
ComPtr<slang::IBlob> diagnosticsBlob;
- slang::IModule* module = slangSession->loadModule("shader-toy", diagnosticsBlob.writeRef());
+ Slang::String shaderToyPath = resourceBase.resolveResource("shader-toy.slang");
+ slang::IModule* module = slangSession->loadModule(shaderToyPath.getBuffer(), diagnosticsBlob.writeRef());
diagnoseIfNeeded(diagnosticsBlob);
if(!module)
return SLANG_FAIL;
@@ -197,9 +200,9 @@ Result loadShaderProgram(gfx::IDevice* device, ComPtr<gfx::IShaderProgram>& outS
// same module, and to demonstrate that we will load a different
// module to provide the effect type we will plug in.
//
- const char* effectModuleName = "example-effect";
const char* effectTypeName = "ExampleEffect";
- slang::IModule* effectModule = slangSession->loadModule(effectModuleName, diagnosticsBlob.writeRef());
+ Slang::String effectModulePath = resourceBase.resolveResource("example-effect.slang");
+ slang::IModule* effectModule = slangSession->loadModule(effectModulePath.getBuffer(), diagnosticsBlob.writeRef());
diagnoseIfNeeded(diagnosticsBlob);
if(!module)
return SLANG_FAIL;