Skip to content

Commit 133399b

Browse files
]Fixed CustomPassUtils scaling issues when used with RTHandles allocated from a RenderTexture. (#4140)
* Fixed custom pass scaling issues when using RTHandles allocated from a RenderTexture * Updated changelog Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
1 parent 171f03b commit 133399b

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

com.unity.render-pipelines.core/Runtime/Textures/RTHandle.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ public void Release()
155155
/// <returns>Input size scaled by the RTHandle scale factor.</returns>
156156
public Vector2Int GetScaledSize(Vector2Int refSize)
157157
{
158+
if (!useScaling)
159+
return refSize;
160+
158161
if (scaleFunc != null)
159162
{
160163
return scaleFunc(refSize);

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
154154
- Fixed GBuffer clear option in FrameSettings not working
155155
- Fixed usage of Panini Projection with floating point HDRP and Post Processing color buffers.
156156
- Fixed a NaN generating in Area light code.
157+
- Fixed CustomPassUtils scaling issues when used with RTHandles allocated from a RenderTexture.
157158

158159
### Changed
159160
- Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,11 @@ internal static void SetRenderTargetWithScaleBias(in CustomPassContext ctx, Mate
569569
{
570570
// viewport with RT handle scale and scale factor:
571571
Rect viewport = new Rect();
572-
Vector2 destSize = viewport.size = destination.GetScaledSize(destination.rtHandleProperties.currentViewportSize);
572+
if (destination.useScaling)
573+
viewport.size = destination.GetScaledSize(destination.rtHandleProperties.currentViewportSize);
574+
else
575+
viewport.size = new Vector2Int(destination.rt.width, destination.rt.height);
576+
Vector2 destSize = viewport.size;
573577
viewport.position = new Vector2(viewport.size.x * destScaleBias.z, viewport.size.y * destScaleBias.w);
574578
viewport.size *= new Vector2(destScaleBias.x, destScaleBias.y);
575579

0 commit comments

Comments
 (0)