Fix T64499: edit mode display glitch on Intel HD 4x00 and Windows 7/8

There may well be more vertex shaders that need this, but I couldn't find them
in my testing.

Differential Revision: https://developer.blender.org/D4921
This commit is contained in:
Brecht Van Lommel 2019-05-21 23:59:57 +02:00
parent ff3a20d1bc
commit c06bd2d184
Notes: blender-bot 2023-12-22 20:14:11 +01:00
Referenced by issue #65385, Blender 2.8 glitch in edit mode
Referenced by issue #64499, Edit Mode - Intel HD 4x00 display glitch on Windows 7/8
9 changed files with 24 additions and 0 deletions

View File

@ -48,3 +48,11 @@ uniform mat4 ModelMatrixInverse;
#define point_world_to_ndc(p) (ViewProjectionMatrix * vec4(p, 1.0))
#define point_world_to_object(p) ((ModelMatrixInverse * vec4(p, 1.0)).xyz)
#define point_world_to_view(p) ((ViewMatrix * vec4(p, 1.0)).xyz)
/* Due to some shader compiler bug, we somewhat need to access gl_VertexID
* to make vertex shaders work. even if it's actually dead code. */
#ifdef GPU_INTEL
# define GPU_INTEL_VERTEX_SHADER_WORKAROUND gl_Position.x = float(gl_VertexID);
#else
# define GPU_INTEL_VERTEX_SHADER_WORKAROUND
#endif

View File

@ -7,6 +7,8 @@ flat out int vertFlag;
void main()
{
GPU_INTEL_VERTEX_SHADER_WORKAROUND
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
vertFlag = data;

View File

@ -9,6 +9,8 @@ out vec4 finalColor;
void main()
{
GPU_INTEL_VERTEX_SHADER_WORKAROUND
if ((data & VERT_SELECTED) != 0) {
if ((data & VERT_ACTIVE) != 0) {
finalColor = colorEditMeshActive;

View File

@ -9,6 +9,8 @@ in float rad;
void main()
{
GPU_INTEL_VERTEX_SHADER_WORKAROUND
vec3 final_pos = pos;
float flip = (gl_InstanceID != 0) ? -1.0 : 1.0;

View File

@ -22,6 +22,8 @@ vec2 proj(vec4 pos)
void main()
{
GPU_INTEL_VERTEX_SHADER_WORKAROUND
clipCase = 0;
vec3 world_pos = point_object_to_world(pos);

View File

@ -8,6 +8,8 @@ flat out vec4 faceColor;
void main()
{
GPU_INTEL_VERTEX_SHADER_WORKAROUND
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);

View File

@ -12,6 +12,8 @@ out vec4 weightColor;
void main()
{
GPU_INTEL_VERTEX_SHADER_WORKAROUND
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
weightColor = vec4(weight_color.rgb, 1.0);

View File

@ -20,6 +20,8 @@ out int selectOveride;
void main()
{
GPU_INTEL_VERTEX_SHADER_WORKAROUND
vec3 world_pos = point_object_to_world(pos);
#if !defined(FACE)

View File

@ -21,6 +21,8 @@ flat out vec4 v2;
void main()
{
GPU_INTEL_VERTEX_SHADER_WORKAROUND
vec3 n = normalize(normal_object_to_world(nor));
vec3 world_pos = point_object_to_world(pos);