2019-12-26 14:45:42 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2019-02-25 09:08:54 -05:00
# include "ShaderPrint.h"
# include "ShaderPrintParameters.h"
2022-02-22 15:35:01 -05:00
# include "ShaderParameterStruct.h"
2019-02-25 09:08:54 -05:00
# include "CommonRenderResources.h"
# include "Containers/DynamicRHIResourceArray.h"
# include "Engine/Engine.h"
# include "GlobalShader.h"
# include "PipelineStateCache.h"
# include "RenderGraphBuilder.h"
2022-02-20 07:20:20 -05:00
# include "ScenePrivate.h"
2022-04-26 09:59:10 -04:00
# include "SceneRendering.h"
# include "ScreenPass.h"
# include "SystemTextures.h"
2019-02-25 09:08:54 -05:00
namespace ShaderPrint
{
2022-02-22 15:35:01 -05:00
//////////////////////////////////////////////////////////////////////////////////////////////////
2019-02-25 09:08:54 -05:00
// Console variables
2022-02-22 15:35:01 -05:00
2022-06-03 15:58:15 -04:00
static int32 GEnabled = false ;
static FAutoConsoleVariableRef CVarEnable (
2022-02-22 15:35:01 -05:00
TEXT ( " r.ShaderPrint " ) ,
2022-06-03 15:58:15 -04:00
GEnabled ,
2019-02-25 09:08:54 -05:00
TEXT ( " ShaderPrint debugging toggle. \n " ) ,
ECVF_Cheat | ECVF_RenderThreadSafe ) ;
static TAutoConsoleVariable < int32 > CVarFontSize (
2022-02-22 15:35:01 -05:00
TEXT ( " r.ShaderPrint.FontSize " ) ,
2021-09-24 12:06:31 -04:00
8 ,
2019-02-25 09:08:54 -05:00
TEXT ( " ShaderPrint font size. \n " ) ,
ECVF_Cheat | ECVF_RenderThreadSafe ) ;
static TAutoConsoleVariable < int32 > CVarFontSpacingX (
2022-02-22 15:35:01 -05:00
TEXT ( " r.ShaderPrint.FontSpacingX " ) ,
2019-02-25 09:08:54 -05:00
0 ,
TEXT ( " ShaderPrint horizontal spacing between symbols. \n " ) ,
ECVF_Cheat | ECVF_RenderThreadSafe ) ;
static TAutoConsoleVariable < int32 > CVarFontSpacingY (
2022-02-22 15:35:01 -05:00
TEXT ( " r.ShaderPrint.FontSpacingY " ) ,
2019-02-25 09:08:54 -05:00
8 ,
TEXT ( " ShaderPrint vertical spacing between symbols. \n " ) ,
ECVF_Cheat | ECVF_RenderThreadSafe ) ;
2022-02-22 15:35:01 -05:00
static TAutoConsoleVariable < int32 > CVarMaxCharacterCount (
TEXT ( " r.ShaderPrint.MaxCharacters " ) ,
2019-02-25 09:08:54 -05:00
2000 ,
TEXT ( " ShaderPrint output buffer size. \n " ) ,
ECVF_Cheat | ECVF_RenderThreadSafe ) ;
2022-02-20 07:20:20 -05:00
static TAutoConsoleVariable < int32 > CVarMaxWidgetCount (
2022-02-22 15:35:01 -05:00
TEXT ( " r.ShaderPrint.MaxWidget " ) ,
2022-02-20 07:20:20 -05:00
32 ,
TEXT ( " ShaderPrint max widget count. \n " ) ,
ECVF_Cheat | ECVF_RenderThreadSafe ) ;
2022-02-22 15:35:01 -05:00
static TAutoConsoleVariable < int32 > CVarMaxLineCount (
TEXT ( " r.ShaderPrint.MaxLine " ) ,
32 ,
TEXT ( " ShaderPrint max line count. \n " ) ,
ECVF_Cheat | ECVF_RenderThreadSafe ) ;
2022-05-13 09:53:35 -04:00
static TAutoConsoleVariable < int32 > CVarMaxTriangleCount (
TEXT ( " r.ShaderPrint.MaxTriangle " ) ,
32 ,
TEXT ( " ShaderPrint max triangle count. \n " ) ,
ECVF_Cheat | ECVF_RenderThreadSafe ) ;
2022-02-22 15:35:01 -05:00
static TAutoConsoleVariable < int32 > CVarDrawLock (
TEXT ( " r.ShaderPrint.Lock " ) ,
0 ,
TEXT ( " Lock the line drawing. \n " ) ,
ECVF_Cheat | ECVF_RenderThreadSafe ) ;
//////////////////////////////////////////////////////////////////////////////////////////////////
// Global states
2022-02-20 07:20:20 -05:00
static uint32 GWidgetRequestCount = 0 ;
2021-09-24 12:06:31 -04:00
static uint32 GCharacterRequestCount = 0 ;
2022-02-22 15:35:01 -05:00
static uint32 GLineRequestCount = 0 ;
2022-05-13 09:53:35 -04:00
static uint32 GTriangleRequestCount = 0 ;
2022-02-22 15:35:01 -05:00
static FViewInfo * GDefaultView = nullptr ;
2022-06-03 13:34:01 -04:00
static TArray < FFrozenShaderPrintData > GShaderPrintDataToRender ;
2019-02-25 09:08:54 -05:00
2022-02-22 15:35:01 -05:00
//////////////////////////////////////////////////////////////////////////////////////////////////
// Struct & Functions
2019-02-25 09:08:54 -05:00
2022-02-22 15:35:01 -05:00
static uint32 GetMaxValueCount ( )
2019-02-25 09:08:54 -05:00
{
2022-06-03 15:58:15 -04:00
return FMath : : Max ( CVarMaxCharacterCount . GetValueOnAnyThread ( ) + int32 ( GCharacterRequestCount ) , 0 ) ;
2019-02-25 09:08:54 -05:00
}
2022-02-22 15:35:01 -05:00
static uint32 GetMaxWidgetCount ( )
2022-02-20 07:20:20 -05:00
{
2022-06-03 15:58:15 -04:00
return FMath : : Max ( CVarMaxWidgetCount . GetValueOnAnyThread ( ) + int32 ( GWidgetRequestCount ) , 0 ) ;
2022-02-20 07:20:20 -05:00
}
2022-02-22 15:35:01 -05:00
static uint32 GetMaxLineCount ( )
{
2022-06-03 15:58:15 -04:00
return FMath : : Max ( CVarMaxLineCount . GetValueOnAnyThread ( ) + int32 ( GLineRequestCount ) , 0 ) ;
2022-02-22 15:35:01 -05:00
}
2022-05-13 09:53:35 -04:00
static uint32 GetMaxTriangleCount ( )
2022-05-10 09:18:43 -04:00
{
2022-06-03 15:58:15 -04:00
return FMath : : Max ( CVarMaxTriangleCount . GetValueOnAnyThread ( ) + int32 ( GTriangleRequestCount ) , 0 ) ;
2022-05-10 09:18:43 -04:00
}
2022-05-13 09:53:35 -04:00
// Returns the number of uints used for counters, a line element, and a triangle elements
2022-05-30 03:08:58 -04:00
static uint32 GetCountersUintSize ( ) { return 4 ; }
2022-05-13 09:53:35 -04:00
static uint32 GetPackedLineUintSize ( ) { return 8 ; }
static uint32 GetPackedTriangleUintSize ( ) { return 12 ; }
2022-05-30 03:08:58 -04:00
static uint32 GetPackedSymbolUintSize ( ) { return 4 ; }
2022-05-13 09:53:35 -04:00
2019-02-25 09:08:54 -05:00
// Get symbol buffer size
// This is some multiple of the value buffer size to allow for maximum value->symbol expansion
2022-04-26 09:59:10 -04:00
static uint32 GetMaxSymbolCountFromValueCount ( uint32 MaxValueCount )
{
return MaxValueCount * 12u ;
}
2022-02-22 15:35:01 -05:00
static bool IsDrawLocked ( )
{
return CVarDrawLock . GetValueOnRenderThread ( ) > 0 ;
}
2022-05-30 03:08:58 -04:00
// Empty buffer for binding when ShaderPrint is disabled
class FEmptyBuffer : public FBufferWithRDG
{
public :
void InitRHI ( ) override
{
Buffer = AllocatePooledBuffer ( FRDGBufferDesc : : CreateStructuredDesc ( 4 , GetCountersUintSize ( ) ) , TEXT ( " ShaderPrint.EmptyValueBuffer " ) ) ;
}
} ;
FBufferWithRDG * GEmptyBuffer = new TGlobalResource < FEmptyBuffer > ( ) ;
2022-02-22 15:35:01 -05:00
//////////////////////////////////////////////////////////////////////////////////////////////////
// Uniform buffer
2019-02-25 09:08:54 -05:00
// ShaderPrint uniform buffer
2022-04-12 13:08:02 -04:00
IMPLEMENT_GLOBAL_SHADER_PARAMETER_STRUCT ( FShaderPrintCommonParameters , " ShaderPrintData " ) ;
2022-02-22 07:23:17 -05:00
2019-02-25 09:08:54 -05:00
// Fill the uniform buffer parameters
2022-10-07 00:18:05 -04:00
void GetParameters ( FShaderPrintSetup const & InSetup , FShaderPrintCommonParameters & OutParameters )
{
const FVector2D ViewSize ( FMath : : Max ( InSetup . ViewRect . Size ( ) . X , 1 ) , FMath : : Max ( InSetup . ViewRect . Size ( ) . Y , 1 ) ) ;
const float FontWidth = float ( InSetup . FontSize . X ) * InSetup . DPIScale / ViewSize . X ;
const float FontHeight = float ( InSetup . FontSize . Y ) * InSetup . DPIScale / ViewSize . Y ;
const float SpaceWidth = float ( InSetup . FontSpacing . X ) * InSetup . DPIScale / ViewSize . X ;
const float SpaceHeight = float ( InSetup . FontSpacing . Y ) * InSetup . DPIScale / ViewSize . Y ;
OutParameters . FontSize = FVector2f ( FontWidth , FontHeight ) ;
OutParameters . FontSpacing = FVector2f ( FontWidth + SpaceWidth , FontHeight + SpaceHeight ) ;
OutParameters . Resolution = InSetup . ViewRect . Size ( ) ;
OutParameters . CursorCoord = InSetup . CursorCoord ;
OutParameters . MaxValueCount = InSetup . MaxValueCount ;
OutParameters . MaxSymbolCount = GetMaxSymbolCountFromValueCount ( InSetup . MaxValueCount ) ;
OutParameters . MaxStateCount = InSetup . MaxStateCount ;
OutParameters . MaxLineCount = InSetup . MaxLineCount ;
OutParameters . MaxTriangleCount = InSetup . MaxTriangleCount ;
OutParameters . TranslatedWorldOffset = FVector3f ( InSetup . PreViewTranslation ) ;
}
2019-02-25 09:08:54 -05:00
// Return a uniform buffer with values filled and with single frame lifetime
2022-10-07 00:18:05 -04:00
static TUniformBufferRef < ShaderPrint : : FShaderPrintCommonParameters > CreateUniformBuffer ( const FShaderPrintSetup & InSetup )
2021-09-24 03:34:49 -04:00
{
2022-10-07 00:18:05 -04:00
FShaderPrintCommonParameters Parameters ;
GetParameters ( InSetup , Parameters ) ;
2022-04-26 09:59:10 -04:00
2022-10-07 00:18:05 -04:00
return TUniformBufferRef < ShaderPrint : : FShaderPrintCommonParameters > : : CreateUniformBufferImmediate ( Parameters , UniformBuffer_SingleFrame ) ;
2019-02-25 09:08:54 -05:00
}
2022-02-22 15:35:01 -05:00
//////////////////////////////////////////////////////////////////////////////////////////////////
// Accessors
2022-04-26 09:59:10 -04:00
// Fill the FShaderParameters parameters
2022-06-03 13:34:01 -04:00
void SetParameters ( FRDGBuilder & GraphBuilder , const FShaderPrintData & InData , FShaderParameters & OutParameters )
2022-04-26 09:59:10 -04:00
{
2022-06-03 13:34:01 -04:00
OutParameters . Common = InData . UniformBuffer ;
OutParameters . ShaderPrint_StateBuffer = GraphBuilder . CreateSRV ( InData . ShaderPrintStateBuffer ) ;
2022-06-11 09:42:00 -04:00
OutParameters . ShaderPrint_RWEntryBuffer = GraphBuilder . CreateUAV ( InData . ShaderPrintEntryBuffer ) ;
2022-04-26 09:59:10 -04:00
}
2022-02-22 15:35:01 -05:00
void SetParameters ( FRDGBuilder & GraphBuilder , FShaderParameters & OutParameters )
{
2022-04-26 09:59:10 -04:00
if ( ensure ( GDefaultView ! = nullptr ) )
2022-02-22 15:35:01 -05:00
{
SetParameters ( GraphBuilder , GDefaultView - > ShaderPrintData , OutParameters ) ;
}
}
2021-09-24 03:34:49 -04:00
void SetParameters ( FRDGBuilder & GraphBuilder , const FViewInfo & View , FShaderParameters & OutParameters )
2019-02-25 09:08:54 -05:00
{
2022-02-22 07:23:17 -05:00
SetParameters ( GraphBuilder , View . ShaderPrintData , OutParameters ) ;
2021-09-24 03:34:49 -04:00
}
2019-04-11 09:29:25 -04:00
bool IsSupported ( EShaderPlatform InShaderPlatform )
{
2022-10-07 00:18:05 -04:00
return ! IsMobilePlatform ( InShaderPlatform ) & & ! IsHlslccShaderPlatform ( InShaderPlatform ) ;
2019-04-11 09:29:25 -04:00
}
2022-06-03 15:58:15 -04:00
bool IsEnabled ( )
2020-09-24 00:43:27 -04:00
{
2022-06-03 15:58:15 -04:00
return GEnabled ! = 0 ;
2020-09-24 00:43:27 -04:00
}
2022-06-03 15:58:15 -04:00
void SetEnabled ( bool bInEnabled )
2020-09-24 00:43:27 -04:00
{
2022-06-03 15:58:15 -04:00
GEnabled = bInEnabled ? 1 : 0 ;
}
bool IsValid ( FShaderPrintData const & InShaderPrintData )
{
// Assume that if UniformBuffer is valid then all other buffers are.
return InShaderPrintData . UniformBuffer . IsValid ( ) ;
}
bool IsEnabled ( FShaderPrintData const & InShaderPrintData )
{
return InShaderPrintData . Setup . bEnabled ;
}
bool IsDefaultViewValid ( )
{
return GDefaultView ! = nullptr & & IsValid ( GDefaultView - > ShaderPrintData ) ;
}
bool IsDefaultViewEnabled ( )
{
return GDefaultView ! = nullptr & & IsEnabled ( GDefaultView - > ShaderPrintData ) ;
2020-09-24 00:43:27 -04:00
}
2022-02-22 15:35:01 -05:00
void RequestSpaceForCharacters ( uint32 InCount )
2020-09-24 00:43:27 -04:00
{
2022-02-22 15:35:01 -05:00
GCharacterRequestCount + = InCount ;
}
2020-09-24 00:43:27 -04:00
2022-02-22 15:35:01 -05:00
void RequestSpaceForLines ( uint32 InCount )
2021-09-24 12:06:31 -04:00
{
2022-02-22 15:35:01 -05:00
GLineRequestCount + = InCount ;
2021-09-24 12:06:31 -04:00
}
2022-05-13 09:53:35 -04:00
void RequestSpaceForTriangles ( uint32 InCount )
{
GTriangleRequestCount + = InCount ;
}
2022-06-03 13:34:01 -04:00
void SubmitShaderPrintData ( FFrozenShaderPrintData & InData )
{
GShaderPrintDataToRender . Add ( InData ) ;
}
2022-02-22 15:35:01 -05:00
//////////////////////////////////////////////////////////////////////////////////////////////////
// Widget/Characters Shaders
2019-02-25 09:08:54 -05:00
// Shader to initialize the output value buffer
2022-06-11 09:42:00 -04:00
class FShaderPrintClearCounterCS : public FGlobalShader
2019-02-25 09:08:54 -05:00
{
public :
2022-06-11 09:42:00 -04:00
DECLARE_GLOBAL_SHADER ( FShaderPrintClearCounterCS ) ;
SHADER_USE_PARAMETER_STRUCT ( FShaderPrintClearCounterCS , FGlobalShader ) ;
2019-02-25 09:08:54 -05:00
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
2022-05-30 03:08:58 -04:00
SHADER_PARAMETER_RDG_BUFFER_UAV ( RWStructuredBuffer < uint > , RWValuesBuffer )
2019-02-25 09:08:54 -05:00
END_SHADER_PARAMETER_STRUCT ( )
static bool ShouldCompilePermutation ( FGlobalShaderPermutationParameters const & Parameters )
{
2019-04-11 09:29:25 -04:00
return IsSupported ( Parameters . Platform ) ;
2019-02-25 09:08:54 -05:00
}
} ;
2022-06-11 09:42:00 -04:00
IMPLEMENT_GLOBAL_SHADER ( FShaderPrintClearCounterCS , " /Engine/Private/ShaderPrintDraw.usf " , " ClearCounterCS " , SF_Compute ) ;
2019-02-25 09:08:54 -05:00
// Shader to fill the indirect parameter arguments ready for the value->symbol compute pass
class FShaderBuildIndirectDispatchArgsCS : public FGlobalShader
{
public :
2019-10-01 13:03:04 -04:00
DECLARE_GLOBAL_SHADER ( FShaderBuildIndirectDispatchArgsCS ) ;
2019-02-25 09:08:54 -05:00
SHADER_USE_PARAMETER_STRUCT ( FShaderBuildIndirectDispatchArgsCS , FGlobalShader ) ;
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
2022-02-22 07:23:17 -05:00
SHADER_PARAMETER_STRUCT_REF ( FShaderPrintCommonParameters , Common )
2022-05-30 03:08:58 -04:00
SHADER_PARAMETER_RDG_BUFFER_SRV ( StructuredBuffer < uint > , ValuesBuffer )
SHADER_PARAMETER_RDG_BUFFER_UAV ( RWStructuredBuffer < uint > , RWSymbolsBuffer )
2022-04-19 05:59:25 -04:00
SHADER_PARAMETER_RDG_BUFFER_UAV ( RWBuffer < uint > , RWIndirectDispatchArgsBuffer )
2019-02-25 09:08:54 -05:00
END_SHADER_PARAMETER_STRUCT ( )
static bool ShouldCompilePermutation ( FGlobalShaderPermutationParameters const & Parameters )
{
2019-04-11 09:29:25 -04:00
return IsSupported ( Parameters . Platform ) ;
2019-02-25 09:08:54 -05:00
}
} ;
2019-10-01 13:03:04 -04:00
IMPLEMENT_GLOBAL_SHADER ( FShaderBuildIndirectDispatchArgsCS , " /Engine/Private/ShaderPrintDraw.usf " , " BuildIndirectDispatchArgsCS " , SF_Compute ) ;
2019-02-25 09:08:54 -05:00
2022-02-20 07:20:20 -05:00
// Shader to clean & compact widget state
class FShaderCompactStateBufferCS : public FGlobalShader
{
public :
DECLARE_GLOBAL_SHADER ( FShaderCompactStateBufferCS ) ;
SHADER_USE_PARAMETER_STRUCT ( FShaderCompactStateBufferCS , FGlobalShader ) ;
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
SHADER_PARAMETER ( uint32 , FrameIndex )
SHADER_PARAMETER ( uint32 , FrameThreshold )
2022-02-22 07:23:17 -05:00
SHADER_PARAMETER_STRUCT_REF ( FShaderPrintCommonParameters , Common )
2022-02-20 07:20:20 -05:00
SHADER_PARAMETER_RDG_BUFFER_UAV ( RWStructuredBuffer < uint > , RWStateBuffer )
END_SHADER_PARAMETER_STRUCT ( )
static bool ShouldCompilePermutation ( FGlobalShaderPermutationParameters const & Parameters )
{
return IsSupported ( Parameters . Platform ) ;
}
} ;
IMPLEMENT_GLOBAL_SHADER ( FShaderCompactStateBufferCS , " /Engine/Private/ShaderPrintDraw.usf " , " CompactStateBufferCS " , SF_Compute ) ;
2019-02-25 09:08:54 -05:00
// Shader to read the values buffer and convert to the symbols buffer
class FShaderBuildSymbolBufferCS : public FGlobalShader
{
public :
2019-10-01 13:03:04 -04:00
DECLARE_GLOBAL_SHADER ( FShaderBuildSymbolBufferCS ) ;
2019-02-25 09:08:54 -05:00
SHADER_USE_PARAMETER_STRUCT ( FShaderBuildSymbolBufferCS , FGlobalShader ) ;
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
2022-02-20 07:20:20 -05:00
SHADER_PARAMETER ( uint32 , FrameIndex )
2022-02-22 07:23:17 -05:00
SHADER_PARAMETER_STRUCT_REF ( FShaderPrintCommonParameters , Common )
2022-05-30 03:08:58 -04:00
SHADER_PARAMETER_RDG_BUFFER_SRV ( StructuredBuffer < uint > , ValuesBuffer )
SHADER_PARAMETER_RDG_BUFFER_UAV ( RWStructuredBuffer < uint > , RWSymbolsBuffer )
2022-02-20 07:20:20 -05:00
SHADER_PARAMETER_RDG_BUFFER_UAV ( RWStructuredBuffer < uint > , RWStateBuffer )
2021-03-17 06:03:08 -04:00
RDG_BUFFER_ACCESS ( IndirectDispatchArgsBuffer , ERHIAccess : : IndirectArgs )
2019-02-25 09:08:54 -05:00
END_SHADER_PARAMETER_STRUCT ( )
static bool ShouldCompilePermutation ( FGlobalShaderPermutationParameters const & Parameters )
{
2019-04-11 09:29:25 -04:00
return IsSupported ( Parameters . Platform ) ;
2019-02-25 09:08:54 -05:00
}
} ;
2019-10-01 13:03:04 -04:00
IMPLEMENT_GLOBAL_SHADER ( FShaderBuildSymbolBufferCS , " /Engine/Private/ShaderPrintDraw.usf " , " BuildSymbolBufferCS " , SF_Compute ) ;
2019-02-25 09:08:54 -05:00
// Shader to fill the indirect parameter arguments ready for draw pass
class FShaderBuildIndirectDrawArgsCS : public FGlobalShader
{
public :
2019-10-01 13:03:04 -04:00
DECLARE_GLOBAL_SHADER ( FShaderBuildIndirectDrawArgsCS ) ;
2019-02-25 09:08:54 -05:00
SHADER_USE_PARAMETER_STRUCT ( FShaderBuildIndirectDrawArgsCS , FGlobalShader ) ;
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
2022-02-22 07:23:17 -05:00
SHADER_PARAMETER_STRUCT_REF ( FShaderPrintCommonParameters , Common )
2022-05-30 03:08:58 -04:00
SHADER_PARAMETER_RDG_BUFFER_SRV ( StructuredBuffer < uint > , SymbolsBuffer )
2022-04-19 05:59:25 -04:00
SHADER_PARAMETER_RDG_BUFFER_UAV ( RWBuffer < uint > , RWIndirectDrawArgsBuffer )
2019-02-25 09:08:54 -05:00
END_SHADER_PARAMETER_STRUCT ( )
static bool ShouldCompilePermutation ( FGlobalShaderPermutationParameters const & Parameters )
{
2019-04-11 09:29:25 -04:00
return IsSupported ( Parameters . Platform ) ;
2019-02-25 09:08:54 -05:00
}
} ;
2019-10-01 13:03:04 -04:00
IMPLEMENT_GLOBAL_SHADER ( FShaderBuildIndirectDrawArgsCS , " /Engine/Private/ShaderPrintDraw.usf " , " BuildIndirectDrawArgsCS " , SF_Compute ) ;
2019-02-25 09:08:54 -05:00
// Shader for draw pass to render each symbol
class FShaderDrawSymbols : public FGlobalShader
{
public :
2021-12-07 07:48:20 -05:00
FShaderDrawSymbols ( )
{ }
FShaderDrawSymbols ( const ShaderMetaType : : CompiledShaderInitializerType & Initializer )
: FGlobalShader ( Initializer )
{ }
2019-02-25 09:08:54 -05:00
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
RENDER_TARGET_BINDING_SLOTS ( )
2022-02-22 07:23:17 -05:00
SHADER_PARAMETER_STRUCT_REF ( FShaderPrintCommonParameters , Common )
2019-02-25 09:08:54 -05:00
SHADER_PARAMETER_TEXTURE ( Texture2D , MiniFontTexture )
2022-05-30 03:08:58 -04:00
SHADER_PARAMETER_RDG_BUFFER_SRV ( StructuredBuffer < uint > , SymbolsBuffer )
2021-03-17 06:03:08 -04:00
RDG_BUFFER_ACCESS ( IndirectDrawArgsBuffer , ERHIAccess : : IndirectArgs )
2019-02-25 09:08:54 -05:00
END_SHADER_PARAMETER_STRUCT ( )
static bool ShouldCompilePermutation ( FGlobalShaderPermutationParameters const & Parameters )
{
2019-04-11 09:29:25 -04:00
return IsSupported ( Parameters . Platform ) ;
2019-02-25 09:08:54 -05:00
}
} ;
class FShaderDrawSymbolsVS : public FShaderDrawSymbols
{
2019-10-01 13:03:04 -04:00
DECLARE_GLOBAL_SHADER ( FShaderDrawSymbolsVS ) ;
2021-12-07 07:48:20 -05:00
SHADER_USE_PARAMETER_STRUCT ( FShaderDrawSymbolsVS , FShaderDrawSymbols ) ;
2019-02-25 09:08:54 -05:00
} ;
2019-10-01 13:03:04 -04:00
IMPLEMENT_GLOBAL_SHADER ( FShaderDrawSymbolsVS , " /Engine/Private/ShaderPrintDraw.usf " , " DrawSymbolsVS " , SF_Vertex ) ;
2019-02-25 09:08:54 -05:00
class FShaderDrawSymbolsPS : public FShaderDrawSymbols
{
2019-10-01 13:03:04 -04:00
DECLARE_GLOBAL_SHADER ( FShaderDrawSymbolsPS ) ;
2021-12-07 07:48:20 -05:00
SHADER_USE_PARAMETER_STRUCT ( FShaderDrawSymbolsPS , FShaderDrawSymbols ) ;
2019-02-25 09:08:54 -05:00
} ;
2019-10-01 13:03:04 -04:00
IMPLEMENT_GLOBAL_SHADER ( FShaderDrawSymbolsPS , " /Engine/Private/ShaderPrintDraw.usf " , " DrawSymbolsPS " , SF_Pixel ) ;
2019-02-25 09:08:54 -05:00
2022-02-22 15:35:01 -05:00
//////////////////////////////////////////////////////////////////////////
// Line Shaders
class FShaderDrawDebugCopyCS : public FGlobalShader
{
DECLARE_GLOBAL_SHADER ( FShaderDrawDebugCopyCS ) ;
SHADER_USE_PARAMETER_STRUCT ( FShaderDrawDebugCopyCS , FGlobalShader ) ;
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
SHADER_PARAMETER_RDG_BUFFER_SRV ( StructuredBuffer , ElementBuffer )
SHADER_PARAMETER_RDG_BUFFER_UAV ( RWBuffer , RWIndirectArgs )
2022-05-13 09:53:35 -04:00
SHADER_PARAMETER ( uint32 , PrimitiveType )
SHADER_PARAMETER_STRUCT_REF ( FShaderPrintCommonParameters , ShaderPrintData )
2022-02-22 15:35:01 -05:00
END_SHADER_PARAMETER_STRUCT ( )
static bool ShouldCompilePermutation ( const FGlobalShaderPermutationParameters & Parameters )
{
return IsSupported ( Parameters . Platform ) ;
}
static void ModifyCompilationEnvironment ( const FGlobalShaderPermutationParameters & Parameters , FShaderCompilerEnvironment & OutEnvironment )
{
FGlobalShader : : ModifyCompilationEnvironment ( Parameters , OutEnvironment ) ;
OutEnvironment . SetDefine ( TEXT ( " GPU_DEBUG_RENDERING " ) , 1 ) ;
OutEnvironment . SetDefine ( TEXT ( " GPU_DEBUG_RENDERING_COPY_CS " ) , 1 ) ;
}
} ;
2022-02-22 15:49:31 -05:00
IMPLEMENT_GLOBAL_SHADER ( FShaderDrawDebugCopyCS , " /Engine/Private/ShaderPrintDrawPrimitive.usf " , " ShaderDrawDebugCopyCS " , SF_Compute ) ;
2022-02-22 15:35:01 -05:00
class FShaderDrawDebugVS : public FGlobalShader
{
DECLARE_GLOBAL_SHADER ( FShaderDrawDebugVS ) ;
SHADER_USE_PARAMETER_STRUCT ( FShaderDrawDebugVS , FGlobalShader ) ;
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
2022-05-13 09:53:35 -04:00
SHADER_PARAMETER_STRUCT_REF ( FShaderPrintCommonParameters , Common )
2022-02-22 15:35:01 -05:00
SHADER_PARAMETER ( FVector3f , TranslatedWorldOffsetConversion )
2022-04-26 09:59:10 -04:00
SHADER_PARAMETER ( FMatrix44f , TranslatedWorldToClip )
2022-02-22 15:35:01 -05:00
SHADER_PARAMETER_STRUCT_REF ( FViewUniformShaderParameters , View )
SHADER_PARAMETER_SRV ( StructuredBuffer , LockedShaderDrawDebugPrimitive )
SHADER_PARAMETER_RDG_BUFFER_SRV ( StructuredBuffer , ShaderDrawDebugPrimitive )
RDG_BUFFER_ACCESS ( IndirectBuffer , ERHIAccess : : IndirectArgs )
END_SHADER_PARAMETER_STRUCT ( )
2022-05-13 09:53:35 -04:00
class FPrimitiveType : SHADER_PERMUTATION_INT ( " PERMUTATION_PRIMITIVE_TYPE " , 2 ) ;
using FPermutationDomain = TShaderPermutationDomain < FPrimitiveType > ;
2022-02-22 15:35:01 -05:00
static bool ShouldCompilePermutation ( const FGlobalShaderPermutationParameters & Parameters )
{
return IsSupported ( Parameters . Platform ) ;
}
static void ModifyCompilationEnvironment ( const FGlobalShaderPermutationParameters & Parameters , FShaderCompilerEnvironment & OutEnvironment )
{
FGlobalShader : : ModifyCompilationEnvironment ( Parameters , OutEnvironment ) ;
OutEnvironment . SetDefine ( TEXT ( " GPU_DEBUG_RENDERING " ) , 1 ) ;
2022-05-13 09:53:35 -04:00
FPermutationDomain PermutationVector ( Parameters . PermutationId ) ;
if ( PermutationVector . Get < FPrimitiveType > ( ) = = 0 )
{
OutEnvironment . SetDefine ( TEXT ( " GPU_DEBUG_RENDERING_LINE_VS " ) , 1 ) ;
}
else
{
OutEnvironment . SetDefine ( TEXT ( " GPU_DEBUG_RENDERING_TRIANGLE_VS " ) , 1 ) ;
}
2022-02-22 15:35:01 -05:00
}
} ;
2022-02-22 15:49:31 -05:00
IMPLEMENT_GLOBAL_SHADER ( FShaderDrawDebugVS , " /Engine/Private/ShaderPrintDrawPrimitive.usf " , " ShaderDrawDebugVS " , SF_Vertex ) ;
2022-02-22 15:35:01 -05:00
class FShaderDrawDebugPS : public FGlobalShader
{
DECLARE_GLOBAL_SHADER ( FShaderDrawDebugPS ) ;
SHADER_USE_PARAMETER_STRUCT ( FShaderDrawDebugPS , FGlobalShader ) ;
BEGIN_SHADER_PARAMETER_STRUCT ( FParameters , )
SHADER_PARAMETER ( FVector2f , OutputInvResolution )
SHADER_PARAMETER ( FVector2f , OriginalViewRectMin )
SHADER_PARAMETER ( FVector2f , OriginalViewSize )
SHADER_PARAMETER ( FVector2f , OriginalBufferInvSize )
2022-07-05 14:17:46 -04:00
SHADER_PARAMETER ( uint32 , bCheckerboardEnabled )
2022-02-22 15:35:01 -05:00
SHADER_PARAMETER_RDG_TEXTURE ( Texture2D , DepthTexture )
SHADER_PARAMETER_SAMPLER ( SamplerState , DepthSampler )
RENDER_TARGET_BINDING_SLOTS ( )
END_SHADER_PARAMETER_STRUCT ( )
using FPermutationDomain = TShaderPermutationDomain < > ;
static bool ShouldCompilePermutation ( const FGlobalShaderPermutationParameters & Parameters )
{
return IsSupported ( Parameters . Platform ) ;
}
static void ModifyCompilationEnvironment ( const FGlobalShaderPermutationParameters & Parameters , FShaderCompilerEnvironment & OutEnvironment )
{
FGlobalShader : : ModifyCompilationEnvironment ( Parameters , OutEnvironment ) ;
OutEnvironment . SetDefine ( TEXT ( " GPU_DEBUG_RENDERING " ) , 1 ) ;
OutEnvironment . SetDefine ( TEXT ( " GPU_DEBUG_RENDERING_PS " ) , 1 ) ;
}
} ;
2022-02-22 15:49:31 -05:00
IMPLEMENT_GLOBAL_SHADER ( FShaderDrawDebugPS , " /Engine/Private/ShaderPrintDrawPrimitive.usf " , " ShaderDrawDebugPS " , SF_Pixel ) ;
2022-02-22 15:35:01 -05:00
BEGIN_SHADER_PARAMETER_STRUCT ( FShaderDrawVSPSParameters , )
SHADER_PARAMETER_STRUCT_INCLUDE ( FShaderDrawDebugVS : : FParameters , VS )
SHADER_PARAMETER_STRUCT_INCLUDE ( FShaderDrawDebugPS : : FParameters , PS )
END_SHADER_PARAMETER_STRUCT ( )
2022-04-26 09:59:10 -04:00
//////////////////////////////////////////////////////////////////////////////////////////////////
// Setup render data
FShaderPrintSetup : : FShaderPrintSetup ( FIntRect InViewRect )
{
2022-06-03 13:34:01 -04:00
bEnabled = IsEnabled ( ) ;
2022-04-26 09:59:10 -04:00
2022-06-03 13:34:01 -04:00
ViewRect = InViewRect ;
FontSize = FIntPoint ( FMath : : Max ( CVarFontSize . GetValueOnAnyThread ( ) , 1 ) , FMath : : Max ( CVarFontSize . GetValueOnAnyThread ( ) , 1 ) ) ;
FontSpacing = FIntPoint ( FMath : : Max ( CVarFontSpacingX . GetValueOnAnyThread ( ) , 1 ) , FMath : : Max ( CVarFontSpacingY . GetValueOnAnyThread ( ) , 1 ) ) ;
2022-06-03 15:58:15 -04:00
MaxValueCount = bEnabled ? GetMaxValueCount ( ) : 0 ;
MaxStateCount = bEnabled ? GetMaxWidgetCount ( ) : 0 ;
MaxLineCount = bEnabled ? GetMaxLineCount ( ) : 0 ;
MaxTriangleCount = bEnabled ? GetMaxTriangleCount ( ) : 0 ;
2022-04-26 09:59:10 -04:00
}
FShaderPrintSetup : : FShaderPrintSetup ( FSceneView const & View )
{
2022-06-03 15:58:15 -04:00
bEnabled = IsEnabled ( ) & & IsSupported ( View . GetShaderPlatform ( ) ) & & View . Family - > EngineShowFlags . ShaderPrint ;
2022-06-03 13:34:01 -04:00
2022-04-26 09:59:10 -04:00
ViewRect = View . UnconstrainedViewRect ;
CursorCoord = View . CursorPos ;
PreViewTranslation = View . ViewMatrices . GetPreViewTranslation ( ) ;
DPIScale = View . Family - > DebugDPIScale ;
2022-06-03 13:34:01 -04:00
FontSize = FIntPoint ( FMath : : Max ( CVarFontSize . GetValueOnAnyThread ( ) , 1 ) , FMath : : Max ( CVarFontSize . GetValueOnAnyThread ( ) , 1 ) ) ;
FontSpacing = FIntPoint ( FMath : : Max ( CVarFontSpacingX . GetValueOnAnyThread ( ) , 1 ) , FMath : : Max ( CVarFontSpacingY . GetValueOnAnyThread ( ) , 1 ) ) ;
2022-06-03 15:58:15 -04:00
MaxValueCount = bEnabled ? GetMaxValueCount ( ) : 0 ;
MaxStateCount = bEnabled ? GetMaxWidgetCount ( ) : 0 ;
MaxLineCount = bEnabled ? GetMaxLineCount ( ) : 0 ;
MaxTriangleCount = bEnabled ? GetMaxTriangleCount ( ) : 0 ;
2022-04-26 09:59:10 -04:00
}
FShaderPrintData CreateShaderPrintData ( FRDGBuilder & GraphBuilder , FShaderPrintSetup const & InSetup , FSceneViewState * InViewState )
{
FShaderPrintData ShaderPrintData ;
// Common uniform buffer
2022-06-03 13:34:01 -04:00
ShaderPrintData . Setup = InSetup ;
2022-04-26 09:59:10 -04:00
ShaderPrintData . UniformBuffer = CreateUniformBuffer ( InSetup ) ;
// Early out if system is disabled.
// Note that we still bind dummy buffers.
// This is in case some debug shader code is still active and accessing the buffer.
2022-06-03 13:34:01 -04:00
if ( ! InSetup . bEnabled )
2022-04-26 09:59:10 -04:00
{
2022-06-11 09:42:00 -04:00
ShaderPrintData . ShaderPrintEntryBuffer = GraphBuilder . RegisterExternalBuffer ( GEmptyBuffer - > Buffer ) ;
2022-04-26 09:59:10 -04:00
ShaderPrintData . ShaderPrintStateBuffer = GraphBuilder . RegisterExternalBuffer ( GEmptyBuffer - > Buffer ) ;
return ShaderPrintData ;
}
2022-06-11 09:42:00 -04:00
// Characters/Widgets/Primitives/Lines
2022-04-26 09:59:10 -04:00
{
2022-06-11 09:42:00 -04:00
const bool bLockBufferThisFrame = IsDrawLocked ( ) & & InViewState ! = nullptr & & ! InViewState - > ShaderPrintStateData . bIsLocked ;
ERDGBufferFlags Flags = bLockBufferThisFrame ? ERDGBufferFlags : : MultiFrame : ERDGBufferFlags : : None ;
const uint32 UintElementCount =
GetCountersUintSize ( ) +
GetPackedSymbolUintSize ( ) * InSetup . MaxValueCount +
GetPackedLineUintSize ( ) * InSetup . MaxLineCount +
GetPackedTriangleUintSize ( ) * InSetup . MaxTriangleCount ;
ShaderPrintData . ShaderPrintEntryBuffer = GraphBuilder . CreateBuffer ( FRDGBufferDesc : : CreateStructuredDesc ( 4 , UintElementCount ) , TEXT ( " ShaderPrint.EntryBuffer " ) , Flags ) ;
2022-04-26 09:59:10 -04:00
// State buffer is retrieved from the view state, or created if it does not exist
if ( InViewState ! = nullptr )
{
if ( InViewState - > ShaderPrintStateData . StateBuffer )
{
ShaderPrintData . ShaderPrintStateBuffer = GraphBuilder . RegisterExternalBuffer ( InViewState - > ShaderPrintStateData . StateBuffer ) ;
}
else
{
2022-05-30 03:08:58 -04:00
ShaderPrintData . ShaderPrintStateBuffer = GraphBuilder . CreateBuffer ( FRDGBufferDesc : : CreateStructuredDesc ( 4 , ( 3 * InSetup . MaxStateCount ) + 1 ) , TEXT ( " ShaderPrint.StateBuffer " ) ) ;
2022-04-26 09:59:10 -04:00
AddClearUAVPass ( GraphBuilder , GraphBuilder . CreateUAV ( ShaderPrintData . ShaderPrintStateBuffer , PF_R32_UINT ) , 0u ) ;
InViewState - > ShaderPrintStateData . StateBuffer = GraphBuilder . ConvertToExternalBuffer ( ShaderPrintData . ShaderPrintStateBuffer ) ;
}
}
else
{
ShaderPrintData . ShaderPrintStateBuffer = GraphBuilder . RegisterExternalBuffer ( GEmptyBuffer - > Buffer ) ;
}
2022-06-11 09:42:00 -04:00
// Clear counters
2022-04-26 09:59:10 -04:00
{
2022-06-11 09:42:00 -04:00
FGlobalShaderMap * GlobalShaderMap = GetGlobalShaderMap ( GMaxRHIFeatureLevel ) ;
TShaderMapRef < FShaderPrintClearCounterCS > ComputeShader ( GlobalShaderMap ) ;
2022-04-26 09:59:10 -04:00
2022-06-11 09:42:00 -04:00
FShaderPrintClearCounterCS : : FParameters * PassParameters = GraphBuilder . AllocParameters < FShaderPrintClearCounterCS : : FParameters > ( ) ;
PassParameters - > RWValuesBuffer = GraphBuilder . CreateUAV ( ShaderPrintData . ShaderPrintEntryBuffer ) ;
2022-04-26 09:59:10 -04:00
ClearUnusedGraphResources ( ComputeShader , PassParameters ) ;
GraphBuilder . AddPass (
2022-06-11 09:42:00 -04:00
RDG_EVENT_NAME ( " ShaderPrint::ClearCounters " ) ,
2022-04-26 09:59:10 -04:00
PassParameters ,
ERDGPassFlags : : Compute ,
[ PassParameters , ComputeShader ] ( FRHICommandList & RHICmdList )
{
FComputeShaderUtils : : Dispatch ( RHICmdList , ComputeShader , * PassParameters , FIntVector ( 1 , 1 , 1 ) ) ;
} ) ;
}
if ( InViewState ! = nullptr )
{
if ( IsDrawLocked ( ) & & ! InViewState - > ShaderPrintStateData . bIsLocked )
{
2022-06-11 09:42:00 -04:00
InViewState - > ShaderPrintStateData . EntryBuffer = GraphBuilder . ConvertToExternalBuffer ( ShaderPrintData . ShaderPrintEntryBuffer ) ;
2022-04-26 09:59:10 -04:00
InViewState - > ShaderPrintStateData . PreViewTranslation = InSetup . PreViewTranslation ;
InViewState - > ShaderPrintStateData . bIsLocked = true ;
}
if ( ! IsDrawLocked ( ) & & InViewState - > ShaderPrintStateData . bIsLocked )
{
2022-06-11 09:42:00 -04:00
InViewState - > ShaderPrintStateData . EntryBuffer = nullptr ;
2022-04-26 09:59:10 -04:00
InViewState - > ShaderPrintStateData . PreViewTranslation = FVector : : ZeroVector ;
InViewState - > ShaderPrintStateData . bIsLocked = false ;
}
}
}
return ShaderPrintData ;
}
2022-06-03 13:34:01 -04:00
2022-04-26 09:59:10 -04:00
FShaderPrintData CreateShaderPrintData ( FRDGBuilder & GraphBuilder , FShaderPrintSetup const & InSetup )
{
return CreateShaderPrintData ( GraphBuilder , InSetup , nullptr ) ;
}
2022-06-03 13:34:01 -04:00
FFrozenShaderPrintData FreezeShaderPrintData ( FRDGBuilder & GraphBuilder , FShaderPrintData & ShaderPrintData )
{
FFrozenShaderPrintData Out ;
Out . Setup = ShaderPrintData . Setup ;
2022-06-11 09:42:00 -04:00
Out . ShaderPrintEntryBuffer = GraphBuilder . ConvertToExternalBuffer ( ShaderPrintData . ShaderPrintEntryBuffer ) ;
2022-06-03 13:34:01 -04:00
Out . ShaderPrintStateBuffer = GraphBuilder . ConvertToExternalBuffer ( ShaderPrintData . ShaderPrintStateBuffer ) ;
return Out ;
}
FShaderPrintData UnFreezeShaderPrintData ( FRDGBuilder & GraphBuilder , FFrozenShaderPrintData & FrozenShaderPrintData )
{
FShaderPrintData Out ;
Out . Setup = FrozenShaderPrintData . Setup ;
Out . UniformBuffer = CreateUniformBuffer ( Out . Setup ) ;
2022-06-11 09:42:00 -04:00
Out . ShaderPrintEntryBuffer = GraphBuilder . RegisterExternalBuffer ( FrozenShaderPrintData . ShaderPrintEntryBuffer ) ;
2022-06-03 13:34:01 -04:00
Out . ShaderPrintStateBuffer = GraphBuilder . RegisterExternalBuffer ( FrozenShaderPrintData . ShaderPrintStateBuffer ) ;
return Out ;
}
2022-02-22 15:35:01 -05:00
//////////////////////////////////////////////////////////////////////////////////////////////////
// Drawing/Rendering API
2020-10-27 13:40:36 -04:00
void BeginView ( FRDGBuilder & GraphBuilder , FViewInfo & View )
2019-02-25 09:08:54 -05:00
{
2021-01-19 06:29:15 -04:00
TRACE_CPUPROFILER_EVENT_SCOPE ( ShaderPrint : : BeginView ) ;
2021-09-24 03:34:49 -04:00
2021-06-18 09:22:16 -04:00
if ( ! IsSupported ( View . GetShaderPlatform ( ) ) )
2019-04-11 09:29:25 -04:00
{
2022-06-03 13:34:01 -04:00
View . ShaderPrintData = FShaderPrintData ( ) ;
2019-04-11 09:29:25 -04:00
return ;
}
2022-02-22 15:35:01 -05:00
// Invalid to call begin twice for the same view.
2022-04-26 09:59:10 -04:00
ensure ( GDefaultView ! = & View ) ;
2022-02-22 15:35:01 -05:00
if ( GDefaultView = = nullptr )
2022-02-20 07:20:20 -05:00
{
2022-02-22 15:35:01 -05:00
GDefaultView = & View ;
}
2022-04-26 09:59:10 -04:00
// Create the render data and store on the view.
FShaderPrintSetup ShaderPrintSetup ( View ) ;
View . ShaderPrintData = CreateShaderPrintData ( GraphBuilder , ShaderPrintSetup , View . ViewState ) ;
2022-02-22 15:35:01 -05:00
2022-04-26 09:59:10 -04:00
// Reset counter which is read on the next BeginView().
GCharacterRequestCount = 0 ;
GWidgetRequestCount = 0 ;
GLineRequestCount = 0 ;
2022-05-13 09:53:35 -04:00
GTriangleRequestCount = 0 ;
2019-02-25 09:08:54 -05:00
}
2022-04-26 09:59:10 -04:00
static void InternalDrawView_Characters (
FRDGBuilder & GraphBuilder ,
FShaderPrintData const & ShaderPrintData ,
FIntRect ViewRect ,
int32 FrameNumber ,
FScreenPassTexture OutputTexture )
2019-02-25 09:08:54 -05:00
{
// Initialize graph managed resources
2022-06-03 15:58:15 -04:00
const uint32 UintElementCount = GetCountersUintSize ( ) + GetPackedSymbolUintSize ( ) * GetMaxSymbolCountFromValueCount ( ShaderPrintData . Setup . MaxValueCount ) ;
2022-05-30 03:08:58 -04:00
FRDGBufferRef SymbolBuffer = GraphBuilder . CreateBuffer ( FRDGBufferDesc : : CreateStructuredDesc ( 4 , UintElementCount ) , TEXT ( " ShaderPrint.SymbolBuffer " ) ) ;
2022-10-31 10:15:11 -04:00
FRDGBufferRef IndirectDispatchArgsBuffer = GraphBuilder . CreateBuffer ( FRDGBufferDesc : : CreateIndirectDesc < FRHIDispatchIndirectParameters > ( 1 ) , TEXT ( " ShaderPrint.IndirectDispatchArgs " ) ) ;
2022-02-20 07:20:20 -05:00
FRDGBufferRef IndirectDrawArgsBuffer = GraphBuilder . CreateBuffer ( FRDGBufferDesc : : CreateIndirectDesc ( 5 ) , TEXT ( " ShaderPrint.IndirectDrawArgs " ) ) ;
2019-02-25 09:08:54 -05:00
// Non graph managed resources
2022-06-11 09:42:00 -04:00
FRDGBufferSRVRef ValueBuffer = GraphBuilder . CreateSRV ( ShaderPrintData . ShaderPrintEntryBuffer ) ;
2022-04-26 09:59:10 -04:00
FRDGBufferSRVRef StateBuffer = GraphBuilder . CreateSRV ( ShaderPrintData . ShaderPrintStateBuffer ) ;
2022-04-06 18:24:24 -04:00
FTextureRHIRef FontTexture = GSystemTextures . AsciiTexture - > GetRHI ( ) ;
2019-02-25 09:08:54 -05:00
2022-04-26 09:59:10 -04:00
FGlobalShaderMap * GlobalShaderMap = GetGlobalShaderMap ( GMaxRHIFeatureLevel ) ;
2019-02-25 09:08:54 -05:00
// BuildIndirectDispatchArgs
{
typedef FShaderBuildIndirectDispatchArgsCS SHADER ;
TShaderMapRef < SHADER > ComputeShader ( GlobalShaderMap ) ;
SHADER : : FParameters * PassParameters = GraphBuilder . AllocParameters < SHADER : : FParameters > ( ) ;
2022-04-26 09:59:10 -04:00
PassParameters - > Common = ShaderPrintData . UniformBuffer ;
2022-03-07 15:09:45 -05:00
PassParameters - > ValuesBuffer = ValueBuffer ;
2022-04-19 05:59:25 -04:00
PassParameters - > RWSymbolsBuffer = GraphBuilder . CreateUAV ( SymbolBuffer ) ;
2019-02-25 09:08:54 -05:00
PassParameters - > RWIndirectDispatchArgsBuffer = GraphBuilder . CreateUAV ( IndirectDispatchArgsBuffer , EPixelFormat : : PF_R32_UINT ) ;
FComputeShaderUtils : : AddPass (
GraphBuilder ,
2022-01-31 15:55:18 -05:00
RDG_EVENT_NAME ( " ShaderPrint::BuildIndirectDispatchArgs " ) ,
2020-02-06 13:13:41 -05:00
ComputeShader , PassParameters ,
2019-02-25 09:08:54 -05:00
FIntVector ( 1 , 1 , 1 ) ) ;
}
// BuildSymbolBuffer
{
typedef FShaderBuildSymbolBufferCS SHADER ;
TShaderMapRef < SHADER > ComputeShader ( GlobalShaderMap ) ;
SHADER : : FParameters * PassParameters = GraphBuilder . AllocParameters < SHADER : : FParameters > ( ) ;
2022-04-26 09:59:10 -04:00
PassParameters - > FrameIndex = FrameNumber ;
PassParameters - > Common = ShaderPrintData . UniformBuffer ;
2022-03-07 15:09:45 -05:00
PassParameters - > ValuesBuffer = ValueBuffer ;
2022-04-19 05:59:25 -04:00
PassParameters - > RWSymbolsBuffer = GraphBuilder . CreateUAV ( SymbolBuffer ) ;
2022-04-26 09:59:10 -04:00
PassParameters - > RWStateBuffer = GraphBuilder . CreateUAV ( ShaderPrintData . ShaderPrintStateBuffer ) ;
2019-02-25 09:08:54 -05:00
PassParameters - > IndirectDispatchArgsBuffer = IndirectDispatchArgsBuffer ;
FComputeShaderUtils : : AddPass (
GraphBuilder ,
2022-01-31 15:55:18 -05:00
RDG_EVENT_NAME ( " ShaderPrint::BuildSymbolBuffer " ) ,
2020-02-06 13:13:41 -05:00
ComputeShader , PassParameters ,
2019-02-25 09:08:54 -05:00
IndirectDispatchArgsBuffer , 0 ) ;
}
2022-02-20 07:20:20 -05:00
// CompactStateBuffer
2022-03-07 15:09:45 -05:00
#if 0
2022-02-20 07:20:20 -05:00
{
typedef FShaderCompactStateBufferCS SHADER ;
TShaderMapRef < SHADER > ComputeShader ( GlobalShaderMap ) ;
SHADER : : FParameters * PassParameters = GraphBuilder . AllocParameters < SHADER : : FParameters > ( ) ;
2022-04-26 09:59:10 -04:00
PassParameters - > FrameIndex = FrameNumber ;
2022-02-20 07:20:20 -05:00
PassParameters - > FrameThreshold = 300u ;
2022-04-26 09:59:10 -04:00
PassParameters - > Common = ShaderPrintData . UniformBuffer ;
PassParameters - > RWStateBuffer = GraphBuilder . CreateUAV ( ShaderPrintData . ShaderPrintStateBuffer ) ;
2022-02-20 07:20:20 -05:00
FComputeShaderUtils : : AddPass (
GraphBuilder ,
RDG_EVENT_NAME ( " ShaderPrint::CompactStateBuffer " ) ,
ComputeShader , PassParameters , FIntVector ( 1 , 1 , 1 ) ) ;
}
2022-03-07 15:09:45 -05:00
# endif
2022-02-20 07:20:20 -05:00
2019-02-25 09:08:54 -05:00
// BuildIndirectDrawArgs
{
typedef FShaderBuildIndirectDrawArgsCS SHADER ;
TShaderMapRef < SHADER > ComputeShader ( GlobalShaderMap ) ;
SHADER : : FParameters * PassParameters = GraphBuilder . AllocParameters < SHADER : : FParameters > ( ) ;
2022-04-26 09:59:10 -04:00
PassParameters - > Common = ShaderPrintData . UniformBuffer ;
2019-02-25 09:08:54 -05:00
PassParameters - > SymbolsBuffer = GraphBuilder . CreateSRV ( SymbolBuffer ) ;
PassParameters - > RWIndirectDrawArgsBuffer = GraphBuilder . CreateUAV ( IndirectDrawArgsBuffer , EPixelFormat : : PF_R32_UINT ) ;
FComputeShaderUtils : : AddPass (
GraphBuilder ,
2022-01-31 15:55:18 -05:00
RDG_EVENT_NAME ( " ShaderPrint::BuildIndirectDrawArgs " ) ,
2020-02-06 13:13:41 -05:00
ComputeShader , PassParameters ,
2019-02-25 09:08:54 -05:00
FIntVector ( 1 , 1 , 1 ) ) ;
}
// DrawSymbols
{
typedef FShaderDrawSymbols SHADER ;
TShaderMapRef < FShaderDrawSymbolsVS > VertexShader ( GlobalShaderMap ) ;
TShaderMapRef < FShaderDrawSymbolsPS > PixelShader ( GlobalShaderMap ) ;
SHADER : : FParameters * PassParameters = GraphBuilder . AllocParameters < SHADER : : FParameters > ( ) ;
2022-01-18 06:20:07 -05:00
PassParameters - > RenderTargets [ 0 ] = FRenderTargetBinding ( OutputTexture . Texture , ERenderTargetLoadAction : : ELoad ) ;
2022-04-26 09:59:10 -04:00
PassParameters - > Common = ShaderPrintData . UniformBuffer ;
2019-02-25 09:08:54 -05:00
PassParameters - > MiniFontTexture = FontTexture ;
PassParameters - > SymbolsBuffer = GraphBuilder . CreateSRV ( SymbolBuffer ) ;
PassParameters - > IndirectDrawArgsBuffer = IndirectDrawArgsBuffer ;
GraphBuilder . AddPass (
2022-01-31 15:55:18 -05:00
RDG_EVENT_NAME ( " ShaderPrint::DrawSymbols " ) ,
2019-02-25 09:08:54 -05:00
PassParameters ,
2019-07-16 18:13:25 -04:00
ERDGPassFlags : : Raster ,
2022-04-26 09:59:10 -04:00
[ VertexShader , PixelShader , PassParameters , ViewRect ] ( FRHICommandList & RHICmdList )
2019-02-25 09:08:54 -05:00
{
2022-01-18 06:20:07 -05:00
2019-02-25 09:08:54 -05:00
FGraphicsPipelineStateInitializer GraphicsPSOInit ;
2022-01-18 06:20:07 -05:00
RHICmdList . ApplyCachedRenderTargets ( GraphicsPSOInit ) ;
2019-02-25 09:08:54 -05:00
GraphicsPSOInit . DepthStencilState = TStaticDepthStencilState < false , CF_Always > : : GetRHI ( ) ;
GraphicsPSOInit . BlendState = TStaticBlendState < CW_RGBA , BO_Add , BF_One , BF_InverseSourceAlpha , BO_Add , BF_Zero , BF_One > : : GetRHI ( ) ;
GraphicsPSOInit . RasterizerState = TStaticRasterizerState < > : : GetRHI ( ) ;
GraphicsPSOInit . PrimitiveType = PT_TriangleList ;
GraphicsPSOInit . BoundShaderState . VertexDeclarationRHI = GetVertexDeclarationFVector4 ( ) ;
2020-02-06 13:13:41 -05:00
GraphicsPSOInit . BoundShaderState . VertexShaderRHI = VertexShader . GetVertexShader ( ) ;
GraphicsPSOInit . BoundShaderState . PixelShaderRHI = PixelShader . GetPixelShader ( ) ;
2022-01-18 06:20:07 -05:00
SetGraphicsPipelineState ( RHICmdList , GraphicsPSOInit , 0 ) ;
2019-02-25 09:08:54 -05:00
2022-04-26 09:59:10 -04:00
RHICmdList . SetViewport ( ViewRect . Min . X , ViewRect . Min . Y , 0.0f , ViewRect . Max . X , ViewRect . Max . Y , 1.0f ) ;
2022-01-18 06:20:07 -05:00
SetShaderParameters ( RHICmdList , VertexShader , VertexShader . GetVertexShader ( ) , * PassParameters ) ;
SetShaderParameters ( RHICmdList , PixelShader , PixelShader . GetPixelShader ( ) , * PassParameters ) ;
2019-02-25 09:08:54 -05:00
2022-01-18 06:20:07 -05:00
RHICmdList . DrawIndexedPrimitiveIndirect ( GTwoTrianglesIndexBuffer . IndexBufferRHI , PassParameters - > IndirectDrawArgsBuffer - > GetIndirectRHICallBuffer ( ) , 0 ) ;
2019-02-25 09:08:54 -05:00
} ) ;
}
}
2022-05-13 09:53:35 -04:00
static void InternalDrawView_Primitives (
2022-02-22 15:35:01 -05:00
FRDGBuilder & GraphBuilder ,
2022-05-13 09:53:35 -04:00
const FShaderPrintData & ShaderPrintData ,
FRDGBufferRef ShaderPrintPrimitiveBuffer ,
const FIntRect & ViewRect ,
const FIntRect & UnscaledViewRect ,
const FMatrix & TranslatedWorldToClip ,
const FVector & TranslatedWorldOffsetConversion ,
const bool bLines ,
const bool bLocked ,
2022-02-22 15:35:01 -05:00
FRDGTextureRef OutputTexture ,
FRDGTextureRef DepthTexture )
{
2022-04-26 09:59:10 -04:00
FGlobalShaderMap * GlobalShaderMap = GetGlobalShaderMap ( GMaxRHIFeatureLevel ) ;
2022-02-22 15:35:01 -05:00
FRDGBufferRef IndirectBuffer = GraphBuilder . CreateBuffer ( FRDGBufferDesc : : CreateIndirectDesc < FRHIDrawIndirectParameters > ( 1 ) , TEXT ( " ShaderDraw.IndirectBuffer " ) , ERDGBufferFlags : : None ) ;
{
FShaderDrawDebugCopyCS : : FParameters * Parameters = GraphBuilder . AllocParameters < FShaderDrawDebugCopyCS : : FParameters > ( ) ;
2022-05-13 09:53:35 -04:00
Parameters - > ElementBuffer = GraphBuilder . CreateSRV ( ShaderPrintPrimitiveBuffer ) ;
2022-02-22 15:35:01 -05:00
Parameters - > RWIndirectArgs = GraphBuilder . CreateUAV ( IndirectBuffer , PF_R32_UINT ) ;
2022-05-13 09:53:35 -04:00
Parameters - > ShaderPrintData = ShaderPrintData . UniformBuffer ;
Parameters - > PrimitiveType = bLines ? 0u : 1u ;
2022-02-22 15:35:01 -05:00
2022-04-26 09:59:10 -04:00
TShaderMapRef < FShaderDrawDebugCopyCS > ComputeShader ( GlobalShaderMap ) ;
2022-02-22 15:35:01 -05:00
ClearUnusedGraphResources ( ComputeShader , Parameters ) ;
GraphBuilder . AddPass (
2022-05-13 09:53:35 -04:00
RDG_EVENT_NAME ( " ShaderPrint::CopyLineArgs(%s%s) " , bLines ? TEXT ( " Lines " ) : TEXT ( " Triangles " ) , bLocked ? TEXT ( " ,Locked " ) : TEXT ( " " ) ) ,
2022-02-22 15:35:01 -05:00
Parameters ,
ERDGPassFlags : : Compute ,
[ Parameters , ComputeShader ] ( FRHICommandList & RHICmdList )
{
FComputeShaderUtils : : Dispatch ( RHICmdList , ComputeShader , * Parameters , FIntVector ( 1 , 1 , 1 ) ) ;
} ) ;
}
2022-05-13 09:53:35 -04:00
FShaderDrawDebugVS : : FPermutationDomain PermutationVector ;
PermutationVector . Set < FShaderDrawDebugVS : : FPrimitiveType > ( bLines ? 0u : 1u ) ;
TShaderMapRef < FShaderDrawDebugVS > VertexShader ( GlobalShaderMap , PermutationVector ) ;
2022-04-26 09:59:10 -04:00
TShaderMapRef < FShaderDrawDebugPS > PixelShader ( GlobalShaderMap ) ;
2022-02-22 15:35:01 -05:00
2022-07-05 14:17:46 -04:00
// Create a transient depth texture which allows to depth test filled primitive between themselves. These primitives are not culled against the scene depth texture, but only 'checkerboarded'.
FRDGTextureRef TransientDepthTexture = GraphBuilder . CreateTexture ( FRDGTextureDesc : : Create2D ( OutputTexture - > Desc . Extent , PF_DepthStencil , FClearValueBinding : : DepthFar , TexCreate_DepthStencilTargetable | TexCreate_ShaderResource ) , TEXT ( " ShaderPrint.DepthTexture " ) ) ;
2022-02-22 15:35:01 -05:00
FShaderDrawVSPSParameters * PassParameters = GraphBuilder . AllocParameters < FShaderDrawVSPSParameters > ( ) ;
PassParameters - > VS . TranslatedWorldOffsetConversion = FVector3f ( TranslatedWorldOffsetConversion ) ;
2022-04-26 09:59:10 -04:00
PassParameters - > VS . TranslatedWorldToClip = FMatrix44f ( TranslatedWorldToClip ) ;
2022-02-22 15:35:01 -05:00
PassParameters - > PS . RenderTargets [ 0 ] = FRenderTargetBinding ( OutputTexture , ERenderTargetLoadAction : : ELoad ) ;
2022-07-05 14:17:46 -04:00
PassParameters - > PS . RenderTargets . DepthStencil = FDepthStencilBinding ( TransientDepthTexture , ERenderTargetLoadAction : : EClear , ERenderTargetLoadAction : : ENoAction , FExclusiveDepthStencil : : DepthWrite_StencilNop ) ;
2022-04-26 09:59:10 -04:00
PassParameters - > PS . OutputInvResolution = FVector2f ( 1.f / UnscaledViewRect . Width ( ) , 1.f / UnscaledViewRect . Height ( ) ) ;
PassParameters - > PS . OriginalViewRectMin = FVector2f ( ViewRect . Min ) ;
PassParameters - > PS . OriginalViewSize = FVector2f ( ViewRect . Width ( ) , ViewRect . Height ( ) ) ;
2022-02-22 15:35:01 -05:00
PassParameters - > PS . OriginalBufferInvSize = FVector2f ( 1.f / DepthTexture - > Desc . Extent . X , 1.f / DepthTexture - > Desc . Extent . Y ) ;
PassParameters - > PS . DepthTexture = DepthTexture ;
PassParameters - > PS . DepthSampler = TStaticSamplerState < SF_Point , AM_Clamp , AM_Clamp , AM_Clamp > : : GetRHI ( ) ;
2022-07-05 14:17:46 -04:00
PassParameters - > PS . bCheckerboardEnabled = bLines ? 1u : 0u ;
2022-05-13 09:53:35 -04:00
PassParameters - > VS . ShaderDrawDebugPrimitive = GraphBuilder . CreateSRV ( ShaderPrintPrimitiveBuffer ) ;
2022-02-22 15:35:01 -05:00
PassParameters - > VS . IndirectBuffer = IndirectBuffer ;
2022-05-13 09:53:35 -04:00
PassParameters - > VS . Common = ShaderPrintData . UniformBuffer ;
2022-02-22 15:35:01 -05:00
ValidateShaderParameters ( PixelShader , PassParameters - > PS ) ;
ClearUnusedGraphResources ( PixelShader , & PassParameters - > PS , { IndirectBuffer } ) ;
ValidateShaderParameters ( VertexShader , PassParameters - > VS ) ;
ClearUnusedGraphResources ( VertexShader , & PassParameters - > VS , { IndirectBuffer } ) ;
2022-04-26 09:59:10 -04:00
const FIntRect Viewport = UnscaledViewRect ;
2022-02-22 15:35:01 -05:00
GraphBuilder . AddPass (
2022-05-13 09:53:35 -04:00
RDG_EVENT_NAME ( " ShaderPrint::Draw(%s%s) " , bLines ? TEXT ( " Lines " ) : TEXT ( " Triangles " ) , bLocked ? TEXT ( " ,Locked " ) : TEXT ( " " ) ) ,
2022-02-22 15:35:01 -05:00
PassParameters ,
ERDGPassFlags : : Raster ,
2022-05-13 09:53:35 -04:00
[ VertexShader , PixelShader , PassParameters , IndirectBuffer , Viewport , bLines ] ( FRHICommandList & RHICmdList )
2022-02-22 15:35:01 -05:00
{
// Marks the indirect draw parameter as used by the pass, given it's not used directly by any of the shaders.
PassParameters - > VS . IndirectBuffer - > MarkResourceAsUsed ( ) ;
FGraphicsPipelineStateInitializer GraphicsPSOInit ;
RHICmdList . ApplyCachedRenderTargets ( GraphicsPSOInit ) ;
2022-07-05 14:17:46 -04:00
GraphicsPSOInit . DepthStencilState = TStaticDepthStencilState < true , CF_DepthNearOrEqual > : : GetRHI ( ) ;
2022-02-22 15:35:01 -05:00
GraphicsPSOInit . BlendState = TStaticBlendState < CW_RGBA , BO_Add , BF_One , BF_InverseSourceAlpha , BO_Add , BF_Zero , BF_One > : : GetRHI ( ) ; // Premultiplied-alpha composition
GraphicsPSOInit . RasterizerState = TStaticRasterizerState < FM_Solid , CM_None , true > : : GetRHI ( ) ;
2022-05-13 09:53:35 -04:00
GraphicsPSOInit . PrimitiveType = bLines ? PT_LineList : PT_TriangleList ;
2022-02-22 15:35:01 -05:00
GraphicsPSOInit . BoundShaderState . VertexDeclarationRHI = GEmptyVertexDeclaration . VertexDeclarationRHI ;
GraphicsPSOInit . BoundShaderState . VertexShaderRHI = VertexShader . GetVertexShader ( ) ;
GraphicsPSOInit . BoundShaderState . PixelShaderRHI = PixelShader . GetPixelShader ( ) ;
SetGraphicsPipelineState ( RHICmdList , GraphicsPSOInit , 0 ) ;
RHICmdList . SetViewport ( Viewport . Min . X , Viewport . Min . Y , 0.0f , Viewport . Max . X , Viewport . Max . Y , 1.0f ) ;
SetShaderParameters ( RHICmdList , VertexShader , VertexShader . GetVertexShader ( ) , PassParameters - > VS ) ;
SetShaderParameters ( RHICmdList , PixelShader , PixelShader . GetPixelShader ( ) , PassParameters - > PS ) ;
// Marks the indirect draw parameter as used by the pass, given it's not used directly by any of the shaders.
FRHIBuffer * IndirectBufferRHI = PassParameters - > VS . IndirectBuffer - > GetIndirectRHICallBuffer ( ) ;
check ( IndirectBufferRHI ! = nullptr ) ;
RHICmdList . DrawPrimitiveIndirect ( IndirectBufferRHI , 0 ) ;
} ) ;
}
2022-06-03 13:34:01 -04:00
void InternalDrawView ( FRDGBuilder & GraphBuilder , const FViewInfo & View , const FShaderPrintData & ShaderPrintData , const FScreenPassTexture & OutputTexture , const FScreenPassTexture & DepthTexture )
2022-02-22 15:35:01 -05:00
{
2022-06-03 13:34:01 -04:00
if ( ! ensure ( OutputTexture . IsValid ( ) ) )
{
return ;
}
2022-02-22 15:35:01 -05:00
RDG_EVENT_SCOPE ( GraphBuilder , " ShaderPrint::DrawView " ) ;
2022-05-19 14:28:47 -04:00
const FIntRect SourceViewRect = View . ViewRect ;
const FIntRect OutputViewRect = OutputTexture . ViewRect ;
2022-06-03 13:34:01 -04:00
const FVector PreViewTranslation = View . ViewMatrices . GetPreViewTranslation ( ) - ShaderPrintData . Setup . PreViewTranslation ;
2022-02-22 15:35:01 -05:00
// Lines
{
2022-06-11 09:42:00 -04:00
FRDGBufferRef DataBuffer = ShaderPrintData . ShaderPrintEntryBuffer ;
2022-06-03 13:34:01 -04:00
InternalDrawView_Primitives ( GraphBuilder , ShaderPrintData , DataBuffer , SourceViewRect , OutputViewRect , View . ViewMatrices . GetTranslatedViewProjectionMatrix ( ) , PreViewTranslation , true /*bLines*/ , false /*bLocked*/ , OutputTexture . Texture , DepthTexture . Texture ) ;
2022-02-22 15:35:01 -05:00
}
2022-05-13 09:53:35 -04:00
// Triangles
{
2022-06-11 09:42:00 -04:00
FRDGBufferRef DataBuffer = ShaderPrintData . ShaderPrintEntryBuffer ;
2022-06-03 13:34:01 -04:00
InternalDrawView_Primitives ( GraphBuilder , ShaderPrintData , DataBuffer , SourceViewRect , OutputViewRect , View . ViewMatrices . GetTranslatedViewProjectionMatrix ( ) , PreViewTranslation , false /*bLines*/ , false /*bLocked*/ , OutputTexture . Texture , DepthTexture . Texture ) ;
2022-05-13 09:53:35 -04:00
}
// Locked Lines/Triangles
2022-02-22 15:35:01 -05:00
if ( View . ViewState & & View . ViewState - > ShaderPrintStateData . bIsLocked )
{
2022-06-03 13:34:01 -04:00
const FVector LockedPreViewTranslation = View . ViewMatrices . GetPreViewTranslation ( ) - View . ViewState - > ShaderPrintStateData . PreViewTranslation ;
2022-06-11 09:42:00 -04:00
FRDGBufferRef DataBuffer = GraphBuilder . RegisterExternalBuffer ( View . ViewState - > ShaderPrintStateData . EntryBuffer ) ;
2022-06-03 13:34:01 -04:00
InternalDrawView_Primitives ( GraphBuilder , ShaderPrintData , DataBuffer , SourceViewRect , OutputViewRect , View . ViewMatrices . GetTranslatedViewProjectionMatrix ( ) , LockedPreViewTranslation , true /*bLines*/ , true /*bLocked*/ , OutputTexture . Texture , DepthTexture . Texture ) ;
InternalDrawView_Primitives ( GraphBuilder , ShaderPrintData , DataBuffer , SourceViewRect , OutputViewRect , View . ViewMatrices . GetTranslatedViewProjectionMatrix ( ) , LockedPreViewTranslation , false /*bLines*/ , true /*bLocked*/ , OutputTexture . Texture , DepthTexture . Texture ) ;
2022-02-22 15:35:01 -05:00
}
// Characters
{
2022-04-26 09:59:10 -04:00
const int32 FrameNumber = View . Family ? View . Family - > FrameNumber : 0u ;
2022-06-03 13:34:01 -04:00
InternalDrawView_Characters ( GraphBuilder , ShaderPrintData , OutputViewRect , FrameNumber , OutputTexture ) ;
}
}
void DrawView ( FRDGBuilder & GraphBuilder , const FViewInfo & View , const FScreenPassTexture & OutputTexture , const FScreenPassTexture & DepthTexture )
{
// Draw the shader print data for the view.
InternalDrawView ( GraphBuilder , View , View . ShaderPrintData , OutputTexture , DepthTexture ) ;
// Draw any externally enqueued shader print data.
for ( FFrozenShaderPrintData & ShaderPrintDataToRender : GShaderPrintDataToRender )
{
FShaderPrintData ShaderPrintData = UnFreezeShaderPrintData ( GraphBuilder , ShaderPrintDataToRender ) ;
InternalDrawView ( GraphBuilder , View , ShaderPrintData , OutputTexture , DepthTexture ) ;
2022-02-22 15:35:01 -05:00
}
}
2019-02-25 09:08:54 -05:00
void EndView ( FViewInfo & View )
{
2021-09-24 03:34:49 -04:00
View . ShaderPrintData = FShaderPrintData ( ) ;
2022-02-22 15:35:01 -05:00
GDefaultView = nullptr ;
2022-06-03 13:34:01 -04:00
GShaderPrintDataToRender . Reset ( ) ;
2019-02-25 09:08:54 -05:00
}
2022-06-03 13:34:01 -04:00
}