Reset offset correction in "stored on GPU" path #780
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.
This one-liner is, I hope, the fix for this issue.
The new stuff in 3713 introduced custom vertex formats. These meant you could no longer always jump right into the geometry data, and thus need a "correction":
fVertexOffset - fOffsetCorrection
, inRenderer::CheckAndInsertDrawCommand()
.The "stored on GPU" path would still want essentially the old behavior, since its buffers only have data for themselves, but the correction snippet was still being used, but never zeroing out that value: it's either whatever it last was or (as in the link) some uninitialized garbage. In the latter case that happens to be a negative value and thus produce that WebGL error.
This was a general bug—I believe I did see it in my tests, when indexed meshes were involved (the only source of "stored on GPU" buffers in most builds), but it "went away" (probably when I reordered some objects) and I falsely assumed something had fixed it. The web beta stores all objects on GPU, so the problem couldn't help but show up.