本文整理汇总了C++中FRHICommandList::SetLocalBoundShaderState方法的典型用法代码示例。如果您正苦于以下问题:C++ FRHICommandList::SetLocalBoundShaderState方法的具体用法?C++ FRHICommandList::SetLocalBoundShaderState怎么用?C++ FRHICommandList::SetLocalBoundShaderState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FRHICommandList
的用法示例。
在下文中一共展示了FRHICommandList::SetLocalBoundShaderState方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetShader
void FDecalRendering::SetShader(FRHICommandList& RHICmdList, const FViewInfo& View, bool bShaderComplexity, const FTransientDecalRenderData& DecalData, const FMatrix& FrustumComponentToClip)
{
const FMaterialShaderMap* MaterialShaderMap = DecalData.MaterialResource->GetRenderingThreadShaderMap();
auto PixelShader = MaterialShaderMap->GetShader<FDeferredDecalPS>();
TShaderMapRef<FDeferredDecalVS> VertexShader(View.ShaderMap);
if(bShaderComplexity)
{
TShaderMapRef<FShaderComplexityAccumulatePS> VisualizePixelShader(View.ShaderMap);
const uint32 NumPixelShaderInstructions = PixelShader->GetNumInstructions();
const uint32 NumVertexShaderInstructions = VertexShader->GetNumInstructions();
static FGlobalBoundShaderState BoundShaderState;
SetGlobalBoundShaderState(RHICmdList, View.GetFeatureLevel(), BoundShaderState, GetVertexDeclarationFVector4(), *VertexShader, *VisualizePixelShader);
VisualizePixelShader->SetParameters(RHICmdList, NumVertexShaderInstructions, NumPixelShaderInstructions, View.GetFeatureLevel());
}
else
{
// first Bind, then SetParameters()
RHICmdList.SetLocalBoundShaderState(RHICmdList.BuildLocalBoundShaderState(GetVertexDeclarationFVector4(), VertexShader->GetVertexShader(), FHullShaderRHIRef(), FDomainShaderRHIRef(), PixelShader->GetPixelShader(), FGeometryShaderRHIRef()));
PixelShader->SetParameters(RHICmdList, View, DecalData.MaterialProxy, *DecalData.DecalProxy, DecalData.FadeAlpha);
}
VertexShader->SetParameters(RHICmdList, View, FrustumComponentToClip);
}
示例2: SetShader
void FDecalRendering::SetShader(FRHICommandList& RHICmdList, const FViewInfo& View, const FTransientDecalRenderData& DecalData, const FMatrix& FrustumComponentToClip)
{
const FMaterialShaderMap* MaterialShaderMap = DecalData.MaterialResource->GetRenderingThreadShaderMap();
auto PixelShader = MaterialShaderMap->GetShader<FDeferredDecalPS>();
TShaderMapRef<FDeferredDecalVS> VertexShader(View.ShaderMap);
const EDebugViewShaderMode DebugViewShaderMode = View.Family->GetDebugViewShaderMode();
if (DebugViewShaderMode != DVSM_None)
{
// For this to work, decal VS must output compatible interpolants. Currently this requires to use FDebugPSInLean.
// Here we pass nullptr for the material interface because the use of a static bound shader state is only compatible with unique shaders.
IDebugViewModePSInterface* DebugPixelShader = FDebugViewMode::GetPSInterface(View.ShaderMap, nullptr, DebugViewShaderMode);
const uint32 NumPixelShaderInstructions = PixelShader->GetNumInstructions();
const uint32 NumVertexShaderInstructions = VertexShader->GetNumInstructions();
static FGlobalBoundShaderState BoundShaderState[DVSM_MAX];
SetGlobalBoundShaderState(RHICmdList, View.GetFeatureLevel(), BoundShaderState[(uint32)DebugViewShaderMode], GetVertexDeclarationFVector4(), *VertexShader, DebugPixelShader->GetShader());
DebugPixelShader->SetParameters(RHICmdList, *VertexShader, PixelShader, DecalData.MaterialProxy, *DecalData.MaterialResource, View);
DebugPixelShader->SetMesh(RHICmdList, View);
}
else
{
// first Bind, then SetParameters()
RHICmdList.SetLocalBoundShaderState(RHICmdList.BuildLocalBoundShaderState(GetVertexDeclarationFVector4(), VertexShader->GetVertexShader(), FHullShaderRHIRef(), FDomainShaderRHIRef(), PixelShader->GetPixelShader(), FGeometryShaderRHIRef()));
PixelShader->SetParameters(RHICmdList, View, DecalData.MaterialProxy, *DecalData.DecalProxy, DecalData.FadeAlpha);
}
// SetUniformBufferParameter() need to happen after the shader has been set otherwise a DebugBreak could occur.
// we don't have the Primitive uniform buffer setup for decals (later we want to batch)
{
auto& PrimitiveVS = VertexShader->GetUniformBufferParameter<FPrimitiveUniformShaderParameters>();
auto& PrimitivePS = PixelShader->GetUniformBufferParameter<FPrimitiveUniformShaderParameters>();
// uncomment to track down usage of the Primitive uniform buffer
// check(!PrimitiveVS.IsBound());
// check(!PrimitivePS.IsBound());
// to prevent potential shader error (UE-18852 ElementalDemo crashes due to nil constant buffer)
SetUniformBufferParameter(RHICmdList, VertexShader->GetVertexShader(), PrimitiveVS, GIdentityPrimitiveUniformBuffer);
if (DebugViewShaderMode == DVSM_None)
{
SetUniformBufferParameter(RHICmdList, PixelShader->GetPixelShader(), PrimitivePS, GIdentityPrimitiveUniformBuffer);
}
}
VertexShader->SetParameters(RHICmdList, View, FrustumComponentToClip);
}
示例3: SetShader
void FDecalRendering::SetShader(FRHICommandList& RHICmdList, const FViewInfo& View, bool bShaderComplexity, const FTransientDecalRenderData& DecalData, const FMatrix& FrustumComponentToClip)
{
const FMaterialShaderMap* MaterialShaderMap = DecalData.MaterialResource->GetRenderingThreadShaderMap();
auto PixelShader = MaterialShaderMap->GetShader<FDeferredDecalPS>();
TShaderMapRef<FDeferredDecalVS> VertexShader(View.ShaderMap);
// we don't have the Primitive uniform buffer setup for decals (later we want to batch)
{
auto& PrimitiveVS = VertexShader->GetUniformBufferParameter<FPrimitiveUniformShaderParameters>();
auto& PrimitivePS = PixelShader->GetUniformBufferParameter<FPrimitiveUniformShaderParameters>();
// uncomment to track down usage of the Primitive uniform buffer
// check(!PrimitiveVS.IsBound());
// check(!PrimitivePS.IsBound());
// to prevent potential shader error (UE-18852 ElementalDemo crashes due to nil constant buffer)
SetUniformBufferParameter(RHICmdList, VertexShader->GetVertexShader(), PrimitiveVS, GIdentityPrimitiveUniformBuffer);
SetUniformBufferParameter(RHICmdList, PixelShader->GetPixelShader(), PrimitivePS, GIdentityPrimitiveUniformBuffer);
}
if(bShaderComplexity)
{
TShaderMapRef<FShaderComplexityAccumulatePS> VisualizePixelShader(View.ShaderMap);
const uint32 NumPixelShaderInstructions = PixelShader->GetNumInstructions();
const uint32 NumVertexShaderInstructions = VertexShader->GetNumInstructions();
static FGlobalBoundShaderState BoundShaderState;
SetGlobalBoundShaderState(RHICmdList, View.GetFeatureLevel(), BoundShaderState, GetVertexDeclarationFVector4(), *VertexShader, *VisualizePixelShader);
VisualizePixelShader->SetParameters(RHICmdList, NumVertexShaderInstructions, NumPixelShaderInstructions, View.GetFeatureLevel());
}
else
{
// first Bind, then SetParameters()
RHICmdList.SetLocalBoundShaderState(RHICmdList.BuildLocalBoundShaderState(GetVertexDeclarationFVector4(), VertexShader->GetVertexShader(), FHullShaderRHIRef(), FDomainShaderRHIRef(), PixelShader->GetPixelShader(), FGeometryShaderRHIRef()));
PixelShader->SetParameters(RHICmdList, View, DecalData.MaterialProxy, *DecalData.DecalProxy, DecalData.FadeAlpha);
}
VertexShader->SetParameters(RHICmdList, View, FrustumComponentToClip);
}
示例4: SetVertexShaderOnly
void FDecalRendering::SetVertexShaderOnly(FRHICommandList& RHICmdList, const FViewInfo& View, const FMatrix& FrustumComponentToClip)
{
TShaderMapRef<FDeferredDecalVS> VertexShader(View.ShaderMap);
RHICmdList.SetLocalBoundShaderState(RHICmdList.BuildLocalBoundShaderState(GetVertexDeclarationFVector4(), VertexShader->GetVertexShader(), FHullShaderRHIRef(), FDomainShaderRHIRef(), NULL, FGeometryShaderRHIRef()));
VertexShader->SetParameters(RHICmdList, View, FrustumComponentToClip);
}