Fixed validation errors caused by debug draw and fixed SHDebugDraw::WireCapsule not being static

This commit is contained in:
Kah Wei 2023-01-16 14:39:35 +08:00
parent 8e58d47115
commit b603044579
2 changed files with 10 additions and 3 deletions

View File

@ -104,6 +104,10 @@ namespace SHADE
auto subPass = renderGraph->GetNode("Debug Draw")->GetSubpass("Debug Draw"); auto subPass = renderGraph->GetNode("Debug Draw")->GetSubpass("Debug Draw");
subPass->AddExteriorDrawCalls([this](Handle<SHVkCommandBuffer> cmdBuffer, Handle<SHRenderer> renderer, uint32_t frameIndex) subPass->AddExteriorDrawCalls([this](Handle<SHVkCommandBuffer> cmdBuffer, Handle<SHRenderer> renderer, uint32_t frameIndex)
{ {
// Set line width first
cmdBuffer->SetLineWidth(LineWidth);
// Draw
const uint32_t FRAME_IDX = gfxSystem->GetCurrentFrameIndex(); const uint32_t FRAME_IDX = gfxSystem->GetCurrentFrameIndex();
cmdBuffer->BeginLabeledSegment("SHDebugDraw (No Depth Test)"); cmdBuffer->BeginLabeledSegment("SHDebugDraw (No Depth Test)");
{ {
@ -128,6 +132,10 @@ namespace SHADE
auto subPassWithDepth = renderGraph->GetNode("Debug Draw with Depth")->GetSubpass("Debug Draw with Depth"); auto subPassWithDepth = renderGraph->GetNode("Debug Draw with Depth")->GetSubpass("Debug Draw with Depth");
subPassWithDepth->AddExteriorDrawCalls([this](Handle<SHVkCommandBuffer> cmdBuffer, Handle<SHRenderer> renderer, uint32_t frameIndex) subPassWithDepth->AddExteriorDrawCalls([this](Handle<SHVkCommandBuffer> cmdBuffer, Handle<SHRenderer> renderer, uint32_t frameIndex)
{ {
// Set line width first
cmdBuffer->SetLineWidth(LineWidth);
// Draw
const uint32_t FRAME_IDX = gfxSystem->GetCurrentFrameIndex(); const uint32_t FRAME_IDX = gfxSystem->GetCurrentFrameIndex();
cmdBuffer->BeginLabeledSegment("SHDebugDraw (Depth Tested)"); cmdBuffer->BeginLabeledSegment("SHDebugDraw (Depth Tested)");
{ {
@ -506,7 +514,6 @@ namespace SHADE
if (batch.NumPoints[frameIndex] > 0) if (batch.NumPoints[frameIndex] > 0)
{ {
cmdBuffer->BindPipeline(batch.Pipeline); cmdBuffer->BindPipeline(batch.Pipeline);
cmdBuffer->SetLineWidth(LineWidth);
cmdBuffer->BindVertexBuffer(0, batch.VertexBuffers[frameIndex], 0); cmdBuffer->BindVertexBuffer(0, batch.VertexBuffers[frameIndex], 0);
cmdBuffer->DrawArrays(batch.NumPoints[frameIndex], 1, 0, 0); cmdBuffer->DrawArrays(batch.NumPoints[frameIndex], 1, 0, 0);
} }

View File

@ -205,7 +205,7 @@ namespace SHADE
/// <param name="color"></param> /// <param name="color"></param>
/// <param name="color">Colour to draw with.</param> /// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param> /// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void WireCapsule(const SHVec3& position, const SHQuaternion& rotation, float height, float radius, const SHColour& color = SHColour::WHITE, bool depthTested = false); static void WireCapsule(const SHVec3& position, const SHQuaternion& rotation, float height, float radius, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* Persistent Draw Function Class "Folder" */ /* Persistent Draw Function Class "Folder" */
@ -388,7 +388,7 @@ namespace SHADE
/// <param name="color"></param> /// <param name="color"></param>
/// <param name="color">Colour to draw with.</param> /// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param> /// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void WireCapsule(const SHVec3& position, const SHQuaternion& rotation, float height, float radius, const SHColour& color = SHColour::WHITE, bool depthTested = false); static void WireCapsule(const SHVec3& position, const SHQuaternion& rotation, float height, float radius, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary> /// <summary>
/// Clears any persistent drawn debug primitives. /// Clears any persistent drawn debug primitives.
/// </summary> /// </summary>