Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
93d8a80
feat: add RPS pipeline and default resource creation methods in Rende…
Top61ly Apr 2, 2025
83d0554
feat: implement forward and shadow pipelines in RenderSystem
Top61ly Apr 3, 2025
5e79678
feat: add static wrapper functions for shadowmap and forward opaque p…
Top61ly Apr 3, 2025
51fa74c
feat: add RPS pipeline and default resource creation methods in Rende…
Top61ly Apr 2, 2025
8526ad4
feat: implement forward and shadow pipelines in RenderSystem
Top61ly Apr 3, 2025
1d31a8d
feat: add static wrapper functions for shadowmap and forward opaque p…
Top61ly Apr 3, 2025
c7c5c39
Merge branch 'dev/refactor_rps' of https://github.com/gore-engine/gor…
Top61ly Apr 5, 2025
9ecd198
feat: add profiling scopes to RenderSystem methods for performance tr…
Top61ly Apr 6, 2025
29df4a7
feat: add PerDrawData and PerframeData structures for rendering data …
Top61ly Apr 9, 2025
62fc8d8
refactor: remove unused RPS initialization and related data structure…
Top61ly Apr 9, 2025
f90396f
feat: implement shadowmap and forward opaque rendering wrappers in Re…
Top61ly Apr 12, 2025
bd6a9a8
feat: add overridePipeline parameter to DrawRenderer and ScheduleDraw…
Top61ly Apr 13, 2025
409b179
fix: correct scope definition placement for application initializatio…
Top61ly Apr 13, 2025
1bcfa88
feat: implement shadow mapping support with new shader bindings and r…
Top61ly Apr 14, 2025
6a14bd0
feat: enhance rendering system with dynamic buffer support and shadow…
Top61ly Apr 20, 2025
ddb0e19
feat: introduce TransientBindGroupUpdateDesc structure and update bin…
Top61ly Apr 21, 2025
39d2fbc
refactor: rename CreateShadowPassBindLayout to CreateShadowPassObject…
Top61ly Apr 23, 2025
93297bc
feat: add BindGroupUpdateDesc structure for improved binding management
Top61ly Apr 26, 2025
8246fbf
refactor: update TransientTextureBinding and TransientBufferBinding t…
Top61ly Apr 26, 2025
51f293f
feat: implement UpdateBindGroup method for enhanced binding updates
Top61ly Apr 26, 2025
408d95b
fix: correct typo in UpdateBindGroup method for descriptorSet variable
Top61ly Apr 26, 2025
c7df500
feat: add CreateTransientBindGroup method and update BindGroup handli…
Top61ly Apr 27, 2025
1b5957f
fix: update UpdateFrequency from None to Persistent in BindGroup and …
Top61ly Apr 28, 2025
d5122aa
feat: add ResetDescriptorPool method and integrate it into RenderSyst…
Top61ly Apr 28, 2025
2d5d93e
feat: refactor descriptor pool management to support framed pools and…
Top61ly Apr 29, 2025
84fe75a
feat: add UpdateGlobalConstantBuffer method to enhance global constan…
Top61ly May 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
488 changes: 208 additions & 280 deletions sample/App/SampleApp.cpp

Large diffs are not rendered by default.

79 changes: 39 additions & 40 deletions sample/App/SampleApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,56 +34,55 @@ class SampleApp final : public gore::App
void PreRender();

// Temporary RenderPassDesc for pipeline creation
void InitializeRpsSystem();
void CreateRenderPassDesc();
void CreateUnifiedGlobalDynamicBuffer();
void CreateGlobalBindGroup();
void CreatePipelines();
// void CreateRenderPassDesc();
// void CreateUnifiedGlobalDynamicBuffer();
// void CreateGlobalBindGroup();
// void CreatePipelines();

void CreateDefaultResources();
// void CreateDefaultResources();

void CreateForwardPipeline();
void CreateShadowmapPipeline();
// void CreateForwardPipeline();
// void CreateShadowmapPipeline();

const int K_OBJECT_BATCH_COUNT = 128;
// const int K_OBJECT_BATCH_COUNT = 128;

void UpdateAllGameObjectsGPUPerObjectData();
// // void UpdateAllGameObjectsGPUPerObjectData();

static void DrawTriangleWithRPSWrapper(const RpsCmdCallbackContext* pContext);
static void ShadowmapPassWithRPSWrapper(const RpsCmdCallbackContext* pContext);
static void ForwardOpaquePassWithRPSWrapper(const RpsCmdCallbackContext* pContext);
// static void DrawTriangleWithRPSWrapper(const RpsCmdCallbackContext* pContext);
// static void ShadowmapPassWithRPSWrapper(const RpsCmdCallbackContext* pContext);
// static void ForwardOpaquePassWithRPSWrapper(const RpsCmdCallbackContext* pContext);
private:
void UpdateFPSText(float deltaTime);

