aboutsummaryrefslogtreecommitdiff
path: root/src/platform/vulkan/vulkan_common.h
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-22 06:57:16 +0200
committerhachem <im@hachem.wtf>2026-09-22 06:57:16 +0200
commitd7c1ced08d5d78fcb239550404db4e67d4357a19 (patch)
tree9c0e218b096d138075cbf6a48e2562d33a8f94ed /src/platform/vulkan/vulkan_common.h
parent270eda6f558c972ec86ad0580f1d3d18afc83a94 (diff)
fix: windows supportHEADmain
Diffstat (limited to 'src/platform/vulkan/vulkan_common.h')
-rw-r--r--src/platform/vulkan/vulkan_common.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/platform/vulkan/vulkan_common.h b/src/platform/vulkan/vulkan_common.h
index 22d389c..ead4d1f 100644
--- a/src/platform/vulkan/vulkan_common.h
+++ b/src/platform/vulkan/vulkan_common.h
@@ -187,6 +187,9 @@ namespace Donut::RHI
auto bind_pipeline(Pipeline* p) -> void override
{
m_pipe = static_cast<VkPipelineR*>(p);
+ // a pipeline whose shaders never loaded has no vk object; binding a null
+ // handle is driver roulette, so skip it and let draw() skip too
+ if (!m_pipe || m_pipe->m_pipeline == VK_NULL_HANDLE) { m_pipe = nullptr; return; }
vkCmdBindPipeline(m_cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipe->m_pipeline);
}
auto set_viewport(int x, int y, int w, int h, bool flip_y) -> void override
@@ -216,9 +219,9 @@ namespace Donut::RHI
auto bind_index_buffer(Buffer* ib) -> void override
{ vkCmdBindIndexBuffer(m_cmd, static_cast<VkBufferR*>(ib)->m_buf, 0, VK_INDEX_TYPE_UINT32); }
auto draw(uint32_t vertex_count) -> void override
- { flush_descriptors(); vkCmdDraw(m_cmd, vertex_count, 1, 0, 0); }
+ { if (!m_pipe) return; flush_descriptors(); vkCmdDraw(m_cmd, vertex_count, 1, 0, 0); }
auto draw_indexed(uint32_t index_count) -> void override
- { flush_descriptors(); vkCmdDrawIndexed(m_cmd, index_count, 1, 0, 0, 0); }
+ { if (!m_pipe) return; flush_descriptors(); vkCmdDrawIndexed(m_cmd, index_count, 1, 0, 0, 0); }
// allocate + write + bind a descriptor set for the current pipeline's
// declared resources, using whatever was bound since bind_pipeline.