Skip to content

Commit

Permalink
[vulkan] SP_ASSERT_VK will now display the actual expression
Browse files Browse the repository at this point in the history
  • Loading branch information
PanosK92 committed Dec 25, 2024
1 parent 2c5ad20 commit 2aba74b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
7 changes: 4 additions & 3 deletions runtime/RHI/RHI_Implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,10 @@ static const char* vkresult_to_string(const VkResult result)
{ \
Log::SetLogToFile(true); \
SP_LOG_ERROR("%s", vkresult_to_string(vk_result)); \
SP_ASSERT(false && "Vulkan call failed"); \
}
#endif
SP_ASSERT(vk_result); \
} \

#endif // API_GRAPHICS_VULKAN

// RHI_Context
#include "RHI_Definitions.h"
Expand Down
23 changes: 7 additions & 16 deletions runtime/Rendering/Renderer_Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2296,11 +2296,11 @@ namespace Spartan
if (!shader_v || !shader_v->IsCompiled() || !shader_p || !shader_p->IsCompiled() || !draw || !font->HasText())
return;

cmd_list->BeginMarker("text");
cmd_list->BeginTimeblock("text");

font->UpdateVertexAndIndexBuffers(cmd_list);

// set pipeline state
// define pipeline state
static RHI_PipelineState pso;
pso.name = "text";
pso.shaders[RHI_Shader_Type::Vertex] = shader_v;
Expand All @@ -2310,39 +2310,30 @@ namespace Spartan
pso.depth_stencil_state = GetDepthStencilState(Renderer_DepthStencilState::Off);
pso.render_target_color_textures[0] = tex_out;
pso.clear_color[0] = rhi_color_load;
cmd_list->SetPipelineState(pso);

// set shared state
cmd_list->SetPipelineState(pso);
cmd_list->SetBufferVertex(font->GetVertexBuffer());
cmd_list->SetBufferIndex(font->GetIndexBuffer());
cmd_list->SetCullMode(RHI_CullMode::Back);

// outline
cmd_list->BeginTimeblock("text_outline");
// draw outline
if (font->GetOutline() != Font_Outline_None && font->GetOutlineSize() != 0)
{
// set pass constants
m_pcb_pass_cpu.set_f4_value(font->GetColorOutline());
cmd_list->PushConstants(m_pcb_pass_cpu);

// draw
cmd_list->SetTexture(Renderer_BindingsSrv::font_atlas, font->GetAtlasOutline().get());
cmd_list->DrawIndexed(font->GetIndexCount());
}
cmd_list->EndTimeblock();

// inline
cmd_list->BeginTimeblock("text_inline");
// draw inline
{
// set pass constants
m_pcb_pass_cpu.set_f4_value(font->GetColor());
cmd_list->PushConstants(m_pcb_pass_cpu);

// draw
cmd_list->SetTexture(Renderer_BindingsSrv::font_atlas, font->GetAtlas().get());
cmd_list->DrawIndexed(font->GetIndexCount());
}
cmd_list->EndTimeblock();

cmd_list->EndMarker();
cmd_list->EndTimeblock();
}
}

0 comments on commit 2aba74b

Please sign in to comment.