vkQuake icon indicating copy to clipboard operation
vkQuake copied to clipboard

Add viewport based scaling support

Open temx opened this issue 2 years ago • 9 comments

When r_simplescale is set to 1, instead of adjusting texture LOD and point sampling in the screen effects shader, adjust the viewport to render a smaller rectangle and then point upscale after screen effects, before the HUD is drawn (like QuakeSpasm does). This gives faster 3D view rendering and supports any scale factor.

temx avatar Jan 21 '23 15:01 temx

If we merge this then we should remove all the other scaling code. I was hesitant doing this before because it requires the GUI to be rendered in a separate render pass instead of a sub pass. I assume this is the case here?

Novum avatar Jan 21 '23 21:01 Novum

Unless I'm misunderstanding something, the GUI is already rendered on a separate render pass. The Screen Effects compute shader runs in the middle (and if using WATER_WARP it already reads from different coords), and that's where the scaling is done. The only use of subpasses that I can see is GUI -> POST_PROCESS (color correction), but that's after scaling is finished.

temx avatar Jan 21 '23 23:01 temx

I'll take a look

Novum avatar Jan 23 '23 06:01 Novum

Still want to merge this btw. Just haven't had time to look at it.

I basically want to verify first if it's not better to just realloc the render targets at the smaller size?

Novum avatar Feb 15 '23 03:02 Novum

IIRC using smaller render targets would require more of them (two are needed to run the screen effects, and if they're smaller a new larger one wold be needed for the UI), and managing that doesn't look like it'd be less complex. Is that just to save some memory?

temx avatar Feb 15 '23 03:02 temx

I just have bad memories from using resolution scaling based on viewports. But I think we don't do any bilinear sampling of render targets (which causes problems at the borders) so it might be fine. You can alias the same memory for multiple render target sizes. Just needs a barrier.

Novum avatar Feb 15 '23 04:02 Novum

I'm okay with merging this, but I think we should just remove the screen effects path completely with the same PR.

Novum avatar Feb 27 '23 21:02 Novum

The subgroup stuff too? The screen effects path could be repurposed to do "supersampling downsampling" as it did before. Not sure if many people would want to use that.

temx avatar Feb 27 '23 22:02 temx

I would just kill it. I'm not attached to that code :)

Novum avatar Feb 27 '23 23:02 Novum