Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-09-10 15:18:19 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-09-10 15:19:00 +0300
commit8d59f060ca73247b2265db04655eef9db0f1c06a (patch)
treeb9dd534a3dbe7ce805fa6f0fb11b0a9301fb8fde /source/blender/gpu/opengl/gl_shader.cc
parent9d5977f5e1fa2eac782278c61c3cc86685cc1b5a (diff)
GL: Wrap extension support inside GLContext
This makes it possible to disable all the extensions when forcing workarounds. Also it will allow future options to selectively disable each extension to know which one is buggy.
Diffstat (limited to 'source/blender/gpu/opengl/gl_shader.cc')
-rw-r--r--source/blender/gpu/opengl/gl_shader.cc26
1 files changed, 8 insertions, 18 deletions
diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc
index 7b3a071bf63..c400f218f5a 100644
--- a/source/blender/gpu/opengl/gl_shader.cc
+++ b/source/blender/gpu/opengl/gl_shader.cc
@@ -85,25 +85,15 @@ char *GLShader::glsl_patch_get(void)
/* Enable extensions for features that are not part of our base GLSL version
* don't use an extension for something already available! */
- if (GLEW_ARB_texture_gather) {
- /* There is a bug on older Nvidia GPU where GL_ARB_texture_gather
- * is reported to be supported but yield a compile error (see T55802). */
- if (!GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_ANY) || GLEW_VERSION_4_0) {
- STR_CONCAT(patch, slen, "#extension GL_ARB_texture_gather: enable\n");
-
- /* Some drivers don't agree on GLEW_ARB_texture_gather and the actual support in the
- * shader so double check the preprocessor define (see T56544). */
- if (!GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_ANY) && !GLEW_VERSION_4_0) {
- STR_CONCAT(patch, slen, "#ifdef GL_ARB_texture_gather\n");
- STR_CONCAT(patch, slen, "# define GPU_ARB_texture_gather\n");
- STR_CONCAT(patch, slen, "#endif\n");
- }
- else {
- STR_CONCAT(patch, slen, "#define GPU_ARB_texture_gather\n");
- }
- }
+ if (GLContext::texture_gather_support) {
+ STR_CONCAT(patch, slen, "#extension GL_ARB_texture_gather: enable\n");
+ /* Some drivers don't agree on GLEW_ARB_texture_gather and the actual support in the
+ * shader so double check the preprocessor define (see T56544). */
+ STR_CONCAT(patch, slen, "#ifdef GL_ARB_texture_gather\n");
+ STR_CONCAT(patch, slen, "# define GPU_ARB_texture_gather\n");
+ STR_CONCAT(patch, slen, "#endif\n");
}
- if (GLEW_ARB_shader_draw_parameters) {
+ if (GLContext::shader_draw_parameters_support) {
STR_CONCAT(patch, slen, "#extension GL_ARB_shader_draw_parameters : enable\n");
STR_CONCAT(patch, slen, "#define GPU_ARB_shader_draw_parameters\n");
}