Add padded static size and recursive padding to crevice and use it#18
Add padded static size and recursive padding to crevice and use it#18superdump wants to merge 29 commits intocart:pipelined-renderingfrom
Conversation
Renamed PipelineDescriptor to RenderPipelineDescriptor
StandardMaterial flat values
…n for Bind Groups
* bevy_pbr2: Add support for most of the StandardMaterial textures Normal maps are not included here as they require tangents in a vertex attribute. * bevy_pbr2: Ensure RenderCommandQueue is ready for PbrShaders init * texture_pipelined: Add a light to the scene so we can see stuff * WIP bevy_pbr2: back to front sorting hack * bevy_pbr2: Uniform control flow for texture sampling in pbr.frag From 'fintelia' on the Bevy Render Rework Round 2 discussion: "My understanding is that GPUs these days never use the "execute both branches and select the result" strategy. Rather, what they do is evaluate the branch condition on all threads of a warp, and jump over it if all of them evaluate to false. If even a single thread needs to execute the if statement body, however, then the remaining threads are paused until that is completed." * bevy_pbr2: Simplify texture and sampler names The StandardMaterial_ prefix is no longer needed * bevy_pbr2: Match default 'AmbientColor' of current bevy_pbr for now * bevy_pbr2: Convert from non-linear to linear sRGB for the color uniform * bevy_pbr2: Add pbr_pipelined example * Fix view vector in pbr frag to work in ortho * bevy_pbr2: Use a 90 degree y fov and light range projection for lights * bevy_pbr2: Add AmbientLight resource * bevy_pbr2: Convert PointLight color to linear sRGB for use in fragment shader * bevy_pbr2: pbr.frag: Rename PointLight.projection to view_projection The uniform contains the view_projection matrix so this was incorrect. * bevy_pbr2: PointLight is an OmniLight as it has a radius * bevy_pbr2: Factoring out duplicated code * bevy_pbr2: Implement RenderAsset for StandardMaterial * Remove unnecessary texture and sampler clones * fix comment formatting * remove redundant Buffer:from * Don't extract meshes when their material textures aren't ready * make missing textures in the queue step an error Co-authored-by: Aevyrie <aevyrie@gmail.com> Co-authored-by: Carter Anderson <mcanders1@gmail.com>
Force main thread for prepare_windows system
bevy_pbr2: Fix light uniforms
This rounds up the size to the struct's alignment. This allows interoperability with wgsl.
|
Looking at the wgsl spec: https://www.w3.org/TR/WGSL/#alignment-and-size For wgsl: it looks like a struct's alignment is the maximum alignment of its members. And a struct's size is the offset of the last member of the struct, plus the size of the last member of the struct (which is what I think implicit-stride arrays work the same way as glsl arrays, except that glsl seems to say things about aligning to vec4 unconditionally in some situations:
It's not exactly clear to me what the |
|
I'll keep the discussion going over there, but I found an error case: LPGhatguy/crevice#29 (comment) |
* bevy_sprite2/_pbr2: Do not queue sprites/meshes if there are no views
05bd717 to
955c79f
Compare
This appears to work just fine for rounding up the sizes. We had the code already for rounding up sizes to the struct alignment in
UniformVecfor item sizes so I just moved that intocreviceas astd140_padded_size_staticand tested it - it returns what wgpu expects for wgsl forGpuLightsandViewUniformmin_binding_sizeat least. I'll let them decide if it is fully correct, but if it isn't then we need to fixUniformVectoo I expect.