upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/main.cpp
diff options
context:
space:
mode:
authorJan Trencansky <jan.trencansky@protonmail.com>2026-11-23 14:50:00 -0500
committerJan Trencansky <jan.trencansky@protonmail.com>2026-11-23 14:50:00 -0500
commitf57ed9da22d9bd258db541e4537006727bc872ad (patch)
tree080ad437583c4db995901a2d766767a338609935 /runtime/src/main.cpp
parent867d922f09b86583859796a174df89555fb32da8 (diff)
d3d12: a shader path that is not UTF-8 never throws, and LEONIDA_SHADERS is absolute
- A shader_path.txt that is not UTF-8 no longer throws out of Create*PipelineState: MSVC's STL reports the failed conversion as std::system_error, not filesystem_error. configured_shader_directory() returns the reason instead, and DeviceState::library() catches every std::exception, so the "invalid translated shader path" message prints and the pipeline fails. The reader of the file itself is unchanged. - A relative LEONIDA_SHADERS no longer follows the current directory: gta6rt makes it absolute at startup, next to --game-dir and --overlay, and ShaderLibrary::load keeps an absolute folder for the modules it reads later. Tests: d3d12_shader_path_test (new, Windows, no GPU) and a relative-folder check in shader_library_test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/main.cpp')
-rw-r--r--runtime/src/main.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp
index 71a5b44e1..a3d0996dc 100644
--- a/runtime/src/main.cpp
+++ b/runtime/src/main.cpp
@@ -111,6 +111,15 @@ int wmain(int argc, wchar_t** argv) {
111 }; 111 };
112 game_dir = game_dir.empty() ? absolute_or_same(image).parent_path() : absolute_or_same(game_dir); 112 game_dir = game_dir.empty() ? absolute_or_same(image).parent_path() : absolute_or_same(game_dir);
113 if (!overlay_dir.empty()) overlay_dir = absolute_or_same(overlay_dir); 113 if (!overlay_dir.empty()) overlay_dir = absolute_or_same(overlay_dir);
114 // LEONIDA_SHADERS too: the D3D12 device reads it at the title's first pipeline state, after it may have moved.
115 if (const DWORD size = GetEnvironmentVariableW(L"LEONIDA_SHADERS", nullptr, 0)) {
116 std::wstring shaders(size, L'\0');
117 const DWORD n = GetEnvironmentVariableW(L"LEONIDA_SHADERS", shaders.data(), size);
118 if (n && n < size) {
119 shaders.resize(n);
120 SetEnvironmentVariableW(L"LEONIDA_SHADERS", absolute_or_same(shaders).c_str());
121 }
122 }
114 // An image without relocations whose range this process already uses (arm64 Wine on macOS) runs in a new 123 // An image without relocations whose range this process already uses (arm64 Wine on macOS) runs in a new
115 // process that has the range reserved from the start (base_reservation.h); that process does not do this again. 124 // process that has the range reserved from the start (base_reservation.h); that process does not do this again.
116 if (!rt::base_reservation::inherited()) 125 if (!rt::base_reservation::inherited())