UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
OneColorShader.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3
4#pragma once
5
6#include "CoreMinimal.h"
7#include "GlobalShader.h"
8#include "HAL/Platform.h"
9#include "Math/Color.h"
11#include "PixelFormat.h"
12#include "RHICommandList.h"
13#include "RHIDefinitions.h"
15#include "Shader.h"
16#include "ShaderCore.h"
20#include "ShaderParameters.h"
21#include "ShaderPermutation.h"
22
24
28template<bool bUsingNDCPositions=true, bool bUsingVertexLayers=false>
30{
32
34 TOneColorVS() {}
35
36public:
37
43
45 {
47 OutEnvironment.SetDefine(TEXT("USING_NDC_POSITIONS"), (uint32)(bUsingNDCPositions ? 1 : 0));
48 OutEnvironment.SetDefine(TEXT("USING_LAYERS"), (uint32)(bUsingVertexLayers ? 1 : 0));
49 }
50
55
57 {
58 return true;
59 }
60
61 static const TCHAR* GetSourceFilename()
62 {
63 return TEXT("/Engine/Private/OneColorShader.usf");
64 }
65
66 static const TCHAR* GetFunctionName()
67 {
68 return TEXT("MainVertexShader");
69 }
70
71private:
73};
74
94
99{
101public:
102 class TOneColorPixelShader128bitRT : SHADER_PERMUTATION_BOOL("b128BITRENDERTARGET");
104 class TOneColorPixelNumUintOutputs : SHADER_PERMUTATION_RANGE_INT("NUM_UINT_OUTPUTS", 0, 8);
105 using FPermutationDomain = TShaderPermutationDomain<TOneColorPixelShaderNumOutputs, TOneColorPixelShader128bitRT, TOneColorPixelNumUintOutputs>;
106
108 TOneColorPixelShaderMRT(const ShaderMetaType::CompiledShaderInitializerType& Initializer);
109
110 static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters);
111 static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters& Parameters, FShaderCompilerEnvironment& OutEnvironment);
112
113 UE_DEPRECATED(5.3, "FParameters and FillParameters should be used instead of this helper.")
114 RENDERCORE_API static void SetColors(FRHICommandList& RHICmdList, const TShaderMapRef<TOneColorPixelShaderMRT>& Shader, const FLinearColor* Colors, int32 NumColors);
115};
116
121{
123public:
126
127 static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters);
128
130 LAYOUT_FIELD(FShaderParameter, Params0); // Texture Width,Height (.xy); Use Exclude Rect 1 : 0 (.z)
131 LAYOUT_FIELD(FShaderParameter, Params1); // Include X0,Y0 (.xy) - X1,Y1 (.zw)
132 LAYOUT_FIELD(FShaderParameter, Params2); // ExcludeRect X0,Y0 (.xy) - X1,Y1 (.zw)
134};
135
143
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_EXPORTED_GLOBAL_SHADER(ShaderClass, RequiredAPI)
Definition GlobalShader.h:409
#define LAYOUT_FIELD(T, Name,...)
Definition MemoryLayout.h:471
const bool
Definition NetworkReplayStreaming.h:178
@ MaxSimultaneousRenderTargets
Definition RHIDefinitions.h:287
#define SHADER_PARAMETER_ARRAY(MemberType, MemberName, ArrayDecl)
Definition ShaderParameterMacros.h:1696
#define BEGIN_SHADER_PARAMETER_STRUCT(StructTypeName, DllStorage)
Definition ShaderParameterMacros.h:1482
#define RENDER_TARGET_BINDING_SLOTS()
Definition ShaderParameterMacros.h:1955
#define END_SHADER_PARAMETER_STRUCT()
Definition ShaderParameterMacros.h:1485
void SetShaderValue(FRHIBatchedShaderParameters &BatchedParameters, const FShaderParameter &Parameter, const ParameterType &Value, uint32 ElementIndex=0)
Definition ShaderParameterUtils.h:24
@ SPF_Mandatory
Definition ShaderParameters.h:51
#define SHADER_PERMUTATION_RANGE_INT(InDefineName, Start, Count)
Definition ShaderPermutation.h:499
#define SHADER_PERMUTATION_BOOL(InDefineName)
Definition ShaderPermutation.h:482
#define DECLARE_EXPORTED_SHADER_TYPE(ShaderClass, ShaderMetaTypeShortcut, RequiredAPI,...)
Definition Shader.h:1683
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition OneColorShader.h:121
LAYOUT_FIELD(FShaderResourceParameter, FillTexture)
LAYOUT_FIELD(FShaderParameter, Params0)
LAYOUT_FIELD(FShaderParameter, Params2)
LAYOUT_FIELD(FShaderParameter, FillValue)
LAYOUT_FIELD(FShaderParameter, Params1)
Definition GlobalShader.h:269
static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters &Parameters, FShaderCompilerEnvironment &Environment)
Definition GlobalShader.h:289
static bool ShouldCompilePermutation(const FShaderPermutationParameters &)
Definition Shader.h:860
Definition OneColorShader.h:137
Definition UnrealType.h:3087
Definition OneColorShader.h:79
RENDERCORE_API void FillParameters(FParameters &Parameters, const FLinearColor *Colors, int32 NumColors)
Definition OneColorShader.cpp:16
SHADER_USE_PARAMETER_STRUCT(FOneColorPS, FGlobalShader)
static RENDERCORE_API void SetColors(FRHICommandList &RHICmdList, const TShaderMapRef< FOneColorPS > &Shader, const FLinearColor *Colors, int32 NumColors)
Definition OneColorShader.cpp:33
Definition MemoryImage.h:49
Definition RHICommandList.h:3819
Definition ShaderParameters.h:56
Definition ShaderParameters.h:87
Definition OneColorShader.h:99
Definition OneColorShader.h:30
static const TCHAR * GetFunctionName()
Definition OneColorShader.h:66
static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters &Parameters, FShaderCompilerEnvironment &OutEnvironment)
Definition OneColorShader.h:44
static const TCHAR * GetSourceFilename()
Definition OneColorShader.h:61
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters &Parameters)
Definition OneColorShader.h:56
TOneColorVS(const ShaderMetaType::CompiledShaderInitializerType &Initializer)
Definition OneColorShader.h:38
void SetParameters(FRHIBatchedShaderParameters &BatchedParameters, float Depth)
Definition OneColorShader.h:51
Definition Shader.h:2629
Definition GlobalShader.h:73
Definition Color.h:48
Definition RHIShaderParameters.h:241
Definition Shader.h:1610
Definition ShaderCore.h:544
Definition ShaderPermutation.h:229