本文整理汇总了C++中FRHICommandList::SetBlendState方法的典型用法代码示例。如果您正苦于以下问题:C++ FRHICommandList::SetBlendState方法的具体用法?C++ FRHICommandList::SetBlendState怎么用?C++ FRHICommandList::SetBlendState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FRHICommandList
的用法示例。
在下文中一共展示了FRHICommandList::SetBlendState方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetParameters
void FSlateMaterialShaderPS::SetParameters(FRHICommandList& RHICmdList, const FSceneView& View, const FMaterialRenderProxy* MaterialRenderProxy, const FMaterial* Material, float InDisplayGamma, const FVector4& InShaderParams )
{
const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();
EBlendMode BlendMode = Material->GetBlendMode();
switch (BlendMode)
{
default:
case BLEND_Opaque:
RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI());
break;
case BLEND_Masked:
RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI());
break;
case BLEND_Translucent:
RHICmdList.SetBlendState(TStaticBlendState<CW_RGB, BO_Add, BF_SourceAlpha, BF_InverseSourceAlpha, BO_Add, BF_Zero, BF_InverseSourceAlpha>::GetRHI());
break;
case BLEND_Additive:
// Add to the existing scene color
RHICmdList.SetBlendState(TStaticBlendState<CW_RGB, BO_Add, BF_One, BF_One, BO_Add, BF_Zero, BF_InverseSourceAlpha>::GetRHI());
break;
case BLEND_Modulate:
// Modulate with the existing scene color
RHICmdList.SetBlendState(TStaticBlendState<CW_RGB, BO_Add, BF_DestColor, BF_Zero>::GetRHI());
break;
};
SetShaderValue( RHICmdList, ShaderRHI, DisplayGamma, InDisplayGamma );
SetShaderValue( RHICmdList, ShaderRHI, ShaderParams, InShaderParams );
const bool bDeferredPass = false;
FMaterialShader::SetParameters<FPixelShaderRHIParamRef>(RHICmdList, ShaderRHI, MaterialRenderProxy, *Material, View, bDeferredPass, ESceneRenderTargetsMode::SetTextures);
}
示例2: CopySceneColor
void FTranslucencyDrawingPolicyFactory::CopySceneColor(FRHICommandList& RHICmdList, const FViewInfo& View, const FPrimitiveSceneProxy* PrimitiveSceneProxy)
{
SCOPED_DRAW_EVENTF(RHICmdList, EventCopy, TEXT("CopySceneColor for %s %s"), *PrimitiveSceneProxy->GetOwnerName().ToString(), *PrimitiveSceneProxy->GetResourceName().ToString());
RHICmdList.SetRasterizerState(TStaticRasterizerState<FM_Solid, CM_None>::GetRHI());
RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI());
RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI());
GSceneRenderTargets.ResolveSceneColor(RHICmdList);
GSceneRenderTargets.BeginRenderingLightAttenuation(RHICmdList);
RHICmdList.SetViewport(View.ViewRect.Min.X, View.ViewRect.Min.Y, 0.0f, View.ViewRect.Max.X, View.ViewRect.Max.Y, 1.0f);
TShaderMapRef<FScreenVS> ScreenVertexShader(View.ShaderMap);
TShaderMapRef<FCopySceneColorPS> PixelShader(View.ShaderMap);
SetGlobalBoundShaderState(RHICmdList, View.GetFeatureLevel(), CopySceneColorBoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *ScreenVertexShader, *PixelShader);
/// ?
PixelShader->SetParameters(RHICmdList, View);
DrawRectangle(
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()),
GSceneRenderTargets.GetBufferSizeXY(),
*ScreenVertexShader,
EDRF_UseTriangleOptimization);
GSceneRenderTargets.FinishRenderingLightAttenuation(RHICmdList);
}
示例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: BindShaders
void FIESLightProfileBatchedElementParameters::BindShaders( FRHICommandList& RHICmdList, ERHIFeatureLevel::Type InFeatureLevel, const FMatrix& InTransform, const float InGamma, const FMatrix& ColorWeights, const FTexture* Texture )
{
TShaderMapRef<FSimpleElementVS> VertexShader(GetGlobalShaderMap(InFeatureLevel));
TShaderMapRef<FIESLightProfilePS> PixelShader(GetGlobalShaderMap(InFeatureLevel));
static FGlobalBoundShaderState BoundShaderState;
SetGlobalBoundShaderState(RHICmdList, InFeatureLevel, BoundShaderState, GSimpleElementVertexDeclaration.VertexDeclarationRHI, *VertexShader, *PixelShader);
RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI());
VertexShader->SetParameters(RHICmdList, InTransform);
PixelShader->SetParameters(RHICmdList, Texture, BrightnessInLumens);
}
示例5: SetVelocitiesState
static void SetVelocitiesState(FRHICommandList& RHICmdList, const FViewInfo& View, TRefCountPtr<IPooledRenderTarget>& VelocityRT)
{
const FIntPoint BufferSize = GSceneRenderTargets.GetBufferSizeXY();
const FIntPoint VelocityBufferSize = BufferSize; // full resolution so we can reuse the existing full res z buffer
const uint32 MinX = View.ViewRect.Min.X * VelocityBufferSize.X / BufferSize.X;
const uint32 MinY = View.ViewRect.Min.Y * VelocityBufferSize.Y / BufferSize.Y;
const uint32 MaxX = View.ViewRect.Max.X * VelocityBufferSize.X / BufferSize.X;
const uint32 MaxY = View.ViewRect.Max.Y * VelocityBufferSize.Y / BufferSize.Y;
RHICmdList.SetViewport(MinX, MinY, 0.0f, MaxX, MaxY, 1.0f);
RHICmdList.SetBlendState(TStaticBlendState<CW_RGBA>::GetRHI());
// Note, this is a reversed Z depth surface, using CF_GreaterEqual.
RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false,CF_GreaterEqual>::GetRHI());
RHICmdList.SetRasterizerState(GetStaticRasterizerState<true>(FM_Solid, CM_CW));
}
示例6: FinishOcclusionTerm
void FinishOcclusionTerm(FRHICommandList& RHICmdList, const FViewInfo& View, const FLightSceneInfo* const LightSceneInfo, TRefCountPtr<IPooledRenderTarget>& LightShaftsSource, TRefCountPtr<IPooledRenderTarget>& LightShaftsDest)
{
TShaderMapRef<FScreenVS> ScreenVertexShader(View.ShaderMap);
const FIntPoint BufferSize = FSceneRenderTargets::Get(RHICmdList).GetBufferSizeXY();
const uint32 DownsampleFactor = GetLightShaftDownsampleFactor();
const FIntPoint FilterBufferSize = BufferSize / DownsampleFactor;
const FIntPoint DownSampledXY = View.ViewRect.Min / DownsampleFactor;
const uint32 DownsampledSizeX = View.ViewRect.Width() / DownsampleFactor;
const uint32 DownsampledSizeY = View.ViewRect.Height() / DownsampleFactor;
SetRenderTarget(RHICmdList, LightShaftsDest->GetRenderTargetItem().TargetableTexture, FTextureRHIRef());
RHICmdList.SetViewport(0, 0, 0.0f, FilterBufferSize.X, FilterBufferSize.Y, 1.0f);
RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI());
RHICmdList.SetRasterizerState(TStaticRasterizerState<>::GetRHI());
RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI());
TShaderMapRef<FFinishOcclusionPixelShader> MaskOcclusionTermPixelShader(View.ShaderMap);
SetGlobalBoundShaderState(RHICmdList, View.GetFeatureLevel(), AccumulateTermBoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *ScreenVertexShader, *MaskOcclusionTermPixelShader);
/// ?
MaskOcclusionTermPixelShader->SetParameters(RHICmdList, LightSceneInfo, View, LightShaftsSource);
{
// Apply a radial blur to the bloom and occlusion mask
DrawRectangle(
RHICmdList,
DownSampledXY.X, DownSampledXY.Y,
DownsampledSizeX, DownsampledSizeY,
DownSampledXY.X, DownSampledXY.Y,
DownsampledSizeX, DownsampledSizeY,
FilterBufferSize, FilterBufferSize,
*ScreenVertexShader,
EDRF_UseTriangleOptimization);
}
RHICmdList.CopyToResolveTarget(LightShaftsDest->GetRenderTargetItem().TargetableTexture, LightShaftsDest->GetRenderTargetItem().ShaderResourceTexture, false, FResolveParams());
}
示例7: Visualise
void FLightPropagationVolume::Visualise(FRHICommandList& RHICmdList, const FViewInfo& View) const
{
SCOPED_DRAW_EVENT(RHICmdList, LpvVisualise);
check(View.GetFeatureLevel() == ERHIFeatureLevel::SM5);
TShaderMapRef<FLpvVisualiseVS> VertexShader(View.ShaderMap);
TShaderMapRef<FLpvVisualiseGS> GeometryShader(View.ShaderMap);
TShaderMapRef<FLpvVisualisePS> PixelShader(View.ShaderMap);
RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI());
RHICmdList.SetRasterizerState(TStaticRasterizerState<FM_Solid, CM_None>::GetRHI());
RHICmdList.SetBlendState(TStaticBlendState<CW_RGB, BO_Add, BF_One, BF_One>::GetRHI());
SetGlobalBoundShaderState(RHICmdList, View.GetFeatureLevel(), LpvVisBoundShaderState, GSimpleElementVertexDeclaration.VertexDeclarationRHI, *VertexShader, *PixelShader, *GeometryShader);
VertexShader->SetParameters(RHICmdList, View);
GeometryShader->SetParameters(RHICmdList, View);
PixelShader->SetParameters(RHICmdList, this, View);
RHICmdList.SetStreamSource(0, NULL, 0, 0);
RHICmdList.DrawPrimitive(PT_PointList, 0, 1, 32 * 3);
PixelShader->UnbindBuffers(RHICmdList);
}
示例8: ClearQuadSetup
static void ClearQuadSetup( FRHICommandList& RHICmdList, ERHIFeatureLevel::Type FeatureLevel, bool bClearColor, int32 NumClearColors, const FLinearColor* ClearColorArray, bool bClearDepth, float Depth, bool bClearStencil, uint32 Stencil )
{
// Set new states
FBlendStateRHIParamRef BlendStateRHI;
if (NumClearColors <= 1)
{
BlendStateRHI = bClearColor
? TStaticBlendState<>::GetRHI()
: TStaticBlendState<CW_NONE>::GetRHI();
}
else
{
BlendStateRHI = bClearColor
? TStaticBlendState<>::GetRHI()
: TStaticBlendStateWriteMask<CW_NONE,CW_NONE,CW_NONE,CW_NONE,CW_NONE,CW_NONE,CW_NONE,CW_NONE>::GetRHI();
}
const FDepthStencilStateRHIParamRef DepthStencilStateRHI =
(bClearDepth && bClearStencil)
? TStaticDepthStencilState<
true, CF_Always,
true,CF_Always,SO_Replace,SO_Replace,SO_Replace,
false,CF_Always,SO_Replace,SO_Replace,SO_Replace,
0xff,0xff
>::GetRHI()
: bClearDepth
? TStaticDepthStencilState<true, CF_Always>::GetRHI()
: bClearStencil
? TStaticDepthStencilState<
false, CF_Always,
true,CF_Always,SO_Replace,SO_Replace,SO_Replace,
false,CF_Always,SO_Replace,SO_Replace,SO_Replace,
0xff,0xff
>::GetRHI()
: TStaticDepthStencilState<false, CF_Always>::GetRHI();
RHICmdList.SetRasterizerState(TStaticRasterizerState<FM_Solid, CM_None>::GetRHI());
RHICmdList.SetBlendState(BlendStateRHI);
RHICmdList.SetDepthStencilState(DepthStencilStateRHI);
auto ShaderMap = GetGlobalShaderMap(FeatureLevel);
// Set the new shaders
TShaderMapRef<TOneColorVS<true> > VertexShader(ShaderMap);
FOneColorPS* PixelShader = NULL;
// Set the shader to write to the appropriate number of render targets
// On AMD PC hardware, outputting to a color index in the shader without a matching render target set has a significant performance hit
if (NumClearColors <= 1)
{
TShaderMapRef<TOneColorPixelShaderMRT<1> > MRTPixelShader(ShaderMap);
PixelShader = *MRTPixelShader;
}
else if (NumClearColors == 2)
{
TShaderMapRef<TOneColorPixelShaderMRT<2> > MRTPixelShader(ShaderMap);
PixelShader = *MRTPixelShader;
}
else if (NumClearColors == 3)
{
TShaderMapRef<TOneColorPixelShaderMRT<3> > MRTPixelShader(ShaderMap);
PixelShader = *MRTPixelShader;
}
else if (NumClearColors == 4)
{
TShaderMapRef<TOneColorPixelShaderMRT<4> > MRTPixelShader(ShaderMap);
PixelShader = *MRTPixelShader;
}
else if (NumClearColors == 5)
{
TShaderMapRef<TOneColorPixelShaderMRT<5> > MRTPixelShader(ShaderMap);
PixelShader = *MRTPixelShader;
}
else if (NumClearColors == 6)
{
TShaderMapRef<TOneColorPixelShaderMRT<6> > MRTPixelShader(ShaderMap);
PixelShader = *MRTPixelShader;
}
else if (NumClearColors == 7)
{
TShaderMapRef<TOneColorPixelShaderMRT<7> > MRTPixelShader(ShaderMap);
PixelShader = *MRTPixelShader;
}
else if (NumClearColors == 8)
{
TShaderMapRef<TOneColorPixelShaderMRT<8> > MRTPixelShader(ShaderMap);
PixelShader = *MRTPixelShader;
}
SetGlobalBoundShaderState(RHICmdList, FeatureLevel, GClearMRTBoundShaderState[FMath::Max(NumClearColors - 1, 0)], GetVertexDeclarationFVector4(), *VertexShader, PixelShader);
PixelShader->SetColors(RHICmdList, ClearColorArray, NumClearColors);
}
示例9: DrawClearQuadMRT
// TODO support ExcludeRect
void DrawClearQuadMRT(FRHICommandList& RHICmdList, ERHIFeatureLevel::Type FeatureLevel, bool bClearColor, int32 NumClearColors, const FLinearColor* ClearColorArray, bool bClearDepth, float Depth, bool bClearStencil, uint32 Stencil)
{
// Set new states
FBlendStateRHIParamRef BlendStateRHI;
if (NumClearColors <= 1)
{
BlendStateRHI = bClearColor
? TStaticBlendState<>::GetRHI()
: TStaticBlendState<CW_NONE>::GetRHI();
}
else
{
BlendStateRHI = bClearColor
? TStaticBlendState<>::GetRHI()
: TStaticBlendStateWriteMask<CW_NONE,CW_NONE,CW_NONE,CW_NONE,CW_NONE,CW_NONE,CW_NONE,CW_NONE>::GetRHI();
}
const FDepthStencilStateRHIParamRef DepthStencilStateRHI =
(bClearDepth && bClearStencil)
? TStaticDepthStencilState<
true, CF_Always,
true,CF_Always,SO_Replace,SO_Replace,SO_Replace,
false,CF_Always,SO_Replace,SO_Replace,SO_Replace,
0xff,0xff
>::GetRHI()
: bClearDepth
? TStaticDepthStencilState<true, CF_Always>::GetRHI()
: bClearStencil
? TStaticDepthStencilState<
false, CF_Always,
true,CF_Always,SO_Replace,SO_Replace,SO_Replace,
false,CF_Always,SO_Replace,SO_Replace,SO_Replace,
0xff,0xff
>::GetRHI()
: TStaticDepthStencilState<false, CF_Always>::GetRHI();
RHICmdList.SetRasterizerState(TStaticRasterizerState<FM_Solid, CM_None>::GetRHI());
RHICmdList.SetBlendState(BlendStateRHI);
RHICmdList.SetDepthStencilState(DepthStencilStateRHI);
auto ShaderMap = GetGlobalShaderMap(FeatureLevel);
// Set the new shaders
TShaderMapRef<TOneColorVS<true> > VertexShader(ShaderMap);
FOneColorPS* PixelShader = NULL;
// Set the shader to write to the appropriate number of render targets
// On AMD PC hardware, outputting to a color index in the shader without a matching render target set has a significant performance hit
if (NumClearColors <= 1)
{
TShaderMapRef<TOneColorPixelShaderMRT<1> > MRTPixelShader(ShaderMap);
PixelShader = *MRTPixelShader;
}
else if (NumClearColors == 2)
{
TShaderMapRef<TOneColorPixelShaderMRT<2> > MRTPixelShader(ShaderMap);
PixelShader = *MRTPixelShader;
}
else if (NumClearColors == 3)
{
TShaderMapRef<TOneColorPixelShaderMRT<3> > MRTPixelShader(ShaderMap);
PixelShader = *MRTPixelShader;
}
else if (NumClearColors == 4)
{
TShaderMapRef<TOneColorPixelShaderMRT<4> > MRTPixelShader(ShaderMap);
PixelShader = *MRTPixelShader;
}
else if (NumClearColors == 5)
{
TShaderMapRef<TOneColorPixelShaderMRT<5> > MRTPixelShader(ShaderMap);
PixelShader = *MRTPixelShader;
}
else if (NumClearColors == 6)
{
TShaderMapRef<TOneColorPixelShaderMRT<6> > MRTPixelShader(ShaderMap);
PixelShader = *MRTPixelShader;
}
else if (NumClearColors == 7)
{
TShaderMapRef<TOneColorPixelShaderMRT<7> > MRTPixelShader(ShaderMap);
PixelShader = *MRTPixelShader;
}
else if (NumClearColors == 8)
{
TShaderMapRef<TOneColorPixelShaderMRT<8> > MRTPixelShader(ShaderMap);
PixelShader = *MRTPixelShader;
}
SetGlobalBoundShaderState(RHICmdList, FeatureLevel, GClearMRTBoundShaderState[FMath::Max(NumClearColors - 1, 0)], GetVertexDeclarationFVector4(), *VertexShader, PixelShader);
FLinearColor ShaderClearColors[MaxSimultaneousRenderTargets];
FMemory::Memzero(ShaderClearColors);
for (int32 i = 0; i < NumClearColors; i++)
{
ShaderClearColors[i] = ClearColorArray[i];
//.........这里部分代码省略.........
示例10: SetDecalBlendState
// @param RenderState 0:before BasePass, 1:before lighting, (later we could add "after lighting" and multiply)
void SetDecalBlendState(FRHICommandList& RHICmdList, const ERHIFeatureLevel::Type SMFeatureLevel, EDecalRenderStage InDecalRenderStage, EDecalBlendMode DecalBlendMode, bool bHasNormal)
{
if(InDecalRenderStage == DRS_BeforeBasePass)
{
// before base pass (for DBuffer decals)
if(SMFeatureLevel == ERHIFeatureLevel::SM4)
{
// DX10 doesn't support masking/using different blend modes per MRT.
// We set the opacity in the shader to 0 so we can use the same frame buffer blend.
RHICmdList.SetBlendState( TStaticBlendState<
CW_RGBA, BO_Add, BF_SourceAlpha, BF_InverseSourceAlpha, BO_Add,BF_Zero,BF_InverseSourceAlpha,
CW_RGBA, BO_Add, BF_SourceAlpha, BF_InverseSourceAlpha, BO_Add,BF_Zero,BF_InverseSourceAlpha,
CW_RGBA, BO_Add, BF_SourceAlpha, BF_InverseSourceAlpha, BO_Add,BF_Zero,BF_InverseSourceAlpha >::GetRHI() );
return;
}
else
{
// see DX10 comment above
// As we set the opacity in the shader we don't need to set different frame buffer blend modes but we like to hint to the driver that we
// don't need to output there. We also could replace this with many SetRenderTarget calls but it might be slower (needs to be tested).
switch(DecalBlendMode)
{
case DBM_DBuffer_ColorNormalRoughness:
RHICmdList.SetBlendState( TStaticBlendState<
CW_RGBA, BO_Add, BF_SourceAlpha, BF_InverseSourceAlpha, BO_Add,BF_Zero,BF_InverseSourceAlpha,
CW_RGBA, BO_Add, BF_SourceAlpha, BF_InverseSourceAlpha, BO_Add,BF_Zero,BF_InverseSourceAlpha,
CW_RGBA, BO_Add, BF_SourceAlpha, BF_InverseSourceAlpha, BO_Add,BF_Zero,BF_InverseSourceAlpha >::GetRHI() );
break;
case DBM_DBuffer_Color:
// we can optimize using less MRT later
RHICmdList.SetBlendState( TStaticBlendState<
CW_RGBA, BO_Add, BF_SourceAlpha, BF_InverseSourceAlpha, BO_Add,BF_Zero,BF_InverseSourceAlpha,
CW_RGBA, BO_Add, BF_Zero, BF_One, BO_Add,BF_Zero,BF_One,
CW_RGBA, BO_Add, BF_Zero, BF_One, BO_Add,BF_Zero,BF_One>::GetRHI() );
break;
case DBM_DBuffer_ColorNormal:
// we can optimize using less MRT later
RHICmdList.SetBlendState( TStaticBlendState<
CW_RGBA, BO_Add, BF_SourceAlpha, BF_InverseSourceAlpha, BO_Add,BF_Zero,BF_InverseSourceAlpha,
CW_RGBA, BO_Add, BF_SourceAlpha, BF_InverseSourceAlpha, BO_Add,BF_Zero,BF_InverseSourceAlpha,
CW_RGBA, BO_Add, BF_Zero, BF_One, BO_Add,BF_Zero,BF_One >::GetRHI() );
break;
case DBM_DBuffer_ColorRoughness:
// we can optimize using less MRT later
RHICmdList.SetBlendState( TStaticBlendState<
CW_RGBA, BO_Add, BF_SourceAlpha, BF_InverseSourceAlpha, BO_Add,BF_Zero,BF_InverseSourceAlpha,
CW_RGBA, BO_Add, BF_Zero, BF_One, BO_Add,BF_Zero,BF_One,
CW_RGBA, BO_Add, BF_SourceAlpha, BF_InverseSourceAlpha, BO_Add,BF_Zero,BF_InverseSourceAlpha >::GetRHI() );
break;
case DBM_DBuffer_Normal:
// we can optimize using less MRT later
RHICmdList.SetBlendState( TStaticBlendState<
CW_RGBA, BO_Add, BF_Zero, BF_One, BO_Add,BF_Zero,BF_One,
CW_RGBA, BO_Add, BF_SourceAlpha, BF_InverseSourceAlpha, BO_Add,BF_Zero,BF_InverseSourceAlpha,
CW_RGBA, BO_Add, BF_Zero, BF_One, BO_Add,BF_Zero,BF_One>::GetRHI() );
break;
case DBM_DBuffer_NormalRoughness:
// we can optimize using less MRT later
RHICmdList.SetBlendState( TStaticBlendState<
CW_RGBA, BO_Add, BF_Zero, BF_One, BO_Add,BF_Zero,BF_One,
CW_RGBA, BO_Add, BF_SourceAlpha, BF_InverseSourceAlpha, BO_Add,BF_Zero,BF_InverseSourceAlpha,
CW_RGBA, BO_Add, BF_SourceAlpha, BF_InverseSourceAlpha, BO_Add,BF_Zero,BF_InverseSourceAlpha >::GetRHI() );
break;
case DBM_DBuffer_Roughness:
// we can optimize using less MRT later
RHICmdList.SetBlendState( TStaticBlendState<
CW_RGBA, BO_Add, BF_Zero, BF_One, BO_Add,BF_Zero,BF_One,
CW_RGBA, BO_Add, BF_Zero, BF_One, BO_Add,BF_Zero,BF_One,
CW_RGBA, BO_Add, BF_SourceAlpha, BF_InverseSourceAlpha, BO_Add,BF_Zero,BF_InverseSourceAlpha >::GetRHI() );
break;
default:
// the decal type should not be rendered in this pass - internal error
check(0);
break;
}
}
return;
}
else if(InDecalRenderStage == DRS_AfterBasePass)
{
ensure(DecalBlendMode == DBM_Volumetric_DistanceFunction);
RHICmdList.SetBlendState( TStaticBlendState<>::GetRHI() );
}
else
{
// before lighting (for non DBuffer decals)
//.........这里部分代码省略.........
示例11: GammaCorrectToViewportRenderTarget
// TODO: REMOVE if no longer needed:
void FSceneRenderer::GammaCorrectToViewportRenderTarget(FRHICommandList& RHICmdList, const FViewInfo* View, float OverrideGamma)
{
// Set the view family's render target/viewport.
SetRenderTarget(RHICmdList, ViewFamily.RenderTarget->GetRenderTargetTexture(), FTextureRHIRef());
// Deferred the clear until here so the garbage left in the non rendered regions by the post process effects do not show up
if( ViewFamily.bDeferClear )
{
RHICmdList.Clear(true, FLinearColor::Black, false, 0.0f, false, 0, FIntRect());
ViewFamily.bDeferClear = false;
}
SCOPED_DRAW_EVENT(RHICmdList, GammaCorrection);
// turn off culling and blending
RHICmdList.SetRasterizerState(TStaticRasterizerState<FM_Solid, CM_None>::GetRHI());
RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI());
// turn off depth reads/writes
RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI());
TShaderMapRef<FGammaCorrectionVS> VertexShader(View->ShaderMap);
TShaderMapRef<FGammaCorrectionPS> PixelShader(View->ShaderMap);
static FGlobalBoundShaderState PostProcessBoundShaderState;
SetGlobalBoundShaderState(RHICmdList, View->GetFeatureLevel(), PostProcessBoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *VertexShader, *PixelShader);
float InvDisplayGamma = 1.0f / ViewFamily.RenderTarget->GetDisplayGamma();
if (OverrideGamma != 0)
{
InvDisplayGamma = 1 / OverrideGamma;
}
const FPixelShaderRHIParamRef ShaderRHI = PixelShader->GetPixelShader();
SetShaderValue(
RHICmdList,
ShaderRHI,
PixelShader->InverseGamma,
InvDisplayGamma
);
SetShaderValue(RHICmdList, ShaderRHI,PixelShader->ColorScale,View->ColorScale);
SetShaderValue(RHICmdList, ShaderRHI,PixelShader->OverlayColor,View->OverlayColor);
const FTextureRHIRef DesiredSceneColorTexture = GSceneRenderTargets.GetSceneColorTexture();
SetTextureParameter(
RHICmdList,
ShaderRHI,
PixelShader->SceneTexture,
PixelShader->SceneTextureSampler,
TStaticSamplerState<SF_Bilinear>::GetRHI(),
DesiredSceneColorTexture
);
// Draw a quad mapping scene color to the view's render target
DrawRectangle(
RHICmdList,
View->UnscaledViewRect.Min.X,View->UnscaledViewRect.Min.Y,
View->UnscaledViewRect.Width(),View->UnscaledViewRect.Height(),
View->ViewRect.Min.X,View->ViewRect.Min.Y,
View->ViewRect.Width(),View->ViewRect.Height(),
ViewFamily.RenderTarget->GetSizeXY(),
GSceneRenderTargets.GetBufferSizeXY(),
*VertexShader,
EDRF_UseTriangleOptimization);
}