Skip to content

Commit b86d05e

Browse files
committed
Merge pull request #109993 from bruvzg/upscale_gl_check
Check renderer type when setting 3D upscaling mode.
2 parents 9c5cb0d + adce527 commit b86d05e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

servers/rendering/renderer_viewport.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ void RendererViewport::_configure_3d_render_buffers(Viewport *p_viewport) {
145145
scaling_3d_mode = RS::VIEWPORT_SCALING_3D_MODE_OFF;
146146
}
147147

148+
if (scaling_3d_mode != RS::VIEWPORT_SCALING_3D_MODE_OFF && scaling_3d_mode != RS::VIEWPORT_SCALING_3D_MODE_BILINEAR && OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") {
149+
scaling_3d_mode = RS::VIEWPORT_SCALING_3D_MODE_BILINEAR;
150+
scaling_type = RS::scaling_3d_mode_type(scaling_3d_mode);
151+
WARN_PRINT_ONCE("MetalFX and FSR upscaling are not supported in the Compatibility renderer. Falling back to bilinear scaling.");
152+
}
153+
148154
if (scaling_3d_mode == RS::VIEWPORT_SCALING_3D_MODE_METALFX_TEMPORAL && !RD::get_singleton()->has_feature(RD::SUPPORTS_METALFX_TEMPORAL)) {
149155
if (RD::get_singleton()->has_feature(RD::SUPPORTS_METALFX_SPATIAL)) {
150156
// Prefer MetalFX spatial if it is supported, which will be much more efficient than FSR2,
@@ -974,6 +980,9 @@ void RendererViewport::viewport_set_scaling_3d_mode(RID p_viewport, RS::Viewport
974980
ERR_FAIL_COND_EDMSG(p_mode == RS::VIEWPORT_SCALING_3D_MODE_FSR2, "FSR2 is only available when using the Forward+ renderer.");
975981
ERR_FAIL_COND_EDMSG(p_mode == RS::VIEWPORT_SCALING_3D_MODE_METALFX_TEMPORAL, "MetalFX Temporal is only available when using the Forward+ renderer.");
976982
}
983+
if (rendering_method == "gl_compatibility") {
984+
ERR_FAIL_COND_EDMSG(p_mode == RS::VIEWPORT_SCALING_3D_MODE_METALFX_SPATIAL, "MetalFX Spatial is only available when using the Forward+ and Mobile renderers.");
985+
}
977986

978987
if (viewport->scaling_3d_mode == p_mode) {
979988
return;

0 commit comments

Comments
 (0)