summaryrefslogtreecommitdiffstats
path: root/source/core/slang-platform.cpp
diff options
context:
space:
mode:
authorHarsh Aggarwal (NVIDIA) <haaggarwal@nvidia.com>2025-08-08 03:13:25 +0530
committerGitHub <noreply@github.com>2025-08-07 21:43:25 +0000
commite595743b5aa4f6bd88800cfbcfd6eead3cc3d01b (patch)
tree4e019aaf7218b1c0113ad35d935c82aa0c6d5964 /source/core/slang-platform.cpp
parent4721b6ef2dd4e1b39c85acc492f9c6af8898a34b (diff)
Fix intrinsic LoadLocalRootTableConstant for optix (#7949)
Due to an older version of spec referred there was an inconsitency v1.29 2/20/2025 - [HitObject LoadLocalRootArgumentsConstant] Latest spec https://microsoft.github.io/DirectX-Specs/d3d/Raytracing.html#hitobject-loadlocalroottableconstant Refer: OptiX backend support for Shader Execution Reordering (SER) features as outlined in issue #6647. -
Diffstat (limited to 'source/core/slang-platform.cpp')
-rw-r--r--source/core/slang-platform.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/source/core/slang-platform.cpp b/source/core/slang-platform.cpp
index aab1f3044..f7e82fdf0 100644
--- a/source/core/slang-platform.cpp
+++ b/source/core/slang-platform.cpp
@@ -174,12 +174,27 @@ SLANG_COMPILE_TIME_ASSERT(E_OUTOFMEMORY == SLANG_E_OUT_OF_MEMORY);
}
#else // _WIN32
-
/* static */ SlangResult PlatformUtil::getInstancePath([[maybe_unused]] StringBuilder& out)
{
- // On non Windows it's typically hard to get the instance path, so we'll say not implemented.
- // The meaning is also somewhat more ambiguous - is it the exe or the shared library path?
+#if defined(__linux__) || defined(__CYGWIN__)
+ char path[PATH_MAX];
+ ssize_t len = readlink("/proc/self/exe", path, sizeof(path) - 1);
+ if (len == -1)
+ {
+ return SLANG_FAIL;
+ }
+
+ path[len] = '\0';
+ String pathString(path);
+
+ // We don't want the instance name, just the path to it
+ out.clear();
+ out.append(Path::getParentDirectory(pathString));
+
+ return out.getLength() > 0 ? SLANG_OK : SLANG_FAIL;
+#else
return SLANG_E_NOT_IMPLEMENTED;
+#endif
}
/* static */ SlangResult PlatformUtil::appendResult(