Files
UnrealEngineUWP/Engine/Source/Runtime/SlateRHIRenderer/Private/SlatePostProcessor.h
Jeff Fisher ef53d2904d FPostProcessRectParams SourceTexture support for 2DArray.
-FPostProcessRectParams was still using the old FTexture2DRHIRef/GetTexture2D pattern rather than using FTextureRHIRef directly.  This meant that it did not support 2DArray textures, like the VR swapchain, and caused an assert during a post-process blur on Lyra.
#review-20297934
#rb Arciel.Reckman
#preflight 6287e5ff9b764703c31a4077

[CL 20300846 by Jeff Fisher in ue5-main branch]
2022-05-20 15:11:49 -04:00

48 lines
1.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "RHI.h"
#include "Layout/SlateRect.h"
class FSlatePostProcessResource;
class IRendererModule;
struct FPostProcessRectParams
{
FTextureRHIRef SourceTexture;
FSlateRect SourceRect;
FSlateRect DestRect;
FVector4 CornerRadius;
FIntPoint SourceTextureSize;
TFunction<void(FRHICommandListImmediate&, FGraphicsPipelineStateInitializer&)> RestoreStateFunc;
uint32 StencilRef{};
};
struct FBlurRectParams
{
int32 KernelSize;
int32 DownsampleAmount;
float Strength;
};
class FSlatePostProcessor
{
public:
FSlatePostProcessor();
~FSlatePostProcessor();
void BlurRect(FRHICommandListImmediate& RHICmdList, IRendererModule& RendererModule, const FBlurRectParams& Params, const FPostProcessRectParams& RectParams);
void ColorDeficiency(FRHICommandListImmediate& RHICmdList, IRendererModule& RendererModule, const FPostProcessRectParams& RectParams);
void ReleaseRenderTargets();
private:
void DownsampleRect(FRHICommandListImmediate& RHICmdList, IRendererModule& RendererModule, const FPostProcessRectParams& Params, const FIntPoint& DownsampleSize);
void UpsampleRect(FRHICommandListImmediate& RHICmdList, IRendererModule& RendererModule, const FPostProcessRectParams& Params, const FIntPoint& DownsampleSize, FSamplerStateRHIRef& Sampler);
int32 ComputeBlurWeights(int32 KernelSize, float StdDev, TArray<FVector4f>& OutWeightsAndOffsets);
private:
FSlatePostProcessResource* IntermediateTargets;
};