Fix WebGL not rendering StandardMaterial#12110
Merged
alice-i-cecile merged 3 commits intobevyengine:mainfrom Feb 25, 2024
janhohenheim:fix-webgl
Merged
Fix WebGL not rendering StandardMaterial#12110alice-i-cecile merged 3 commits intobevyengine:mainfrom janhohenheim:fix-webgl
StandardMaterial#12110alice-i-cecile merged 3 commits intobevyengine:mainfrom
janhohenheim:fix-webgl
Conversation
afonsolage
reviewed
Feb 25, 2024
mockersf
approved these changes
Feb 25, 2024
doonv
approved these changes
Feb 25, 2024
msvbg
pushed a commit
to msvbg/bevy
that referenced
this pull request
Feb 26, 2024
# Objective - Fixes bevyengine#12081 ## Solution Passing the `Affine2` as a neatly packed `mat3x2` breaks WebGL with `drawElementsInstanced: Buffer for uniform block is smaller than UNIFORM_BLOCK_DATA_SIZE.` I fixed this by using a `mat3x3` instead. Alternative solutions that come to mind: - Pass in a `mat3x2` on non-webgl targets and a `mat3x3` otherwise. I guess I could use `#ifdef SIXTEEN_BYTE_ALIGNMENT` for this, but it doesn't seem quite right? This would be more efficient, but decrease code quality. - Do something about `UNIFORM_BLOCK_DATA_SIZE`. I don't know how, so I'd need some guidance here. @superdump let me know if you'd like me to implement other variants. Otherwise, I vote for merging this as a quick fix for `main` and then improving the packing in subsequent PRs :) ## Additional notes Ideally we should merge this before @JMS55 rebases bevyengine#10164 so that they don't have to rebase everything a second time.
msvbg
pushed a commit
to msvbg/bevy
that referenced
this pull request
Feb 26, 2024
# Objective - Fixes bevyengine#12081 ## Solution Passing the `Affine2` as a neatly packed `mat3x2` breaks WebGL with `drawElementsInstanced: Buffer for uniform block is smaller than UNIFORM_BLOCK_DATA_SIZE.` I fixed this by using a `mat3x3` instead. Alternative solutions that come to mind: - Pass in a `mat3x2` on non-webgl targets and a `mat3x3` otherwise. I guess I could use `#ifdef SIXTEEN_BYTE_ALIGNMENT` for this, but it doesn't seem quite right? This would be more efficient, but decrease code quality. - Do something about `UNIFORM_BLOCK_DATA_SIZE`. I don't know how, so I'd need some guidance here. @superdump let me know if you'd like me to implement other variants. Otherwise, I vote for merging this as a quick fix for `main` and then improving the packing in subsequent PRs :) ## Additional notes Ideally we should merge this before @JMS55 rebases bevyengine#10164 so that they don't have to rebase everything a second time.
mockersf
added a commit
to mockersf/bevy
that referenced
this pull request
Feb 28, 2024
This reverts commit ad5d790.
mockersf
added a commit
to mockersf/bevy
that referenced
this pull request
Feb 29, 2024
mockersf
added a commit
to mockersf/bevy
that referenced
this pull request
Mar 19, 2024
This reverts commit ad5d790.
mockersf
added a commit
to mockersf/bevy
that referenced
this pull request
Apr 9, 2024
This reverts commit ad5d790.
mockersf
added a commit
to mockersf/bevy
that referenced
this pull request
Apr 9, 2024
This reverts commit ad5d790.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Objective
Solution
Passing the
Affine2as a neatly packedmat3x2breaks WebGL withdrawElementsInstanced: Buffer for uniform block is smaller than UNIFORM_BLOCK_DATA_SIZE.I fixed this by using a
mat3x3instead.Alternative solutions that come to mind:
mat3x2on non-webgl targets and amat3x3otherwise. I guess I could use#ifdef SIXTEEN_BYTE_ALIGNMENTfor this, but it doesn't seem quite right? This would be more efficient, but decrease code quality.UNIFORM_BLOCK_DATA_SIZE. I don't know how, so I'd need some guidance here.@superdump let me know if you'd like me to implement other variants. Otherwise, I vote for merging this as a quick fix for
mainand then improving the packing in subsequent PRs :)Additional notes
Ideally we should merge this before @JMS55 rebases #10164 so that they don't have to rebase everything a second time.