From 84d6e8e921965c30a381a1a8ea689fa386d321ff Mon Sep 17 00:00:00 2001 From: Matthew Date: Fri, 15 Aug 2025 06:35:00 +1000 Subject: [PATCH] more fixes --- vulkan.d | 9 --------- vulkan_util.d | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/vulkan.d b/vulkan.d index cc74be9..3e459e0 100644 --- a/vulkan.d +++ b/vulkan.d @@ -609,15 +609,6 @@ InitBuffers(Vulkan* vk) vk.transfer_buf = CreateMappedBuffer!(u8)(vk, BT.Staging, transfer_size); } -void -BindUIBuffers(Vulkan* vk) -{ - VkDeviceSize offset = 0; - - vkCmdBindIndexBuffer(vk.cmds[vk.frame_index], vk.ui_index_buf.buffer, 0, VK_INDEX_TYPE_UINT32); - vkCmdBindVertexBuffers(vk.cmds[vk.frame_index], 0, 1, &vk.ui_vert_buf.buffer, &offset); -} - void BindBuffers(Vulkan* vk, Buffer* index_buffer, Buffer* vertex_buffer) { diff --git a/vulkan_util.d b/vulkan_util.d index 5ced0ec..c21d0b5 100644 --- a/vulkan_util.d +++ b/vulkan_util.d @@ -1,4 +1,5 @@ import core.stdc.stdio : Printf = printf; +import core.stdc.string : memset; alias i8 = byte; alias i16 = short; @@ -17,6 +18,8 @@ alias b32 = uint; alias usize = size_t; +const DEFAULT_ALIGNMENT = (void *).sizeof * 2; + version(linux) { import core.sys.posix.sys.mman; @@ -35,6 +38,49 @@ MemFree(void* ptr, u64 size) } +void +Logf(Args...)(string fmt, Args args) +{ + try + { + writefln(fmt, args); + } + catch (Exception e) + { + assert(false, "Incompatible format type"); + } +} + +void +Log(string str) +{ + writeln(str); +} + +void +Log(char* str) +{ + writeln(str); +} + +u64 +KB(u64 v) +{ + return v * 1024; +}; + +u64 +MB(u64 v) +{ + return KB(v) * 1024; +}; + +u64 +GB(u64 v) +{ + return MB(v) * 1024; +}; + struct Node(T) { Node!(T)* next;