Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions com.unity.render-pipelines.core/Runtime/Textures/RTHandleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ internal enum ResizeMode

int m_MaxWidths = 0;
int m_MaxHeights = 0;
#if UNITY_EDITOR
// In editor every now and then we must reset the size of the rthandle system if it was set very high and then switched back to a much smaller scale.
int m_FramesSinceLastReset = 0;
#endif

/// <summary>
/// RTHandleSystem constructor.
Expand Down Expand Up @@ -172,6 +176,26 @@ public void SetReferenceSize(int width, int height, MSAASamples msaaSamples, boo
width = Mathf.Max(width, 1);
height = Mathf.Max(height, 1);

#if UNITY_EDITOR
// If the reference size is significantly higher than the current actualWidth/Height and it is larger than 1440p dimensions, we reset the reference size every several frames
// in editor to avoid issues if a large resolution was temporarily set.
const int resetInterval = 100;
if (((m_MaxWidths / (float)width) > 2.0f && m_MaxWidths > 2560) ||
((m_MaxHeights / (float)height) > 2.0f && m_MaxHeights > 1440))
{
if (m_FramesSinceLastReset > resetInterval)
{
m_FramesSinceLastReset = 0;
ResetReferenceSize(width, height);
}
m_FramesSinceLastReset++;
}

// If some cameras is requesting the same res as the max res, we don't want to reset
if (m_MaxWidths == width && m_MaxHeights == height)
m_FramesSinceLastReset = 0;
#endif

bool sizeChanged = width > GetMaxWidth() || height > GetMaxHeight() || reset;
bool msaaSamplesChanged = (msaaSamples != m_ScaledRTCurrentMSAASamples);

Expand Down
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The version number for this package has increased due to a version update of a r
- Fixed NullRef Exception when decals are in the scene, no asset is set and HDRP wizard is run.
- Fixed nan when a decal affects normals.
- Fixed issue with TAA causing bleeding of a view into another when multiple views are visible.
- Fix an issue that caused issues of usability of editor if a very high resolution is set by mistake and then reverted back to a smaller resolution.

### Changed
- Combined occlusion meshes into one to reduce draw calls and state changes with XR single-pass.
Expand Down