From 73324c71ec48958f3b38b98b4d0c38b2009c3f23 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 24 Sep 2025 07:23:14 -0500 Subject: [PATCH] Force Mac upload method to DATA Maybe will help with crashing/memory corruption? Data is the most basic upload method in GL so Mac should be able to support it a lot better than BUFFER_STORAGE. --- .../core/render/glObject/GLProxy.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/glObject/GLProxy.java b/core/src/main/java/com/seibel/distanthorizons/core/render/glObject/GLProxy.java index 5efae5050..44717187f 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/render/glObject/GLProxy.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/render/glObject/GLProxy.java @@ -23,6 +23,7 @@ import com.seibel.distanthorizons.api.enums.config.EDhApiGLErrorHandlingMode; import com.seibel.distanthorizons.api.enums.config.EDhApiGpuUploadMethod; import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; +import com.seibel.distanthorizons.core.jar.EPlatform; import com.seibel.distanthorizons.core.logging.ConfigBasedLogger; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.util.objects.GLMessages.*; @@ -173,17 +174,26 @@ public class GLProxy // get the best automatic upload method String vendor = GL32.glGetString(GL32.GL_VENDOR).toUpperCase(); // example return: "NVIDIA CORPORATION" - if (vendor.contains("NVIDIA") || vendor.contains("GEFORCE")) + if (EPlatform.get() != EPlatform.MACOS) { - // NVIDIA card - this.preferredUploadMethod = this.bufferStorageSupported ? EDhApiGpuUploadMethod.BUFFER_STORAGE : EDhApiGpuUploadMethod.SUB_DATA; + if (vendor.contains("NVIDIA") || vendor.contains("GEFORCE")) + { + // NVIDIA card + this.preferredUploadMethod = this.bufferStorageSupported ? EDhApiGpuUploadMethod.BUFFER_STORAGE : EDhApiGpuUploadMethod.SUB_DATA; + } + else + { + // AMD or Intel card + this.preferredUploadMethod = this.bufferStorageSupported ? EDhApiGpuUploadMethod.BUFFER_STORAGE : EDhApiGpuUploadMethod.DATA; + } } else { - // AMD or Intel card - this.preferredUploadMethod = this.bufferStorageSupported ? EDhApiGpuUploadMethod.BUFFER_STORAGE : EDhApiGpuUploadMethod.DATA; + // Mac may have an issue with Buffer Storage, so default to the most basic + // form of uploading + this.preferredUploadMethod = EDhApiGpuUploadMethod.DATA; } - GL_LOGGER.info("GPU Vendor [" + vendor + "], Preferred upload method is [" + this.preferredUploadMethod + "]."); + GL_LOGGER.info("GPU Vendor [" + vendor + "] with OS [" + EPlatform.get().getName() + "], Preferred upload method is [" + this.preferredUploadMethod + "].");