Add rendering post-process scene integration test

This commit is contained in:
2026-04-06 13:30:53 +08:00
parent 0804052d6f
commit 2b70a2e309
17 changed files with 1144 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
#pragma once
#include <XCEngine/Core/Asset/ResourceHandle.h>
#include <XCEngine/Core/Containers/String.h>
#include <XCEngine/Core/Math/Vector4.h>
#include <XCEngine/Rendering/RenderPass.h>
#include <XCEngine/Resources/Shader/Shader.h>
#include <XCEngine/RHI/RHIEnums.h>
namespace XCEngine {
namespace RHI {
class RHIDescriptorPool;
class RHIDescriptorSet;
class RHIPipelineLayout;
class RHIPipelineState;
class RHISampler;
class RHIDevice;
} // namespace RHI
namespace Rendering {
namespace Passes {
class BuiltinColorScalePostProcessPass final : public RenderPass {
public:
struct OwnedDescriptorSet {
RHI::RHIDescriptorPool* pool = nullptr;
RHI::RHIDescriptorSet* set = nullptr;
};
explicit BuiltinColorScalePostProcessPass(
const Math::Vector4& colorScale = Math::Vector4(0.65f, 0.80f, 1.0f, 1.0f),
Containers::String shaderPath = {});
~BuiltinColorScalePostProcessPass() override;
const char* GetName() const override;
bool Execute(const RenderPassContext& context) override;
void Shutdown() override;
void SetColorScale(const Math::Vector4& colorScale);
const Math::Vector4& GetColorScale() const;
void SetShaderPath(const Containers::String& shaderPath);
const Containers::String& GetShaderPath() const;
private:
bool EnsureInitialized(const RenderContext& renderContext, RHI::Format renderTargetFormat);
bool CreateResources(const RenderContext& renderContext, RHI::Format renderTargetFormat);
void DestroyResources();
void DestroyOwnedDescriptorSet(OwnedDescriptorSet& descriptorSet);
Containers::String m_shaderPath;
Math::Vector4 m_colorScale = Math::Vector4(0.65f, 0.80f, 1.0f, 1.0f);
RHI::RHIDevice* m_device = nullptr;
RHI::RHIType m_backendType = RHI::RHIType::D3D12;
RHI::Format m_renderTargetFormat = RHI::Format::Unknown;
Resources::ResourceHandle<Resources::Shader> m_shader;
RHI::RHISampler* m_sampler = nullptr;
RHI::RHIPipelineLayout* m_pipelineLayout = nullptr;
RHI::RHIPipelineState* m_pipelineState = nullptr;
OwnedDescriptorSet m_constantsSet = {};
OwnedDescriptorSet m_textureSet = {};
OwnedDescriptorSet m_samplerSet = {};
RHI::RHIResourceView* m_boundSourceColorView = nullptr;
};
} // namespace Passes
} // namespace Rendering
} // namespace XCEngine

View File

@@ -29,6 +29,7 @@ Containers::String GetBuiltinDepthOnlyShaderPath();
Containers::String GetBuiltinShadowCasterShaderPath();
Containers::String GetBuiltinObjectIdShaderPath();
Containers::String GetBuiltinSkyboxShaderPath();
Containers::String GetBuiltinColorScalePostProcessShaderPath();
Containers::String GetBuiltinDefaultPrimitiveTexturePath();
bool TryParseBuiltinPrimitiveType(const Containers::String& path, BuiltinPrimitiveType& outPrimitiveType);