chore: checkpoint current workspace changes

This commit is contained in:
2026-04-11 22:14:02 +08:00
parent 3e55f8c204
commit 8848cfd958
227 changed files with 34027 additions and 6711 deletions

View File

@@ -100,7 +100,9 @@ bool ExecuteScenePassRequest(
context,
request.surface,
sceneData,
nullptr
nullptr,
nullptr,
RHI::ResourceStates::Common
};
return pass->Execute(passContext);
}
@@ -122,7 +124,9 @@ bool ExecuteStandalonePass(
context,
surface,
sceneData,
nullptr
nullptr,
nullptr,
RHI::ResourceStates::Common
};
return pass->Execute(passContext);
}
@@ -242,6 +246,7 @@ bool ExecuteFullscreenPassSequenceStage(
const RenderSurface* currentSourceSurface = passContext.sourceSurface;
RHI::RHIResourceView* currentSourceColorView = passContext.sourceColorView;
RHI::ResourceStates currentSourceColorState = passContext.sourceColorState;
for (size_t passIndex = 0; passIndex < sequence->GetPassCount(); ++passIndex) {
const bool isLastPass = (passIndex + 1u) == sequence->GetPassCount();
@@ -264,7 +269,8 @@ bool ExecuteFullscreenPassSequenceStage(
*outputSurface,
passContext.sceneData,
currentSourceSurface,
currentSourceColorView
currentSourceColorView,
currentSourceColorState
};
if (!sequence->ExecutePass(passIndex, chainedContext)) {
return false;
@@ -274,6 +280,7 @@ bool ExecuteFullscreenPassSequenceStage(
intermediateEntry->currentColorState = RHI::ResourceStates::PixelShaderResource;
currentSourceSurface = &intermediateEntry->surface;
currentSourceColorView = intermediateEntry->shaderResourceView;
currentSourceColorState = intermediateEntry->currentColorState;
}
}
@@ -290,7 +297,8 @@ RenderPassContext BuildFrameStagePassContext(
outputSurface != nullptr ? *outputSurface : request.surface,
sceneData,
request.GetSourceSurface(stage),
request.GetSourceColorView(stage)
request.GetSourceColorView(stage),
request.GetSourceColorState(stage)
};
}
@@ -373,11 +381,21 @@ RenderDirectionalShadowData BuildDirectionalShadowData(
shadowData.enabled = true;
shadowData.viewProjection = plan.cameraData.viewProjection;
shadowData.shadowMap = shadowMapView;
const float texelWorldSize = plan.texelWorldSize > Math::EPSILON
? plan.texelWorldSize
: (plan.orthographicHalfExtent > Math::EPSILON && plan.mapWidth > 0u
? (plan.orthographicHalfExtent * 2.0f) / static_cast<float>(plan.mapWidth)
: 0.0f);
shadowData.shadowParams = Math::Vector4(
0.0015f,
1.0f / static_cast<float>(plan.mapWidth),
1.0f / static_cast<float>(plan.mapHeight),
0.85f);
shadowData.shadowOptions = Math::Vector4(
1.0f,
texelWorldSize,
1.5f,
0.0f);
return shadowData;
}
@@ -619,43 +637,74 @@ bool CameraRenderer::ExecuteRenderPlan(
bool CameraRenderer::Render(
const CameraRenderRequest& request) {
if (!request.IsValid() || m_pipeline == nullptr) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"CameraRenderer::Render failed: request invalid or pipeline missing");
return false;
}
const RenderSurface& mainSceneSurface = request.GetMainSceneSurface();
if (mainSceneSurface.GetRenderAreaWidth() == 0 ||
mainSceneSurface.GetRenderAreaHeight() == 0) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"CameraRenderer::Render failed: main scene surface render area is empty");
return false;
}
if (request.depthOnly.IsRequested() &&
!request.depthOnly.IsValid()) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"CameraRenderer::Render failed: depth-only request invalid");
return false;
}
if (request.postProcess.IsRequested() &&
!request.postProcess.IsValid()) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"CameraRenderer::Render failed: post-process request invalid");
return false;
}
if (request.finalOutput.IsRequested() &&
!request.finalOutput.IsValid()) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"CameraRenderer::Render failed: final-output request invalid");
return false;
}
if (request.objectId.IsRequested() &&
!request.objectId.IsValid()) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"CameraRenderer::Render failed: object-id request invalid");
return false;
}
ShadowCasterRenderRequest resolvedShadowCaster = {};
RHI::RHIResourceView* shadowMapView = nullptr;
if (!ResolveShadowCasterRequest(request, resolvedShadowCaster, shadowMapView)) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"CameraRenderer::Render failed: ResolveShadowCasterRequest returned false");
return false;
}
RenderSceneData sceneData = {};
if (!BuildSceneDataForRequest(request, shadowMapView, sceneData)) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"CameraRenderer::Render failed: BuildSceneDataForRequest returned false");
return false;
}
return ExecuteRenderPlan(request, resolvedShadowCaster, sceneData);
if (!ExecuteRenderPlan(request, resolvedShadowCaster, sceneData)) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"CameraRenderer::Render failed: ExecuteRenderPlan returned false");
return false;
}
return true;
}
} // namespace Rendering