Files
Seele/src/Engine/Graphics/RenderPass/LightCullingPass.h
T

68 lines
2.0 KiB
C++
Raw Normal View History

2021-05-06 17:02:10 +02:00
#pragma once
#include "RenderPass.h"
2023-11-15 17:42:57 +01:00
#include "Graphics/Shader.h"
2021-10-01 19:55:04 +02:00
#include "Scene/Scene.h"
2021-05-06 17:02:10 +02:00
namespace Seele
{
DECLARE_REF(CameraActor)
2021-05-10 23:57:55 +02:00
DECLARE_REF(Scene)
DECLARE_REF(Viewport)
2023-10-24 15:01:09 +02:00
class LightCullingPass : public RenderPass
2021-05-06 17:02:10 +02:00
{
public:
2023-10-26 18:37:29 +02:00
LightCullingPass(Gfx::PGraphics graphics, PScene scene);
2023-11-05 10:36:01 +01:00
LightCullingPass(LightCullingPass&&) = default;
LightCullingPass& operator=(LightCullingPass&&) = default;
2021-05-06 17:02:10 +02:00
virtual ~LightCullingPass();
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;
static void modifyRenderPassMacros(Map<const char*, const char*>& defines);
private:
2021-05-10 23:57:55 +02:00
void setupFrustums();
2022-02-24 22:38:26 +01:00
static constexpr uint32 BLOCK_SIZE = 32;
2021-05-10 23:57:55 +02:00
static constexpr uint32 INDEX_LIGHT_ENV = 1;
2021-10-13 15:20:30 +02:00
struct DispatchParams
2021-05-06 17:02:10 +02:00
{
glm::uvec3 numThreadGroups;
uint32_t pad0;
glm::uvec3 numThreads;
uint32_t pad1;
} dispatchParams;
2021-10-13 15:20:30 +02:00
struct Plane
2021-05-06 17:02:10 +02:00
{
2023-01-21 18:43:21 +01:00
Vector n;
2021-05-06 17:02:10 +02:00
float d;
};
2021-10-13 15:20:30 +02:00
struct Frustum
2021-05-06 17:02:10 +02:00
{
Plane planes[4];
};
2021-05-10 23:57:55 +02:00
2023-11-05 10:36:01 +01:00
Gfx::OShaderBuffer frustumBuffer;
Gfx::OUniformBuffer dispatchParamsBuffer;
Gfx::OUniformBuffer viewParamsBuffer;
2023-11-11 13:56:12 +01:00
Gfx::ODescriptorLayout dispatchParamsLayout;
Gfx::PDescriptorSet dispatchParamsSet;
2023-11-05 10:36:01 +01:00
Gfx::OComputeShader frustumShader;
2023-11-09 22:15:51 +01:00
Gfx::PComputePipeline frustumPipeline;
2023-11-05 10:36:01 +01:00
PLightEnvironment lightEnv;
2021-05-10 23:57:55 +02:00
Gfx::PTexture2D depthAttachment;
2023-11-05 10:36:01 +01:00
Gfx::OShaderBuffer oLightIndexCounter;
Gfx::OShaderBuffer tLightIndexCounter;
Gfx::OShaderBuffer oLightIndexList;
Gfx::OShaderBuffer tLightIndexList;
Gfx::OTexture2D oLightGrid;
Gfx::OTexture2D tLightGrid;
2021-05-10 23:57:55 +02:00
Gfx::PDescriptorSet cullingDescriptorSet;
2023-11-05 10:36:01 +01:00
Gfx::ODescriptorLayout cullingDescriptorLayout;
Gfx::OComputeShader cullingShader;
2023-11-09 22:15:51 +01:00
Gfx::PComputePipeline cullingPipeline;
2021-05-06 17:02:10 +02:00
};
2021-05-10 23:57:55 +02:00
DEFINE_REF(LightCullingPass)
2021-05-06 17:02:10 +02:00
} // namespace Seele