From 2aba74bdcbb487ae6274f0c961a5a7b4b8872ee7 Mon Sep 17 00:00:00 2001 From: Panos Karabelas Date: Wed, 25 Dec 2024 14:59:52 +0000 Subject: [PATCH] [vulkan] SP_ASSERT_VK will now display the actual expression --- runtime/RHI/RHI_Implementation.h | 7 ++++--- runtime/Rendering/Renderer_Passes.cpp | 23 +++++++---------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/runtime/RHI/RHI_Implementation.h b/runtime/RHI/RHI_Implementation.h index 27894fbf9..e6cfb7962 100644 --- a/runtime/RHI/RHI_Implementation.h +++ b/runtime/RHI/RHI_Implementation.h @@ -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" diff --git a/runtime/Rendering/Renderer_Passes.cpp b/runtime/Rendering/Renderer_Passes.cpp index 9be1698e0..075e66e66 100644 --- a/runtime/Rendering/Renderer_Passes.cpp +++ b/runtime/Rendering/Renderer_Passes.cpp @@ -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; @@ -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(); } }