0

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 either.

cafce25
  • 15,907
  • 4
  • 25
  • 31
Jove
  • 105
  • 4

1 Answers1

1

If you want to render at a lower resolution than the Surface you're displaying to then you have to

  1. create a texture of the size you want,
  2. render to that (in exactly the same way you'd render to the surface), and
  3. in a separate render pass, render that texture to the surface by putting it on a triangle that covers the entire screen.

A fair bit of setup, but the second render pass is also a useful opportunity to do things like tone mapping and other screen-space effects.

Kevin Reid
  • 37,492
  • 13
  • 80
  • 108