diff --git a/Source/Engine/Graphics/Graphics.cpp b/Source/Engine/Graphics/Graphics.cpp
index 6410124c2..8ba17479a 100644
--- a/Source/Engine/Graphics/Graphics.cpp
+++ b/Source/Engine/Graphics/Graphics.cpp
@@ -29,6 +29,9 @@ bool Graphics::GICascadesBlending = false;
PostProcessSettings Graphics::PostProcessSettings;
bool Graphics::GammaColorSpace = true;
bool Graphics::SpreadWorkload = true;
+#if !BUILD_RELEASE && !USE_EDITOR
+float Graphics::TestValue = 0.0f;
+#endif
bool Graphics::PostProcessing::ColorGradingVolumeLUT = true;
#if GRAPHICS_API_NULL
diff --git a/Source/Engine/Graphics/Graphics.h b/Source/Engine/Graphics/Graphics.h
index 194339a97..97ba6a724 100644
--- a/Source/Engine/Graphics/Graphics.h
+++ b/Source/Engine/Graphics/Graphics.h
@@ -90,6 +90,16 @@ public:
///
API_FIELD() static bool SpreadWorkload;
+#if BUILD_RELEASE && !USE_EDITOR
+ /// Unused.
+ API_FIELD() static constexpr float TestValue = 0.0f;
+#else
+ ///
+ /// Debug utility to control visual or rendering features during development. For example, can be used to branch different code paths in shaders for A/B testing (perf or quality).
+ ///
+ API_FIELD() static float TestValue;
+#endif
+
public:
// Post Processing effects rendering configuration.
API_CLASS(Static, Attributes = "DebugCommand") class FLAXENGINE_API PostProcessing
diff --git a/Source/Engine/Graphics/Materials/MaterialShader.cpp b/Source/Engine/Graphics/Materials/MaterialShader.cpp
index 5d929320d..2c8b02acc 100644
--- a/Source/Engine/Graphics/Materials/MaterialShader.cpp
+++ b/Source/Engine/Graphics/Materials/MaterialShader.cpp
@@ -5,6 +5,7 @@
#include "Engine/Serialization/MemoryReadStream.h"
#include "Engine/Level/LargeWorlds.h"
#include "Engine/Renderer/RenderList.h"
+#include "Engine/Graphics/Graphics.h"
#include "Engine/Graphics/RenderTask.h"
#include "Engine/Graphics/GPUDevice.h"
#include "Engine/Graphics/GPUContext.h"
@@ -38,6 +39,7 @@ GPU_CB_STRUCT(MaterialShaderDataPerView {
Float3 LargeWorldsChunkIndex;
float LargeWorldsChunkSize;
Float3 ViewPadding0;
+ float TestValue;
float ScaledTimeParam;
});
@@ -89,6 +91,7 @@ void IMaterial::BindParameters::BindViewData()
cb.TemporalAAJitter = view.TemporalAAJitter;
cb.LargeWorldsChunkIndex = LargeWorlds::Enable ? (Float3)Int3(view.Origin / LargeWorlds::ChunkSize) : Float3::Zero;
cb.LargeWorldsChunkSize = LargeWorlds::ChunkSize;
+ cb.TestValue = Graphics::TestValue;
// Update constants
GPUContext->UpdateCB(PerViewConstants, &cb);
diff --git a/Source/Shaders/MaterialCommon.hlsl b/Source/Shaders/MaterialCommon.hlsl
index 8c9567c29..2f9b2dde5 100644
--- a/Source/Shaders/MaterialCommon.hlsl
+++ b/Source/Shaders/MaterialCommon.hlsl
@@ -176,7 +176,8 @@ cbuffer ViewData : register(b1)
float4 TemporalAAJitter;
float3 LargeWorldsChunkIndex;
float LargeWorldsChunkSize;
- float3 ViewPadding0;
+ float2 ViewPadding0;
+ float TestValue;
float ScaledTimeParam;
};
#endif