Color Vision Deficiency causing GPU performance issue related to Retainer Panel usage

Hi, we’re having a problem when enabling the Color Deficiency modes because it’s applying to extra passes for each retainer panel that we render.

Our game relies heavily on retainer panels to render the UI and after each retainer is rendered, the color deficiency causes two additional passes on the GPU to be rendered, a “ColorDeficiency” pass followed by an “Upsample” pass.

It’s doing this for every retainer panel we render which means we can often have 12 ColorDeficiency and 12 Upsample passes per frame, bloating our GPU time.

I was just wondering if this was expected and if so what we can do to optimise this?

I was also wondering what the Upsample pass does, as the input and output target sizes always seem to be identical, so I’m unsure what function it performs.

Many thanks,

Alex

[Attachment Removed]

Hi,

It seems that Upsample pass is probably just a poorly named copy which is needed to apply the color deficiency correction. However, I’d expect retainer panels to skip applying that correction since it’s meant to be done later (see SRetainerWidget::UpdateWidgetRenderer):

// This will be handled by the main slate rendering pass
WidgetRenderer->SetApplyColorDeficiencyCorrection(false);

From what I can tell, we’re ignoring that argument currently. Can you try updating FSlate3DRenderer::DrawWindowToTarget_RenderThread to pass that argument through, and see if that resolves the issue without any visual artifacts? It should just need to be piped through to the FSlateDrawElementsPassInputs:

		FSlateDrawElementsPassInputs DrawElementsInputs =
		{
			  .StencilTexture        = SlateStencilTexture
			, .ElementsTexture       = SlateElementsTexture
			, .ElementsLoadAction    = ConsumeLoadAction(ElementsLoadAction)
			, .ElementsBuffers       = SlateElementsBuffers[WindowElementIndex]
			, .ElementsMatrix        = FMatrix44f(ElementsMatrix)
			, .ElementsOffset        = FVector2f(ElementsOffset.X, ElementsOffset.Y)
			, .Time                  = FGameTime::CreateDilated(Context.RealTimeSeconds, Context.DeltaRealTimeSeconds, Context.WorldTimeSeconds, Context.DeltaTimeSeconds)
			, .bAllowGammaCorrection = bGammaCorrection
			, .bAllowColorDeficiencyCorrection = bAllowColorDeficiencyCorrection
		};

Let me know if that works for you!

[Attachment Removed]

Hi Cody! Thanks for the swift reply! I can confirm this has fixed our problem. So my setup looks like this now in Slate3DRenderer.cpp and I no longer see multiple color deficiency and upsample passes :raising_hands:.

Seems like this fix might be worth making in main for others going forward?​

		FSlateDrawElementsPassInputs DrawElementsInputs =
		{
			  .StencilTexture        = SlateStencilTexture
			, .ElementsTexture       = SlateElementsTexture
			, .ElementsLoadAction    = ConsumeLoadAction(ElementsLoadAction)
			, .ElementsBuffers       = SlateElementsBuffers[WindowElementIndex]
			, .ElementsMatrix        = FMatrix44f(ElementsMatrix)
			, .ElementsOffset        = FVector2f(ElementsOffset.X, ElementsOffset.Y)
			, .Time                  = FGameTime::CreateDilated(Context.RealTimeSeconds, Context.DeltaRealTimeSeconds, Context.WorldTimeSeconds, Context.DeltaTimeSeconds)
			, .bAllowGammaCorrection = bGammaCorrection
			, .bAllowColorDeficiencyCorrection = bAllowColorDeficiencyCorrection
		};

[Attachment Removed]

Excellent, glad to hear that worked! This fix is checked in at CL# 56016840.

[Attachment Removed]