#include "Rendering/Shadow/DirectionalShadowRuntime.h" #include "Rendering/Execution/CameraFramePlan.h" #include "Rendering/Shadow/DirectionalShadowData.h" namespace XCEngine { namespace Rendering { bool DirectionalShadowRuntime::ResolveExecutionState( const CameraFramePlan& plan, DirectionalShadowExecutionState& outShadowState) { outShadowState = {}; outShadowState.shadowCasterRequest = plan.shadowCaster; if (outShadowState.shadowCasterRequest.IsRequested()) { return outShadowState.shadowCasterRequest.IsValid(); } if (!plan.directionalShadow.IsValid()) { return true; } const DirectionalShadowSurfaceAllocation* shadowAllocation = m_surfaceCache.Resolve(plan.request.context, plan.directionalShadow); if (shadowAllocation == nullptr || !shadowAllocation->IsValid()) { return false; } outShadowState.shadowCasterRequest.surface = shadowAllocation->surface; outShadowState.shadowCasterRequest.clearFlags = RenderClearFlags::Depth; if (!outShadowState.shadowCasterRequest.hasCameraDataOverride) { outShadowState.shadowCasterRequest.hasCameraDataOverride = true; outShadowState.shadowCasterRequest.cameraDataOverride = plan.directionalShadow.cameraData; } outShadowState.shadowData = BuildRenderDirectionalShadowData( plan.directionalShadow, shadowAllocation->depthShaderView); return true; } } // namespace Rendering } // namespace XCEngine