From 61d024686403b7be8d6cbd3cd9c5aeaf39b445af Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Thu, 12 Jun 2025 08:51:08 -0400 Subject: pke: move ui colors to instance buffer --- src/window.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/window.cpp') diff --git a/src/window.cpp b/src/window.cpp index 1211476..69b06ab 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -253,7 +253,7 @@ void PKVK_BeginBuffer(unsigned int family_index, VkDeviceSize requestedMemorySiz if (requestedMemorySize == 0) return; - VkBufferCreateInfo transferBufferCI; + VkBufferCreateInfo transferBufferCI{}; transferBufferCI.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; transferBufferCI.pNext = nullptr; transferBufferCI.flags = 0; @@ -305,7 +305,7 @@ void pkvk_buffer_create(pkvk_buffer_create_data *data, pkvk_buffer_create_data_o * buffer setup */ VkBuffer tmpBuffer; - VkBufferCreateInfo bufferCI; + VkBufferCreateInfo bufferCI{}; bufferCI.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; bufferCI.pNext = nullptr; bufferCI.flags = {}; @@ -2107,7 +2107,7 @@ void CreateGraphicsPipelines() { offset = 0; const long vertexBindingCount_ui_base = 3; VkVertexInputBindingDescription vertInputBD_ui_base[vertexBindingCount_ui_base]; - const long vertexAttrDescCount_ui_base = 8; + const long vertexAttrDescCount_ui_base = 10; VkVertexInputAttributeDescription vertAttrDesc_ui_base[vertexAttrDescCount_ui_base]; VkPipelineVertexInputStateCreateInfo vkPipelineVertexInputStateCreateInfo_ui_base{vkPipelineVertexInputStateCreateInfo_txtr}; { @@ -2127,6 +2127,8 @@ void CreateGraphicsPipelines() { vertInputBD_ui_base[index].binding = index; vertInputBD_ui_base[index].stride = 0 + sizeof(glm::mat4) // pos_scale + + sizeof(glm::vec4) // in_border_color + + sizeof(glm::vec4) // in_background_color + sizeof(glm::vec2) // px_scale + sizeof(float) // depth + (sizeof(float) * 1) // padding @@ -2160,6 +2162,20 @@ void CreateGraphicsPipelines() { index += 1; } + // instance - in_border_color + vertAttrDesc_ui_base[index].binding = 2; + vertAttrDesc_ui_base[index].format = VK_FORMAT_R32G32B32A32_SFLOAT; + vertAttrDesc_ui_base[index].offset = offset; + offset += sizeof(glm::vec4); + index += 1; + + // instance - in_background_color + vertAttrDesc_ui_base[index].binding = 2; + vertAttrDesc_ui_base[index].format = VK_FORMAT_R32G32B32A32_SFLOAT; + vertAttrDesc_ui_base[index].offset = offset; + offset += sizeof(glm::vec4); + index += 1; + // instance - in_sprite_region_min vertAttrDesc_ui_base[index].binding = 2; vertAttrDesc_ui_base[index].format = VK_FORMAT_R32G32_SFLOAT; -- cgit v1.2.3