diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-01-25 18:21:47 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-01-25 18:23:54 +0300 |
commit | 6c25aabddfb484980e87e2b1cb07e31350c61796 (patch) | |
tree | 7680eb850bcea9b042988158b008726d452e97f5 /source/blender/gpu | |
parent | 0477ca75f0853cda7a6c4d70f812712ae64115df (diff) |
GLShader: Fix fallback to gl_BaseInstance
All `#entension` directives needs to be first before any other
token. Add missing `;` after uniform declaration.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/opengl/gl_shader.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc index 6cfe8e90d3e..532065ed08f 100644 --- a/source/blender/gpu/opengl/gl_shader.cc +++ b/source/blender/gpu/opengl/gl_shader.cc @@ -579,10 +579,6 @@ static char *glsl_patch_default_get() STR_CONCAT(patch, slen, "#define GPU_ARB_shader_draw_parameters\n"); STR_CONCAT(patch, slen, "#define gpu_BaseInstance gl_BaseInstanceARB\n"); } - else { - /* Fallback: Emulate base instance using a uniform. */ - STR_CONCAT(patch, slen, "uniform int gpu_BaseInstance\n"); - } if (GLContext::geometry_shader_invocations) { STR_CONCAT(patch, slen, "#extension GL_ARB_gpu_shader5 : enable\n"); STR_CONCAT(patch, slen, "#define GPU_ARB_gpu_shader5\n"); @@ -592,6 +588,11 @@ static char *glsl_patch_default_get() STR_CONCAT(patch, slen, "#define GPU_ARB_texture_cube_map_array\n"); } + /* Fallbacks. */ + if (!GLContext::shader_draw_parameters_support) { + STR_CONCAT(patch, slen, "uniform int gpu_BaseInstance;\n"); + } + /* Vulkan GLSL compat. */ STR_CONCAT(patch, slen, "#define gpu_InstanceIndex (gl_InstanceID + gpu_BaseInstance)\n"); |