230: Implement sample_count field r=kvark a=rukai I'm trying to get MSAA working for brawllib renderer. This PR allows for more ways to hit validation errors. Giving a valid but mismatching sample count results in these validation errors. ``` ERROR gfx_backend_vulkan VALIDATION [VUID-vkCmdCopyImageToBuffer-srcImage-00188 (0)] : vkCmdCopyImageToBuffer(): srcImage for image 0xe030 was created with a sample count of VK_SAMPLE_COUNT_4_BIT but must be VK_SAMPLE_COUNT_1_BIT. The Vulkan spec states: srcImage must have a sample count equal to VK_SAMPLE_COUNT_1_BIT (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkCmdCopyImageToBuffer-srcImage-00188) object info: (type: IMAGE, hndl: 57392) ERROR gfx_backend_vulkan VALIDATION [UNASSIGNED-CoreValidation-DrawState-NumSamplesMismatch (0)] : Num samples mismatch! At draw-time in Pipeline (0x7) with 1 samples while current RenderPass (0xe) w/ 4 samples! object info: (type: PIPELINE, hndl: 7) ERROR gfx_backend_vulkan VALIDATION [VUID-vkCmdDrawIndexed-renderPass-02684 (0)] : vkCmdDrawIndexed(): RenderPasses incompatible between active render pass w/ renderPass 0xe and pipeline state object w/ renderPass 0x6 Attachment 0 is not compatible with 0: They have different samples.. The Vulkan spec states: The current render pass must be compatible with the renderPass member of the VkGraphicsPipelineCreateInfo structure specified when creating the VkPipeline bound to VK_PIPELINE_BIND_POINT_GRAPHICS. (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkCmdDrawIndexed-renderPass-02684) object info: (type: RENDER_PASS, hndl: 14) ``` Co-authored-by: Rukai <rubickent@gmail.com>
This is an active GitHub mirror of the WebGPU native implementation in Rust, which now lives in Mozilla-central. Issues and pull requests are accepted, but we merge them in m-c manually and then sync to GitHub instead of landing directly here.
WebGPU
This is an experimental WebGPU implementation as a native static library. It's written in Rust and is based on gfx-hal and Rendy libraries. The corresponding WebIDL specification can be found at gpuweb project.
The implementation consists of the following parts:
wgpu-native- the native implementation of WebGPU as a C API librarywgpu-remote- remoting layer to work with WebGPU across the process boundaryffi- the C headers generated by cbindgen for both of the libraries
Supported platforms:
- Vulkan on Windows and Linux
- D3D12 and D3D11 on Windows
- Metal on macOS and iOS
Usage
This repository contains C-language examples that link to the native library targets and perform basic rendering and computation. To run the C triangle example, install a C compiler + glfw 3, then run these commands at the root of the repo:
rustup toolchain install nightly
cargo install cbindgen
make examples-native
cd examples/hello_triangle_c/build
./hello_triangle
The idiomatic Rust wrapper lives in https://github.com/gfx-rs/wgpu-rs and provides a number of more complex examples to get a feel of the API.