You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb arne.schober #preflight 61d85ab0932a02483ce13e7d #ROBOMERGE-AUTHOR: andrew.davidson #ROBOMERGE-SOURCE: CL 18544411 in //UE5/Release-5.0/... via CL 18544434 #ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669) [CL 18544466 by andrew davidson in ue5-release-engine-test branch]
127 lines
3.5 KiB
C++
127 lines
3.5 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
/*=============================================================================
|
|
DummyRenderResource.h: Frequently used rendering resources
|
|
=============================================================================*/
|
|
|
|
#pragma once
|
|
|
|
#include "RenderResource.h"
|
|
#include "GlobalShader.h"
|
|
#include "ShaderParameterStruct.h"
|
|
#include "PipelineStateCache.h"
|
|
|
|
|
|
/** The vertex data used to filter a texture. */
|
|
struct FFilterVertex
|
|
{
|
|
public:
|
|
FVector4f Position;
|
|
FVector2f UV;
|
|
};
|
|
|
|
/** The filter vertex declaration resource type. */
|
|
class FFilterVertexDeclaration : public FRenderResource
|
|
{
|
|
public:
|
|
FVertexDeclarationRHIRef VertexDeclarationRHI;
|
|
|
|
/** Destructor. */
|
|
virtual ~FFilterVertexDeclaration() {}
|
|
|
|
virtual void InitRHI()
|
|
{
|
|
FVertexDeclarationElementList Elements;
|
|
uint16 Stride = sizeof(FFilterVertex);
|
|
Elements.Add(FVertexElement(0, STRUCT_OFFSET(FFilterVertex, Position), VET_Float4, 0, Stride));
|
|
Elements.Add(FVertexElement(0, STRUCT_OFFSET(FFilterVertex, UV), VET_Float2, 1, Stride));
|
|
VertexDeclarationRHI = PipelineStateCache::GetOrCreateVertexDeclaration(Elements);
|
|
}
|
|
|
|
virtual void ReleaseRHI()
|
|
{
|
|
VertexDeclarationRHI.SafeRelease();
|
|
}
|
|
};
|
|
|
|
extern RENDERCORE_API TGlobalResource<FFilterVertexDeclaration> GFilterVertexDeclaration;
|
|
|
|
/** The empty vertex declaration resource type. */
|
|
class FEmptyVertexDeclaration : public FRenderResource
|
|
{
|
|
public:
|
|
FVertexDeclarationRHIRef VertexDeclarationRHI;
|
|
|
|
/** Destructor. */
|
|
virtual ~FEmptyVertexDeclaration() {}
|
|
|
|
virtual void InitRHI()
|
|
{
|
|
FVertexDeclarationElementList Elements;
|
|
VertexDeclarationRHI = PipelineStateCache::GetOrCreateVertexDeclaration(Elements);
|
|
}
|
|
|
|
virtual void ReleaseRHI()
|
|
{
|
|
VertexDeclarationRHI.SafeRelease();
|
|
}
|
|
};
|
|
|
|
extern RENDERCORE_API TGlobalResource<FEmptyVertexDeclaration> GEmptyVertexDeclaration;
|
|
|
|
/**
|
|
* Static vertex and index buffer used for 2D screen rectangles.
|
|
*/
|
|
class FScreenRectangleVertexBuffer : public FVertexBuffer
|
|
{
|
|
public:
|
|
/** Initialize the RHI for this rendering resource */
|
|
void InitRHI() override;
|
|
};
|
|
|
|
extern RENDERCORE_API TGlobalResource<FScreenRectangleVertexBuffer> GScreenRectangleVertexBuffer;
|
|
|
|
|
|
class FScreenRectangleIndexBuffer : public FIndexBuffer
|
|
{
|
|
public:
|
|
/** Initialize the RHI for this rendering resource */
|
|
void InitRHI() override;
|
|
};
|
|
|
|
extern RENDERCORE_API TGlobalResource<FScreenRectangleIndexBuffer> GScreenRectangleIndexBuffer;
|
|
|
|
|
|
/** Vertex shader to draw a screen quad that works on all platforms. Does not have any shader parameters.
|
|
* The pixel shader should just use SV_Position. */
|
|
class RENDERCORE_API FScreenVertexShaderVS : public FGlobalShader
|
|
{
|
|
DECLARE_GLOBAL_SHADER(FScreenVertexShaderVS);
|
|
SHADER_USE_PARAMETER_STRUCT(FScreenVertexShaderVS, FGlobalShader);
|
|
|
|
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters) {
|
|
return true;
|
|
}
|
|
|
|
BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
|
|
END_SHADER_PARAMETER_STRUCT()
|
|
};
|
|
|
|
/** Pixel shader to copy pixels from src to dst performing a format change that works on all platforms. */
|
|
class RENDERCORE_API FCopyRectPS : public FGlobalShader
|
|
{
|
|
DECLARE_GLOBAL_SHADER(FCopyRectPS);
|
|
SHADER_USE_PARAMETER_STRUCT(FCopyRectPS, FGlobalShader);
|
|
|
|
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
|
|
SHADER_PARAMETER_RDG_TEXTURE(Texture2D, InputTexture)
|
|
SHADER_PARAMETER_SAMPLER(SamplerState, InputSampler)
|
|
RENDER_TARGET_BINDING_SLOTS()
|
|
END_SHADER_PARAMETER_STRUCT()
|
|
};
|