2 ms·
> gl.drawArrays(gl.TRIANGLES, 0, 6); Using 2 tris for this isn’t ideal because you will get duplicate fragment invocations along the horizontal seam where the
by cmovq 1y ago
> gl.drawArrays(gl.TRIANGLES, 0, 6);
Using 2 tris for this isn’t ideal because you will get duplicate fragment invocations along the horizontal seam where the triangles meet. It is slightly more efficient to use one larger triangle extending outside the viewport, the offscreen parts will be clipped and not generate any additional fragments.
[1]: https://wallisc.github.io/rendering/2021/04/18/Fullscreen-Pass.html https://wallisc.github.io/rendering/2021/04/18/Fullscreen-Pa...
- nathan-barry 1y agoThat's a great insight, you're right.
- tarnith 1y agoAlso see https://michaldrobot.com/2014/04/01/gcn-execution-patterns-in-full-screen-passes/ https://michaldrobot.com/2014/04/01/gcn-execution-patterns-i... A bit of an older article but still very relevant. I've found with webGL2 you can also skip the whole upload/binding of the buffer and just emit the vertexes/coordinates from the vertex shader as well. Less of an impact than cutting it down, but if you're just trying to get a a fragment going, why not use the least amount of data and CPU-> GPU upload possible.
- cmovq 1y agoYeah it’s nice even just to avoid having to set up a vertex buffer: ivec2 vert = ivec2(gl_VertexID & 1, gl_VertexID >> 1); out_uv = 2.0 * vec2(vert); gl_Position = vec4(out_uv * 2.0 - 1.0, 0.0, 1.0);