Blender  V3.3
gl_backend.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2020 Blender Foundation. All rights reserved. */
3 
8 #include "BKE_global.h"
9 
11 #include "gpu_platform_private.hh"
12 
13 #include "gl_debug.hh"
14 
15 #include "gl_backend.hh"
16 
17 namespace blender::gpu {
18 
19 /* -------------------------------------------------------------------- */
23 static bool match_renderer(StringRef renderer, const Vector<std::string> &items)
24 {
25  for (const std::string &item : items) {
26  const std::string wrapped = " " + item + " ";
27  if (renderer.endswith(item) || renderer.find(wrapped) != StringRef::not_found) {
28  return true;
29  }
30  }
31  return false;
32 }
33 
34 void GLBackend::platform_init()
35 {
37 
38  const char *vendor = (const char *)glGetString(GL_VENDOR);
39  const char *renderer = (const char *)glGetString(GL_RENDERER);
40  const char *version = (const char *)glGetString(GL_VERSION);
45 
46 #ifdef _WIN32
47  os = GPU_OS_WIN;
48 #elif defined(__APPLE__)
49  os = GPU_OS_MAC;
50 #else
51  os = GPU_OS_UNIX;
52 #endif
53 
54  if (strstr(vendor, "ATI") || strstr(vendor, "AMD")) {
55  device = GPU_DEVICE_ATI;
56  driver = GPU_DRIVER_OFFICIAL;
57  }
58  else if (strstr(vendor, "NVIDIA")) {
59  device = GPU_DEVICE_NVIDIA;
60  driver = GPU_DRIVER_OFFICIAL;
61  }
62  else if (strstr(vendor, "Intel") ||
63  /* src/mesa/drivers/dri/intel/intel_context.c */
64  strstr(renderer, "Mesa DRI Intel") || strstr(renderer, "Mesa DRI Mobile Intel")) {
65  device = GPU_DEVICE_INTEL;
66  driver = GPU_DRIVER_OFFICIAL;
67 
68  if (strstr(renderer, "UHD Graphics") ||
69  /* Not UHD but affected by the same bugs. */
70  strstr(renderer, "HD Graphics 530") || strstr(renderer, "Kaby Lake GT2") ||
71  strstr(renderer, "Whiskey Lake")) {
72  device |= GPU_DEVICE_INTEL_UHD;
73  }
74  }
75  else if (strstr(renderer, "Mesa DRI R") ||
76  (strstr(renderer, "Radeon") && strstr(vendor, "X.Org")) ||
77  (strstr(renderer, "AMD") && strstr(vendor, "X.Org")) ||
78  (strstr(renderer, "Gallium ") && strstr(renderer, " on ATI ")) ||
79  (strstr(renderer, "Gallium ") && strstr(renderer, " on AMD "))) {
80  device = GPU_DEVICE_ATI;
81  driver = GPU_DRIVER_OPENSOURCE;
82  }
83  else if (strstr(renderer, "Nouveau") || strstr(vendor, "nouveau")) {
84  device = GPU_DEVICE_NVIDIA;
85  driver = GPU_DRIVER_OPENSOURCE;
86  }
87  else if (strstr(vendor, "Mesa")) {
88  device = GPU_DEVICE_SOFTWARE;
89  driver = GPU_DRIVER_SOFTWARE;
90  }
91  else if (strstr(vendor, "Microsoft")) {
92  device = GPU_DEVICE_SOFTWARE;
93  driver = GPU_DRIVER_SOFTWARE;
94  }
95  else if (strstr(vendor, "Apple")) {
96  /* Apple Silicon. */
97  device = GPU_DEVICE_APPLE;
98  driver = GPU_DRIVER_OFFICIAL;
99  }
100  else if (strstr(renderer, "Apple Software Renderer")) {
101  device = GPU_DEVICE_SOFTWARE;
102  driver = GPU_DRIVER_SOFTWARE;
103  }
104  else if (strstr(renderer, "llvmpipe") || strstr(renderer, "softpipe")) {
105  device = GPU_DEVICE_SOFTWARE;
106  driver = GPU_DRIVER_SOFTWARE;
107  }
108  else {
109  printf("Warning: Could not find a matching GPU name. Things may not behave as expected.\n");
110  printf("Detected OpenGL configuration:\n");
111  printf("Vendor: %s\n", vendor);
112  printf("Renderer: %s\n", renderer);
113  }
114 
115  /* Detect support level */
116  if (!GLEW_VERSION_3_3) {
117  support_level = GPU_SUPPORT_LEVEL_UNSUPPORTED;
118  }
119  else {
120  if ((device & GPU_DEVICE_INTEL) && (os & GPU_OS_WIN)) {
121  /* Old Intel drivers with known bugs that cause material properties to crash.
122  * Version Build 10.18.14.5067 is the latest available and appears to be working
123  * ok with our workarounds, so excluded from this list. */
124  if (strstr(version, "Build 7.14") || strstr(version, "Build 7.15") ||
125  strstr(version, "Build 8.15") || strstr(version, "Build 9.17") ||
126  strstr(version, "Build 9.18") || strstr(version, "Build 10.18.10.3") ||
127  strstr(version, "Build 10.18.10.4") || strstr(version, "Build 10.18.10.5") ||
128  strstr(version, "Build 10.18.14.4")) {
129  support_level = GPU_SUPPORT_LEVEL_LIMITED;
130  }
131  }
132  if ((device & GPU_DEVICE_ATI) && (os & GPU_OS_UNIX)) {
133  /* Platform seems to work when SB backend is disabled. This can be done
134  * by adding the environment variable `R600_DEBUG=nosb`. */
135  if (strstr(renderer, "AMD CEDAR")) {
136  support_level = GPU_SUPPORT_LEVEL_LIMITED;
137  }
138  }
139  }
140 
141  GPG.init(device, os, driver, support_level, GPU_BACKEND_OPENGL, vendor, renderer, version);
142 }
143 
144 void GLBackend::platform_exit()
145 {
147  GPG.clear();
148 }
149 
152 /* -------------------------------------------------------------------- */
157 {
158  int cube_size = 2;
159  float clear_color[4] = {1.0f, 0.5f, 0.0f, 0.0f};
160  float *source_pix = (float *)MEM_callocN(sizeof(float[4]) * cube_size * cube_size * 6, __func__);
161 
162  /* NOTE: Debug layers are not yet enabled. Force use of glGetError. */
163  debug::check_gl_error("Cubemap Workaround Start");
164  /* Not using GPU API since it is not yet fully initialized. */
165  GLuint tex, fb;
166  /* Create cubemap with 2 mip level. */
167  glGenTextures(1, &tex);
168  glBindTexture(GL_TEXTURE_CUBE_MAP, tex);
169  for (int mip = 0; mip < 2; mip++) {
170  for (int i = 0; i < 6; i++) {
171  const int width = cube_size / (1 << mip);
172  GLenum target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + i;
173  glTexImage2D(target, mip, GL_RGBA16F, width, width, 0, GL_RGBA, GL_FLOAT, source_pix);
174  }
175  }
176  glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_BASE_LEVEL, 0);
177  glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_LEVEL, 0);
178  /* Attach and clear mip 1. */
179  glGenFramebuffers(1, &fb);
180  glBindFramebuffer(GL_FRAMEBUFFER, fb);
181  glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex, 1);
182  glDrawBuffer(GL_COLOR_ATTACHMENT0);
183  glClearColor(UNPACK4(clear_color));
184  glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
185  glClear(GL_COLOR_BUFFER_BIT);
186  glBindFramebuffer(GL_FRAMEBUFFER, 0);
187 
188  /* Read mip 1. If color is not the same as the clear_color, the rendering failed. */
189  glGetTexImage(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 1, GL_RGBA, GL_FLOAT, source_pix);
190  bool enable_workaround = !equals_v4v4(clear_color, source_pix);
191  MEM_freeN(source_pix);
192 
193  glDeleteFramebuffers(1, &fb);
194  glDeleteTextures(1, &tex);
195 
196  debug::check_gl_error("Cubemap Workaround End9");
197 
198  return enable_workaround;
199 }
200 
201 static const char *gl_extension_get(int i)
202 {
203  return (char *)glGetStringi(GL_EXTENSIONS, i);
204 }
205 
206 static void detect_workarounds()
207 {
208  const char *vendor = (const char *)glGetString(GL_VENDOR);
209  const char *renderer = (const char *)glGetString(GL_RENDERER);
210  const char *version = (const char *)glGetString(GL_VERSION);
211 
212  if (G.debug & G_DEBUG_GPU_FORCE_WORKAROUNDS) {
213  printf("\n");
214  printf("GL: Forcing workaround usage and disabling extensions.\n");
215  printf(" OpenGL identification strings\n");
216  printf(" vendor: %s\n", vendor);
217  printf(" renderer: %s\n", renderer);
218  printf(" version: %s\n\n", version);
223  /* Turn off extensions. */
243  return;
244  }
245 
246  /* Limit support for GLEW_ARB_base_instance to OpenGL 4.0 and higher. NVIDIA Quadro FX 4800
247  * (TeraScale) report that they support GLEW_ARB_base_instance, but the driver does not support
248  * GLEW_ARB_draw_indirect as it has an OpenGL3 context what also matches the minimum needed
249  * requirements.
250  *
251  * We use it as a target for glMapBuffer(Range) what is part of the OpenGL 4 API. So better
252  * disable it when we don't have an OpenGL4 context (See T77657) */
253  if (!GLEW_VERSION_4_0) {
255  }
257  (strstr(version, "4.5.13399") || strstr(version, "4.5.13417") ||
258  strstr(version, "4.5.13422") || strstr(version, "4.5.13467"))) {
259  /* The renderers include:
260  * Radeon HD 5000;
261  * Radeon HD 7500M;
262  * Radeon HD 7570M;
263  * Radeon HD 7600M;
264  * Radeon R5 Graphics;
265  * And others... */
269  GCaps.broken_amd_driver = true;
270  }
271  /* Compute shaders have some issues with those versions (see T94936). */
273  (strstr(version, "4.5.14831") || strstr(version, "4.5.14760"))) {
275  }
276  /* We have issues with this specific renderer. (see T74024) */
278  (strstr(renderer, "AMD VERDE") || strstr(renderer, "AMD KAVERI") ||
279  strstr(renderer, "AMD TAHITI"))) {
282  GCaps.broken_amd_driver = true;
283  }
284  /* Fix slowdown on this particular driver. (see T77641) */
286  strstr(version, "Mesa 19.3.4")) {
288  GCaps.broken_amd_driver = true;
289  }
290  /* See T82856: AMD drivers since 20.11 running on a polaris architecture doesn't support the
291  * `GL_INT_2_10_10_10_REV` data type correctly. This data type is used to pack normals and flags.
292  * The work around uses `GPU_RGBA16I`. In 22.?.? drivers this has been fixed for
293  * polaris platform. Keeping legacy platforms around just in case.
294  */
296  const Vector<std::string> matches = {
297  "RX550/550", "(TM) 520", "(TM) 530", "(TM) 535", "R5", "R7", "R9"};
298 
299  if (match_renderer(renderer, matches)) {
301  }
302  }
303  /* There is an issue with the #glBlitFramebuffer on MacOS with radeon pro graphics.
304  * Blitting depth with#GL_DEPTH24_STENCIL8 is buggy so the workaround is to use
305  * #GPU_DEPTH32F_STENCIL8. Then Blitting depth will work but blitting stencil will
306  * still be broken. */
308  if (strstr(renderer, "AMD Radeon Pro") || strstr(renderer, "AMD Radeon R9") ||
309  strstr(renderer, "AMD Radeon RX")) {
311  }
312  }
313  /* Limit this fix to older hardware with GL < 4.5. This means Broadwell GPUs are
314  * covered since they only support GL 4.4 on windows.
315  * This fixes some issues with workbench anti-aliasing on Win + Intel GPU. (see T76273) */
316  if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_WIN, GPU_DRIVER_OFFICIAL) && !GLEW_VERSION_4_5) {
318  }
319  /* Special fix for these specific GPUs.
320  * Without this workaround, blender crashes on startup. (see T72098) */
322  (strstr(renderer, "HD Graphics 620") || strstr(renderer, "HD Graphics 630"))) {
324  }
325  /* Intel Ivy Bridge GPU's seems to have buggy cube-map array support. (see T75943) */
327  (strstr(renderer, "HD Graphics 4000") || strstr(renderer, "HD Graphics 4400") ||
328  strstr(renderer, "HD Graphics 2500"))) {
330  }
331  /* Maybe not all of these drivers have problems with `GLEW_ARB_base_instance`.
332  * But it's hard to test each case.
333  * We get crashes from some crappy Intel drivers don't work well with shaders created in
334  * different rendering contexts. */
336  (strstr(version, "Build 10.18.10.3") || strstr(version, "Build 10.18.10.4") ||
337  strstr(version, "Build 10.18.10.5") || strstr(version, "Build 10.18.14.4") ||
338  strstr(version, "Build 10.18.14.5"))) {
341  }
342  /* Somehow fixes armature display issues (see T69743). */
344  (strstr(version, "Build 20.19.15.4285"))) {
346  }
347  /* See T70187: merging vertices fail. This has been tested from `18.2.2` till `19.3.0~dev`
348  * of the Mesa driver */
350  (strstr(version, "Mesa 18.") || strstr(version, "Mesa 19.0") ||
351  strstr(version, "Mesa 19.1") || strstr(version, "Mesa 19.2"))) {
353  }
354  /* There is a bug on older Nvidia GPU where GL_ARB_texture_gather
355  * is reported to be supported but yield a compile error (see T55802). */
356  if (GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_ANY) && !GLEW_VERSION_4_0) {
358  }
359 
360  /* dFdx/dFdy calculation factors, those are dependent on driver. */
362  strstr(version, "3.3.10750")) {
364  GLContext::derivative_signs[1] = -1.0;
365  }
367  if (strstr(version, "4.0.0 - Build 10.18.10.3308") ||
368  strstr(version, "4.0.0 - Build 9.18.10.3186") ||
369  strstr(version, "4.0.0 - Build 9.18.10.3165") ||
370  strstr(version, "3.1.0 - Build 9.17.10.3347") ||
371  strstr(version, "3.1.0 - Build 9.17.10.4101") ||
372  strstr(version, "3.3.0 - Build 8.15.10.2618")) {
373  GLContext::derivative_signs[0] = -1.0;
375  }
376  }
377 
378  /* Some Intel drivers have issues with using mips as frame-buffer targets if
379  * GL_TEXTURE_MAX_LEVEL is higher than the target MIP.
380  * Only check at the end after all other workarounds because this uses the drawing code.
381  * Also after device/driver flags to avoid the check that causes pre GCN Radeon to crash. */
382  if (GCaps.mip_render_workaround == false) {
384  }
385  /* Disable multi-draw if the base instance cannot be read. */
388  }
389  /* Enable our own incomplete debug layer if no other is available. */
390  if (GLContext::debug_layer_support == false) {
392  }
393 
394  /* Broken glGenerateMipmap on macOS 10.15.7 security update. */
396  strstr(renderer, "HD Graphics 4000")) {
398  }
399 
400  /* Buggy interface query functions cause crashes when handling SSBOs (T93680) */
402  (strstr(renderer, "HD Graphics 4400") || strstr(renderer, "HD Graphics 4600"))) {
404  }
405 
406  /* Certain Intel/AMD based platforms don't clear the viewport textures. Always clearing leads to
407  * noticeable performance regressions on other platforms as well. */
411  }
412 
413  /* Metal-related Workarounds. */
414 
415  /* Minimum Per-Vertex stride is 1 byte for OpenGL. */
417 
418 } // namespace blender::gpu
419 
424 GLint GLContext::max_ubo_binds = 0;
425 GLint GLContext::max_ubo_size = 0;
426 GLint GLContext::max_ssbo_binds = 0;
427 GLint GLContext::max_ssbo_size = 0;
428 
433 bool GLContext::copy_image_support = false;
434 bool GLContext::debug_layer_support = false;
441 bool GLContext::multi_bind_support = false;
450 
456 float GLContext::derivative_signs[2] = {1.0f, 1.0f};
457 
458 void GLBackend::capabilities_init()
459 {
460  BLI_assert(GLEW_VERSION_3_3);
461  /* Common Capabilities. */
462  glGetIntegerv(GL_MAX_TEXTURE_SIZE, &GCaps.max_texture_size);
463  glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &GCaps.max_texture_layers);
464  glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &GCaps.max_textures_frag);
465  glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &GCaps.max_textures_vert);
466  glGetIntegerv(GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS, &GCaps.max_textures_geom);
467  glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &GCaps.max_textures);
468  glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, &GCaps.max_uniforms_vert);
469  glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &GCaps.max_uniforms_frag);
470  glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &GCaps.max_batch_indices);
471  glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, &GCaps.max_batch_vertices);
472  glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &GCaps.max_vertex_attribs);
474  /* Due to a bug, querying GL_MAX_VARYING_FLOATS is emitting GL_INVALID_ENUM.
475  * Force use minimum required value. */
477  }
478  else {
479  glGetIntegerv(GL_MAX_VARYING_FLOATS, &GCaps.max_varying_floats);
480  }
481 
482  glGetIntegerv(GL_NUM_EXTENSIONS, &GCaps.extensions_len);
484 
485  GCaps.mem_stats_support = GLEW_NVX_gpu_memory_info || GLEW_ATI_meminfo;
486  GCaps.shader_image_load_store_support = GLEW_ARB_shader_image_load_store;
487  GCaps.compute_shader_support = GLEW_ARB_compute_shader && GLEW_VERSION_4_3;
489  glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 0, &GCaps.max_work_group_count[0]);
490  glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 1, &GCaps.max_work_group_count[1]);
491  glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 2, &GCaps.max_work_group_count[2]);
492  glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 0, &GCaps.max_work_group_size[0]);
493  glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 1, &GCaps.max_work_group_size[1]);
494  glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 2, &GCaps.max_work_group_size[2]);
495  glGetIntegerv(GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS,
497  glGetIntegerv(GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS, &GCaps.max_compute_shader_storage_blocks);
498  }
499  GCaps.shader_storage_buffer_objects_support = GLEW_ARB_shader_storage_buffer_object;
500  /* GL specific capabilities. */
501  glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &GLContext::max_texture_3d_size);
502  glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &GLContext::max_cubemap_size);
503  glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_BLOCKS, &GLContext::max_ubo_binds);
504  glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &GLContext::max_ubo_size);
506  glGetIntegerv(GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS, &GLContext::max_ssbo_binds);
507  glGetIntegerv(GL_MAX_SHADER_STORAGE_BLOCK_SIZE, &GLContext::max_ssbo_size);
508  }
509  GLContext::base_instance_support = GLEW_ARB_base_instance;
510  GLContext::clear_texture_support = GLEW_ARB_clear_texture;
511  GLContext::copy_image_support = GLEW_ARB_copy_image;
512  GLContext::debug_layer_support = GLEW_VERSION_4_3 || GLEW_KHR_debug || GLEW_ARB_debug_output;
513  GLContext::direct_state_access_support = GLEW_ARB_direct_state_access;
514  GLContext::explicit_location_support = GLEW_VERSION_4_3;
515  GLContext::geometry_shader_invocations = GLEW_ARB_gpu_shader5;
516  GLContext::fixed_restart_index_support = GLEW_ARB_ES3_compatibility;
517  GLContext::layered_rendering_support = GLEW_AMD_vertex_shader_layer;
518  GLContext::native_barycentric_support = GLEW_AMD_shader_explicit_vertex_parameter;
519  GLContext::multi_bind_support = GLEW_ARB_multi_bind;
520  GLContext::multi_draw_indirect_support = GLEW_ARB_multi_draw_indirect;
521  GLContext::shader_draw_parameters_support = GLEW_ARB_shader_draw_parameters;
522  GLContext::stencil_texturing_support = GLEW_VERSION_4_3;
523  GLContext::texture_cube_map_array_support = GLEW_ARB_texture_cube_map_array;
524  GLContext::texture_filter_anisotropic_support = GLEW_EXT_texture_filter_anisotropic;
525  GLContext::texture_gather_support = GLEW_ARB_texture_gather;
526  GLContext::texture_storage_support = GLEW_VERSION_4_3;
527  GLContext::vertex_attrib_binding_support = GLEW_ARB_vertex_attrib_binding;
528 
530 
531  /* Disable this feature entirely when not debugging. */
532  if ((G.debug & G_DEBUG_GPU) == 0) {
535  }
536 }
537 
540 } // namespace blender::gpu
@ G_DEBUG_GPU
Definition: BKE_global.h:193
@ G_DEBUG_GPU_FORCE_WORKAROUNDS
Definition: BKE_global.h:195
#define BLI_assert(a)
Definition: BLI_assert.h:46
MINLINE bool equals_v4v4(const float a[4], const float b[4]) ATTR_WARN_UNUSED_RESULT
#define UNPACK4(a)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
@ GPU_BACKEND_OPENGL
Definition: GPU_platform.h:17
eGPUDriverType
Definition: GPU_platform.h:43
@ GPU_DRIVER_ANY
Definition: GPU_platform.h:47
@ GPU_DRIVER_OFFICIAL
Definition: GPU_platform.h:44
@ GPU_DRIVER_OPENSOURCE
Definition: GPU_platform.h:45
@ GPU_DRIVER_SOFTWARE
Definition: GPU_platform.h:46
eGPUSupportLevel
Definition: GPU_platform.h:50
@ GPU_SUPPORT_LEVEL_LIMITED
Definition: GPU_platform.h:52
@ GPU_SUPPORT_LEVEL_SUPPORTED
Definition: GPU_platform.h:51
@ GPU_SUPPORT_LEVEL_UNSUPPORTED
Definition: GPU_platform.h:53
eGPUOSType
Definition: GPU_platform.h:36
@ GPU_OS_WIN
Definition: GPU_platform.h:37
@ GPU_OS_UNIX
Definition: GPU_platform.h:39
@ GPU_OS_ANY
Definition: GPU_platform.h:40
@ GPU_OS_MAC
Definition: GPU_platform.h:38
eGPUDeviceType
Definition: GPU_platform.h:23
@ GPU_DEVICE_ATI
Definition: GPU_platform.h:25
@ GPU_DEVICE_INTEL_UHD
Definition: GPU_platform.h:27
@ GPU_DEVICE_SOFTWARE
Definition: GPU_platform.h:29
@ GPU_DEVICE_NVIDIA
Definition: GPU_platform.h:24
@ GPU_DEVICE_ANY
Definition: GPU_platform.h:31
@ GPU_DEVICE_APPLE
Definition: GPU_platform.h:28
@ GPU_DEVICE_INTEL
Definition: GPU_platform.h:26
bool GPU_type_matches(eGPUDeviceType device, eGPUOSType os, eGPUDriverType driver)
static constexpr int64_t not_found
constexpr int64_t find(char c, int64_t pos=0) const
constexpr bool endswith(StringRef suffix) const
static bool stencil_texturing_support
Definition: gl_context.hh:66
static bool geometry_shader_invocations
Definition: gl_context.hh:59
static bool layered_rendering_support
Definition: gl_context.hh:61
static bool debug_layer_support
Definition: gl_context.hh:56
static bool shader_draw_parameters_support
Definition: gl_context.hh:65
static bool explicit_location_support
Definition: gl_context.hh:58
static GLint max_ssbo_binds
Definition: gl_context.hh:49
static GLint max_texture_3d_size
Definition: gl_context.hh:45
static bool debug_layer_workaround
Definition: gl_context.hh:75
static float derivative_signs[2]
Definition: gl_context.hh:78
static bool base_instance_support
Definition: gl_context.hh:53
static bool vertex_attrib_binding_support
Definition: gl_context.hh:71
static bool texture_storage_support
Definition: gl_context.hh:70
static GLint max_ssbo_size
Definition: gl_context.hh:48
static GLint max_ubo_binds
Definition: gl_context.hh:47
static bool fixed_restart_index_support
Definition: gl_context.hh:60
static bool copy_image_support
Definition: gl_context.hh:55
static bool texture_gather_support
Definition: gl_context.hh:69
static GLint max_ubo_size
Definition: gl_context.hh:46
static bool direct_state_access_support
Definition: gl_context.hh:57
static bool texture_filter_anisotropic_support
Definition: gl_context.hh:68
static bool clear_texture_support
Definition: gl_context.hh:54
static bool unused_fb_slot_workaround
Definition: gl_context.hh:76
static bool multi_bind_support
Definition: gl_context.hh:63
static GLint max_cubemap_size
Definition: gl_context.hh:44
static bool texture_cube_map_array_support
Definition: gl_context.hh:67
static bool native_barycentric_support
Definition: gl_context.hh:62
static bool generate_mipmap_workaround
Definition: gl_context.hh:77
static bool multi_draw_indirect_support
Definition: gl_context.hh:64
void init(eGPUDeviceType gpu_device, eGPUOSType os_type, eGPUDriverType driver_type, eGPUSupportLevel gpu_support_level, eGPUBackendType backend, const char *vendor_str, const char *renderer_str, const char *version_str)
Definition: gpu_platform.cc:64
BLI_INLINE float fb(float length, float L)
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
#define G(x, y, z)
void check_gl_error(const char *info)
Definition: gl_debug.cc:181
GPUPlatformGlobal GPG
Definition: gpu_platform.cc:26
static void detect_workarounds()
Definition: gl_backend.cc:206
GPUCapabilities GCaps
static bool detect_mip_render_workaround()
Definition: gl_backend.cc:156
static bool match_renderer(StringRef renderer, const Vector< std::string > &items)
Definition: gl_backend.cc:23
static const char * gl_extension_get(int i)
Definition: gl_backend.cc:201