Upscaling and downscaling textures

I have come to ask a question regarding scaling of textures. Currently in my rendering engine I would like to perform a few passes with raytracing however even with an acceleration structure the performance isn’t great (around 90 FPS for 2100 Triangles) and its being bottlenecked by the GPU. is there a reliable solution to successfully downscale a colour attachment for processing then upscale after processing without losing much accuracy?

As a starting point for evaluating quality, a simple-to-implement solution is to resize with glBlitFramebuffer with the GL_LINEAR filter.

If you need downsampling and resizing in one call, use EXT_framebuffer_multisample_blit_scaled, which adds additional filters which support this. Alternatively, do 2 separate blits: 1 downsample + 1 resize. Depending on the driver, this may give you better quality.

Filtering quality is of course going to depend on your GPU drivers. Consider performing the original render with MSAA to get the max spatial fidelity while still saving on fragment shading and fill costs.

Implementing this should take you very little dev time. And with this you can assess whether the quality meets your needs or you want another tech approach.

1 Like

just implemented it now and works very well only took 15 minutes. At first I was sceptical about the copying of pixels of one framebuffer to another every frame but it seems the GPU doesn’t mind this, perhaps its because i am not copying it back to main memory I am not so sure but thank you. My GPU usage dropped from 80% down to 20%, I think I am going to take your advice with MSAA and see if I can push the downscaling further.

Great!

That’s what I see too. GPU-to-GPU Blit Framebuffer is one of those embarrassingly parallel tasks which maps well to the GPU. Particularly when it’s implemented by the GPU vendor.

1 Like