Files
UnrealEngineUWP/Engine/Source/Runtime/RenderCore/Private/StaticBoundShaderState.cpp
christopher waters 1d0b1d44eb Initial support for Mesh and Amplification Shaders. These new shader types are an optional feature of the RHIs and are only enabled on PC D3D12 with Feature Level SM6.
#jira none
#rb emil.persson, graham.wihlidal, lukas.hermanns

[CL 15742432 by christopher waters in ue5-main branch]
2021-03-18 18:42:49 -04:00

57 lines
1.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
/*=============================================================================
StaticBoundShaderState.cpp: Static bound shader state implementation.
=============================================================================*/
#include "StaticBoundShaderState.h"
#include "RenderingThread.h"
#include "Shader.h"
PRAGMA_DISABLE_DEPRECATION_WARNINGS
TLinkedList<FGlobalBoundShaderStateResource*>*& FGlobalBoundShaderStateResource::GetGlobalBoundShaderStateList()
{
static TLinkedList<FGlobalBoundShaderStateResource*>* List = NULL;
return List;
}
FGlobalBoundShaderStateResource::FGlobalBoundShaderStateResource()
: GlobalListLink(this)
#if DO_CHECK
, BoundVertexDeclaration(nullptr)
, BoundVertexShader(nullptr)
, BoundPixelShader(nullptr)
, BoundGeometryShader(nullptr)
#endif
{
// Add this resource to the global list in the rendering thread.
if(IsInRenderingThread())
{
GlobalListLink.LinkHead(GetGlobalBoundShaderStateList());
}
else
{
FGlobalBoundShaderStateResource* Resource = this;
ENQUEUE_RENDER_COMMAND(LinkGlobalBoundShaderStateResource)(
[Resource](FRHICommandList& RHICmdList)
{
Resource->GlobalListLink.LinkHead(GetGlobalBoundShaderStateList());
});
}
}
FGlobalBoundShaderStateResource::~FGlobalBoundShaderStateResource()
{
// Remove this resource from the global list.
GlobalListLink.Unlink();
}
void FGlobalBoundShaderStateResource::ReleaseRHI()
{
// Release the cached bound shader state.
BoundShaderState.SafeRelease();
}
PRAGMA_ENABLE_DEPRECATION_WARNINGS