runtime (macOS): with a layer asked for, the loader is pinned to our MoltenVK whatever the shell set - the SDK's setup-env.sh exports VK_DRIVER_FILES and VK_ICD_FILENAMES at its own, and the one left set loaded a second MoltenVK; VK_DRIVER_FILES overwritten, VK_ICD_FILENAMES cleared, R3D_VK_ANY_DRIVER=1 to keep the shell's
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
47ba741f6d
commit
01df9b9d77
2 changed files with 18 additions and 9 deletions
7
changes/pin-icd-always.md
Normal file
7
changes/pin-icd-always.md
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
bump: patch
|
||||||
|
type: fix
|
||||||
|
**A validation run sees the game's MoltenVK.** With a layer asked for, the loader was pinned to
|
||||||
|
ludic.render3d's MoltenVK only when the shell named no driver - but the SDK's setup-env.sh exports both
|
||||||
|
VK_DRIVER_FILES and VK_ICD_FILENAMES at the SDK's own MoltenVK, so a shell with one left set loaded that
|
||||||
|
one beside ours. The pin now overwrites VK_DRIVER_FILES and clears VK_ICD_FILENAMES; R3D_VK_ANY_DRIVER=1
|
||||||
|
keeps the shell's driver for a run that means to try another.
|
||||||
|
|
@ -50,6 +50,7 @@ entry:
|
||||||
|
|
||||||
declare i32 @dladdr(ptr, ptr)
|
declare i32 @dladdr(ptr, ptr)
|
||||||
declare i32 @setenv(ptr, ptr, i32)
|
declare i32 @setenv(ptr, ptr, i32)
|
||||||
|
declare i32 @unsetenv(ptr)
|
||||||
declare ptr @strrchr(ptr, i32)
|
declare ptr @strrchr(ptr, i32)
|
||||||
declare i32 @access(ptr, i32)
|
declare i32 @access(ptr, i32)
|
||||||
@.lvk_e1 = private unnamed_addr constant [19 x i8] c"VK_INSTANCE_LAYERS\00"
|
@.lvk_e1 = private unnamed_addr constant [19 x i8] c"VK_INSTANCE_LAYERS\00"
|
||||||
|
|
@ -57,6 +58,7 @@ declare i32 @access(ptr, i32)
|
||||||
@.lvk_e3 = private unnamed_addr constant [14 x i8] c"R3D_VK_LOADER\00"
|
@.lvk_e3 = private unnamed_addr constant [14 x i8] c"R3D_VK_LOADER\00"
|
||||||
@.lvk_df = private unnamed_addr constant [16 x i8] c"VK_DRIVER_FILES\00"
|
@.lvk_df = private unnamed_addr constant [16 x i8] c"VK_DRIVER_FILES\00"
|
||||||
@.lvk_if = private unnamed_addr constant [17 x i8] c"VK_ICD_FILENAMES\00"
|
@.lvk_if = private unnamed_addr constant [17 x i8] c"VK_ICD_FILENAMES\00"
|
||||||
|
@.lvk_any = private unnamed_addr constant [18 x i8] c"R3D_VK_ANY_DRIVER\00"
|
||||||
@.lvk_gipa = private unnamed_addr constant [22 x i8] c"vkGetInstanceProcAddr\00"
|
@.lvk_gipa = private unnamed_addr constant [22 x i8] c"vkGetInstanceProcAddr\00"
|
||||||
@.lvk_icd = private unnamed_addr constant [23 x i8] c"%.*s/MoltenVK_icd.json\00"
|
@.lvk_icd = private unnamed_addr constant [23 x i8] c"%.*s/MoltenVK_icd.json\00"
|
||||||
|
|
||||||
|
|
@ -76,16 +78,15 @@ entry:
|
||||||
}
|
}
|
||||||
|
|
||||||
; The loader told to use our MoltenVK and no other: VK_DRIVER_FILES set to the ICD json beside the
|
; The loader told to use our MoltenVK and no other: VK_DRIVER_FILES set to the ICD json beside the
|
||||||
; libMoltenVK.dylib the program is linked against (found through dladdr), unless the caller named a
|
; libMoltenVK.dylib the program is linked against (found through dladdr), over whatever the shell had -
|
||||||
; driver already, or there is no json there (a bundle ships none).
|
; the SDK's setup-env.sh exports both VK_DRIVER_FILES and VK_ICD_FILENAMES at its own MoltenVK, and a
|
||||||
|
; validation run must see the driver the game uses - and VK_ICD_FILENAMES cleared. R3D_VK_ANY_DRIVER=1
|
||||||
|
; leaves the shell's choice alone; nothing is set where there is no json (a bundle ships none).
|
||||||
define internal void @lvk_pin_icd() {
|
define internal void @lvk_pin_icd() {
|
||||||
entry:
|
entry:
|
||||||
%df = call ptr @getenv(ptr @.lvk_df)
|
%any = call ptr @getenv(ptr @.lvk_any)
|
||||||
%if = call ptr @getenv(ptr @.lvk_if)
|
%keep = icmp ne ptr %any, null
|
||||||
%hdf = icmp ne ptr %df, null
|
br i1 %keep, label %out, label %find
|
||||||
%hif = icmp ne ptr %if, null
|
|
||||||
%named = or i1 %hdf, %hif
|
|
||||||
br i1 %named, label %out, label %find
|
|
||||||
find:
|
find:
|
||||||
%h = call ptr @dlopen(ptr @.lvk_mr, i32 6)
|
%h = call ptr @dlopen(ptr @.lvk_mr, i32 6)
|
||||||
%noh = icmp eq ptr %h, null
|
%noh = icmp eq ptr %h, null
|
||||||
|
|
@ -115,7 +116,8 @@ json:
|
||||||
%there = icmp eq i32 %acc, 0
|
%there = icmp eq i32 %acc, 0
|
||||||
br i1 %there, label %pin, label %out
|
br i1 %there, label %pin, label %out
|
||||||
pin:
|
pin:
|
||||||
%s = call i32 @setenv(ptr @.lvk_df, ptr %buf, i32 0)
|
%s = call i32 @setenv(ptr @.lvk_df, ptr %buf, i32 1)
|
||||||
|
%u = call i32 @unsetenv(ptr @.lvk_if)
|
||||||
br label %out
|
br label %out
|
||||||
out:
|
out:
|
||||||
ret void
|
ret void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue