Skip to content

Commit d7bd858

Browse files
Avoid Intel Ultra 7 graphical glitches during vertex discard (#8730)
Co-authored-by: pmconne <[email protected]>
1 parent afa3d68 commit d7bd858

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@itwin/core-frontend",
5+
"comment": "Work around Intel Ultra 7 vertex discard glitch",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@itwin/core-frontend"
10+
}

core/frontend/src/internal/render/webgl/ShaderBuilder.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,14 +819,20 @@ export class VertexShaderBuilder extends ShaderBuilder {
819819
main.addline(" v_color = baseColor;");
820820
}
821821

822+
/*
823+
There is currently a driver glitch which is known to affect much of the Intel Ultra 7 family of chipsets when using Intel driver from some point after driver version 32.0.101.6078 (9/13/2024).
824+
825+
The graphics driver will glitch when discarding triangles using the vertex shader (setting all vertices to the same value) if gl_Position was not initialized to a valid position beforehand.
826+
827+
The workaround for this bug involves ensuring that gl_Position is initialized to a valid position before attempting a discard using a degenerate triangle.
828+
*/
829+
main.addline(" gl_Position = computePosition(rawPosition);");
822830
const checkForDiscard = this.get(VertexShaderComponent.CheckForDiscard);
823831
if (undefined !== checkForDiscard) {
824832
prelude.addFunction("bool checkForDiscard()", checkForDiscard);
825833
main.add(vertexDiscard);
826834
}
827835

828-
main.addline(" gl_Position = computePosition(rawPosition);");
829-
830836
const finalizePos = this.get(VertexShaderComponent.FinalizePosition);
831837
if (undefined !== finalizePos) {
832838
prelude.addFunction("vec4 finalizePosition(vec4 pos)", finalizePos);

0 commit comments

Comments
 (0)