Open rreusser opened 2 years ago
Confirmed, here is a notebook which reproduces the issue: https://observablehq.com/d/243a0f078d6865bd
To reproduce:
If the OES_vertex_array_object
is present, this will produce the expected result. If not, then emulation will render the second (unfancy) triangle incorrectly but throw no errors or warnings.
const regl = createREGL({
extensions: ['ANGLE_instanced_arrays', 'OES_vertex_array_object']
});
const vao = regl.vao([
{ divisor: 0, buffer: regl.buffer([[-0.1, -0.1], [0.1, -0.1], [0, 0.1]]) },
{ divisor: 1, buffer: regl.buffer([[-0.2, 0.4], [0.2, .4]]) }
]);
const drawTrianglesWithVAO = regl({
vert: `
precision highp float;
attribute vec2 xy, tri;
void main () {
gl_Position = vec4(xy + tri, 0, 1);
}`,
frag: `
precision highp float;
void main () {
gl_FragColor = vec4(0,0,0,1);
}`,
attributes: { tri: 0, xy: 1 },
vao,
count: 3,
instances: 2
});
const drawTriangle = regl({
vert: `
precision highp float;
attribute vec2 xy;
attribute vec3 color;
varying vec3 vColor;
void main () {
vColor = color;
gl_Position = vec4(xy, 0, 1);
}`,
frag: `
precision highp float;
varying vec3 vColor;
void main () {
gl_FragColor = vec4(pow(vColor, vec3(0.454)),1);
}`,
attributes: {
xy: [[-0.1, -0.5], [0.1, -0.5], [0, -0.3]],
color: [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
},
count: 3
});
regl.poll();
drawTrianglesWithVAO();
drawTriangle();
Can still reproduce this issue.
In this notebook: https://observablehq.com/@rreusser/strange-attractors-on-the-gpu-part-2
The particles use a VAO. It should look like this:
but when I disable the VAO extension, causing the particles to fall back to VAO emulation, the particles render correctly but the grid is incorrect:
I'll see if I can, but I don't yet have a more focused reproduction of the bug.See below for reproduction.Attribute 0 of particle rendering has divisor 0, all others have divisor 1. That could potentially be a cause.