本文整理汇总了C++中SCOPED_DRAW_EVENT函数的典型用法代码示例。如果您正苦于以下问题:C++ SCOPED_DRAW_EVENT函数的具体用法?C++ SCOPED_DRAW_EVENT怎么用?C++ SCOPED_DRAW_EVENT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SCOPED_DRAW_EVENT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StencilDecalMask
/** Draws a full view quad that sets stencil to 1 anywhere that decals should not be projected. */
void StencilDecalMask(const FSceneView& View)
{
SCOPED_DRAW_EVENT(StencilDecalMask, DEC_SCENE_ITEMS);
RHISetRasterizerState(TStaticRasterizerState<FM_Solid,CM_None>::GetRHI());
RHISetBlendState(TStaticBlendState<CW_NONE>::GetRHI());
RHISetRenderTarget(NULL, GSceneRenderTargets.GetSceneDepthSurface());
RHISetViewport(View.ViewRect.Min.X, View.ViewRect.Min.Y, 0.0f, View.ViewRect.Max.X, View.ViewRect.Max.Y, 1.0f);
// Write 1 to highest bit of stencil to areas that should not receive decals
RHISetDepthStencilState(TStaticDepthStencilState<false,CF_Always,true,CF_Always,SO_Replace,SO_Replace,SO_Replace>::GetRHI(), 0x80);
TShaderMapRef<FScreenVS> ScreenVertexShader(GetGlobalShaderMap());
TShaderMapRef<FStencilDecalMaskPS> PixelShader(GetGlobalShaderMap());
SetGlobalBoundShaderState(StencilDecalMaskBoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *ScreenVertexShader, *PixelShader);
PixelShader->SetParameters(View);
DrawRectangle(
0, 0,
View.ViewRect.Width(), View.ViewRect.Height(),
View.ViewRect.Min.X, View.ViewRect.Min.Y,
View.ViewRect.Width(), View.ViewRect.Height(),
FIntPoint(View.ViewRect.Width(), View.ViewRect.Height()),
GSceneRenderTargets.GetBufferSizeXY(),
EDRF_UseTriangleOptimization);
}
示例2: check
void FCompositionLighting::ProcessBeforeBasePass(FRHICommandListImmediate& RHICmdList, FViewInfo& View)
{
check(IsInRenderingThread());
// so that the passes can register themselves to the graph
{
FMemMark Mark(FMemStack::Get());
FRenderingCompositePassContext CompositeContext(RHICmdList, View);
FPostprocessContext Context(CompositeContext.Graph, View);
// Add the passes we want to add to the graph (commenting a line means the pass is not inserted into the graph) ----------
// decals are before AmbientOcclusion so the decal can output a normal that AO is affected by
if (Context.View.Family->EngineShowFlags.Decals &&
!Context.View.Family->EngineShowFlags.ShaderComplexity &&
IsDBufferEnabled())
{
FRenderingCompositePass* Pass = Context.Graph.RegisterPass(new(FMemStack::Get()) FRCPassPostProcessDeferredDecals(DRS_BeforeBasePass));
Pass->SetInput(ePId_Input0, Context.FinalOutput);
Context.FinalOutput = FRenderingCompositeOutputRef(Pass);
}
// The graph setup should be finished before this line ----------------------------------------
SCOPED_DRAW_EVENT(RHICmdList, CompositionBeforeBasePass);
CompositeContext.Process(Context.FinalOutput.GetPass(), TEXT("Composition_BeforeBasePass"));
}
}
示例3: StencilDecalMask
/** Draws a full view quad that sets stencil to 1 anywhere that decals should not be projected. */
void StencilDecalMask(FRHICommandList& RHICmdList, const FViewInfo& View, bool bUseHmdMesh)
{
SCOPED_DRAW_EVENT(RHICmdList, StencilDecalMask);
FSceneRenderTargets& SceneContext = FSceneRenderTargets::Get(RHICmdList);
RHICmdList.SetRasterizerState(TStaticRasterizerState<FM_Solid, CM_None>::GetRHI());
RHICmdList.SetBlendState(TStaticBlendState<CW_NONE>::GetRHI());
SetRenderTarget(RHICmdList, NULL, SceneContext.GetSceneDepthSurface(), ESimpleRenderTargetMode::EUninitializedColorExistingDepth, FExclusiveDepthStencil::DepthRead_StencilWrite);
RHICmdList.SetViewport(View.ViewRect.Min.X, View.ViewRect.Min.Y, 0.0f, View.ViewRect.Max.X, View.ViewRect.Max.Y, 1.0f);
// Write 1 to highest bit of stencil to areas that should not receive decals
RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always, true, CF_Always, SO_Replace, SO_Replace, SO_Replace>::GetRHI(), 0x80);
const auto FeatureLevel = View.GetFeatureLevel();
auto ShaderMap = View.ShaderMap;
TShaderMapRef<FScreenVS> ScreenVertexShader(ShaderMap);
TShaderMapRef<FStencilDecalMaskPS> PixelShader(ShaderMap);
SetGlobalBoundShaderState(RHICmdList, FeatureLevel, StencilDecalMaskBoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *ScreenVertexShader, *PixelShader);
PixelShader->SetParameters(RHICmdList, View);
DrawPostProcessPass(
RHICmdList,
0, 0,
View.ViewRect.Width(), View.ViewRect.Height(),
View.ViewRect.Min.X, View.ViewRect.Min.Y,
View.ViewRect.Width(), View.ViewRect.Height(),
FIntPoint(View.ViewRect.Width(), View.ViewRect.Height()),
SceneContext.GetBufferSizeXY(),
*ScreenVertexShader,
View.StereoPass,
bUseHmdMesh,
EDRF_UseTriangleOptimization);
}
示例4: SCOPED_DRAW_EVENT
void FRCPassPostProcessLensBlur::Process(FRenderingCompositePassContext& Context)
{
SCOPED_DRAW_EVENT(Context.RHICmdList, PassPostProcessLensBlur);
const FPooledRenderTargetDesc* InputDesc = GetInputDesc(ePId_Input0);
if(!InputDesc)
{
// input is not hooked up correctly
return;
}
const FSceneView& View = Context.View;
FIntPoint TexSize = InputDesc->Extent;
// usually 1, 2, 4 or 8
uint32 ScaleToFullRes = GSceneRenderTargets.GetBufferSizeXY().X / TexSize.X;
FIntRect ViewRect = FIntRect::DivideAndRoundUp(View.ViewRect, ScaleToFullRes);
FIntPoint ViewSize = ViewRect.Size();
const FSceneRenderTargetItem& DestRenderTarget = PassOutputs[0].RequestSurface(Context);
// Set the view family's render target/viewport.
SetRenderTarget(Context.RHICmdList, DestRenderTarget.TargetableTexture, FTextureRHIRef(), ESimpleRenderTargetMode::EClearColorToBlack);
Context.SetViewportAndCallRHI(ViewRect);
// set the state (additive blending)
Context.RHICmdList.SetBlendState(TStaticBlendState<CW_RGB, BO_Add, BF_One, BF_One>::GetRHI());
Context.RHICmdList.SetRasterizerState(TStaticRasterizerState<>::GetRHI());
Context.RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI());
TShaderMapRef<FPostProcessLensBlurVS> VertexShader(Context.GetShaderMap());
TShaderMapRef<FPostProcessLensBlurPS> PixelShader(Context.GetShaderMap());
static FGlobalBoundShaderState BoundShaderState;
SetGlobalBoundShaderState(Context.RHICmdList, Context.GetFeatureLevel(), BoundShaderState, GEmptyVertexDeclaration.VertexDeclarationRHI, *VertexShader, *PixelShader);
uint32 TileSize = 1;
FIntPoint TileCount = ViewSize / TileSize;
float PixelKernelSize = PercentKernelSize / 100.0f * ViewSize.X;
VertexShader->SetParameters(Context, TileCount, TileSize, PixelKernelSize, Threshold);
PixelShader->SetParameters(Context, PixelKernelSize);
Context.RHICmdList.SetStreamSource(0, NULL, 0, 0);
// needs to be the same on shader side (faster on NVIDIA and AMD)
int32 QuadsPerInstance = 4;
Context.RHICmdList.DrawPrimitive(PT_TriangleList, 0, 2, FMath::DivideAndRoundUp(TileCount.X * TileCount.Y, QuadsPerInstance));
Context.RHICmdList.CopyToResolveTarget(DestRenderTarget.TargetableTexture, DestRenderTarget.ShaderResourceTexture, false, FResolveParams());
}
示例5: SCOPED_DRAW_EVENT
void FRCPassPostProcessAA::Process(FRenderingCompositePassContext& Context)
{
SCOPED_DRAW_EVENT(Context.RHICmdList, PostProcessAA);
const FPooledRenderTargetDesc* InputDesc = GetInputDesc(ePId_Input0);
if(!InputDesc)
{
// input is not hooked up correctly
return;
}
const FSceneView& View = Context.View;
const FSceneViewFamily& ViewFamily = *(View.Family);
FIntRect SrcRect = View.ViewRect;
FIntRect DestRect = View.ViewRect;
FIntPoint SrcSize = InputDesc->Extent;
FIntPoint DestSize = PassOutputs[0].RenderTargetDesc.Extent;
const FSceneRenderTargetItem& DestRenderTarget = PassOutputs[0].RequestSurface(Context);
// Set the view family's render target/viewport.
SetRenderTarget(Context.RHICmdList, DestRenderTarget.TargetableTexture, FTextureRHIRef());
Context.SetViewportAndCallRHI(0, 0, 0.0f, DestSize.X, DestSize.Y, 1.0f );
// set the state
Context.RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI());
Context.RHICmdList.SetRasterizerState(TStaticRasterizerState<>::GetRHI());
Context.RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI());
switch(Quality)
{
case 1: SetShaderTemplAA<1>(Context); break;
case 2: SetShaderTemplAA<2>(Context); break;
case 3: SetShaderTemplAA<3>(Context); break;
case 4: SetShaderTemplAA<4>(Context); break;
case 5: SetShaderTemplAA<5>(Context); break;
default: SetShaderTemplAA<6>(Context); break;
}
// Draw a quad mapping scene color to the view's render target
TShaderMapRef<FFXAAVS> VertexShader(Context.GetShaderMap());
DrawRectangle(
Context.RHICmdList,
DestRect.Min.X, DestRect.Min.Y,
DestRect.Width(), DestRect.Height(),
SrcRect.Min.X, SrcRect.Min.Y,
SrcRect.Width(), SrcRect.Height(),
DestSize,
SrcSize,
*VertexShader,
EDRF_Default);
Context.RHICmdList.CopyToResolveTarget(DestRenderTarget.TargetableTexture, DestRenderTarget.ShaderResourceTexture, false, FResolveParams());
}
示例6: SCOPED_DRAW_EVENT
void FRCPassPostProcessVisualizeLPV::Process(FRenderingCompositePassContext& Context)
{
SCOPED_DRAW_EVENT(Context.RHICmdList, VisualizeLPV);
const FSceneView& View = Context.View;
const FSceneViewFamily& ViewFamily = *(View.Family);
// const FSceneRenderTargetItem& DestRenderTarget = PassOutputs[0].RequestSurface(Context);
const TRefCountPtr<IPooledRenderTarget> RenderTarget = GetInput(ePId_Input0)->GetOutput()->PooledRenderTarget;
const FSceneRenderTargetItem& DestRenderTarget = RenderTarget->GetRenderTargetItem();
// Set the view family's render target/viewport.
SetRenderTarget(Context.RHICmdList, DestRenderTarget.TargetableTexture, FTextureRHIRef());
{
FRenderTargetTemp TempRenderTarget(View, (const FTexture2DRHIRef&)DestRenderTarget.TargetableTexture);
FCanvas Canvas(&TempRenderTarget, NULL, ViewFamily.CurrentRealTime, ViewFamily.CurrentWorldTime, ViewFamily.DeltaWorldTime, View.GetFeatureLevel());
float X = 30;
float Y = 28;
const float YStep = 14;
const float ColumnWidth = 250;
Canvas.DrawShadowedString( X, Y += YStep, TEXT("VisualizeLightPropagationVolume"), GetStatsFont(), FLinearColor(0.2f, 0.2f, 1));
Y += YStep;
const FLightPropagationVolumeSettings& Dest = View.FinalPostProcessSettings.BlendableManager.GetSingleFinalDataConst<FLightPropagationVolumeSettings>();
#define ENTRY(name)\
Canvas.DrawShadowedString( X, Y += YStep, TEXT(#name) TEXT(":"), GetStatsFont(), FLinearColor(1, 1, 1));\
Canvas.DrawShadowedString( X + ColumnWidth, Y, *FString::Printf(TEXT("%g"), Dest.name), GetStatsFont(), FLinearColor(1, 1, 1));
ENTRY(LPVIntensity)
ENTRY(LPVVplInjectionBias)
ENTRY(LPVSize)
ENTRY(LPVSecondaryOcclusionIntensity)
ENTRY(LPVSecondaryBounceIntensity)
ENTRY(LPVGeometryVolumeBias)
ENTRY(LPVEmissiveInjectionIntensity)
ENTRY(LPVDirectionalOcclusionIntensity)
ENTRY(LPVDirectionalOcclusionRadius)
ENTRY(LPVDiffuseOcclusionExponent)
ENTRY(LPVSpecularOcclusionExponent)
ENTRY(LPVDiffuseOcclusionIntensity)
ENTRY(LPVSpecularOcclusionIntensity)
#undef ENTRY
Canvas.Flush_RenderThread(Context.RHICmdList);
}
Context.RHICmdList.CopyToResolveTarget(DestRenderTarget.TargetableTexture, DestRenderTarget.ShaderResourceTexture, false, FResolveParams());
// to satify following passws
FRenderingCompositeOutput* Output = GetOutput(ePId_Output0);
Output->PooledRenderTarget = RenderTarget;
}
示例7: SCOPED_DRAW_EVENT
void FRCPassPostProcessMorpheus::Process(FRenderingCompositePassContext& Context)
{
SCOPED_DRAW_EVENT(Context.RHICmdList, PostProcessMorpheus);
const FPooledRenderTargetDesc* InputDesc = GetInputDesc(ePId_Input0);
if(!InputDesc)
{
// input is not hooked up correctly
return;
}
const FSceneView& View = Context.View;
const FSceneViewFamily& ViewFamily = *(View.Family);
FIntRect SrcRect = View.ViewRect;
FIntRect DestRect = View.UnscaledViewRect;
FIntPoint SrcSize = InputDesc->Extent;
const FSceneRenderTargetItem& DestRenderTarget = PassOutputs[0].RequestSurface(Context);
// Set the view family's render target/viewport.
SetRenderTarget(Context.RHICmdList, DestRenderTarget.TargetableTexture, FTextureRHIRef());
Context.SetViewportAndCallRHI(DestRect);
// set the state
Context.RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI());
Context.RHICmdList.SetRasterizerState(TStaticRasterizerState<>::GetRHI());
Context.RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI());
TShaderMapRef<FPostProcessMorpheusVS> VertexShader(Context.GetShaderMap());
TShaderMapRef<FPostProcessMorpheusPS> PixelShader(Context.GetShaderMap());
static FGlobalBoundShaderState BoundShaderState;
SetGlobalBoundShaderState(Context.RHICmdList, Context.GetFeatureLevel(), BoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *VertexShader, *PixelShader);
FMatrix QuadTexTransform;
FMatrix QuadPosTransform = FMatrix::Identity;
PixelShader->SetPS(Context, SrcRect, SrcSize, View.StereoPass, QuadTexTransform);
// Draw a quad mapping scene color to the view's render target
DrawTransformedRectangle(
Context.RHICmdList,
0, 0,
DestRect.Width(), DestRect.Height(),
QuadPosTransform,
SrcRect.Min.X, SrcRect.Min.Y,
SrcRect.Width(), SrcRect.Height(),
QuadTexTransform,
DestRect.Size(),
SrcSize
);
Context.RHICmdList.CopyToResolveTarget(DestRenderTarget.TargetableTexture, DestRenderTarget.ShaderResourceTexture, false, FResolveParams());
}
示例8: check
void FCompositionLighting::ProcessAfterBasePass(FRHICommandListImmediate& RHICmdList, FViewInfo& View)
{
check(IsInRenderingThread());
FSceneRenderTargets& SceneContext = FSceneRenderTargets::Get(RHICmdList);
// might get renamed to refracted or ...WithAO
SceneContext.GetSceneColor()->SetDebugName(TEXT("SceneColor"));
// to be able to observe results with VisualizeTexture
GRenderTargetPool.VisualizeTexture.SetCheckPoint(RHICmdList, SceneContext.GetSceneColor());
GRenderTargetPool.VisualizeTexture.SetCheckPoint(RHICmdList, SceneContext.GBufferA);
GRenderTargetPool.VisualizeTexture.SetCheckPoint(RHICmdList, SceneContext.GBufferB);
GRenderTargetPool.VisualizeTexture.SetCheckPoint(RHICmdList, SceneContext.GBufferC);
GRenderTargetPool.VisualizeTexture.SetCheckPoint(RHICmdList, SceneContext.GBufferD);
GRenderTargetPool.VisualizeTexture.SetCheckPoint(RHICmdList, SceneContext.GBufferE);
GRenderTargetPool.VisualizeTexture.SetCheckPoint(RHICmdList, SceneContext.GBufferVelocity);
GRenderTargetPool.VisualizeTexture.SetCheckPoint(RHICmdList, SceneContext.ScreenSpaceAO);
// so that the passes can register themselves to the graph
{
FMemMark Mark(FMemStack::Get());
FRenderingCompositePassContext CompositeContext(RHICmdList, View);
FPostprocessContext Context(CompositeContext.Graph, View);
// Add the passes we want to add to the graph (commenting a line means the pass is not inserted into the graph) ----------
// decals are before AmbientOcclusion so the decal can output a normal that AO is affected by
if( Context.View.Family->EngineShowFlags.Decals &&
!Context.View.Family->EngineShowFlags.VisualizeLightCulling) // decal are distracting when looking at LightCulling
{
AddDeferredDecalsBeforeLighting(Context);
}
FRenderingCompositeOutputRef AmbientOcclusion;
if(uint32 Levels = ComputeAmbientOcclusionPassCount(Context))
{
AmbientOcclusion = AddPostProcessingAmbientOcclusion(RHICmdList, Context, Levels);
}
if(IsAmbientCubemapPassRequired(Context))
{
AddPostProcessingAmbientCubemap(Context, AmbientOcclusion);
}
// The graph setup should be finished before this line ----------------------------------------
SCOPED_DRAW_EVENT(RHICmdList, LightCompositionTasks_PreLighting);
TRefCountPtr<IPooledRenderTarget>& SceneColor = SceneContext.GetSceneColor();
Context.FinalOutput.GetOutput()->RenderTargetDesc = SceneColor->GetDesc();
Context.FinalOutput.GetOutput()->PooledRenderTarget = SceneColor;
CompositeContext.Process(Context.FinalOutput.GetPass(), TEXT("CompositionLighting_AfterBasePass"));
}
}
示例9: SCOPED_DRAW_EVENT
void FRCPassPostProcessVisualizeBloomOverlay::Process(FRenderingCompositePassContext& Context)
{
SCOPED_DRAW_EVENT(Context.RHICmdList, VisualizeBloomOverlay);
const FPooledRenderTargetDesc* InputDesc = GetInputDesc(ePId_Input0);
check(InputDesc && "Input is not hooked up correctly");
const FSceneView& View = Context.View;
const FSceneViewFamily& ViewFamily = *(View.Family);
FIntPoint SrcSize = InputDesc->Extent;
FIntPoint DestSize = PassOutputs[0].RenderTargetDesc.Extent;
// e.g. 4 means the input texture is 4x smaller than the buffer size
uint32 ScaleFactor = GSceneRenderTargets.GetBufferSizeXY().X / SrcSize.X;
FIntRect SrcRect = View.ViewRect / ScaleFactor;
FIntRect DestRect = SrcRect;
const FSceneRenderTargetItem& DestRenderTarget = PassOutputs[0].RequestSurface(Context);
SetRenderTarget(Context.RHICmdList, DestRenderTarget.TargetableTexture, FTextureRHIRef());
// is optimized away if possible (RT size=view size, )
Context.RHICmdList.Clear(true, FLinearColor(0, 0, 0, 0), false, 1.0f, false, 0, DestRect);
Context.SetViewportAndCallRHI(0, 0, 0.0f, DestRect.Width(), DestRect.Height(), 1.0f );
// set the state
Context.RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI());
Context.RHICmdList.SetRasterizerState(TStaticRasterizerState<>::GetRHI());
Context.RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI());
TShaderMapRef<FPostProcessVS> VertexShader(Context.GetShaderMap());
TShaderMapRef<FPostProcessVisualizeBloomOverlayPS> PixelShader(Context.GetShaderMap());
static FGlobalBoundShaderState BoundShaderState;
SetGlobalBoundShaderState(Context.RHICmdList, Context.GetFeatureLevel(), BoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *VertexShader, *PixelShader);
PixelShader->SetParameters(Context);
VertexShader->SetParameters(Context);
// Draw a quad mapping scene color to the view's render target
DrawRectangle(
Context.RHICmdList,
DestRect.Min.X, DestRect.Min.Y,
DestRect.Width(), DestRect.Height(),
SrcRect.Min.X, SrcRect.Min.Y,
SrcRect.Width(), SrcRect.Height(),
DestRect.Size(),
SrcSize,
*VertexShader,
EDRF_UseTriangleOptimization);
Context.RHICmdList.CopyToResolveTarget(DestRenderTarget.TargetableTexture, DestRenderTarget.ShaderResourceTexture, false, FResolveParams());
}
示例10: SCOPED_DRAW_EVENT
void FDeferredShadingSceneRenderer::RenderLightShaftBloom(FRHICommandListImmediate& RHICmdList)
{
if (DoesViewFamilyAllowLightShafts(ViewFamily))
{
TRefCountPtr<IPooledRenderTarget> LightShafts0;
TRefCountPtr<IPooledRenderTarget> LightShafts1;
for (TSparseArray<FLightSceneInfoCompact>::TConstIterator LightIt(Scene->Lights); LightIt; ++LightIt)
{
const FLightSceneInfo* const LightSceneInfo = LightIt->LightSceneInfo;
if (LightSceneInfo->bEnableLightShaftBloom)
{
SCOPED_DRAW_EVENT(RHICmdList, RenderLightShaftBloom);
// Allocate light shaft render targets on demand, using the pool
AllocateOrReuseLightShaftRenderTarget(RHICmdList, LightShafts0, TEXT("LightShafts0"));
AllocateOrReuseLightShaftRenderTarget(RHICmdList, LightShafts1, TEXT("LightShafts1"));
for (int ViewIndex = 0;ViewIndex < Views.Num();ViewIndex++)
{
FViewInfo& View = Views[ViewIndex];
if (ShouldRenderLightShaftsForLight(View, LightSceneInfo))
{
INC_DWORD_STAT(STAT_LightShaftsLights);
// Generate the bloom source from scene color, masked by depth and downsampled
DownsamplePass<false>(RHICmdList, View, LightSceneInfo, LightShafts0, LightShafts1);
FSceneViewState* ViewState = (FSceneViewState*)View.State;
TRefCountPtr<IPooledRenderTarget>* HistoryState = NULL;
if (ViewState)
{
// Find the previous frame's bloom source for this light
HistoryState = &ViewState->LightShaftBloomHistoryRTs.FindOrAdd(LightSceneInfo->Proxy->GetLightComponent());
}
TRefCountPtr<IPooledRenderTarget> HistoryOutput;
// Apply temporal AA to the occlusion mask
// Result will be in HistoryOutput
ApplyTemporalAA(RHICmdList, View, TEXT("LSBloomHistory"), HistoryState, LightShafts0, HistoryOutput);
// Apply radial blur passes
// Send HistoryOutput in as the first pass input only, so it will not be overwritten by any subsequent passes, since it is needed for next frame
ApplyRadialBlurPasses(RHICmdList, View, LightSceneInfo, HistoryOutput, LightShafts0, LightShafts1);
// Add light shaft bloom to scene color in full res
ApplyLightShaftBloom(RHICmdList, View, LightSceneInfo, LightShafts0);
}
}
}
}
}
}
示例11: SCOPED_DRAW_EVENT
void FRCPassPostProcessHistogramReduce::Process(FRenderingCompositePassContext& Context)
{
SCOPED_DRAW_EVENT(Context.RHICmdList, PostProcessHistogramReduce);
const FPooledRenderTargetDesc* InputDesc = GetInputDesc(ePId_Input0);
if(!InputDesc)
{
// input is not hooked up correctly
return;
}
const FSceneView& View = Context.View;
const FSceneViewFamily& ViewFamily = *(View.Family);
FIntPoint SrcSize = InputDesc->Extent;
FIntPoint DestSize = PassOutputs[0].RenderTargetDesc.Extent;
const FSceneRenderTargetItem& DestRenderTarget = PassOutputs[0].RequestSurface(Context);
// Set the view family's render target/viewport.
SetRenderTarget(Context.RHICmdList, DestRenderTarget.TargetableTexture, FTextureRHIRef());
// set the state
Context.RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI());
Context.RHICmdList.SetRasterizerState(TStaticRasterizerState<>::GetRHI());
Context.RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI());
TShaderMapRef<FPostProcessVS> VertexShader(Context.GetShaderMap());
TShaderMapRef<FPostProcessHistogramReducePS> PixelShader(Context.GetShaderMap());
static FGlobalBoundShaderState BoundShaderState;
SetGlobalBoundShaderState(Context.RHICmdList, Context.GetFeatureLevel(), BoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *VertexShader, *PixelShader);
// we currently assume the input is half res, one full res pixel less to avoid getting bilinear filtered input
FIntPoint GatherExtent = (View.ViewRect.Size() - FIntPoint(1, 1)) / 2;
uint32 LoopSizeValue = ComputeLoopSize(GatherExtent);
PixelShader->SetPS(Context, LoopSizeValue);
DrawPostProcessPass(
Context.RHICmdList,
0, 0,
DestSize.X, DestSize.Y,
0, 0,
SrcSize.X, 0,
DestSize,
SrcSize,
*VertexShader,
View.StereoPass,
Context.HasHmdMesh(),
EDRF_UseTriangleOptimization);
Context.RHICmdList.CopyToResolveTarget(DestRenderTarget.TargetableTexture, DestRenderTarget.ShaderResourceTexture, false, FResolveParams());
}
示例12: SCOPED_DRAW_EVENT
void FRCPassPostProcessVisualizeMotionBlur::Process(FRenderingCompositePassContext& Context)
{
SCOPED_DRAW_EVENT(VisualizeMotionBlur, DEC_SCENE_ITEMS);
const FPooledRenderTargetDesc* InputDesc = GetInputDesc(ePId_Input0);
if(!InputDesc)
{
// input is not hooked up correctly
return;
}
const FSceneView& View = Context.View;
FIntPoint TexSize = InputDesc->Extent;
// we assume the input and output is full resolution
FIntPoint SrcSize = InputDesc->Extent;
FIntPoint DestSize = PassOutputs[0].RenderTargetDesc.Extent;
// e.g. 4 means the input texture is 4x smaller than the buffer size
uint32 ScaleFactor = GSceneRenderTargets.GetBufferSizeXY().X / SrcSize.X;
FIntRect SrcRect = FIntRect::DivideAndRoundUp(View.ViewRect, ScaleFactor);
FIntRect DestRect = SrcRect;
const FSceneRenderTargetItem& DestRenderTarget = PassOutputs[0].RequestSurface(Context);
// Set the view family's render target/viewport.
RHISetRenderTarget(DestRenderTarget.TargetableTexture, FTextureRHIRef());
// is optimized away if possible (RT size=view size, )
RHIClear(true, FLinearColor::Black, false, 1.0f, false, 0, SrcRect);
Context.SetViewportAndCallRHI(SrcRect);
// set the state
RHISetBlendState(TStaticBlendState<>::GetRHI());
RHISetRasterizerState(TStaticRasterizerState<>::GetRHI());
RHISetDepthStencilState(TStaticDepthStencilState<false,CF_Always>::GetRHI());
// Quality 0: visualize
SetMotionBlurShaderTempl<0>(Context);
// Draw a quad mapping scene color to the view's render target
DrawRectangle(
0, 0,
SrcRect.Width(), SrcRect.Height(),
SrcRect.Min.X, SrcRect.Min.Y,
SrcRect.Width(), SrcRect.Height(),
SrcRect.Size(),
SrcSize,
EDRF_UseTriangleOptimization);
RHICopyToResolveTarget(DestRenderTarget.TargetableTexture, DestRenderTarget.ShaderResourceTexture, false, FResolveParams());
}
示例13: SCOPED_DRAW_EVENT
/**
* Initialize scene's views.
* Check visibility, sort translucent items, etc.
*/
void FForwardShadingSceneRenderer::InitViews(FRHICommandListImmediate& RHICmdList)
{
SCOPED_DRAW_EVENT(RHICmdList, InitViews);
SCOPE_CYCLE_COUNTER(STAT_InitViewsTime);
FILCUpdatePrimTaskData ILCTaskData;
PreVisibilityFrameSetup(RHICmdList);
ComputeViewVisibility(RHICmdList);
PostVisibilityFrameSetup(ILCTaskData);
bool bDynamicShadows = ViewFamily.EngineShowFlags.DynamicShadows && GetShadowQuality() > 0;
if (bDynamicShadows && !IsSimpleDynamicLightingEnabled())
{
// Setup dynamic shadows.
InitDynamicShadows(RHICmdList);
}
// if we kicked off ILC update via task, wait and finalize.
if (ILCTaskData.TaskRef.IsValid())
{
Scene->IndirectLightingCache.FinalizeCacheUpdates(Scene, *this, ILCTaskData);
}
// initialize per-view uniform buffer. Pass in shadow info as necessary.
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
{
const TArray<FProjectedShadowInfo*, SceneRenderingAllocator>* DirectionalLightShadowInfo = nullptr;
FViewInfo& ViewInfo = Views[ViewIndex];
FScene* Scene = (FScene*)ViewInfo.Family->Scene;
if (bDynamicShadows && Scene->SimpleDirectionalLight)
{
int32 LightId = Scene->SimpleDirectionalLight->Id;
if (VisibleLightInfos.IsValidIndex(LightId))
{
const FVisibleLightInfo& VisibleLightInfo = VisibleLightInfos[LightId];
if (VisibleLightInfo.AllProjectedShadows.Num() > 0)
{
DirectionalLightShadowInfo = &VisibleLightInfo.AllProjectedShadows;
}
}
}
// Initialize the view's RHI resources.
Views[ViewIndex].InitRHIResources(DirectionalLightShadowInfo);
}
// Now that the indirect lighting cache is updated, we can update the primitive precomputed lighting buffers.
UpdatePrimitivePrecomputedLightingBuffers();
OnStartFrame();
}
示例14: SCOPED_DRAW_EVENT
void FRCPassPostProcessVisualizeComplexity::Process(FRenderingCompositePassContext& Context)
{
SCOPED_DRAW_EVENT(Context.RHICmdList, PostProcessVisualizeComplexity);
const FPooledRenderTargetDesc* InputDesc = GetInputDesc(ePId_Input0);
if(!InputDesc)
{
// input is not hooked up correctly
return;
}
const FSceneView& View = Context.View;
const FSceneViewFamily& ViewFamily = *(View.Family);
FIntRect SrcRect = View.ViewRect;
FIntRect DestRect = View.UnscaledViewRect;
FIntPoint SrcSize = InputDesc->Extent;
const FSceneRenderTargetItem& DestRenderTarget = PassOutputs[0].RequestSurface(Context);
// Set the view family's render target/viewport.
SetRenderTarget(Context.RHICmdList, DestRenderTarget.TargetableTexture, FTextureRHIRef());
Context.SetViewportAndCallRHI(DestRect);
// turn off culling and blending
Context.RHICmdList.SetRasterizerState(TStaticRasterizerState<FM_Solid, CM_None>::GetRHI());
Context.RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI());
// turn off depth reads/writes
Context.RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI());
//reuse this generic vertex shader
TShaderMapRef<FShaderComplexityApplyVS> VertexShader(Context.GetShaderMap());
TShaderMapRef<FShaderComplexityApplyPS> PixelShader(Context.GetShaderMap());
static FGlobalBoundShaderState ShaderComplexityBoundShaderState;
SetGlobalBoundShaderState(Context.RHICmdList, Context.GetFeatureLevel(), ShaderComplexityBoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *VertexShader, *PixelShader);
PixelShader->SetParameters(Context, Colors);
DrawRectangle(
Context.RHICmdList,
0, 0,
DestRect.Width(), DestRect.Height(),
SrcRect.Min.X, SrcRect.Min.Y,
SrcRect.Width(), SrcRect.Height(),
DestRect.Size(),
SrcSize,
*VertexShader,
EDRF_UseTriangleOptimization);
Context.RHICmdList.CopyToResolveTarget(DestRenderTarget.TargetableTexture, DestRenderTarget.ShaderResourceTexture, false, FResolveParams());
}
示例15: SCOPED_DRAW_EVENT
bool FDeferredShadingSceneRenderer::RenderLightMapDensities(FRHICommandListImmediate& RHICmdList)
{
bool bDirty=0;
if (Scene->GetFeatureLevel() >= ERHIFeatureLevel::SM4)
{
SCOPED_DRAW_EVENT(RHICmdList, LightMapDensity);
// Draw the scene's emissive and light-map color.
for(int32 ViewIndex = 0;ViewIndex < Views.Num();ViewIndex++)
{
SCOPED_CONDITIONAL_DRAW_EVENTF(RHICmdList, EventView, Views.Num() > 1, TEXT("View%d"), ViewIndex);
FViewInfo& View = Views[ViewIndex];
// Opaque blending, depth tests and writes.
RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI());
RHICmdList.SetDepthStencilState(TStaticDepthStencilState<true,CF_DepthNearOrEqual>::GetRHI());
RHICmdList.SetViewport(View.ViewRect.Min.X, View.ViewRect.Min.Y, 0, View.ViewRect.Max.X, View.ViewRect.Max.Y, 1);
{
SCOPED_DRAW_EVENT(RHICmdList, Dynamic);
FLightMapDensityDrawingPolicyFactory::ContextType Context;
for (int32 MeshBatchIndex = 0; MeshBatchIndex < View.DynamicMeshElements.Num(); MeshBatchIndex++)
{
const FMeshBatchAndRelevance& MeshBatchAndRelevance = View.DynamicMeshElements[MeshBatchIndex];
if (MeshBatchAndRelevance.bHasOpaqueOrMaskedMaterial || ViewFamily.EngineShowFlags.Wireframe)
{
const FMeshBatch& MeshBatch = *MeshBatchAndRelevance.Mesh;
FLightMapDensityDrawingPolicyFactory::DrawDynamicMesh(RHICmdList, View, Context, MeshBatch, false, true, MeshBatchAndRelevance.PrimitiveSceneProxy, MeshBatch.BatchHitProxyId);
}
}
}
}
}
return bDirty;
}