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-03-26 23:10:29 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-03-26 23:10:44 +0300
commit56e0249489ce89954a54d5006ddf4147dd02e208 (patch)
tree11457e0f51ebfc2be718290da67637204c4621bf /source/blender/gpu/intern/gpu_shader_interface.c
parentafb1a64ccb81b7ed792f64151986f40f53af8da5 (diff)
GPU: Add workaround for faulty default attrib values on some drivers
On some drivers, the default values is not respected correctly. To workaround this we create a small VBO that contains only 1 vec4 worth of data and just bind it using glBindVertexBuffer to ensure 0 stride. This fixes T75069 Instances not rendered correctly by workbench.
Diffstat (limited to 'source/blender/gpu/intern/gpu_shader_interface.c')
-rw-r--r--source/blender/gpu/intern/gpu_shader_interface.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_shader_interface.c b/source/blender/gpu/intern/gpu_shader_interface.c
index f23a0a438d6..349a7217456 100644
--- a/source/blender/gpu/intern/gpu_shader_interface.c
+++ b/source/blender/gpu/intern/gpu_shader_interface.c
@@ -236,6 +236,7 @@ GPUShaderInterface *GPU_shaderinterface_create(int32_t program)
shaderface->name_buffer = MEM_mallocN(name_buffer_len, "name_buffer");
/* Attributes */
+ shaderface->enabled_attrib_mask = 0;
for (uint32_t i = 0; i < attr_len; i++) {
GPUShaderInput *input = MEM_mallocN(sizeof(GPUShaderInput), "GPUShaderInput Attr");
GLsizei remaining_buffer = name_buffer_len - shaderface->name_buffer_offset;
@@ -255,6 +256,8 @@ GPUShaderInterface *GPU_shaderinterface_create(int32_t program)
input->location = glGetAttribLocation(program, name);
+ shaderface->enabled_attrib_mask |= (1 << input->location);
+
set_input_name(shaderface, input, name, name_len);
shader_input_to_bucket(input, shaderface->attr_buckets);