Questions tagged [wgpu-rs]

wgpu-rs is a Rust implementation of the WebGPU specification.

wgpu-rs is a Rust wrapper around wgpu-core which provides back-ends for

  • DirectX 11 and 12
  • Vulkan
  • Metal
  • OpenGL (experimental)

wgpu-rs is released on Github under the Mozilla Public License 2.0. Examples and basic information can be found in the README and on the Wiki page.

An excellent Tutorial for how to get started can be found here.

55 questions
1
vote
1 answer

Ensure extended lifetime of MutexGuard used as reference

In the following minimal code example, a MutexGuard is used for accessing a BindGroup that is sure to exist longer than the lifetime of the RenderPass. However, this is obviously not known to the Rust compiler, resulting in a lifetime error. For…
KingOfDog
  • 65
  • 1
  • 12
1
vote
1 answer

How to render a custom color under title bar with WGPU on Winit for MacOs

I am creating a rust app which uses winit and wgpu. I set the options .with_titlebar_transparent(true) when creating the winit window but I am not sure how to place a color under it. My goal is to make the background color of the content and the…
BigWinnz101
  • 61
  • 1
  • 5
1
vote
1 answer

Triangles not drawing in wgpu with lyon

I am making a system for line drawing in wgpu with lyon. My problem is when I call draw_indexed() with the VertexBuffers from lyon nothing shows up. Sorry about the huge amount of code, wgpu takes a lot to get running impl LineDrawer { fn…
Jove
  • 105
  • 4
1
vote
0 answers

How to dynamically index array inside array that is stored as storage in wgsl

I have the following structure that represents a 3D VoxelGrid: var chunks: array; struct Chunk { position: vec3, metadata: u32, data: array, CHUNK_DATA_SIZE>, }; I had to use a vector inside the…
BrunoWallner
  • 417
  • 3
  • 10
1
vote
1 answer

How to use Storage Buffers in WGPU to store dynamic sized arrays

I am working on a Pathtracer that uses the fragment-shader to render onto a Texture. Currently I only render Spheres that are stored as a UniformBuffer like this: var geometry: Geometry; struct Geometry { sphere_count: u32, spheres:…
BrunoWallner
  • 417
  • 3
  • 10
1
vote
1 answer

WGPU - Rust or С/C++?

Please explain about the Wgpu library:https://github.com/gfx-rs/wgpu The page says: To use wgpu in C/C++, you need wgpu-native. wgpu-native:https://github.com/gfx-rs/wgpu-native I go to the wgpu-native github page, so it says that: This is a native…
Serg_
  • 67
  • 5
1
vote
1 answer

WGPU and Dawn (WebGpu)

I am trying to understand the general concept of wgpu and Dawn. As I understand it, there are two main implementations of the WebGPU standard from Khronos: wgpu from Mozilla and Dawn from Google. Do I understand correctly that: -wgpu: is it a C/Rust…
Lua_beg
  • 31
  • 6
1
vote
1 answer

Why is wgpu failing to build in this crate?

I have recently been working on a game engine in rust and for rendering I have been planning on using the wgpu crate. When I add this to my dependancies wgpu-hal fails to build with 448 errors. my cargo.toml for this crate looks like…
1
vote
1 answer

Dependency fails to compile in workspace but not in package

I'm trying to set up a simple rust-wgpu project based on the cube example. I got it to run as a simple package (test1, below), but when I put it into a package (edit: I meant workspace) (test2), one of its dependencies, wgpu-hal, fails to compile,…
1
vote
1 answer

Problem with uniform buffer on rust's wgpu only for web target

I made this project as a way to learn rust and graphics programming. The program is based on this great tutorial and currently works as a native desktop application (on Windows atleast). However, my main goal is to create a web app to showcase my…
lobis
  • 145
  • 1
  • 10
1
vote
1 answer

How to make a window in Bevy that is a transparent overlay that doesn’t interfere with the underlying applications (doesn’t block mouse, keyboard etc)

I would like to create a bevy window that: Has no background Has no window decoration Is always on top Doesn’t interfere with input to the underlying window. I have done some research, and I think that on windows you can set a value called “input…
James G
  • 13
  • 4
1
vote
1 answer

How to make transparent window in rust using winit + wgpu?

I wanted to create something like rainmeter gadgets for windows. I need to create a partially-transparent window without header and borders. Some parts of my code: // winit let event_loop = EventLoop::new(); let main_window = WindowBuilder::new() …
Ciyox
  • 11
  • 1
1
vote
3 answers

Using mat4x4 as uniform in WGSL

Is it possible to use a mat4x4 as a uniform data type in WGSL? I get the following error when doing so: Shader validation error: ┌─ Shader:18:4 │ 18 │ var model: mat4x4; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^…
junglie85
  • 1,243
  • 10
  • 30
1
vote
1 answer

How do you pass dynamic values into a WGPU vertex shader?

I am this tutorial for wgpu in rust and have successfully rendered a triangle on screen by defining a static array like this: const VERTICES: &[Vertex] = &[ Vertex { position: [-0.0868241, 0.49240386, 0.0], color: [0.1, 0.0, 0.5] }, Vertex…
1
vote
1 answer

How to get Bevy to run longer than 5 seconds on Windows 11 with Geforce RTX 2060

I'm trying to go through the Bevy docs and have noticed that I absoilutely cannot run a single example or basic app for longer than about 5 seconds without getting errors breaking execution. Is there something special outside of the doc's setup…
CoderLee
  • 3,079
  • 3
  • 25
  • 57