Jove
Jove

Reputation: 105

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

Upvotes: 0

Views: 673

Answers (1)

Kevin Reid
Kevin Reid

Reputation: 43782

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.

Upvotes: 2

Related Questions