Files
UnrealEngineUWP/Engine/Source/Runtime/RenderCore/Public/StaticBoundShaderState.h
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

85 lines
2.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
/*=============================================================================
StaticBoundShaderState.h: Static bound shader state definitions.
=============================================================================*/
#pragma once
#include "CoreMinimal.h"
#include "Containers/List.h"
#include "RenderResource.h"
class FShader;
/**
* FGlobalBoundShaderState
*
* Encapsulates a global bound shader state resource.
*/
class FGlobalBoundShaderStateResource : public FRenderResource
{
public:
/** @return The list of global bound shader states. */
RENDERCORE_API static TLinkedList<FGlobalBoundShaderStateResource*>*& GetGlobalBoundShaderStateList();
/** Initialization constructor. */
RENDERCORE_API FGlobalBoundShaderStateResource();
/** Destructor. */
RENDERCORE_API virtual ~FGlobalBoundShaderStateResource();
private:
/** The cached bound shader state. */
FBoundShaderStateRHIRef BoundShaderState;
/** This resource's link in the list of global bound shader states. */
TLinkedList<FGlobalBoundShaderStateResource*> GlobalListLink;
// FRenderResource interface.
RENDERCORE_API virtual void ReleaseRHI();
#if DO_CHECK
FRHIVertexDeclaration* BoundVertexDeclaration;
FRHIVertexShader* BoundVertexShader;
FRHIPixelShader* BoundPixelShader;
FRHIGeometryShader* BoundGeometryShader;
#endif
};
typedef TGlobalResource<FGlobalBoundShaderStateResource> FGlobalBoundShaderState_Internal;
struct FGlobalBoundShaderStateArgs
{
FRHIVertexDeclaration* VertexDeclarationRHI;
FShader* VertexShader;
FShader* PixelShader;
FShader* GeometryShader;
};
struct FGlobalBoundShaderStateWorkArea
{
FGlobalBoundShaderStateArgs Args;
FGlobalBoundShaderState_Internal* BSS; //ideally this would be part of this memory block and not a separate allocation...that is doable, if a little tedious. The point is we need to delay the construction until we get back to the render thread.
FGlobalBoundShaderStateWorkArea()
: BSS(nullptr)
{
}
};
struct FGlobalBoundShaderState
{
public:
FGlobalBoundShaderStateWorkArea* Get(ERHIFeatureLevel::Type InFeatureLevel) { return WorkAreas[InFeatureLevel]; }
FGlobalBoundShaderStateWorkArea** GetPtr(ERHIFeatureLevel::Type InFeatureLevel) { return &WorkAreas[InFeatureLevel]; }
private:
FGlobalBoundShaderStateWorkArea* WorkAreas[ERHIFeatureLevel::Num];
};