Rename SceneRenderTask::RenderingPercentage to RenderScale

This commit is contained in:
2026-06-03 13:01:11 +02:00
parent e0f234c667
commit fd8ae9bc2b
4 changed files with 28 additions and 17 deletions
@@ -98,10 +98,10 @@ namespace FlaxEditor.Windows
[NoSerialize, DefaultValue(1.0f), Limit(0.05f, 5, 0)]
[EditorOrder(1400), EditorDisplay("Quality")]
[Tooltip("The scale of the rendering resolution relative to the output dimensions. If lower than 1 the scene and postprocessing will be rendered at a lower resolution and upscaled to the output backbuffer.")]
public float RenderingPercentage
public float RenderScale
{
get => MainRenderTask.Instance.RenderingPercentage;
set => MainRenderTask.Instance.RenderingPercentage = value;
get => MainRenderTask.Instance.RenderScale;
set => MainRenderTask.Instance.RenderScale = value;
}
[NoSerialize, DefaultValue(RenderingUpscaleLocation.AfterAntiAliasingPass), VisibleIf(nameof(UpscaleLocation_Visible))]
@@ -113,7 +113,7 @@ namespace FlaxEditor.Windows
set => MainRenderTask.Instance.UpscaleLocation = value;
}
private bool UpscaleLocation_Visible => MainRenderTask.Instance.RenderingPercentage < 1.0f;
private bool UpscaleLocation_Visible => MainRenderTask.Instance.RenderScale < 1.0f;
[NoSerialize, DefaultValue(1.0f), Limit(0, 1)]
[EditorOrder(1500), EditorDisplay("Quality"), Tooltip("The global density scale for all foliage instances. The default value is 1. Use values from range 0-1. Lower values decrease amount of foliage instances in-game. Use it to tweak game performance for slower devices.")]
+14 -11
View File
@@ -353,8 +353,11 @@ Viewport SceneRenderTask::GetViewport() const
viewport = Buffers->GetViewport();
else
viewport = Viewport(0, 0, 1280, 720);
viewport.Width *= RenderingPercentage;
viewport.Height *= RenderingPercentage;
PRAGMA_DISABLE_DEPRECATION_WARNINGS
float renderScale = RenderingPercentage * RenderScale;
PRAGMA_ENABLE_DEPRECATION_WARNINGS
viewport.Width *= renderScale;
viewport.Height *= renderScale;
return viewport;
}
@@ -394,13 +397,16 @@ void SceneRenderTask::OnBegin(GPUContext* context)
}
// Setup render buffers for the output rendering resolution
PRAGMA_DISABLE_DEPRECATION_WARNINGS
float renderScale = RenderingPercentage * RenderScale;
PRAGMA_ENABLE_DEPRECATION_WARNINGS
if (Output)
{
Buffers->Init((int32)((float)Output->Width() * RenderingPercentage), (int32)((float)Output->Height() * RenderingPercentage));
Buffers->Init((int32)((float)Output->Width() * renderScale), (int32)((float)Output->Height() * renderScale));
}
else if (SwapChain)
{
Buffers->Init((int32)((float)SwapChain->GetWidth() * RenderingPercentage), (int32)((float)SwapChain->GetHeight() * RenderingPercentage));
Buffers->Init((int32)((float)SwapChain->GetWidth() * renderScale), (int32)((float)SwapChain->GetHeight() * renderScale));
}
}
@@ -434,7 +440,10 @@ bool SceneRenderTask::Resize(int32 width, int32 height)
PROFILE_MEM(Graphics);
if (Output && Output->Resize(width, height))
return true;
if (Buffers && Buffers->Init((int32)((float)width * RenderingPercentage), (int32)((float)height * RenderingPercentage)))
PRAGMA_DISABLE_DEPRECATION_WARNINGS
float renderScale = RenderingPercentage * RenderScale;
PRAGMA_ENABLE_DEPRECATION_WARNINGS
if (Buffers && Buffers->Init((int32)((float)width * renderScale), (int32)((float)height * renderScale)))
return true;
return false;
}
@@ -477,12 +486,6 @@ void MainRenderTask::OnBegin(GPUContext* context)
// Use the main camera for the game (can be later overriden in Begin event by external code)
Camera = Camera::GetMainCamera();
#if !USE_EDITOR
// Sync render buffers size with the backbuffer
const auto size = Screen::GetSize();
Buffers->Init((int32)(size.X * RenderingPercentage), (int32)(size.Y * RenderingPercentage));
#endif
SceneRenderTask::OnBegin(context);
}
+7 -1
View File
@@ -268,8 +268,14 @@ public:
/// <summary>
/// The scale of the rendering resolution relative to the output dimensions. If lower than 1 the scene and postprocessing will be rendered at a lower resolution and upscaled to the output backbuffer.
/// [Deprecated in v1.13]
/// </summary>
API_FIELD() float RenderingPercentage = 1.0f;
API_FIELD() DEPRECATED("Use RenderScale instead.") float RenderingPercentage = 1.0f;
/// <summary>
/// The scale of the rendering resolution relative to the output dimensions. If lower than 1 the scene and postprocessing will be rendered at a lower resolution and upscaled to the output backbuffer.
/// </summary>
API_FIELD() float RenderScale = 1.0f;
/// <summary>
/// The image resolution upscale location within rendering pipeline. Unused if RenderingPercentage is 1.
+3 -1
View File
@@ -733,7 +733,9 @@ void RenderInner(SceneRenderTask* task, RenderContext& renderContext, RenderCont
}
// Upscaling after scene rendering but before post processing
bool useUpscaling = task->RenderingPercentage < 1.0f;
PRAGMA_DISABLE_DEPRECATION_WARNINGS
bool useUpscaling = task->RenderingPercentage * task->RenderScale < 1.0f;
PRAGMA_ENABLE_DEPRECATION_WARNINGS
const Viewport outputViewport = task->GetOutputViewport();
if (useUpscaling && setup.UpscaleLocation == RenderingUpscaleLocation::BeforePostProcessingPass)
{