Add final color scene integration coverage

This commit is contained in:
2026-04-06 16:31:54 +08:00
parent 2d030a97da
commit 2ec24666c0
6 changed files with 459 additions and 1 deletions

View File

@@ -51,6 +51,7 @@ bool D3D12Shader::Compile(const void* sourceData, size_t sourceSize, const char*
if (m_error) {
const char* errorMsg = static_cast<const char*>(m_error->GetBufferPointer());
OutputDebugStringA(errorMsg);
fprintf(stderr, "[SHADER ERROR] %s\n", errorMsg);
}
return false;
}
@@ -180,4 +181,4 @@ ShaderType D3D12Shader::GetType() const {
}
} // namespace RHI
} // namespace XCEngine
} // namespace XCEngine

View File

@@ -118,21 +118,33 @@ const char* BuiltinFinalColorPass::GetName() const {
bool BuiltinFinalColorPass::Execute(const RenderPassContext& context) {
if (!context.renderContext.IsValid() || context.sourceColorView == nullptr) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"BuiltinFinalColorPass requires a valid render context and source color view");
return false;
}
const std::vector<RHI::RHIResourceView*>& colorAttachments = context.surface.GetColorAttachments();
if (colorAttachments.empty() || colorAttachments[0] == nullptr) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"BuiltinFinalColorPass requires a valid destination color attachment");
return false;
}
const Math::RectInt renderArea = context.surface.GetRenderArea();
if (renderArea.width <= 0 || renderArea.height <= 0) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"BuiltinFinalColorPass received an invalid render area");
return false;
}
const RHI::Format renderTargetFormat = colorAttachments[0]->GetFormat();
if (!EnsureInitialized(context.renderContext, renderTargetFormat)) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"BuiltinFinalColorPass failed to initialize GPU resources");
return false;
}
@@ -249,6 +261,9 @@ bool BuiltinFinalColorPass::CreateResources(
const RenderContext& renderContext,
RHI::Format renderTargetFormat) {
if (!renderContext.IsValid()) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"BuiltinFinalColorPass received an invalid render context during resource creation");
return false;
}
@@ -323,6 +338,9 @@ bool BuiltinFinalColorPass::CreateResources(
pipelineLayoutDesc.setLayoutCount = 3;
m_pipelineLayout = m_device->CreatePipelineLayout(pipelineLayoutDesc);
if (m_pipelineLayout == nullptr) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"BuiltinFinalColorPass failed to create pipeline layout");
DestroyResources();
return false;
}
@@ -339,6 +357,9 @@ bool BuiltinFinalColorPass::CreateResources(
samplerDesc.maxLod = 1000.0f;
m_sampler = m_device->CreateSampler(samplerDesc);
if (m_sampler == nullptr) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"BuiltinFinalColorPass failed to create linear clamp sampler");
DestroyResources();
return false;
}
@@ -381,6 +402,9 @@ bool BuiltinFinalColorPass::CreateResources(
RHI::DescriptorHeapType::Sampler,
true,
m_samplerSet)) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"BuiltinFinalColorPass failed to allocate descriptor sets");
DestroyResources();
return false;
}
@@ -395,6 +419,9 @@ bool BuiltinFinalColorPass::CreateResources(
finalColorPass->name,
m_renderTargetFormat));
if (m_pipelineState == nullptr || !m_pipelineState->IsValid()) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"BuiltinFinalColorPass failed to create a valid graphics pipeline state");
DestroyResources();
return false;
}