head 1.1; access; symbols; locks; strict; comment @// @; 1.1 date 2026.09.24.18.41.26; author ktnb; state Exp; branches; next ; commitid AK5A9yfwAFPPbUWG; desc @@ 1.1 log @Slang is a shading language that makes it easier to build and maintain large shader codebases in a modular and extensible fashion, while also maintaining the highest possible performance on modern GPUs and graphics APIs. Slang is based on years of collaboration between researchers at NVIDIA, Carnegie Mellon University, Stanford, MIT, UCSD and the University of Washington. The Slang compiler can generate code for a wide variety of targets: D3D12, Vulkan, Metal, D3D11, CUDA, and even generate code to run on a CPU. For textual targets, such as Metal Shading Language (MSL) and CUDA, Slang produces readable code that preserves original identifier names, as well as the type and call structure, making it easier to debug. @ text @$NetBSD$ use NetBSD sysctl(3) instead of the Linux way. --- source/core/slang-io.cpp.orig 2026-09-23 15:19:58.072004104 +0000 +++ source/core/slang-io.cpp @@@@ -22,7 +22,7 @@@@ // clang-format on #endif -#if defined(__linux__) || defined(__CYGWIN__) || SLANG_APPLE_FAMILY || SLANG_WASM +#if SLANG_LINUX_FAMILY || SLANG_APPLE_FAMILY || SLANG_WASM #include #include // For Path::find @@@@ -37,6 +37,10 @@@@ #include #endif +#if defined(__NetBSD__) +#include +#endif + #include #include /* PATH_MAX */ #include @@@@ -1025,6 +1029,19 @@@@ static SlangResult _calcExectuablePath(char* outPath, } // Zero terminate outPath[resSize] = 0; + return SLANG_OK; +#elif defined(__NetBSD__) + int mib[4] = {CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME}; + size_t len = bufferSize; + if (::sysctl(mib, 4, outPath, &len, nullptr, 0) != 0) + { + if (errno == ENOMEM) + { + *ioSize = len; + return SLANG_E_BUFFER_TOO_SMALL; + } + return SLANG_FAIL; + } return SLANG_OK; #else String text = Slang::File::readAllText("/proc/self/maps"); @