Fix: Mesh Edit Mode Shader: Correct artifacts that appeared on edges of edit mode with some AMD GPUs
In case the problem appeared with the `AMD Radeon HD 7570M`
This commit is contained in:
parent
7183d15d97
commit
b810e9ffc4
|
@ -106,7 +106,7 @@ vec4 getClipData(vec2 pos[3], ivec2 vidx)
|
|||
return vec4(A, Adir);
|
||||
}
|
||||
|
||||
void doVertex(int v, vec4 pos)
|
||||
void doVertex(int v)
|
||||
{
|
||||
#ifdef VERTEX_SELECTION
|
||||
vertexColor = getVertexColor(v);
|
||||
|
@ -116,7 +116,16 @@ void doVertex(int v, vec4 pos)
|
|||
facing = vFacing[v];
|
||||
#endif
|
||||
|
||||
gl_Position = pos;
|
||||
gl_Position = pPos[v];
|
||||
|
||||
EmitVertex();
|
||||
}
|
||||
|
||||
void doLoopStrip(int v, vec3 offset)
|
||||
{
|
||||
doVertex(v);
|
||||
|
||||
gl_Position.xyz += offset;
|
||||
|
||||
EmitVertex();
|
||||
}
|
||||
|
@ -174,12 +183,12 @@ void main()
|
|||
/* Only pass the first 2 distances */
|
||||
for (int v = 0; v < 2; ++v) {
|
||||
eData1[v] = dist(pos, pos[v], v);
|
||||
doVertex(v, pPos[v]);
|
||||
doVertex(v);
|
||||
eData1[v] = 0.0;
|
||||
}
|
||||
|
||||
/* and the last vertex */
|
||||
doVertex(2, pPos[2]);
|
||||
doVertex(2);
|
||||
|
||||
#ifdef EDGE_FIX
|
||||
vec2 fixvec[6];
|
||||
|
@ -250,8 +259,7 @@ void main()
|
|||
|
||||
/* Position of the "hidden" third vertex */
|
||||
eData2[0] = pos[vbe];
|
||||
doVertex(v, pPos[v]);
|
||||
doVertex(v, pPos[v] + vec4(fixvec[v], Z_OFFSET, 0.0));
|
||||
doLoopStrip(v, vec3(fixvec[v], Z_OFFSET));
|
||||
|
||||
/* Now one triangle only shade one edge
|
||||
* so we use the edge distance calculated
|
||||
|
@ -266,20 +274,17 @@ void main()
|
|||
edgesCrease[2] = ecrease[vbe];
|
||||
edgesBweight[2] = ebweight[vbe];
|
||||
|
||||
doVertex(vaf, pPos[vaf]);
|
||||
doVertex(vaf, pPos[vaf] + vec4(fixvecaf[v], Z_OFFSET, 0.0));
|
||||
doLoopStrip(vaf, vec3(fixvecaf[v], Z_OFFSET));
|
||||
|
||||
/* corner vertices should not draw edges but draw point only */
|
||||
flag[2] = (vData[vbe].x << 8);
|
||||
#ifdef VERTEX_SELECTION
|
||||
doVertex(vaf, pPos[vaf]);
|
||||
doVertex(vaf, pPos[vaf] + vec4(cornervec[vaf], Z_OFFSET, 0.0));
|
||||
doLoopStrip(vaf, vec3(cornervec[vaf], Z_OFFSET));
|
||||
#endif
|
||||
}
|
||||
|
||||
/* finish the loop strip */
|
||||
doVertex(2, pPos[2]);
|
||||
doVertex(2, pPos[2] + vec4(fixvec[2], Z_OFFSET, 0.0));
|
||||
doLoopStrip(2, vec3(fixvec[2], Z_OFFSET));
|
||||
#endif
|
||||
}
|
||||
/* Harder case : compute visible edges vectors */
|
||||
|
@ -295,7 +300,7 @@ void main()
|
|||
eData2[2] = tmp.zw;
|
||||
|
||||
for (int v = 0; v < 3; ++v)
|
||||
doVertex(v, pPos[v]);
|
||||
doVertex(v);
|
||||
}
|
||||
|
||||
EndPrimitive();
|
||||
|
|
Loading…
Reference in New Issue