gore::gfx::GraphicsCaps m_GraphicsCaps;

struct SampleRenderPass
{
RenderPassDesc forwardPassDesc;
RenderPassDesc shadowPassDesc;
} renderPasses;

struct SamplePipeline
{
GraphicsPipelineHandle blankPipeline;
GraphicsPipelineHandle forwardPipeline;
GraphicsPipelineHandle shadowPipeline;
GraphicsPipelineHandle gbuffferPipeline;
} pipelines;

struct DefaultResources
{
gore::gfx::TextureHandle whiteTexture;
gore::gfx::TextureHandle blackTexture;
} defaultResources;

gore::gfx::BufferHandle m_UnifiedDynamicBuffer;
gore::gfx::SamplerHandle m_ShadowmapSampler;
gore::gfx::DynamicBufferHandle m_UnifiedDynamicBufferHandle;

gore::gfx::BindLayout m_GlobalBindLayout;
gore::gfx::BindGroupHandle m_GlobalBindGroup;
gore::gfx::BufferHandle m_GlobalConstantBuffer;
// struct SampleRenderPass
// {
// RenderPassDesc forwardPassDesc;
// RenderPassDesc shadowPassDesc;
// } renderPasses;

// struct SamplePipeline
// {
// GraphicsPipelineHandle blankPipeline;
// GraphicsPipelineHandle forwardPipeline;
// GraphicsPipelineHandle shadowPipeline;
// GraphicsPipelineHandle gbuffferPipeline;
// } pipelines;

// struct DefaultResources
// {
// gore::gfx::TextureHandle whiteTexture;
// gore::gfx::TextureHandle blackTexture;
// } defaultResources;

// gore::gfx::BufferHandle m_UnifiedDynamicBuffer;
// gore::gfx::SamplerHandle m_ShadowmapSampler;
// gore::gfx::DynamicBufferHandle m_UnifiedDynamicBufferHandle;

// gore::gfx::BindLayout m_GlobalBindLayout;
// gore::gfx::BindGroupHandle m_GlobalBindGroup;
// gore::gfx::BufferHandle m_GlobalConstantBuffer;
private:
gore::Scene* scene;
};
2 changes: 1 addition & 1 deletion src/Core/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ int App::Run(int width, int height, const char* title)
MicroProfileSetEnableAllGroups(true);
MicroProfileSetForceMetaCounters(true);

MICROPROFILE_SCOPE(g_AppInitialize);
{
MICROPROFILE_SCOPE(g_AppInitialize);
glfwInit();

m_Window = new Window(this, width, height);
Expand Down
16 changes: 11 additions & 5 deletions src/Rendering/BindGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ namespace gore::gfx

enum class UpdateFrequency : uint8_t
{
None,
PerFrame,
Persistent,
PerBatch,
// We should never use this, but it's here for completeness
PerDraw,
Count
Count,
PerFrame // deprecated
};

struct TextureBinding final
Expand Down Expand Up @@ -52,10 +51,17 @@ struct SamplerBinding final
BindType bindType = BindType::Sampler;
};

struct BindGroupUpdateDesc final
{
std::vector<TextureBinding> textures = {};
std::vector<BufferBinding> buffers = {};
std::vector<SamplerBinding> samplers = {};
};

struct BindGroupDesc final
{
const char* debugName = nullptr;
UpdateFrequency updateFrequency = UpdateFrequency::None;
UpdateFrequency updateFrequency = UpdateFrequency::Persistent;
std::vector<TextureBinding> textures = {};
std::vector<BufferBinding> buffers = {};
std::vector<SamplerBinding> samplers = {};
Expand Down
3 changes: 2 additions & 1 deletion src/Rendering/Components/Material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ namespace gore::renderer
{
Material::Material() noexcept :
m_Passes(),
m_AlphaMode(AlphaMode::Opaque)
m_AlphaMode(AlphaMode::Opaque),
m_DynamicBuffer()
{
}

Expand Down
5 changes: 3 additions & 2 deletions src/Rendering/Components/Material.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "Rendering/Pipeline.h"
#include "Rendering/BindGroup.h"

#include "Rendering/DynamicBuffer.h"
namespace gore::renderer
{
using namespace gore::gfx;
Expand Down Expand Up @@ -69,9 +69,10 @@ ENGINE_CLASS(Material) final
}

GETTER_SETTER(AlphaMode, AlphaMode)

GETTER_SETTER(DynamicBufferHandle, DynamicBuffer)
private:
std::vector<Pass> m_Passes;
DynamicBufferHandle m_DynamicBuffer;
AlphaMode m_AlphaMode;
};
} // namespace gore::renderer
11 changes: 7 additions & 4 deletions src/Rendering/DrawStream/Draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ bool MatchDrawFilter(const Pass& pass, const DrawCreateInfo& info)
return pass.name == info.passName;
}

