Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.12 Migration: Reduce the size of MeshUniform section shader code is broken #824

Open
rparrett opened this issue Nov 8, 2023 · 0 comments

Comments

@rparrett
Copy link
Contributor

rparrett commented Nov 8, 2023

affine_to_square isn't even in mesh_functions anymore. It was moved in bevyengine/bevy#9597.

But also, it seems that you want to use mesh_functions::get_model_matrix for this now instead, due to it handling the details of some workaround for some DX12 bug.

Relevant bit of the migration guide:

`MeshUniform` now stores its current and previous model transforms as 4x3 matrices. Helper functions were added to bevy_pbr::mesh_functions to unpack the data.
```rust
// 0.11
var model = mesh[instance_index].model;
// 0.12
#import bevy_pbr::mesh_functions::affine_to_square
var model = affine_to_square(mesh[instance_index].model);
```

Relevant text from Discord:

robswain — Today at 7:11 AM
yes. i'd recommend doing what mesh.wgsl does (if i'm remembering the correct file)

robswain — Today at 7:12 AM
https://github.com/bevyengine/bevy/blob/4852fc7578b7a55db4c05a6fb9f8ebdd290571e1/crates/bevy_pbr/src/render/mesh.wgsl#L46
https://github.com/bevyengine/bevy/blob/4852fc7578b7a55db4c05a6fb9f8ebdd290571e1/crates/bevy_pbr/src/render/mesh_functions.wgsl#L15

robswain — Today at 7:27 AM
and if you want to see a bit more about what the problem with instance index is, there's a comment here: https://github.com/bevyengine/bevy/blob/main/crates/bevy_render/src/instance_index.wgsl
get_model_matrix was to abstract that away and give people something simpler to use

mesh[vertex.instance_index].model seems to show up elsewhere in the migration guide as well...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants