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

Wgsl Naga - How can I use builtin textureStore() with texture_storage_2d?

Naga validate this snippet: [[group(0), binding(0)]] var output : texture_storage_2d; [[stage(compute), workgroup_size(1)]] fn main() { textureStore(output, vec2(10,10),…
Jokari
  • 43
  • 3
1
vote
0 answers

How to make sure I pass the right byte layout to the wgpu shader as uniform

I have this structure #[repr(C)] #[derive(Debug, Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)] struct ProjUniform { view_proj: [[f32; 3]; 3], } impl ProjUniform { fn new() -> Self { Self { view_proj: [[0.0, 0.0,…
eguneys
  • 6,028
  • 7
  • 31
  • 63
1
vote
1 answer

wgpu-rs: `thread 'main' panicked at 'Texture[1] does not exist'`

I create a wgpu::TextureView within a render method as below: let mut encoder = self.device.create_command_encoder(...); let texture_view = self .surface .get_current_frame()? .output .texture …
doliphin
  • 752
  • 6
  • 22
1
vote
1 answer

Wgpu: correctly written WGSL shader parsing error

I am using wgpu-rs and writing shaders in WGSL. To test an example shader, I copied some sample code from here: https://www.w3.org/TR/WGSL/#var-and-let. Here is my simple shader: // Vertex shader struct VertexInput { [[location(0)]] pos:…
can
  • 45
  • 6
1
vote
1 answer

How can I draw a line while only using vertices and indices?

I use wgpu as my graphics backend for my project. this is my current implementation: pub fn draw_line( points: Vec<[f32; 2]>, ) -> (Vec, Vec) { let mut vertices: Vec = Vec::new(); let mut indices: Vec =…
Bruno Wallner
  • 383
  • 5
  • 13
1
vote
0 answers

Get XCB connection for QWindow

How do I get the XCB connection (xcb_connection_t*) for a given QWindow in Qt5? Right now I'm using QX11Info::connection() to retrieve this pointer, but that depends on libQt5X11Extras.so, which might not be available on every target system.…
1
vote
1 answer

Why does Rust seem to ignore my lifetime annotation?

I have the following class pub struct RectangleNode { ... uniform_bind_group: wgpu::BindGroup, ... } Which should implement the following trait pub trait Node<'a, 'b> where 'a : 'b { fn render(&'a self, render_pass: &'b mut…
Gerharddc
  • 3,921
  • 8
  • 45
  • 83
0
votes
1 answer

WGSL: Multiplying a vec4f by a mat4f identity matrix produces different results

I am trying out WebGPU for the first time and have come across a problem. Normally in other rendering frameworks I would multiply a vec4 my a matrix of all 1s and the output would be the same. Here is what I expect with this code: @vertex fn…
Jove
  • 105
  • 4
0
votes
1 answer

Creating writing and reading from buffer wgpu

I have just recently started learning about how to compute on a GPU and I have decided to start with WGPU as I'm familiar with rust and it can be run on pretty much every GPU. As far as my current understanding goes first I have to create a buffer…
LAYTOR
  • 381
  • 4
  • 12
0
votes
2 answers

How to time profile/see when tasks are complete in wgpu (targeting web)?

Basically title. There are support for timestamp queries, but that requires specific device feature support (my laptop for example does not support it when targeting web). There is also the function Queue::onSubmittedWorkDone(callback) that throws…
Pap113
  • 37
  • 1
  • 7
0
votes
1 answer

WGSL throws parsing error on seemingly correct code

I have a storage texture which I (try to) write to in a compute shader. Then in the fragment shader I am trying to read from that storage texture using textureLoad, but I am getting this error and I have no clue what I'm doing wrong: Caused by: …
LordRobin
  • 76
  • 5
0
votes
1 answer

Read from texture in compute shader

I am trying to read (and write) to a texture in my compute shader. And getting the following message: Read-write and read-only storage textures are not allowed by webgpu, they require the native only feature…
frankelot
  • 13,666
  • 16
  • 54
  • 89
0
votes
0 answers

Max texture views accessible per fragment shader in wgpu-rs

I am working on a rendering engine in wgpu-rs. I have a system which "batches" rendering, splitting large amounts of vertices and textures into separate draw calls. However, I need to find out what the limit for textures is. For example, when using…
mqxf
  • 1
  • 1
0
votes
1 answer

Using multiple bind groups in wgpu-rs

I'm new to WGPU and I'm following the learn-wgpu site. However, I'm trying to make a library which I could use to create simple games. For example, to draw two different images on the screen I would use: lib.clear(); lib.add_text_rect(0.0, 0.0, 0.5,…
0
votes
0 answers

My 3d camera has working rotation, but the translation stays fixed at the origin

I've been working on an FPS style camera using wgpu. My code is here: https://github.com/Barbacamanitu/particle_curl I'm sending a view, projection, and inverse view matrix to my shaders. So far, I can look around the scene fine, but when I move the…
Barbacamanitu
  • 61
  • 1
  • 4