bevy/crates/bevy_render/src
Robert Swain 05e5008624 Support array / cubemap / cubemap array textures in KTX2 (#5325)
# Objective

- Fix / support KTX2 array / cubemap / cubemap array textures
- Fixes #4495 . Supersedes #4514 .

## Solution

- Add `Option<TextureViewDescriptor>` to `Image` to enable configuration of the `TextureViewDimension` of a texture.
  - This allows users to set `D2Array`, `D3`, `Cube`, `CubeArray` or whatever they need
  - Automatically configure this when loading KTX2
- Transcode all layers and faces instead of just one
- Use the UASTC block size of 128 bits, and the number of blocks in x/y for a given mip level in order to determine the offset of the layer and face within the KTX2 mip level data
- `wgpu` wants data ordered as layer 0 mip 0..n, layer 1 mip 0..n, etc. See https://docs.rs/wgpu/latest/wgpu/util/trait.DeviceExt.html#tymethod.create_texture_with_data
- Reorder the data KTX2 mip X layer Y face Z to `wgpu` layer Y face Z mip X order
- Add a `skybox` example to demonstrate / test loading cubemaps from PNG and KTX2, including ASTC 4x4, BC7, and ETC2 compression for support everywhere. Note that you need to enable the `ktx2,zstd` features to be able to load the compressed textures.

---

## Changelog

- Fixed: KTX2 array / cubemap / cubemap array textures
- Fixes: Validation failure for compressed textures stored in KTX2 where the width/height are not a multiple of the block dimensions.
- Added: `Image` now has an `Option<TextureViewDescriptor>` field to enable configuration of the texture view. This is useful for configuring the `TextureViewDimension` when it is not just a plain 2D texture and the loader could/did not identify what it should be.

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2022-07-30 07:02:58 +00:00
..
camera update wgpu to 0.13 (#5168) 2022-07-14 21:17:16 +00:00
color Very minor doc formatting changes (#5287) 2022-07-12 13:06:16 +00:00
mesh Improve ergonomics and reduce boilerplate around creating text elements. (#5343) 2022-07-20 14:14:29 +00:00
primitives Very minor doc formatting changes (#5287) 2022-07-12 13:06:16 +00:00
render_graph Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
render_phase Fix various typos (#5417) 2022-07-21 20:46:54 +00:00
render_resource add a debug label to storage buffers (#5341) 2022-07-28 20:37:49 +00:00
renderer Fix various typos (#5417) 2022-07-21 20:46:54 +00:00
texture Support array / cubemap / cubemap array textures in KTX2 (#5325) 2022-07-30 07:02:58 +00:00
view Revert "Recalculate entity aabbs when meshes change (#4944)" (#5489) 2022-07-29 23:24:39 +00:00
extract_component.rs Visibilty Inheritance, universal ComputedVisibility and RenderLayers support (#5310) 2022-07-15 23:24:42 +00:00
extract_param.rs Make RenderStage::Extract run on the render world (#4402) 2022-07-08 23:56:33 +00:00
extract_resource.rs remove an unused import in release (#5320) 2022-07-14 23:43:57 +00:00
lib.rs add a SpatialBundle with visibility and transform components (#5344) 2022-07-18 23:27:30 +00:00
rangefinder.rs Very minor doc formatting changes (#5287) 2022-07-12 13:06:16 +00:00
render_asset.rs Fix various typos (#5417) 2022-07-21 20:46:54 +00:00
settings.rs Add some docs about lowspec rendering (#5091) 2022-06-25 16:22:28 +00:00
spatial_bundle.rs add a SpatialBundle with visibility and transform components (#5344) 2022-07-18 23:27:30 +00:00