Skip to content

Commit

Permalink
WIP Debug and Sync improvements
Browse files Browse the repository at this point in the history
Going on vacation, need this on the other computer
  • Loading branch information
Pursche committed Jul 3, 2024
1 parent 71ddbef commit addf747
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 12 deletions.
2 changes: 2 additions & 0 deletions Source/Game/Game/Rendering/Canvas/Canvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ void Canvas::Draw(DrawParams& params)
Renderer::GraphicsPipelineID texturesPipeline = Renderer::GraphicsPipelineID::Invalid();
{
Renderer::GraphicsPipelineDesc pipelineDesc;
pipelineDesc.debugName = "CanvasTextures";
params.graphResources.InitializePipelineDesc(pipelineDesc);

// Rasterizer state
Expand All @@ -252,6 +253,7 @@ void Canvas::Draw(DrawParams& params)
Renderer::GraphicsPipelineID textPipeline = Renderer::GraphicsPipelineID::Invalid();
{
Renderer::GraphicsPipelineDesc pipelineDesc;
pipelineDesc.debugName = "CanvasText";
params.graphResources.InitializePipelineDesc(pipelineDesc);

// Rasterizer state
Expand Down
2 changes: 2 additions & 0 deletions Source/Game/Game/Rendering/CullUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ void DepthPyramidUtils::BuildPyramid(BuildPyramidParams& params)
// Copy first mip
{
Renderer::ComputePipelineDesc blitPipelineDesc;
blitPipelineDesc.debugName = "Blit Depthpyramid";
params.graphResources->InitializePipelineDesc(blitPipelineDesc);

Renderer::ComputeShaderDesc shaderDesc;
Expand Down Expand Up @@ -103,6 +104,7 @@ void DepthPyramidUtils::BuildPyramid(BuildPyramidParams& params)
// Downsample
{
Renderer::ComputePipelineDesc pipelineDesc;
pipelineDesc.debugName = "Downsample Depthpyramid";
params.graphResources->InitializePipelineDesc(pipelineDesc);

Renderer::ComputeShaderDesc shaderDesc;
Expand Down
24 changes: 18 additions & 6 deletions Source/Game/Game/Rendering/CulledRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ void CulledRenderer::OccluderPass(OccluderPassParams& params)

// Fill the occluders to draw
{
params.commandList->PushMarker(params.passName + " Instanced Occlusion Fill", Color::White);
std::string debugName = params.passName + " Instanced Occlusion Fill";
params.commandList->PushMarker(debugName, Color::White);

Renderer::ComputePipelineDesc pipelineDesc;
pipelineDesc.debugName = debugName;
params.graphResources->InitializePipelineDesc(pipelineDesc);

Renderer::ComputeShaderDesc shaderDesc;
Expand Down Expand Up @@ -107,9 +109,11 @@ void CulledRenderer::OccluderPass(OccluderPassParams& params)

// Create indirect argument buffer
{
params.commandList->PushMarker("Create Indirect", Color::Yellow);
std::string debugName = params.passName + " Create Indirect";
params.commandList->PushMarker(debugName, Color::Yellow);

Renderer::ComputePipelineDesc cullingPipelineDesc;
cullingPipelineDesc.debugName = debugName;
params.graphResources->InitializePipelineDesc(cullingPipelineDesc);

Renderer::ComputeShaderDesc shaderDesc;
Expand Down Expand Up @@ -199,9 +203,11 @@ void CulledRenderer::OccluderPass(OccluderPassParams& params)

// Fill the occluders to draw
{
params.commandList->PushMarker(params.passName + " Occlusion Fill", Color::White);
std::string debugName = params.passName + " Occlusion Fill";
params.commandList->PushMarker(debugName, Color::White);

Renderer::ComputePipelineDesc pipelineDesc;
pipelineDesc.debugName = debugName;
params.graphResources->InitializePipelineDesc(pipelineDesc);

Renderer::ComputeShaderDesc shaderDesc;
Expand Down Expand Up @@ -301,9 +307,11 @@ void CulledRenderer::CullingPass(CullingPassParams& params)

// Do culling
{
params.commandList->PushMarker("Instanced Culling", Color::Yellow);
std::string debugName = params.passName + " Instanced Culling";
params.commandList->PushMarker(debugName, Color::Yellow);

Renderer::ComputePipelineDesc cullingPipelineDesc;
cullingPipelineDesc.debugName = debugName;
params.graphResources->InitializePipelineDesc(cullingPipelineDesc);

Renderer::ComputeShaderDesc shaderDesc;
Expand Down Expand Up @@ -370,9 +378,11 @@ void CulledRenderer::CullingPass(CullingPassParams& params)

// Create indirect argument buffer
{
params.commandList->PushMarker("Create Indirect", Color::Yellow);
std::string debugName = params.passName + " Create Indirect";
params.commandList->PushMarker(debugName, Color::Yellow);

Renderer::ComputePipelineDesc cullingPipelineDesc;
cullingPipelineDesc.debugName = debugName;
params.graphResources->InitializePipelineDesc(cullingPipelineDesc);

Renderer::ComputeShaderDesc shaderDesc;
Expand Down Expand Up @@ -420,7 +430,8 @@ void CulledRenderer::CullingPass(CullingPassParams& params)
}
else
{
params.commandList->PushMarker(params.passName + " Culling", Color::Yellow);
std::string debugName = params.passName + " Culling";
params.commandList->PushMarker(debugName, Color::Yellow);

// Reset the counters
params.commandList->FillBuffer(params.drawCountBuffer, 0, sizeof(u32) * Renderer::Settings::MAX_VIEWS, 0);
Expand All @@ -430,6 +441,7 @@ void CulledRenderer::CullingPass(CullingPassParams& params)
params.commandList->BufferBarrier(params.triangleCountBuffer, Renderer::BufferPassUsage::TRANSFER);

Renderer::ComputePipelineDesc cullingPipelineDesc;
cullingPipelineDesc.debugName = debugName;
params.graphResources->InitializePipelineDesc(cullingPipelineDesc);

Renderer::ComputeShaderDesc shaderDesc;
Expand Down
1 change: 1 addition & 0 deletions Source/Game/Game/Rendering/GameRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ f32 GameRenderer::Render()
builder.Write(_resources.transparency, Renderer::PipelineType::GRAPHICS, Renderer::LoadMode::CLEAR);
builder.Write(_resources.transparencyWeights, Renderer::PipelineType::GRAPHICS, Renderer::LoadMode::CLEAR);
builder.Write(_resources.depth, Renderer::PipelineType::GRAPHICS, Renderer::LoadMode::CLEAR);
builder.Write(_resources.depthColorCopy, Renderer::PipelineType::GRAPHICS, Renderer::LoadMode::CLEAR);
builder.Write(_resources.skyboxDepth, Renderer::PipelineType::GRAPHICS, Renderer::LoadMode::CLEAR);
builder.Write(_resources.packedNormals, Renderer::PipelineType::GRAPHICS, Renderer::LoadMode::CLEAR);
builder.Write(_resources.ssaoTarget, Renderer::PipelineType::GRAPHICS, Renderer::LoadMode::CLEAR);
Expand Down
17 changes: 12 additions & 5 deletions Source/Game/Game/Rendering/RenderUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ void RenderUtils::Blit(Renderer::Renderer* renderer, Renderer::RenderGraphResour
pixelShaderDesc.AddPermutationField("TEX_TYPE", texTypeName);

Renderer::GraphicsPipelineDesc pipelineDesc;
pipelineDesc.debugName = "Blit";
graphResources.InitializePipelineDesc(pipelineDesc);

pipelineDesc.states.vertexShader = renderer->LoadShader(vertexShaderDesc);
Expand Down Expand Up @@ -146,6 +147,7 @@ void RenderUtils::DepthBlit(Renderer::Renderer* renderer, Renderer::RenderGraphR
pixelShaderDesc.AddPermutationField("TEX_TYPE", texTypeName);

Renderer::GraphicsPipelineDesc pipelineDesc;
pipelineDesc.debugName = "DepthBlit";
graphResources.InitializePipelineDesc(pipelineDesc);

pipelineDesc.states.vertexShader = renderer->LoadShader(vertexShaderDesc);
Expand Down Expand Up @@ -204,6 +206,7 @@ void RenderUtils::Overlay(Renderer::Renderer* renderer, Renderer::RenderGraphRes
pixelShaderDesc.AddPermutationField("TEX_TYPE", texTypeName);

Renderer::GraphicsPipelineDesc pipelineDesc;
pipelineDesc.debugName = "Overlay";
graphResources.InitializePipelineDesc(pipelineDesc);

pipelineDesc.states.vertexShader = renderer->LoadShader(vertexShaderDesc);
Expand Down Expand Up @@ -277,6 +280,7 @@ void RenderUtils::DepthOverlay(Renderer::Renderer* renderer, Renderer::RenderGra
pixelShaderDesc.AddPermutationField("TEX_TYPE", texTypeName);

Renderer::GraphicsPipelineDesc pipelineDesc;
pipelineDesc.debugName = "DepthOverlay";
graphResources.InitializePipelineDesc(pipelineDesc);

pipelineDesc.states.vertexShader = renderer->LoadShader(vertexShaderDesc);
Expand Down Expand Up @@ -348,6 +352,7 @@ void RenderUtils::PictureInPicture(Renderer::Renderer* renderer, Renderer::Rende
pixelShaderDesc.AddPermutationField("TEX_TYPE", texTypeName);

Renderer::GraphicsPipelineDesc pipelineDesc;
pipelineDesc.debugName = "PictureInPicture";
graphResources.InitializePipelineDesc(pipelineDesc);

pipelineDesc.states.vertexShader = renderer->LoadShader(vertexShaderDesc);
Expand Down Expand Up @@ -410,7 +415,7 @@ void RenderUtils::PictureInPicture(Renderer::Renderer* renderer, Renderer::Rende

void RenderUtils::DepthPictureInPicture(Renderer::Renderer* renderer, Renderer::RenderGraphResources& graphResources, Renderer::CommandList& commandList, u32 frameIndex, const DepthPictureInPictureParams& params)
{
commandList.PushMarker("PictureInPicture", Color::White);
commandList.PushMarker("DepthPictureInPicture", Color::White);

// Set viewport and scissor
f32 width = static_cast<f32>(params.targetRegion.right) - static_cast<f32>(params.targetRegion.left);
Expand All @@ -434,6 +439,7 @@ void RenderUtils::DepthPictureInPicture(Renderer::Renderer* renderer, Renderer::
pixelShaderDesc.AddPermutationField("TEX_TYPE", texTypeName);

Renderer::GraphicsPipelineDesc pipelineDesc;
pipelineDesc.debugName = "DepthPictureInPicture";
graphResources.InitializePipelineDesc(pipelineDesc);

pipelineDesc.states.vertexShader = renderer->LoadShader(vertexShaderDesc);
Expand Down Expand Up @@ -490,15 +496,16 @@ void RenderUtils::DepthPictureInPicture(Renderer::Renderer* renderer, Renderer::

void RenderUtils::CopyDepthToColor(Renderer::Renderer* renderer, Renderer::RenderGraphResources& graphResources, Renderer::CommandList& commandList, u32 frameIndex, const CopyDepthToColorParams& params)
{
Renderer::ComputePipelineDesc queryPipelineDesc;
graphResources.InitializePipelineDesc(queryPipelineDesc);
Renderer::ComputePipelineDesc pipelineDesc;
pipelineDesc.debugName = "CopyDepthToColor";
graphResources.InitializePipelineDesc(pipelineDesc);

Renderer::ComputeShaderDesc shaderDesc;
shaderDesc.path = "Blitting/blitDepth.cs.hlsl";
queryPipelineDesc.computeShader = renderer->LoadShader(shaderDesc);
pipelineDesc.computeShader = renderer->LoadShader(shaderDesc);

// Do culling
Renderer::ComputePipelineID pipeline = renderer->CreatePipeline(queryPipelineDesc);
Renderer::ComputePipelineID pipeline = renderer->CreatePipeline(pipelineDesc);
commandList.BeginPipeline(pipeline);

commandList.PushMarker("CopyDepthToColorRT", Color::White);
Expand Down
4 changes: 3 additions & 1 deletion Source/Game/Game/Rendering/Skybox/SkyboxRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ void SkyboxRenderer::AddSkyboxPass(Renderer::RenderGraph* renderGraph, RenderRes
Renderer::ImageMutableResource skyboxColor;
Renderer::DepthImageMutableResource depth;

Renderer::BufferResource cameras;

Renderer::DescriptorSetResource globalSet;
};

Expand All @@ -45,7 +47,7 @@ void SkyboxRenderer::AddSkyboxPass(Renderer::RenderGraph* renderGraph, RenderRes
data.skyboxColor = builder.Write(resources.skyboxColor, Renderer::PipelineType::GRAPHICS, Renderer::LoadMode::LOAD);
data.depth = builder.Write(resources.depth, Renderer::PipelineType::GRAPHICS, Renderer::LoadMode::LOAD);

builder.Read(resources.cameras.GetBuffer(), BufferUsage::GRAPHICS);
data.cameras = builder.Read(resources.cameras.GetBuffer(), BufferUsage::GRAPHICS);

data.globalSet = builder.Use(resources.globalDescriptorSet);

Expand Down
3 changes: 3 additions & 0 deletions Source/Game/Game/Rendering/Terrain/TerrainRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ void TerrainRenderer::AddOccluderPass(Renderer::RenderGraph* renderGraph, Render
commandList.PushMarker("Occlusion Fill", Color::White);

Renderer::ComputePipelineDesc pipelineDesc;
pipelineDesc.debugName = "Terrain Occlusion Fill";
graphResources.InitializePipelineDesc(pipelineDesc);

Renderer::ComputeShaderDesc shaderDesc;
Expand Down Expand Up @@ -304,6 +305,7 @@ void TerrainRenderer::AddCullingPass(Renderer::RenderGraph* renderGraph, RenderR
commandList.PushMarker("Reset indirect", Color::White);

Renderer::ComputePipelineDesc pipelineDesc;
pipelineDesc.debugName = "Terrain Reset indirect";
graphResources.InitializePipelineDesc(pipelineDesc);

Renderer::ComputeShaderDesc shaderDesc;
Expand Down Expand Up @@ -342,6 +344,7 @@ void TerrainRenderer::AddCullingPass(Renderer::RenderGraph* renderGraph, RenderR

// Cull instances on GPU
Renderer::ComputePipelineDesc pipelineDesc;
pipelineDesc.debugName = "Terrain Culling";
graphResources.InitializePipelineDesc(pipelineDesc);

Renderer::ComputeShaderDesc shaderDesc;
Expand Down

0 comments on commit addf747

Please sign in to comment.