Skip to content

Commit

Permalink
Fix[vk]: use native function instead of env var reading
Browse files Browse the repository at this point in the history
  • Loading branch information
artdeell authored Sep 17, 2023
1 parent 9572269 commit 0873acf
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions modules/lwjgl/vulkan/src/main/java/org/lwjgl/vulkan/VK.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,12 @@ public static void create() {
*/
private static boolean tryCreateFromEnv() {
if(Platform.get() != Platform.LINUX) return false;
String vulkanHandleHex = System.getenv("VULKAN_PTR");
if(vulkanHandleHex == null || vulkanHandleHex.isEmpty()) return false;
long vulkanHandle = 0;
try {
vulkanHandle = Long.decode(vulkanHandleHex);
} catch (NumberFormatException e) {
e.printStackTrace();
return false;
vulkanHandle = getVulkanDriverHandle();
} catch(UnsatisfiedLinkError e) {
e.printStackTrace();
return false;
}
SharedLibrary VK = Library.createFromHandle("libvulkan.so", vulkanHandle);
create(VK);
Expand Down Expand Up @@ -241,5 +239,5 @@ static Set<String> getEnabledExtensionSet(int apiVersion, @Nullable PointerBuffe

return enabledExtensions;
}

}
public static native long getVulkanDriverHandle();
}

0 comments on commit 0873acf

Please sign in to comment.