1048: Make VertexFormat::size a const fn r=kvark a=Imberflur
**Connections**
Addresses #836
**Description**
The `vertex_attr_array!` macro uses this function. This change enables the macro to be used in `const` contexts and for instance allows returning a `VertexBufferDescriptor` constructed in function without having the difficulties of ensuring the array from `vertex_attr_array!` lives long enough.
**Testing**
I don't believe testing is needed for this.
<!--
Non-trivial functional changes would need to be tested through:
- [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
- [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.
Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See https://github.com/gfx-rs/wgpu/pull/666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->
Co-authored-by: Imbris <imbrisf@gmail.com>
639: Make BindingResource::TextureViewArray more flexible (addresses #588) r=grovesNL a=98devin
Fixes#588
Rather than having a field of `&[TextureView]`, which requires either keeping all TextureViews in a vector in the first place or moving them into a temporary vector or array and back, use `&[&TextureView]` instead. Obviates the need for hacky workarounds if you keep your TextureViews in non-contiguous structs, maps, or can't move them, etc.
For those using a vector previously, the required transformation is merely `.iter().collect()`.
Co-authored-by: Devin Hill <98devin@gmail.com>
635: Staging belt: do not panic by unwrapping send result in recall (fixes#634) r=kvark a=myfreeweb
Co-authored-by: Greg V <greg@unrelenting.technology>
615: Update web bindings r=kvark a=grovesNL
- Use newer buffer mapping API everywhere and remove polyfill.
- There's a weird thing here where we hand out `&[u8]`/`&mut [u8]`s for users to write into, but later have to copy back into the browser-provided `ArrayBuffer`. It's done during `Drop` here but open to some other ideas.
- Add in `web_sys::GpuTextureComponentType::DepthComparison` though it looks like we don't have it in Gecko yet:
> GPUDevice.createBindGroupLayout: 'depth-comparison' (value of 'textureComponentType' member of GPUBindGroupLayoutEntry) is not a valid value for enumeration GPUTextureComponentType.
- `mipmap` fails because `layout` is still required in Gecko:
> GPUDevice.createRenderPipeline: Missing required 'layout' member of GPUPipelineDescriptorBase.
- Add in some parts that we can implement now, including labels, debug markers, render bundles, and `get_bind_group_layout`
Co-authored-by: Joshua Groves <josh@joshgroves.com>
633: Port to the updated wgpu error model r=scoopr a=kvark
Depends on https://github.com/gfx-rs/wgpu/pull/1034
I removed most of the helping sugar we had before, in exchange for simple `match` and a `handle_error` function.
I believe this way it's easier to maintain and debug (stepping through closures is a pain today).
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
1034: Fearless object creation r=kvark a=kvark
**Connections**
Fixes#977Fixes#1032
**Description**
Requiring a separate `xxx_error()` is very convenient for `wgpu-core`, but getting repetitive and complicated for all the users of the API. This PR changes it so we return an object ID unconditionally, and sometimes it's an error. The actual error is passed on the side.
**Testing**
Tested on https://github.com/gfx-rs/wgpu-rs/pull/633
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
Moved the global writing part to it's own function
Merged the texture and the global loop
Applied some suggestions from kvark
Added a topological sorting of the call graph before writing
Removed the struct block loop and now every struct is written
Organized the main backend file a bit
The backend now works in a similar way to the msl backend
Should require less loops, allocations and backtracking
Overall just better to work with it
Added a build script which reads a file with the glsl keywords and
generates a slice to be used in the Namer
Added a way to build a call graph
1037: Add Ids to PassErrorScope r=kvark a=scoopr
Also makes it pub, and the places it is used.
Tweak some error messages.
Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
1036: Stop using Borrow<RefCount> r=scoopr a=kvark
**Connections**
Follow-up to #931
**Description**
Takes advantage of the new `trait Resource` in the state tracker, reducing the code.
**Testing**
Not tested outside of `cargo test`
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
631: Temporarily use `BackendBit::PRIMARY` in examples r=kvark a=grovesNL
`BackendBit::all()` allows GL/surfman to be used on macOS which appears to prevent rendering with Metal (e.g. hello-triangle displays an empty window).
surfman will be removed in later versions of gfx, which will allow us to switch back to `BackendBit::all()` in the examples.
Co-authored-by: Joshua Groves <josh@joshgroves.com>
`BackendBit::all()` allows GL/surfman to be used on macOS which appears
to prevent rendering with Metal (e.g. hello-triangle displays an empty
window).
surfman will be removed in later versions of gfx, which will allow us
to switch back to `BackendBit::all()` in the examples.