Don't return matrix by value due to perf #4136

This commit is contained in:
2026-06-16 11:57:44 +02:00
parent b49b410d6b
commit 39994764d1
3 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -113,7 +113,7 @@ namespace FlaxEditor.Gizmo
if (cb != IntPtr.Zero)
{
var data = new Data();
var projection = renderContext.View.GetOverlayProjection();
renderContext.View.GetOverlayProjection(out var projection);
Matrix.Multiply(ref renderContext.View.View, ref projection, out var viewProjection);
Matrix.Transpose(ref viewProjection, out data.ViewProjectionMatrix);
data.ViewPos = renderContext.View.WorldPosition;
+3 -2
View File
@@ -36,9 +36,10 @@ namespace FlaxEngine
/// <summary>
/// Gets projection matrix for overlay geometry rendered after temporal anti-aliasing has been resolved.
/// </summary>
public Matrix GetOverlayProjection()
/// <param name="projection">Projection matrix valid for rendering before or after (matches current TAA jitter stage).</param>
public void GetOverlayProjection(out Matrix projection)
{
return IsTaaResolved ? NonJitteredProjection : Projection;
projection = IsTaaResolved ? NonJitteredProjection : Projection;
}
/// <summary>
+1 -1
View File
@@ -90,7 +90,7 @@ namespace FlaxEngine
Matrix.Multiply(ref worldMatrix, ref renderContext.View.View, out Matrix viewMatrix);
Matrix projectionMatrix = renderContext.View.Projection;
if (worldSpace && (Canvas.RenderLocation == PostProcessEffectLocation.Default || Canvas.RenderLocation == PostProcessEffectLocation.AfterAntiAliasingPass))
projectionMatrix = renderContext.View.GetOverlayProjection(); // Fix TAA jittering when rendering UI in world after TAA resolve
renderContext.View.GetOverlayProjection(out projectionMatrix); // Fix TAA jittering when rendering UI in world after TAA resolve
Matrix.Multiply(ref viewMatrix, ref projectionMatrix, out Matrix viewProjectionMatrix);
// Pick a depth buffer