Lines: workaround for WebGL/Linux bug #24
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A couple users reported bugs with line rendering on certain Linux laptops. I was able to narrow it down to a problem with
stride
/offset
when multiple vertex attributes are views on the same underlying buffer.This pure-regl example demonstrates the problem. It renders a simple moving average of some data: https://codepen.io/anon/pen/maVppw?editors=0010
On a Mac and some other platforms, this renders as expected (green = stride of 4 bytes, red = stride of 8 bytes):
However on the affected hardware, the result differs:
This is consistent between Chrome & Firefox, so it seems like it might a graphics driver/hardware bug.
The problem seems to occur when 3 or 4 attributes are using the same buffer, but not with only 2, so we can work around it by taking a slight perf hit to upload 2 copies of the same data into two buffers so that each has only two attributes reading from it.