[Bf-blender-cvs] [848f246070f] epoxy: handle missing GL_VENDOR

Christian Rauch noreply at git.blender.org
Fri Jul 1 11:22:03 CEST 2022


Commit: 848f246070f6345b92ae09a2a74ec9511c11031c
Author: Christian Rauch
Date:   Thu Jun 30 16:19:51 2022 +0100
Branches: epoxy
https://developer.blender.org/rB848f246070f6345b92ae09a2a74ec9511c11031c

handle missing GL_VENDOR

===================================================================

M	source/blender/gpu/intern/gpu_platform.cc
M	source/blender/gpu/opengl/gl_backend.cc

===================================================================

diff --git a/source/blender/gpu/intern/gpu_platform.cc b/source/blender/gpu/intern/gpu_platform.cc
index d108dd468a0..f8e2c0fe6fc 100644
--- a/source/blender/gpu/intern/gpu_platform.cc
+++ b/source/blender/gpu/intern/gpu_platform.cc
@@ -79,11 +79,15 @@ void GPUPlatformGlobal::init(eGPUDeviceType gpu_device,
   this->driver = driver_type;
   this->support_level = gpu_support_level;
 
-  this->vendor = BLI_strdup(vendor_str);
-  this->renderer = BLI_strdup(renderer_str);
-  this->version = BLI_strdup(version_str);
-  this->support_key = create_key(gpu_support_level, vendor_str, renderer_str, version_str);
-  this->gpu_name = create_gpu_name(vendor_str, renderer_str, version_str);
+  const char *vendor = vendor_str ? vendor_str : "UNKNOWN";
+  const char *renderer = renderer_str ? renderer_str : "UNKNOWN";
+  const char *version = version_str ? version_str : "UNKNOWN";
+
+  this->vendor = BLI_strdup(vendor);
+  this->renderer = BLI_strdup(renderer);
+  this->version = BLI_strdup(version);
+  this->support_key = create_key(gpu_support_level, vendor, renderer, version);
+  this->gpu_name = create_gpu_name(vendor, renderer, version);
   this->backend = backend;
 }
 
diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc
index 498c2aa336b..6a1577fb907 100644
--- a/source/blender/gpu/opengl/gl_backend.cc
+++ b/source/blender/gpu/opengl/gl_backend.cc
@@ -51,7 +51,12 @@ void GLBackend::platform_init()
   os = GPU_OS_UNIX;
 #endif
 
-  if (strstr(vendor, "ATI") || strstr(vendor, "AMD")) {
+  if (!vendor) {
+    printf("Warning: No OpenGL vendor detected.\n");
+    device = GPU_DEVICE_UNKNOWN;
+    driver = GPU_DRIVER_ANY;
+  }
+  else if (strstr(vendor, "ATI") || strstr(vendor, "AMD")) {
     device = GPU_DEVICE_ATI;
     driver = GPU_DRIVER_OFFICIAL;
   }



More information about the Bf-blender-cvs mailing list