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
path: root/source
diff options
context:
space:
mode:
authorOmar Emara <mail@OmarEmara.dev>2021-04-13 23:36:24 +0300
committerOmar Emara <mail@OmarEmara.dev>2021-04-13 23:36:24 +0300
commitd63b72e9f9305ac275584e801244741f2a14e5d3 (patch)
tree2a9abdcba6a0c172aa9a1905610304459a40b056 /source
parent170293475c36b4c462bdad372a03533d2b948bf1 (diff)
Fix T78803: Bad widget drawing with the R600g driver
The SB back-end optimizer for the mesa R600g driver corrupts the vertex shader for widget drawing. This will not be fixed upstream because SB is getting replaced as part of the new NIR path. This was thought to be an issue with instancing and an attempted fix was submitted in D8374, but it did not fix the issue. This patch reimplements the array look-up part of the code using switch case as a workaround and removes the old workaround implemented as part of D8374. Reviewed By: Clement Foucault Differential Revision: https://developer.blender.org/D10967
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/interface_widgets.c6
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl26
2 files changed, 21 insertions, 11 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 0c6be7b1196..e351cd30c14 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1225,12 +1225,6 @@ static bool draw_widgetbase_batch_skip_draw_cache(void)
return true;
}
- /* There are also reports that some AMD and Mesa driver configuration suffer from the
- * same issue, T78803. */
- if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) {
- return true;
- }
-
return false;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl
index 81e0965fad3..b5036b51d9d 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl
@@ -61,11 +61,27 @@ vec2 do_widget(void)
const vec2 ofs = vec2(0.5, -0.5);
lineWidth = abs(rect.x - recti.x);
vec2 emboss_ofs = vec2(0.0, -lineWidth);
- vec2 v_pos[4] = vec2[4](rect.xz + emboss_ofs + ofs.yy,
- rect.xw + ofs.yx,
- rect.yz + emboss_ofs + ofs.xy,
- rect.yw + ofs.xx);
- vec2 pos = v_pos[gl_VertexID];
+
+ vec2 pos;
+ switch (gl_VertexID) {
+ default:
+ case 0: {
+ pos = rect.xz + emboss_ofs + ofs.yy;
+ break;
+ }
+ case 1: {
+ pos = rect.xw + ofs.yx;
+ break;
+ }
+ case 2: {
+ pos = rect.yz + emboss_ofs + ofs.xy;
+ break;
+ }
+ case 3: {
+ pos = rect.yw + ofs.xx;
+ break;
+ }
+ }
uvInterp = pos - rect.xz;
outRectSize = rect.yw - rect.xz;