2021-05-06 17:02:10 +02:00
|
|
|
#pragma once
|
2024-06-17 16:21:41 +02:00
|
|
|
#include "Graphics/Pipeline.h"
|
2024-06-11 16:55:20 +02:00
|
|
|
#include "Graphics/Query.h"
|
2024-09-07 11:15:47 +02:00
|
|
|
#include "MinimalEngine.h"
|
|
|
|
|
#include "RenderPass.h"
|
2021-05-06 17:02:10 +02:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
namespace Seele {
|
2024-06-11 14:15:29 +02:00
|
|
|
class DepthCullingPass : public RenderPass {
|
2024-06-09 12:20:04 +02:00
|
|
|
public:
|
2024-06-11 14:15:29 +02:00
|
|
|
DepthCullingPass(Gfx::PGraphics graphics, PScene scene);
|
|
|
|
|
DepthCullingPass(DepthCullingPass&&) = default;
|
|
|
|
|
DepthCullingPass& operator=(DepthCullingPass&&) = default;
|
|
|
|
|
virtual ~DepthCullingPass();
|
2022-11-17 16:47:42 +01:00
|
|
|
virtual void beginFrame(const Component::Camera& cam) override;
|
2022-04-15 23:45:44 +02:00
|
|
|
virtual void render() override;
|
|
|
|
|
virtual void endFrame() override;
|
2021-05-06 17:02:10 +02:00
|
|
|
virtual void publishOutputs() override;
|
|
|
|
|
virtual void createRenderPass() override;
|
2024-06-09 12:20:04 +02:00
|
|
|
|
|
|
|
|
private:
|
2024-06-17 16:21:41 +02:00
|
|
|
constexpr static uint64 BLOCK_SIZE = 32;
|
|
|
|
|
struct MipParam {
|
2024-09-07 11:15:47 +02:00
|
|
|
uint32 sourceOffset;
|
|
|
|
|
uint32 destOffset;
|
|
|
|
|
UVector2 sourceDim;
|
|
|
|
|
UVector2 destDim;
|
2024-06-17 16:21:41 +02:00
|
|
|
};
|
2024-08-29 11:23:55 +02:00
|
|
|
|
2024-06-17 16:21:41 +02:00
|
|
|
Array<uint32> mipOffsets;
|
|
|
|
|
Array<UVector2> mipDims;
|
2024-08-31 13:29:33 +02:00
|
|
|
|
2025-02-28 16:56:51 +09:00
|
|
|
constexpr static std::string DEPTHTEXTURE_NAME = "depthTexture";
|
2024-06-17 16:21:41 +02:00
|
|
|
Gfx::OShaderBuffer depthMipBuffer;
|
2025-02-28 16:56:51 +09:00
|
|
|
constexpr static std::string DEPTHMIP_NAME = "depthMip";
|
2024-02-01 10:21:36 +01:00
|
|
|
Gfx::RenderTargetAttachment depthAttachment;
|
2024-05-30 21:24:21 +02:00
|
|
|
Gfx::RenderTargetAttachment visibilityAttachment;
|
2024-06-17 16:21:41 +02:00
|
|
|
Gfx::ODescriptorLayout depthAttachmentLayout;
|
|
|
|
|
Gfx::OPipelineLayout depthCullingLayout;
|
2024-06-15 21:47:20 +02:00
|
|
|
Gfx::OPipelineStatisticsQuery query;
|
2024-09-03 11:03:23 +02:00
|
|
|
Gfx::PTimestampQuery timestamps;
|
2024-06-07 09:19:47 +02:00
|
|
|
|
2024-06-17 16:21:41 +02:00
|
|
|
Gfx::OPipelineLayout depthComputeLayout;
|
2024-09-07 11:15:47 +02:00
|
|
|
Gfx::OComputeShader depthSourceCopyShader;
|
|
|
|
|
Gfx::PComputePipeline depthSourceCopy;
|
|
|
|
|
Gfx::OComputeShader depthReduceLevelShader;
|
|
|
|
|
Gfx::PComputePipeline depthReduceLevel;
|
|
|
|
|
|
2024-06-07 09:19:47 +02:00
|
|
|
Gfx::PShaderBuffer cullingBuffer;
|
2025-01-08 19:15:12 +01:00
|
|
|
PScene scene;
|
2021-05-06 17:02:10 +02:00
|
|
|
};
|
2024-06-11 14:15:29 +02:00
|
|
|
DEFINE_REF(DepthCullingPass)
|
2021-05-06 17:02:10 +02:00
|
|
|
} // namespace Seele
|