5.4.4 Color Regions crash with SMPTE 2110

Hi Rus,

I also recommend adding the sanity clamp and a check for the Max Region before creating the Platform Viewport, like so:

`// ++Dimension Markus : Tentative fix to resolve ICVFX crash due to invalid DX12 dimensions on RHI viewport
// Preventing Graphics API platform crash for hard-limitation of viewport sizes (DX12 only for now)
// We are in a war zone here on-set, so we only considering DX12 platform for the hotfix
FIntRect ViewportLimits{ FIntRect(0, 0, D3D12_VIEWPORT_BOUNDS_MAX, D3D12_VIEWPORT_BOUNDS_MAX) };
BoundingRectangle.Clip(ViewportLimits);

// Clip Min to < D3D12_VIEWPORT_BOUNDS_MAX if Min > 0
BoundingRectangle.Min.X = FMath::Min(BoundingRectangle.Min.X, D3D12_VIEWPORT_BOUNDS_MAX);
BoundingRectangle.Min.Y = FMath::Min(BoundingRectangle.Min.Y, D3D12_VIEWPORT_BOUNDS_MAX);
// In case Min was > Max before Clipping && Min > D3D12_VIEWPORT_BOUNDS_MAX so that Max == Min which is > D3D12_VIEWPORT_BOUNDS_MAX
BoundingRectangle.Max.X = FMath::Min(BoundingRectangle.Max.X, D3D12_VIEWPORT_BOUNDS_MAX);
BoundingRectangle.Max.Y = FMath::Min(BoundingRectangle.Max.Y, D3D12_VIEWPORT_BOUNDS_MAX);

if (BoundingRectangle.Min.X < 0 || BoundingRectangle.Min.Y < 0 || BoundingRectangle.Min.X > D3D12_VIEWPORT_BOUNDS_MAX || BoundingRectangle.Min.Y > D3D12_VIEWPORT_BOUNDS_MAX ||
BoundingRectangle.Max.X < 0 || BoundingRectangle.Max.Y < 0 || BoundingRectangle.Max.X > D3D12_VIEWPORT_BOUNDS_MAX || BoundingRectangle.Max.Y > D3D12_VIEWPORT_BOUNDS_MAX)
{
UE_LOG(ColorCorrectRegions, Error, TEXT(“[RenderRegion()]: Invalid BoundingRectangle Dimensions for Platform Viewport Min (%d, %d), Max (%d, %d)”),
BoundingRectangle.Min.X, BoundingRectangle.Min.Y, BoundingRectangle.Max.X, BoundingRectangle.Max.Y);
return false;
}

// --Dimension Markus : Tentative fix to resolve ICVFX crash due to invalid DX12 dimensions on RHI viewport`

This is because looking at the Clip function one will realize that the last section basically sets a zero area of Region, however 0 not in terms of actual 0,0 but literally in 0 area, while still potentially having a larger-than-allowed position of that 0-area viewport. This can happen is Min was originally larger than Max. For reference:

`void Clip(const TIntRect& R)
{
Min.X = FMath::Max(Min.X, R.Min.X);
Min.Y = FMath::Max(Min.Y, R.Min.Y);
Max.X = FMath::Min(Max.X, R.Max.X);
Max.Y = FMath::Min(Max.Y, R.Max.Y);

// return zero area if not overlapping
Max.X = FMath::Max(Min.X, Max.X);
Max.Y = FMath::Max(Min.Y, Max.Y);
}`Maybe the Clip should just set 0,0 as zero-area rather than the original (probably rogue) input values. But that’s up for discussion and intent I suppose. Anyway, if we apply the additional manual clip from the fix above also for Max, we should be good to ensure both Min and Max are within Platform Viewport Bounds.

Best,

Markus