void PrepareDrawDataAndSort(DrawCreateInfo& info, std::vector<GameObject*>& gameObjects, std::vector<Draw>& sortedDrawData)
void PrepareDrawDataAndSort(DrawCreateInfo& info
, std::vector<GameObject*>& gameObjects
, std::vector<Draw>& sortedDrawData
, Material* overrideMaterial)
{
auto& renderContext = *RenderContext::GetInstance();

Expand All @@ -26,16 +29,16 @@ void PrepareDrawDataAndSort(DrawCreateInfo& info, std::vector<GameObject*>& game
if (renderer->IsValid() == false)
continue;

auto handle = renderer->GetDynamicBuffer();
auto handle = overrideMaterial? overrideMaterial->GetDynamicBuffer() : renderer->GetDynamicBuffer();

Material& material = renderer->GetMaterial();
Material& material = overrideMaterial ? *overrideMaterial : renderer->GetMaterial();
for (const auto& pass : material.GetPasses())
{
if (MatchDrawFilter(pass, info) == false)
continue;

Draw draw;
assert(pass.shader.empty() == false);
// assert(pass.shader.empty() == false);

draw.shader = pass.shader;
draw.bindGroup[0] = pass.bindGroup[0];
Expand Down
2 changes: 1 addition & 1 deletion src/Rendering/DrawStream/Draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ struct DrawSorter
}
};

void PrepareDrawDataAndSort(DrawCreateInfo& info, std::vector<GameObject*>& gameObjects, std::vector<Draw>& sortedDrawData);
void PrepareDrawDataAndSort(DrawCreateInfo& info, std::vector<GameObject*>& gameObjects, std::vector<Draw>& sortedDrawData, Material* overrideMaterial = nullptr);
bool MatchDrawFilter(const Pass& pass, const DrawCreateInfo& info);
void ScheduleDraws(RenderContext& renderContext, const std::unordered_map<DrawKey, std::vector<Draw>>& drawData, const DrawKey& key, vk::CommandBuffer commandBuffer);
} // namespace gore::renderer
Expand Down
4 changes: 2 additions & 2 deletions src/Rendering/DrawStream/DrawStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void CreateDrawStreamFromDrawData(const std::vector<Draw>& drawData, DrawStream&
drawStream.data.assign(writer.GetData(), writer.GetData() + writer.GetByteWritten());
}

void ScheduleDrawStream(RenderContext& renderContext, DrawStream& drawStream, vk::CommandBuffer commandBuffer)
void ScheduleDrawStream(RenderContext& renderContext, DrawStream& drawStream, vk::CommandBuffer commandBuffer, GraphicsPipelineHandle overridePipeline)
{
BitReader reader(drawStream.data.data(), drawStream.data.size());

Expand All @@ -170,7 +170,7 @@ void ScheduleDrawStream(RenderContext& renderContext, DrawStream& drawStream, vk

if (mask.shader != 0)
{
auto shaderHandle = reader.Read<GraphicsPipelineHandle>();
auto shaderHandle = overridePipeline.empty() ? reader.Read<GraphicsPipelineHandle>() : overridePipeline;
graphicsPipeline = renderContext.GetGraphicsPipeline(shaderHandle);
commandBuffer.bindPipeline(vk::PipelineBindPoint::eGraphics, graphicsPipeline.pipeline);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Rendering/DrawStream/DrawStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ struct DrawStream final
};

void CreateDrawStreamFromDrawData(const std::vector<Draw>& drawData, DrawStream& drawStream);
void ScheduleDrawStream(RenderContext& renderContext, DrawStream& drawStream, vk::CommandBuffer commandBuffer);
void ScheduleDrawStream(RenderContext& renderContext, DrawStream& drawStream, vk::CommandBuffer commandBuffer, GraphicsPipelineHandle overridePipeline = {});
} // namespace gore::renderer
17 changes: 0 additions & 17 deletions src/Rendering/GPUData/GlobalConstantBuffer.h

This file was deleted.

41 changes: 0 additions & 41 deletions src/Rendering/RawBindGroupUpdateDesc.h

This file was deleted.

Loading
Loading