/*============================================================================= LightRendering.cpp: Light rendering implementation.=============================================================================*/ #include "RendererPrivate.h"#include "ScenePrivate.h"#include "SceneFilterRendering.h"#include "UniformBuffer.h"#include "ShaderParameters.h"#include "LightRendering.h"#include "LightPropagationVolume.h"#include "SceneUtils.h"// @RyanTorant#include "ApproximateHybridRaytracing.h" IMPLEMENT_UNIFORM_BUFFER_STRUCT(FDeferredLightUniformStruct,TEXT("DeferredLightUniforms")); extern int32 GUseTranslucentLightingVolumes; static int32 bAllowDepthBoundsTest = 1;static FAutoConsoleVariableRef CVarAllowDepthBoundsTest( TEXT("r.AllowDepthBoundsTest"), bAllowDepthBoundsTest, TEXT("If true, use enable depth bounds test when rendering defered lights.") ); // Implement a version for directional lights, and a version for point / spot lightsIMPLEMENT_SHADER_TYPE(template<>,TDeferredLightVS<false>,TEXT("DeferredLightVertexShaders"),TEXT("DirectionalVertexMain"),SF_Vertex);IMPLEMENT_SHADER_TYPE(template<>,TDeferredLightVS<true>,TEXT("DeferredLightVertexShaders"),TEXT("RadialVertexMain"),SF_Vertex); /** A pixel shader for rendering the light in a deferred pass. */template<bool bUseIESProfile, bool bRadialAttenuation, bool bInverseSquaredFalloff, bool bVisualizeLightCulling>class TDeferredLightPS : public FGlobalShader{ DECLARE_SHADER_TYPE(TDeferredLightPS,Global)public: static bool ShouldCache(EShaderPlatform Platform) { return IsFeatureLevelSupported(Platform, ERHIFeatureLevel::SM4); } static void ModifyCompilationEnvironment(EShaderPlatform Platform, FShaderCompilerEnvironment& OutEnvironment) { FGlobalShader::ModifyCompilationEnvironment(Platform, OutEnvironment);