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
0
votes
1 answer

WGpu z-coordinate ignored

I am using wgpu crate in rust to render triangles in layers. The problem is that the z coordinate of the vertices seems to be ignored. The shader returns the z coordinate in the output position, and there is no further transformation applied to it.…
Redirectk
  • 160
  • 9
0
votes
0 answers

Bevy - Render to wgpu::Texture

I am looking for an elegant and hopefully bevy-esque way of rendering to a wgpu::Texture. The reason is that I'm am implementing a WebXR libary and the WebXRFramebuffer must be rendered to in immersive XR. let framebuffer = //get framebuffer from…
chantey
  • 4,252
  • 1
  • 35
  • 40
0
votes
2 answers

Problem with aligning Rust structs to send to the GPU using bytemuck and WGPU

I have this Rust struct that I want to send to the GPU: const MAX_SPHERES: usize = 4; #[repr(C)] #[derive(Copy, Clone, Debug, bytemuck::Pod, bytemuck::Zeroable)] pub struct Sphere { pub position: [f32; 3], pub color: [f32; 3], pub…
BrunoWallner
  • 417
  • 3
  • 10
0
votes
1 answer

How to create a letterbox shader to reserve an aspect ratio in wgpu

I want a shader that reserves the aspect ratio like you see in many games. I have a quad that covers the screen in a second render pass along with the frame as a texture, screen width and height, and target resolution width and height. However I…
Jove
  • 105
  • 4
0
votes
1 answer

Using nannou.rs, how can I provide the correct parameters to the load_from_image_buffer method?

I am currently trying to learn Nannou.rs. I generate a Luma8 image (corresponding to a Perlin heightmap) and I am trying to display it in my app's window using the function load_from_image_buffer implemented by nannou::wgpu::Texture in the model…
Feldspatt
  • 62
  • 8
0
votes
1 answer

How to render at a lower resolution in wgpu?

I am using wgpu and I can't find anywhere how to render at a given resolution. I have tried with setting the Surface width and height but that didn't seem to do anything. I also couldn't find any methods in the render or surface structs I am using…
Jove
  • 105
  • 4
0
votes
1 answer

How to draw a textured cube in WGPU using indices?

I'm trying to draw a Minecraft-like textured cube in WGPU. I have a vertex buffer and an index buffer. I'm using Repeat for adress_mode on the texture sampler. I use texture coordinates greater or smaller than 0 to repeat the dirt texture. The…
NaniNoni
  • 155
  • 11
0
votes
2 answers

Rust WGPU Atomic Texture Operations

TL;DR: Is it possible to access textures atomically in WGSL? By atomically, I mean like specified in the "Atomic Operations" section of the documentation of OpenGL's GL_TEXTURE_*. If not, will changing to GLSL work in WGPU? Background: Hi, recently…
Ely Shaffir
  • 317
  • 3
  • 17
0
votes
1 answer

Eliminating byte repetition on vertex buffer when drawing 2D point

I am using wgpu-rs. I am drawing a 2D point that's within a triangle. I want this point to have a single color throughout. My current implementation is repeating some bytes and seems wasteful. I think there must be a better way. For each (x,y) pair,…
Simplex_
  • 39
  • 4
0
votes
1 answer

wgpu WGSL compute shader does not appear to be doing anything

I'm trying to follow along the "hello compute" example from wgpu on Windows 10 (with some minor modifications, mainly gutting the shader so it does basically no actual computing), but when I read the buffer at the end, it's always zeroed out. This…
YourGamerMom
  • 377
  • 3
  • 13
1 2 3
4