* The conditional at the start of resize() already tests for and exits on the zero width and height condition.
The conditional removed here was then getting run on every other call to resize(), which doesn't seem logical, doesn't correspond to the comment, and seemed to be causing at least one issue with rendered viewport going black during resize.
Fixes#532
(probably) Fixes#519
* Defensive coding to prevent various issues when window size goes to zero, e.g. NaN being passed in cgmath::perspective() aspect ratio parameter.
Fixes#531
523: Change buffer binding to not take a slice r=cwfitzgerald,grovesNL a=kvark
This has been a constant source of confusion w.r.t dynamic offsets.
What it looks like it's doing: user provides a slice of buffer visible to the shader. Just like they provide slices to vertex and index buffer bindings.
What it's actually doing: it takes the offset and size separately, modifying the offset later on based on the dynamic offset.
We don't need this confusion. Semantics is different from `BufferSlice` and so we should have a different API here.
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
517: Added some explanatory comments to hello-compute example r=kvark a=JonathanWoollett-Light
Simply added some more comments explaing the basic compute example.
Also moved the lines:
```rust
let slice_size = numbers.len() * std::mem::size_of::<u32>();
let size = slice_size as wgpu::BufferAddress;
```
To be just before where they are used.
Co-authored-by: Jonathan Woollett-Light <jonathanwoollettlight@gmai.com>
509: Convert StagingBelt to take a &mut CommandEncoder r=kvark a=cwfitzgerald
This allows `StagingBelt` to be `Send`, very important for async/highly multithreaded applications. Also added a bit more documentation.
Tested on the skybox example.
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
502: Expose get_bind_group_layout r=grovesNL a=kvark
Returning a new object is fine for BGLs specifically and for these cases in particular because we made sure the refcount is bumped (and BGL has a special kind of refcount) in f164fd1f46
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
495: Update a documentation to refer to create_buffer_init() instead of create_buffer_with_data() r=kvark a=yutannihilation
A followup of #482
Co-authored-by: Hiroaki Yutani <yutani.ini@gmail.com>
493: Use BCn textures if possible in skybox example r=kvark a=cwfitzgerald
This converts the skybox to using compressed textures if available. I have designed the code to be extensible to other compressed formats as they are added.
Additionally I added srgb to the texture types, as we were using a srgb framebuffer without properly converting into linear on the texture reads.
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
492: Replace NonZeroU32 with u32 in TextureViewDescriptor r=kvark a=kunalmohan
Includes https://github.com/gfx-rs/wgpu/pull/854
(rustfmt seems to have introduced a number of other changes. I can revert them if they are undesired)
r?@kvark
Co-authored-by: Kunal Mohan <kunalmohan99@gmail.com>
482: Add label parameter to `create_buffer_with_data` r=kvark a=OptimisticPeach
Improves QOL by allowing you to attach a label to a buffer when created with predetermined data:
```
let uniform_buf = device.create_buffer_with_data(
bytemuck::cast_slice(my_data),
wgpu::BufferUsage::UNIFORM,
Some(Cow::Borrowed("My Uniforms")),
);
```
Co-authored-by: OptimisticPeach <patrikbuhring@yahoo.com>