1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Add an extra backbuffer color texture that can be used when an upscaler is in use.

Fixes issue #83152. Due to how BLUR_0 is reused for multiple purposes and requires being at native resolution for some post-processing effects to work, FSR2 will use an alternate texture at internal size to use as the screen texture read by shaders instead. The rendering pipeline will prefer using this texture if it exists.
This commit is contained in:
Dario
2023-10-11 14:54:36 -03:00
parent 30f2a6d611
commit 4890e96556
3 changed files with 37 additions and 8 deletions

View File

@@ -58,6 +58,7 @@
#define RB_TEX_BLUR_1 SNAME("blur_1")
#define RB_TEX_HALF_BLUR SNAME("half_blur") // only for raster!
#define RB_TEX_BACK_COLOR SNAME("back_color")
#define RB_TEX_BACK_DEPTH SNAME("back_depth")
class RenderSceneBuffersRD : public RenderSceneBuffers {
@@ -267,7 +268,16 @@ public:
}
// back buffer (color)
RID get_back_buffer_texture() const { return has_texture(RB_SCOPE_BUFFERS, RB_TEX_BLUR_0) ? get_texture(RB_SCOPE_BUFFERS, RB_TEX_BLUR_0) : RID(); } // We (re)use our blur texture here.
RID get_back_buffer_texture() const {
// Prefer returning the dedicated backbuffer color texture if it was created. Return the reused blur texture otherwise.
if (has_texture(RB_SCOPE_BUFFERS, RB_TEX_BACK_COLOR)) {
return get_texture(RB_SCOPE_BUFFERS, RB_TEX_BACK_COLOR);
} else if (has_texture(RB_SCOPE_BUFFERS, RB_TEX_BLUR_0)) {
return get_texture(RB_SCOPE_BUFFERS, RB_TEX_BLUR_0);
} else {
return RID();
}
}
// Upscaled.
void ensure_upscaled();