本文整理汇总了C++中FViewInfo::GetShaderPlatform方法的典型用法代码示例。如果您正苦于以下问题:C++ FViewInfo::GetShaderPlatform方法的具体用法?C++ FViewInfo::GetShaderPlatform怎么用?C++ FViewInfo::GetShaderPlatform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FViewInfo
的用法示例。
在下文中一共展示了FViewInfo::GetShaderPlatform方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawDynamicMesh
/**
* Render a dynamic mesh using a translucent draw policy
* @return true if the mesh rendered
*/
bool FTranslucencyForwardShadingDrawingPolicyFactory::DrawDynamicMesh(
FRHICommandList& RHICmdList,
const FViewInfo& View,
ContextType DrawingContext,
const FMeshBatch& Mesh,
bool bBackFace,
bool bPreFog,
const FPrimitiveSceneProxy* PrimitiveSceneProxy,
FHitProxyId HitProxyId
)
{
bool bDirty = false;
// Determine the mesh's material and blend mode.
const auto FeatureLevel = View.GetFeatureLevel();
const auto ShaderPlatform = View.GetShaderPlatform();
const FMaterial* Material = Mesh.MaterialRenderProxy->GetMaterial(FeatureLevel);
const EBlendMode BlendMode = Material->GetBlendMode();
// Only render translucent materials.
if (IsTranslucentBlendMode(BlendMode))
{
const bool bDisableDepthTest = Material->ShouldDisableDepthTest();
if (bDisableDepthTest)
{
RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI());
}
ProcessBasePassMeshForForwardShading(
RHICmdList,
FProcessBasePassMeshParameters(
Mesh,
Material,
PrimitiveSceneProxy,
true,
false,
ESceneRenderTargetsMode::SetTextures,
FeatureLevel
),
FDrawTranslucentMeshForwardShadingAction(
View,
bBackFace,
HitProxyId
)
);
if (bDisableDepthTest)
{
// Restore default depth state
// Note, this is a reversed Z depth surface, using CF_GreaterEqual.
RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_GreaterEqual>::GetRHI());
}
bDirty = true;
}
return bDirty;
}
示例2: ShouldRenderScreenSpaceAmbientOcclusion
bool ShouldRenderScreenSpaceAmbientOcclusion(const FViewInfo& View)
{
bool bEnabled = true;
if (!IsLpvIndirectPassRequired(View))
{
bEnabled = View.FinalPostProcessSettings.AmbientOcclusionIntensity > 0
&& View.Family->EngineShowFlags.Lighting
&& View.FinalPostProcessSettings.AmbientOcclusionRadius >= 0.1f
&& !View.Family->UseDebugViewPS()
&& (FSSAOHelper::IsBasePassAmbientOcclusionRequired(View) || IsAmbientCubemapPassRequired(View) || IsReflectionEnvironmentActive(View) || IsSkylightActive(View) || View.Family->EngineShowFlags.VisualizeBuffer)
&& !IsAnyForwardShadingEnabled(View.GetShaderPlatform());
}
return bEnabled;
}
示例3: DrawDynamicMesh
bool FBasePassForwardOpaqueDrawingPolicyFactory::DrawDynamicMesh(
FRHICommandList& RHICmdList,
const FViewInfo& View,
ContextType DrawingContext,
const FMeshBatch& Mesh,
bool bBackFace,
bool bPreFog,
const FPrimitiveSceneProxy* PrimitiveSceneProxy,
FHitProxyId HitProxyId
)
{
// Determine the mesh's material and blend mode.
const auto FeatureLevel = View.GetFeatureLevel();
const auto ShaderPlatform = View.GetShaderPlatform();
const FMaterial* Material = Mesh.MaterialRenderProxy->GetMaterial(FeatureLevel);
const EBlendMode BlendMode = Material->GetBlendMode();
// Only draw opaque materials.
if(!IsTranslucentBlendMode(BlendMode))
{
ProcessBasePassMeshForForwardShading(
RHICmdList,
FProcessBasePassMeshParameters(
Mesh,
Material,
PrimitiveSceneProxy,
true,
false,
DrawingContext.TextureMode,
FeatureLevel
),
FDrawBasePassForwardShadingDynamicMeshAction(
View,
bBackFace,
HitProxyId
)
);
return true;
}
else
{
return false;
}
}
示例4: DrawDynamicMesh
/**
* Render a dynamic mesh using a translucent draw policy
* @return true if the mesh rendered
*/
bool FTranslucencyForwardShadingDrawingPolicyFactory::DrawDynamicMesh(
FRHICommandList& RHICmdList,
const FViewInfo& View,
ContextType DrawingContext,
const FMeshBatch& Mesh,
bool bBackFace,
bool bPreFog,
const FPrimitiveSceneProxy* PrimitiveSceneProxy,
FHitProxyId HitProxyId
)
{
bool bDirty = false;
// Determine the mesh's material and blend mode.
const auto FeatureLevel = View.GetFeatureLevel();
const auto ShaderPlatform = View.GetShaderPlatform();
const FMaterial* Material = Mesh.MaterialRenderProxy->GetMaterial(FeatureLevel);
const EBlendMode BlendMode = Material->GetBlendMode();
// Only render translucent materials.
if (IsTranslucentBlendMode(BlendMode))
{
ProcessBasePassMeshForForwardShading(
RHICmdList,
FProcessBasePassMeshParameters(
Mesh,
Material,
PrimitiveSceneProxy,
true,
false,
ESceneRenderTargetsMode::SetTextures,
FeatureLevel
),
FDrawTranslucentMeshForwardShadingAction(
View,
bBackFace,
HitProxyId
)
);
bDirty = true;
}
return bDirty;
}
示例5: ProcessAfterLighting
void FCompositionLighting::ProcessAfterLighting(FRHICommandListImmediate& RHICmdList, FViewInfo& View)
{
check(IsInRenderingThread());
FSceneRenderTargets& SceneContext = FSceneRenderTargets::Get(RHICmdList);
GRenderTargetPool.VisualizeTexture.SetCheckPoint(RHICmdList, SceneContext.ReflectiveShadowMapDiffuse);
GRenderTargetPool.VisualizeTexture.SetCheckPoint(RHICmdList, SceneContext.ReflectiveShadowMapNormal);
GRenderTargetPool.VisualizeTexture.SetCheckPoint(RHICmdList, SceneContext.ReflectiveShadowMapDepth);
{
FMemMark Mark(FMemStack::Get());
FRenderingCompositePassContext CompositeContext(RHICmdList, View);
FPostprocessContext Context(CompositeContext.Graph, View);
FRenderingCompositeOutputRef AmbientOcclusion;
// Screen Space Subsurface Scattering
{
float Radius = CVarSSSScale.GetValueOnRenderThread();
bool bSimpleDynamicLighting = IsSimpleDynamicLightingEnabled();
bool bScreenSpaceSubsurfacePassNeeded = (View.ShadingModelMaskInView & (1 << MSM_SubsurfaceProfile)) != 0;
if (bScreenSpaceSubsurfacePassNeeded && Radius > 0 && !bSimpleDynamicLighting && View.Family->EngineShowFlags.SubsurfaceScattering &&
//@todo-rco: Remove this when we fix the cross-compiler
!IsOpenGLPlatform(View.GetShaderPlatform()))
{
// can be optimized out if we don't do split screen/stereo rendering (should be done after we some post process refactoring)
FRenderingCompositePass* PassExtractSpecular = Context.Graph.RegisterPass(new(FMemStack::Get()) FRCPassPostProcessSubsurfaceExtractSpecular());
PassExtractSpecular->SetInput(ePId_Input0, Context.FinalOutput);
FRenderingCompositePass* PassSetup = Context.Graph.RegisterPass(new(FMemStack::Get()) FRCPassPostProcessSubsurfaceSetup(View));
PassSetup->SetInput(ePId_Input0, Context.FinalOutput);
FRenderingCompositePass* Pass0 = Context.Graph.RegisterPass(new(FMemStack::Get()) FRCPassPostProcessSubsurface(0));
Pass0->SetInput(ePId_Input0, PassSetup);
FRenderingCompositePass* Pass1 = Context.Graph.RegisterPass(new(FMemStack::Get()) FRCPassPostProcessSubsurface(1));
Pass1->SetInput(ePId_Input0, Pass0);
Pass1->SetInput(ePId_Input1, PassSetup);
// full res composite pass, no blurring (Radius=0)
FRenderingCompositePass* RecombinePass = Context.Graph.RegisterPass(new(FMemStack::Get()) FRCPassPostProcessSubsurfaceRecombine());
RecombinePass->SetInput(ePId_Input0, Pass1);
RecombinePass->SetInput(ePId_Input1, PassExtractSpecular);
SCOPED_DRAW_EVENT(RHICmdList, CompositionLighting_SSSSS);
CompositeContext.Process(RecombinePass, TEXT("CompositionLighting_SSSSS"));
}
}
// The graph setup should be finished before this line ----------------------------------------
SCOPED_DRAW_EVENT(RHICmdList, CompositionAfterLighting);
// we don't replace the final element with the scenecolor because this is what those passes should do by themself
CompositeContext.Process(Context.FinalOutput.GetPass(), TEXT("CompositionLighting"));
}
// We only release the after the last view was processed (SplitScreen)
if(View.Family->Views[View.Family->Views.Num() - 1] == &View)
{
// The RT should be released as early as possible to allow sharing of that memory for other purposes.
// This becomes even more important with some limited VRam (XBoxOne).
SceneContext.SetLightAttenuation(0);
}
}
示例6: BuildVisibleDecalList
void FDecalRendering::BuildVisibleDecalList(const FScene& Scene, const FViewInfo& View, EDecalRenderStage DecalRenderStage, FTransientDecalRenderDataList& OutVisibleDecals)
{
QUICK_SCOPE_CYCLE_COUNTER(BuildVisibleDecalList);
OutVisibleDecals.Empty(Scene.Decals.Num());
const float FadeMultiplier = CVarDecalFadeScreenSizeMultiplier.GetValueOnRenderThread();
const EShaderPlatform ShaderPlatform = View.GetShaderPlatform();
const bool bIsPerspectiveProjection = View.IsPerspectiveProjection();
// Build a list of decals that need to be rendered for this view in SortedDecals
for (const FDeferredDecalProxy* DecalProxy : Scene.Decals)
{
bool bIsShown = true;
if (!DecalProxy->IsShown(&View))
{
bIsShown = false;
}
const FMatrix ComponentToWorldMatrix = DecalProxy->ComponentTrans.ToMatrixWithScale();
// can be optimized as we test against a sphere around the box instead of the box itself
const float ConservativeRadius = FMath::Sqrt(
ComponentToWorldMatrix.GetScaledAxis(EAxis::X).SizeSquared() +
ComponentToWorldMatrix.GetScaledAxis(EAxis::Y).SizeSquared() +
ComponentToWorldMatrix.GetScaledAxis(EAxis::Z).SizeSquared());
// can be optimized as the test is too conservative (sphere instead of OBB)
if(ConservativeRadius < SMALL_NUMBER || !View.ViewFrustum.IntersectSphere(ComponentToWorldMatrix.GetOrigin(), ConservativeRadius))
{
bIsShown = false;
}
if (bIsShown)
{
FTransientDecalRenderData Data(Scene, DecalProxy, ConservativeRadius);
// filter out decals with blend modes that are not supported on current platform
if (IsBlendModeSupported(ShaderPlatform, Data.DecalBlendMode))
{
if (bIsPerspectiveProjection && Data.DecalProxy->Component->FadeScreenSize != 0.0f)
{
float Distance = (View.ViewMatrices.ViewOrigin - ComponentToWorldMatrix.GetOrigin()).Size();
float Radius = ComponentToWorldMatrix.GetMaximumAxisScale();
float CurrentScreenSize = ((Radius / Distance) * FadeMultiplier);
// fading coefficient needs to increase with increasing field of view and decrease with increasing resolution
// FadeCoeffScale is an empirically determined constant to bring us back roughly to fraction of screen size for FadeScreenSize
const float FadeCoeffScale = 600.0f;
float FOVFactor = ((2.0f/View.ViewMatrices.ProjMatrix.M[0][0]) / View.ViewRect.Width()) * FadeCoeffScale;
float FadeCoeff = Data.DecalProxy->Component->FadeScreenSize * FOVFactor;
float FadeRange = FadeCoeff * 0.5f;
float Alpha = (CurrentScreenSize - FadeCoeff) / FadeRange;
Data.FadeAlpha = FMath::Min(Alpha, 1.0f);
}
EDecalRenderStage LocalDecalRenderStage = FDecalRenderingCommon::ComputeRenderStage(ShaderPlatform, Data.DecalBlendMode);
// we could do this test earlier to avoid the decal intersection but getting DecalBlendMode also costs
if (View.Family->EngineShowFlags.ShaderComplexity || (DecalRenderStage == LocalDecalRenderStage && Data.FadeAlpha>0.0f) )
{
OutVisibleDecals.Add(Data);
}
}
}
}
if (OutVisibleDecals.Num() > 0)
{
// Sort by sort order to allow control over composited result
// Then sort decals by state to reduce render target switches
// Also sort by component since Sort() is not stable
struct FCompareFTransientDecalRenderData
{
FORCEINLINE bool operator()(const FTransientDecalRenderData& A, const FTransientDecalRenderData& B) const
{
if (B.DecalProxy->SortOrder != A.DecalProxy->SortOrder)
{
return A.DecalProxy->SortOrder < B.DecalProxy->SortOrder;
}
// bHasNormal here is more important then blend mode because we want to render every decals that output normals before those that read normal.
if (B.bHasNormal != A.bHasNormal)
{
return B.bHasNormal < A.bHasNormal; // < so that those outputting normal are first.
}
if (B.DecalBlendMode != A.DecalBlendMode)
{
return (int32)B.DecalBlendMode < (int32)A.DecalBlendMode;
}
// Batch decals with the same material together
if (B.MaterialProxy != A.MaterialProxy)
{
return B.MaterialProxy < A.MaterialProxy;
}
return (PTRINT)B.DecalProxy->Component < (PTRINT)A.DecalProxy->Component;
}
};
//.........这里部分代码省略.........
示例7: ProcessAfterLighting
void FCompositionLighting::ProcessAfterLighting(FRHICommandListImmediate& RHICmdList, FViewInfo& View)
{
check(IsInRenderingThread());
FSceneRenderTargets& SceneContext = FSceneRenderTargets::Get(RHICmdList);
{
FMemMark Mark(FMemStack::Get());
FRenderingCompositePassContext CompositeContext(RHICmdList, View);
FPostprocessContext Context(RHICmdList, CompositeContext.Graph, View);
FRenderingCompositeOutputRef AmbientOcclusion;
// Screen Space Subsurface Scattering
{
float Radius = CVarSSSScale.GetValueOnRenderThread();
bool bSimpleDynamicLighting = IsAnyForwardShadingEnabled(View.GetShaderPlatform());
bool bScreenSpaceSubsurfacePassNeeded = ((View.ShadingModelMaskInView & (1 << MSM_SubsurfaceProfile)) != 0) && IsSubsurfacePostprocessRequired();
bool bSubsurfaceAllowed = CVarSubsurfaceScattering.GetValueOnRenderThread() == 1;
if (bScreenSpaceSubsurfacePassNeeded
&& !bSimpleDynamicLighting
&& bSubsurfaceAllowed)
{
bool bHalfRes = CVarSSSHalfRes.GetValueOnRenderThread() != 0;
bool bSingleViewportMode = View.Family->Views.Num() == 1;
if(Radius > 0 && View.Family->EngineShowFlags.SubsurfaceScattering)
{
FRenderingCompositePass* PassSetup = Context.Graph.RegisterPass(new(FMemStack::Get()) FRCPassPostProcessSubsurfaceSetup(View, bHalfRes));
PassSetup->SetInput(ePId_Input0, Context.FinalOutput);
FRenderingCompositePass* PassX = Context.Graph.RegisterPass(new(FMemStack::Get()) FRCPassPostProcessSubsurface(0, bHalfRes));
PassX->SetInput(ePId_Input0, PassSetup);
FRenderingCompositePass* PassY = Context.Graph.RegisterPass(new(FMemStack::Get()) FRCPassPostProcessSubsurface(1, bHalfRes));
PassY->SetInput(ePId_Input0, PassX);
PassY->SetInput(ePId_Input1, PassSetup);
// full res composite pass, no blurring (Radius=0), replaces SceneColor
FRenderingCompositePass* RecombinePass = Context.Graph.RegisterPass(new(FMemStack::Get()) FRCPassPostProcessSubsurfaceRecombine(bHalfRes, bSingleViewportMode));
RecombinePass->SetInput(ePId_Input0, Context.FinalOutput);
RecombinePass->SetInput(ePId_Input1, PassY);
RecombinePass->SetInput(ePId_Input2, PassSetup);
Context.FinalOutput = FRenderingCompositeOutputRef(RecombinePass);
}
else
{
// needed for Scalability
FRenderingCompositePass* RecombinePass = Context.Graph.RegisterPass(new(FMemStack::Get()) FRCPassPostProcessSubsurfaceRecombine(bHalfRes, bSingleViewportMode));
RecombinePass->SetInput(ePId_Input0, Context.FinalOutput);
Context.FinalOutput = FRenderingCompositeOutputRef(RecombinePass);
}
}
}
// The graph setup should be finished before this line ----------------------------------------
SCOPED_DRAW_EVENT(RHICmdList, CompositionAfterLighting);
SCOPED_GPU_STAT(RHICmdList, Stat_GPU_CompositionPostLighting);
// we don't replace the final element with the scenecolor because this is what those passes should do by themself
CompositeContext.Process(Context.FinalOutput.GetPass(), TEXT("CompositionLighting"));
}
// We only release the after the last view was processed (SplitScreen)
if(View.Family->Views[View.Family->Views.Num() - 1] == &View)
{
// The RT should be released as early as possible to allow sharing of that memory for other purposes.
// This becomes even more important with some limited VRam (XBoxOne).
SceneContext.SetLightAttenuation(0);
}
}