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>2022-01-25 20:48:40 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-01-25 20:48:58 +0300
commit2637f94358329e1a8fce59dd036c577459e5a847 (patch)
treeb8a434b788565700694b4722e2f2a9cf6f2d5a41 /source/blender/gpu/opengl/gl_shader.cc
parent3e2591c83ed6c4eb8adecfe06c976717f161cd23 (diff)
GLShader: Fix buffer overflow caused by workaround uniform
In order to use a workaround builtin uniform, we need to count it just like other uniforms and give it some space in the name buffer. This also fixes extensions being added after the uniform declaration. All `#extension` directives are now part of the gl backend.
Diffstat (limited to 'source/blender/gpu/opengl/gl_shader.cc')
-rw-r--r--source/blender/gpu/opengl/gl_shader.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc
index 532065ed08f..ac9aec5af04 100644
--- a/source/blender/gpu/opengl/gl_shader.cc
+++ b/source/blender/gpu/opengl/gl_shader.cc
@@ -587,6 +587,18 @@ static char *glsl_patch_default_get()
STR_CONCAT(patch, slen, "#extension GL_ARB_texture_cube_map_array : enable\n");
STR_CONCAT(patch, slen, "#define GPU_ARB_texture_cube_map_array\n");
}
+ if (GLEW_ARB_conservative_depth) {
+ STR_CONCAT(patch, slen, "#extension GL_ARB_conservative_depth : enable\n");
+ }
+ if (GPU_shader_image_load_store_support()) {
+ STR_CONCAT(patch, slen, "#extension GL_ARB_shader_image_load_store: enable\n");
+ STR_CONCAT(patch, slen, "#extension GL_ARB_shading_language_420pack: enable\n");
+ }
+
+ if (!GLContext::shader_draw_parameters_support) {
+ /* Fallback: Emulate base instance using a uniform. */
+ STR_CONCAT(patch, slen, "uniform int gpu_BaseInstance;\n");
+ }
/* Fallbacks. */
if (!GLContext::shader_draw_parameters_support) {