diff options
| author | venkataram-nv <vedavamadath@nvidia.com> | 2024-07-01 10:08:04 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-01 10:08:04 -0700 |
| commit | 0e71a6d40d2ccdc9e6bb861e7bbdb9479dbec636 (patch) | |
| tree | 4d43b38d7c1de52caba5e48e118021dced1ac7a8 /examples/gpu-printing/main.cpp | |
| parent | d276ea3558e2ac0672a3340301d2dec6d5cf321b (diff) | |
Resource searching for examples (#4518)
Diffstat (limited to 'examples/gpu-printing/main.cpp')
| -rw-r--r-- | examples/gpu-printing/main.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/examples/gpu-printing/main.cpp b/examples/gpu-printing/main.cpp index 984534a7b..39b97a889 100644 --- a/examples/gpu-printing/main.cpp +++ b/examples/gpu-printing/main.cpp @@ -1,19 +1,21 @@ // main.cpp +#include <string> #include <slang.h> #include <slang-com-ptr.h> using Slang::ComPtr; +#include "gpu-printing.h" #include "slang-gfx.h" #include "gfx-util/shader-cursor.h" #include "tools/platform/window.h" #include "source/core/slang-basic.h" -using namespace gfx; +#include "examples/example-base/example-base.h" -#include <string> +using namespace gfx; -#include "gpu-printing.h" +static const ExampleResources resourceBase("gpu-printing"); ComPtr<slang::ISession> createSlangSession(gfx::IDevice* device) { @@ -87,11 +89,16 @@ Result execute() Result res = gfxCreateDevice(&deviceDesc, gDevice.writeRef()); if(SLANG_FAILED(res)) return res; + Slang::String path = resourceBase.resolveResource("kernels.slang"); + gSlangSession = createSlangSession(gDevice); - gSlangModule = compileShaderModuleFromFile(gSlangSession, "kernels.slang"); + gSlangModule = compileShaderModuleFromFile(gSlangSession, path.getBuffer()); + if(!gSlangModule) + return SLANG_FAIL; gProgram = loadComputeProgram(gSlangModule, "computeMain"); - if(!gProgram) return SLANG_FAIL; + if(!gProgram) + return SLANG_FAIL; ComputePipelineStateDesc desc; desc.program = gProgram; |
