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
This commit is contained in:
parent
170293475c
commit
d63b72e9f9
Notes:
blender-bot
2024-01-31 11:35:08 +01:00
Referenced by issue #78803, UI drawing artifacts on Mesa after recent commit.
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue