From e595743b5aa4f6bd88800cfbcfd6eead3cc3d01b Mon Sep 17 00:00:00 2001 From: "Harsh Aggarwal (NVIDIA)" Date: Fri, 8 Aug 2025 03:13:25 +0530 Subject: 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. - --- source/core/slang-platform.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'source/core/slang-platform.cpp') 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( -- cgit v1.2.3