You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Editor primitives use forward basepass when ES2 feature level is active. #codereview nick.penwarden [CL 2404705 by Allan Bentham in Main branch]
60 lines
2.1 KiB
C++
60 lines
2.1 KiB
C++
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
|
#include "RendererPrivate.h"
|
|
#include "EditorCompositeParams.h"
|
|
|
|
FEditorCompositingParameters::FEditorCompositingParameters()
|
|
{
|
|
}
|
|
|
|
void FEditorCompositingParameters::Bind(const FShaderParameterMap& ParameterMap)
|
|
{
|
|
EditorCompositeDepthTestParameter.Bind(ParameterMap, TEXT("bEnableEditorPrimitiveDepthTest"));
|
|
MSAASampleCount.Bind(ParameterMap, TEXT("MSAASampleCount"));
|
|
FilteredSceneDepthTexture.Bind(ParameterMap, TEXT("FilteredSceneDepthTexture"));
|
|
FilteredSceneDepthTextureSampler.Bind(ParameterMap, TEXT("FilteredSceneDepthTextureSampler"));
|
|
}
|
|
|
|
void FEditorCompositingParameters::SetParameters(
|
|
FRHICommandList& RHICmdList,
|
|
const FMaterial& MaterialResource,
|
|
const FSceneView* View,
|
|
bool bEnableEditorPrimitveDepthTest,
|
|
const FPixelShaderRHIParamRef ShaderRHI)
|
|
{
|
|
#if WITH_EDITOR
|
|
if (GMaxRHIFeatureLevel >= ERHIFeatureLevel::SM4)
|
|
{
|
|
if (MaterialResource.IsUsedWithEditorCompositing())
|
|
{
|
|
// Compute parameters for converting from screen space to pixel
|
|
FIntRect DestRect = View->ViewRect;
|
|
FIntPoint ViewportOffset = DestRect.Min;
|
|
FIntPoint ViewportExtent = DestRect.Size();
|
|
|
|
FVector4 ScreenPosToPixelValue(
|
|
ViewportExtent.X * 0.5f,
|
|
-ViewportExtent.Y * 0.5f,
|
|
ViewportExtent.X * 0.5f - 0.5f + ViewportOffset.X,
|
|
ViewportExtent.Y * 0.5f - 0.5f + ViewportOffset.Y);
|
|
|
|
if (FilteredSceneDepthTexture.IsBound())
|
|
{
|
|
const FTexture2DRHIRef* DepthTexture = GSceneRenderTargets.GetActualDepthTexture();
|
|
check(DepthTexture != NULL);
|
|
SetTextureParameter(
|
|
RHICmdList,
|
|
ShaderRHI,
|
|
FilteredSceneDepthTexture,
|
|
FilteredSceneDepthTextureSampler,
|
|
TStaticSamplerState<SF_Bilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI(),
|
|
*DepthTexture
|
|
);
|
|
}
|
|
|
|
SetShaderValue(RHICmdList, ShaderRHI, EditorCompositeDepthTestParameter, bEnableEditorPrimitveDepthTest);
|
|
SetShaderValue(RHICmdList, ShaderRHI, MSAASampleCount, GSceneRenderTargets.EditorPrimitivesColor ? GSceneRenderTargets.EditorPrimitivesColor->GetDesc().NumSamples : 0);
|
|
}
|
|
}
|
|
#endif
|
|
}
|