diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-02-28 22:33:58 -0500 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-02-28 22:33:58 -0500 |
| commit | 37347bf7811a5fa42c98e2a19adfee15252ee479 (patch) | |
| tree | 70fe178ad777f52404f51b90c06b8d14ef101276 /src/window.cpp | |
| parent | 85bbecbdebf4f096418aea1cd4f9616f9d97e451 (diff) | |
pke: checkpoint: vk renames + first-pass ui
Renamed pipeline and descriptor names to be more
self-descriptive.
UI work is not done, and will not record.
Needs vulkan items created (buffers).
Diffstat (limited to 'src/window.cpp')
| -rw-r--r-- | src/window.cpp | 230 |
1 files changed, 186 insertions, 44 deletions
diff --git a/src/window.cpp b/src/window.cpp index 6a71fe1..5f04275 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -16,6 +16,7 @@ #include "plugins.hpp" #include "static-cube.hpp" #include "static-missing-texture.hpp" +#include "static-ui.hpp" #include "window-types.hpp" #include "glm/ext/matrix_transform.hpp" @@ -1655,33 +1656,50 @@ void CreateGraphicsPipelines() { .bindingCount = 2, .pBindings = vkDescriptorSetLayoutBindings, }; - vkResult = vkCreateDescriptorSetLayout(vkDevice, &vkDescriptorSetLayoutCreateInfo, vkAllocator, &pkePipelines.descr_layouts.named.texture); + vkResult = vkCreateDescriptorSetLayout(vkDevice, &vkDescriptorSetLayoutCreateInfo, vkAllocator, &pkePipelines.descr_layouts.named.ubo_txtr); assert(vkResult == VK_SUCCESS); - assert(pkePipelines.descr_layouts.named.texture != VK_NULL_HANDLE); + assert(pkePipelines.descr_layouts.named.ubo_txtr != VK_NULL_HANDLE); // no UBO on glyph vkDescriptorSetLayoutBindings[0] = vkDescriptorSetLayoutBindings[1]; vkDescriptorSetLayoutBindings[0].binding = 0; vkDescriptorSetLayoutCreateInfo.bindingCount = 1; - vkResult = vkCreateDescriptorSetLayout(vkDevice, &vkDescriptorSetLayoutCreateInfo, vkAllocator, &pkePipelines.descr_layouts.named.glyph); + vkResult = vkCreateDescriptorSetLayout(vkDevice, &vkDescriptorSetLayoutCreateInfo, vkAllocator, &pkePipelines.descr_layouts.named.txtr); assert(vkResult == VK_SUCCESS); - assert(pkePipelines.descr_layouts.named.glyph != VK_NULL_HANDLE); + assert(pkePipelines.descr_layouts.named.txtr != VK_NULL_HANDLE); + + // no UBO or txtr + // 2025-02-28 JCB + // I'm calling this "base" for now, meaning no bindings. + // There's a good chance this will be toggled on and off as needed. + // At the current moment, I'm using this to start the UI render work. + // There's a good chance the UI shaders will get *a* UBO (for color?). + vkDescriptorSetLayoutCreateInfo.bindingCount = 0; + vkDescriptorSetLayoutCreateInfo.pBindings = VK_NULL_HANDLE; + vkResult = vkCreateDescriptorSetLayout(vkDevice, &vkDescriptorSetLayoutCreateInfo, vkAllocator, &pkePipelines.descr_layouts.named.base); + assert(vkResult == VK_SUCCESS); + assert(pkePipelines.descr_layouts.named.txtr != VK_NULL_HANDLE); + VkPipelineLayoutCreateInfo vkPipelineLayoutCreateInfo { .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, .pNext = nullptr, .flags = 0, .setLayoutCount = 1, - .pSetLayouts = &pkePipelines.descr_layouts.named.texture, + .pSetLayouts = &pkePipelines.descr_layouts.named.ubo_txtr, .pushConstantRangeCount = 0, .pPushConstantRanges = nullptr, }; - vkCreatePipelineLayout(vkDevice, &vkPipelineLayoutCreateInfo, vkAllocator, &pkePipelines.pipe_layouts.named.texture); - assert(pkePipelines.pipe_layouts.named.texture != VK_NULL_HANDLE); + vkCreatePipelineLayout(vkDevice, &vkPipelineLayoutCreateInfo, vkAllocator, &pkePipelines.pipe_layouts.named.ubo_txtr); + assert(pkePipelines.pipe_layouts.named.ubo_txtr != VK_NULL_HANDLE); + + vkPipelineLayoutCreateInfo.pSetLayouts = &pkePipelines.descr_layouts.named.txtr; + vkCreatePipelineLayout(vkDevice, &vkPipelineLayoutCreateInfo, vkAllocator, &pkePipelines.pipe_layouts.named.txtr); + assert(pkePipelines.pipe_layouts.named.txtr != VK_NULL_HANDLE); - vkPipelineLayoutCreateInfo.pSetLayouts = &pkePipelines.descr_layouts.named.glyph; - vkCreatePipelineLayout(vkDevice, &vkPipelineLayoutCreateInfo, vkAllocator, &pkePipelines.pipe_layouts.named.glyph); - assert(pkePipelines.pipe_layouts.named.glyph != VK_NULL_HANDLE); + vkPipelineLayoutCreateInfo.pSetLayouts = &pkePipelines.descr_layouts.named.base; + vkCreatePipelineLayout(vkDevice, &vkPipelineLayoutCreateInfo, vkAllocator, &pkePipelines.pipe_layouts.named.base); + assert(pkePipelines.pipe_layouts.named.base != VK_NULL_HANDLE); } // pipelines @@ -1691,6 +1709,8 @@ void CreateGraphicsPipelines() { AssetHandle textureFragShaderAssetHandle { AM_GetHandle(AssetKey{"pke_txtr_frg\0\0\0"})}; AssetHandle vertGlyphAssetHandle{AM_GetHandle(AssetKey{"pke_glyph_vrt\0\0"})}; AssetHandle fragGlyphAssetHandle { AM_GetHandle(AssetKey{"pke_glyph_frg\0\0"})}; + AssetHandle asset_handle_vert_ui_base { AM_GetHandle(AssetKey{"pke_ui_bs_vrt\0\0"})}; + AssetHandle asset_handle_frag_ui_base { AM_GetHandle(AssetKey{"pke_ui_bs_frg\0\0"})}; const long vertexBindingCount = 4; long index = 0; @@ -1873,6 +1893,83 @@ void CreateGraphicsPipelines() { vkPipelineVertexInputStateCreateInfo_glyph.pVertexAttributeDescriptions = vertAttrDesc_glyph; } + index = 0; + offset = 0; + const long vertexBindingCount_ui_base = 3; + VkVertexInputBindingDescription vertInputBD_ui_base[vertexBindingCount_ui_base]; + const long vertexAttrDescCount_ui_base = 8; + VkVertexInputAttributeDescription vertAttrDesc_ui_base[vertexAttrDescCount_ui_base]; + VkPipelineVertexInputStateCreateInfo vkPipelineVertexInputStateCreateInfo_ui_base{vkPipelineVertexInputStateCreateInfo_txtr}; + { + // vertex - vertex + vertInputBD_ui_base[index].binding = index; + vertInputBD_ui_base[index].stride = sizeof(glm::vec2); + vertInputBD_ui_base[index].inputRate = VK_VERTEX_INPUT_RATE_VERTEX; + index += 1; + + // vertex - UV + vertInputBD_ui_base[index].binding = index; + vertInputBD_ui_base[index].stride = sizeof(glm::vec2); + vertInputBD_ui_base[index].inputRate = VK_VERTEX_INPUT_RATE_VERTEX; + index += 1; + + // instance - total + vertInputBD_ui_base[index].binding = index; + vertInputBD_ui_base[index].stride = 0 + + sizeof(glm::mat4) // pos_scale + + sizeof(glm::vec2) // px_scale + + sizeof(float) // depth + + (sizeof(float) * 1) // padding + + 0; + vertInputBD_ui_base[index].inputRate = VK_VERTEX_INPUT_RATE_INSTANCE; + // index += 1; + + index = 0; + for (long i = 0; i < vertexAttrDescCount_ui_base; ++i) { + vertAttrDesc_ui_base[i].location = i; + } + + // vertex - vertex + vertAttrDesc_ui_base[index].binding = 0; + vertAttrDesc_ui_base[index].format = VK_FORMAT_R32G32_SFLOAT; + vertAttrDesc_ui_base[index].offset = 0; + index += 1; + + // vertex - UV + vertAttrDesc_ui_base[index].binding = 1; + vertAttrDesc_ui_base[index].format = VK_FORMAT_R32G32_SFLOAT; + vertAttrDesc_ui_base[index].offset = 0; + index += 1; + + // instance - pos_scale + for (long i = 0; i < 4; ++i) { + 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; + vertAttrDesc_ui_base[index].offset = offset; + offset += sizeof(glm::vec2); + index += 1; + + // instance - in_sprite_region_min + vertAttrDesc_ui_base[index].binding = 2; + vertAttrDesc_ui_base[index].format = VK_FORMAT_R32_SFLOAT; + vertAttrDesc_ui_base[index].offset = offset; + // offset += sizeof(glm::vec2); + // index += 1; + + vkPipelineVertexInputStateCreateInfo_ui_base.vertexBindingDescriptionCount = vertexBindingCount_ui_base; + vkPipelineVertexInputStateCreateInfo_ui_base.pVertexBindingDescriptions = vertInputBD_ui_base; + vkPipelineVertexInputStateCreateInfo_ui_base.vertexAttributeDescriptionCount = vertexAttrDescCount_ui_base; + vkPipelineVertexInputStateCreateInfo_ui_base.pVertexAttributeDescriptions = vertAttrDesc_ui_base; + } + VkPipelineInputAssemblyStateCreateInfo vkPipelineInputAssemblyStateCreateInfo; vkPipelineInputAssemblyStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; vkPipelineInputAssemblyStateCreateInfo.pNext = nullptr; @@ -1976,10 +2073,14 @@ void CreateGraphicsPipelines() { const Asset *textureFragShaderAsset = AM_Get(textureFragShaderAssetHandle); const Asset *glyphVertShaderAsset = AM_Get(vertGlyphAssetHandle); const Asset *glyphFragShaderAsset = AM_Get(fragGlyphAssetHandle); + const Asset *vert_shader_asset_ui_base = AM_Get(asset_handle_vert_ui_base); + const Asset *frag_shader_asset_ui_base = AM_Get(asset_handle_frag_ui_base); assert(textureVertShaderAsset != nullptr && textureVertShaderAsset->state == PKE_ASSET_LOADING_STATE_LOADED); assert(textureFragShaderAsset != nullptr && textureFragShaderAsset->state == PKE_ASSET_LOADING_STATE_LOADED); assert(glyphVertShaderAsset != nullptr && glyphVertShaderAsset->state == PKE_ASSET_LOADING_STATE_LOADED); assert(glyphFragShaderAsset != nullptr && glyphFragShaderAsset->state == PKE_ASSET_LOADING_STATE_LOADED); + assert(vert_shader_asset_ui_base != nullptr && vert_shader_asset_ui_base->state == PKE_ASSET_LOADING_STATE_LOADED); + assert(frag_shader_asset_ui_base != nullptr && frag_shader_asset_ui_base->state == PKE_ASSET_LOADING_STATE_LOADED); VkPipelineShaderStageCreateInfo vkPipelineShaderStageCreateInfo_txtr[2]; for (long i = 0; i < 2; ++i) { @@ -2001,9 +2102,19 @@ void CreateGraphicsPipelines() { } vkPipelineShaderStageCreateInfo_glyph[0].stage = VK_SHADER_STAGE_VERTEX_BIT; vkPipelineShaderStageCreateInfo_glyph[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT; + VkPipelineShaderStageCreateInfo vkPipelineShaderStageCreateInfo_ui_base[2]; + for (long i = 0; i < 2; ++i) { + vkPipelineShaderStageCreateInfo_ui_base[i].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; + vkPipelineShaderStageCreateInfo_ui_base[i].pNext = nullptr; + vkPipelineShaderStageCreateInfo_ui_base[i].flags = {}; + vkPipelineShaderStageCreateInfo_ui_base[i].pName = "main"; + vkPipelineShaderStageCreateInfo_ui_base[i].pSpecializationInfo = nullptr; + } + vkPipelineShaderStageCreateInfo_ui_base[0].stage = VK_SHADER_STAGE_VERTEX_BIT; + vkPipelineShaderStageCreateInfo_ui_base[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT; - VkGraphicsPipelineCreateInfo vkGraphicsPipelineCreateInfo[3]; - for (long i = 0; i < 3; ++i) { + VkGraphicsPipelineCreateInfo vkGraphicsPipelineCreateInfo[4]; + for (long i = 0; i < 4; ++i) { vkGraphicsPipelineCreateInfo[i].sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; vkGraphicsPipelineCreateInfo[i].pNext = nullptr; vkGraphicsPipelineCreateInfo[i].flags = {}; @@ -2020,48 +2131,61 @@ void CreateGraphicsPipelines() { vkGraphicsPipelineCreateInfo[i].basePipelineIndex = {}; } - vkGraphicsPipelineCreateInfo[0].layout = pkePipelines.pipe_layouts.named.texture; - vkGraphicsPipelineCreateInfo[1].layout = pkePipelines.pipe_layouts.named.texture; - vkGraphicsPipelineCreateInfo[2].layout = pkePipelines.pipe_layouts.named.glyph; + vkGraphicsPipelineCreateInfo[0].layout = pkePipelines.pipe_layouts.named.ubo_txtr; + vkGraphicsPipelineCreateInfo[1].layout = pkePipelines.pipe_layouts.named.ubo_txtr; + vkGraphicsPipelineCreateInfo[2].layout = pkePipelines.pipe_layouts.named.txtr; + vkGraphicsPipelineCreateInfo[3].layout = pkePipelines.pipe_layouts.named.base; vkGraphicsPipelineCreateInfo[0].renderPass = pkvk_3d.render_pass; vkGraphicsPipelineCreateInfo[1].renderPass = pkvk_3d.render_pass; vkGraphicsPipelineCreateInfo[2].renderPass = pkvk_2d.render_pass; + vkGraphicsPipelineCreateInfo[3].renderPass = pkvk_2d.render_pass; vkGraphicsPipelineCreateInfo[0].pVertexInputState = &vkPipelineVertexInputStateCreateInfo_txtr; vkGraphicsPipelineCreateInfo[1].pVertexInputState = &vkPipelineVertexInputStateCreateInfo_txtr; vkGraphicsPipelineCreateInfo[2].pVertexInputState = &vkPipelineVertexInputStateCreateInfo_glyph; + vkGraphicsPipelineCreateInfo[3].pVertexInputState = &vkPipelineVertexInputStateCreateInfo_ui_base; vkGraphicsPipelineCreateInfo[0].pRasterizationState = &vkPipelineRasterizationStateCreateInfoFill; vkGraphicsPipelineCreateInfo[1].pRasterizationState = &vkPipelineRasterizationStateCreateInfoLine; vkGraphicsPipelineCreateInfo[2].pRasterizationState = &vkPipelineRasterizationStateCreateInfoFill; + vkGraphicsPipelineCreateInfo[3].pRasterizationState = &vkPipelineRasterizationStateCreateInfoFill; vkGraphicsPipelineCreateInfo[0].pStages = vkPipelineShaderStageCreateInfo_txtr; vkGraphicsPipelineCreateInfo[1].pStages = vkPipelineShaderStageCreateInfo_txtr; vkGraphicsPipelineCreateInfo[2].pStages = vkPipelineShaderStageCreateInfo_glyph; + vkGraphicsPipelineCreateInfo[3].pStages = vkPipelineShaderStageCreateInfo_ui_base; // deffered shader creation vkPipelineShaderStageCreateInfo_txtr[0].module = UploadShader(vertShaderAssetHandle); vkPipelineShaderStageCreateInfo_txtr[1].module = UploadShader(textureFragShaderAssetHandle); vkPipelineShaderStageCreateInfo_glyph[0].module = UploadShader(vertGlyphAssetHandle); vkPipelineShaderStageCreateInfo_glyph[1].module = UploadShader(fragGlyphAssetHandle); + vkPipelineShaderStageCreateInfo_ui_base[0].module = UploadShader(asset_handle_vert_ui_base); + vkPipelineShaderStageCreateInfo_ui_base[1].module = UploadShader(asset_handle_frag_ui_base); - vkResult = vkCreateGraphicsPipelines(vkDevice, VK_NULL_HANDLE, 1, &vkGraphicsPipelineCreateInfo[0], vkAllocator, &pkePipelines.pipelines.named.texture); + vkResult = vkCreateGraphicsPipelines(vkDevice, VK_NULL_HANDLE, 1, &vkGraphicsPipelineCreateInfo[0], vkAllocator, &pkePipelines.pipelines.named.entity_standard); + assert(vkResult == VK_SUCCESS); + vkResult = vkCreateGraphicsPipelines(vkDevice, VK_NULL_HANDLE, 1, &vkGraphicsPipelineCreateInfo[1], vkAllocator, &pkePipelines.pipelines.named.entity_wireframe); assert(vkResult == VK_SUCCESS); - vkResult = vkCreateGraphicsPipelines(vkDevice, VK_NULL_HANDLE, 1, &vkGraphicsPipelineCreateInfo[1], vkAllocator, &pkePipelines.pipelines.named.texture_wireframe); + vkResult = vkCreateGraphicsPipelines(vkDevice, VK_NULL_HANDLE, 1, &vkGraphicsPipelineCreateInfo[2], vkAllocator, &pkePipelines.pipelines.named.font_glyph); assert(vkResult == VK_SUCCESS); - vkResult = vkCreateGraphicsPipelines(vkDevice, VK_NULL_HANDLE, 1, &vkGraphicsPipelineCreateInfo[2], vkAllocator, &pkePipelines.pipelines.named.glyph); + vkResult = vkCreateGraphicsPipelines(vkDevice, VK_NULL_HANDLE, 1, &vkGraphicsPipelineCreateInfo[3], vkAllocator, &pkePipelines.pipelines.named.ui_base); assert(vkResult == VK_SUCCESS); - assert(pkePipelines.pipelines.named.texture != VK_NULL_HANDLE); - assert(pkePipelines.pipelines.named.texture_wireframe != VK_NULL_HANDLE); - assert(pkePipelines.pipelines.named.glyph != VK_NULL_HANDLE); + assert(pkePipelines.pipelines.named.entity_standard != VK_NULL_HANDLE); + assert(pkePipelines.pipelines.named.entity_wireframe != VK_NULL_HANDLE); + assert(pkePipelines.pipelines.named.font_glyph != VK_NULL_HANDLE); + assert(pkePipelines.pipelines.named.ui_base != VK_NULL_HANDLE); for (long i = 0; i < 2; ++i) { vkDestroyShaderModule(vkDevice, vkPipelineShaderStageCreateInfo_txtr[i].module, vkAllocator); vkDestroyShaderModule(vkDevice, vkPipelineShaderStageCreateInfo_glyph[i].module, vkAllocator); + vkDestroyShaderModule(vkDevice, vkPipelineShaderStageCreateInfo_ui_base[i].module, vkAllocator); } // reverse order + AM_Release(asset_handle_frag_ui_base); + AM_Release(asset_handle_vert_ui_base); AM_Release(fragGlyphAssetHandle); AM_Release(vertGlyphAssetHandle); AM_Release(vertShaderAssetHandle); @@ -2483,7 +2607,7 @@ void UpdateDebugGraphicsPipeline() { VkDescriptorSetLayout *descriptorSets = pk_new<VkDescriptorSetLayout>(swapchainLength); for (long i = 0; i < swapchainLength; ++i) { - descriptorSets[i] = pkePipelines.descr_layouts.named.texture; + descriptorSets[i] = pkePipelines.descr_layouts.named.ubo_txtr; } VkDescriptorSetAllocateInfo vkDescriptorSetAllocateInfo; vkDescriptorSetAllocateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; @@ -2706,8 +2830,8 @@ void RecordCommandBuffer(VkCommandBuffer commandBuffer, uint32_t imageIndex) { vkCmdDrawIndexed(commandBuffer, binder->indexCount, binder->instanceCounter, 0, 0, 0); if (pkeSettings.isRenderingDebug) { - vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pkePipelines.pipelines.named.texture_wireframe); - vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pkePipelines.pipe_layouts.named.texture, 0, 1, &pkeDebugHitbox.vkDescriptorSets[imageIndex], 0, {}); + vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pkePipelines.pipelines.named.entity_wireframe); + vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pkePipelines.pipe_layouts.named.ubo_txtr, 0, 1, &pkeDebugHitbox.vkDescriptorSets[imageIndex], 0, {}); vkCmdBindVertexBuffers(commandBuffer, binder->physVertBD.firstBinding, 1, &binder->physVertBD.buffer, binder->physVertBD.offsets); vkCmdBindVertexBuffers(commandBuffer, binder->physNormBD.firstBinding, 1, &binder->physNormBD.buffer, binder->physVertBD.offsets); @@ -2720,8 +2844,8 @@ void RecordCommandBuffer(VkCommandBuffer commandBuffer, uint32_t imageIndex) { } if (pkeDebugHitbox.instanceBuffer != VK_NULL_HANDLE) { - vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pkePipelines.pipelines.named.texture_wireframe); - vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pkePipelines.pipe_layouts.named.texture, 0, 1, &pkeDebugHitbox.vkDescriptorSets[imageIndex], 0, {}); + vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pkePipelines.pipelines.named.entity_wireframe); + vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pkePipelines.pipe_layouts.named.ubo_txtr, 0, 1, &pkeDebugHitbox.vkDescriptorSets[imageIndex], 0, {}); vkCmdBindVertexBuffers(commandBuffer, 0, 1, &UniformBuffers[imageIndex], offsets); // TODO don't hardcode firstBinding @@ -2747,6 +2871,18 @@ void RecordCommandBuffer(VkCommandBuffer commandBuffer, uint32_t imageIndex) { vkCmdSetScissor(commandBuffer, 0, 1, &scissor); // 2d overlay grbinds + if (false) + { + pke_ui_graphics_bindings *ui_gr = pke_ui_get_graphics_bindings(); + vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pkePipelines.pipelines.named.ui_base); + vkCmdBindIndexBuffer(commandBuffer, ui_gr->bd_index.buffer, ui_gr->bd_index.offsets[0], VK_INDEX_TYPE_UINT16); + vkCmdBindVertexBuffers(commandBuffer, ui_gr->bd_vertex.firstBinding, ui_gr->bd_vertex.bindingCount, &ui_gr->bd_vertex.buffer, ui_gr->bd_vertex.offsets); + vkCmdBindVertexBuffers(commandBuffer, ui_gr->bd_uv.firstBinding, ui_gr->bd_uv.bindingCount, &ui_gr->bd_uv.buffer, ui_gr->bd_uv.offsets); + vkCmdBindVertexBuffers(commandBuffer, ui_gr->bd_instance.firstBinding, ui_gr->bd_instance.bindingCount, &ui_gr->bd_instance.buffer, ui_gr->bd_instance.offsets); + vkCmdDrawIndexed(commandBuffer, ui_gr->index_count, ui_gr->instance_counter, 0, 0, 0); + } + + // 2d - font glyphs FontTypeIndex count; FontType *fts = FontType_GetFonts(count); for (FontTypeIndex i = FontTypeIndex{0}; i < count; ++i) @@ -2754,9 +2890,9 @@ void RecordCommandBuffer(VkCommandBuffer commandBuffer, uint32_t imageIndex) { FontType *ft = &fts[(FontTypeIndex_T)i]; if (ft->bindings.instanceCounter == 0) continue; - vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pkePipelines.pipelines.named.glyph); + vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pkePipelines.pipelines.named.font_glyph); - vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pkePipelines.pipe_layouts.named.glyph, 0, 1, &ft->gr.vkDescriptorSet, 0, {}); + vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pkePipelines.pipe_layouts.named.txtr, 0, 1, &ft->gr.vkDescriptorSet, 0, {}); vkCmdBindIndexBuffer(commandBuffer, ft->bindings.indexBD.buffer, ft->bindings.indexBD.offsets[0], VK_INDEX_TYPE_UINT16); vkCmdBindVertexBuffers(commandBuffer, ft->bindings.vertexBD.firstBinding, ft->bindings.vertexBD.bindingCount, &ft->bindings.vertexBD.buffer, ft->bindings.vertexBD.offsets); @@ -3090,22 +3226,28 @@ void DestroyWindow() { vkDestroyImage(vkDevice, pkeDebugHitbox.vkImage, vkAllocator); vkFreeMemory(vkDevice, pkeDebugHitbox.textureMemory, vkAllocator); - if (pkePipelines.pipelines.named.texture != VK_NULL_HANDLE) - vkDestroyPipeline(vkDevice, pkePipelines.pipelines.named.texture, vkAllocator); - if (pkePipelines.pipelines.named.texture_wireframe != VK_NULL_HANDLE) - vkDestroyPipeline(vkDevice, pkePipelines.pipelines.named.texture_wireframe, vkAllocator); - if (pkePipelines.pipelines.named.glyph != VK_NULL_HANDLE) - vkDestroyPipeline(vkDevice, pkePipelines.pipelines.named.glyph, vkAllocator); - - if (pkePipelines.pipe_layouts.named.texture != VK_NULL_HANDLE) - vkDestroyPipelineLayout(vkDevice, pkePipelines.pipe_layouts.named.texture, vkAllocator); - if (pkePipelines.pipe_layouts.named.glyph != VK_NULL_HANDLE) - vkDestroyPipelineLayout(vkDevice, pkePipelines.pipe_layouts.named.glyph, vkAllocator); - - if (pkePipelines.descr_layouts.named.texture != VK_NULL_HANDLE) - vkDestroyDescriptorSetLayout(vkDevice, pkePipelines.descr_layouts.named.texture, vkAllocator); - if (pkePipelines.descr_layouts.named.glyph != VK_NULL_HANDLE) - vkDestroyDescriptorSetLayout(vkDevice, pkePipelines.descr_layouts.named.glyph, vkAllocator); + if (pkePipelines.pipelines.named.entity_standard != VK_NULL_HANDLE) + vkDestroyPipeline(vkDevice, pkePipelines.pipelines.named.entity_standard, vkAllocator); + if (pkePipelines.pipelines.named.entity_wireframe != VK_NULL_HANDLE) + vkDestroyPipeline(vkDevice, pkePipelines.pipelines.named.entity_wireframe, vkAllocator); + if (pkePipelines.pipelines.named.font_glyph != VK_NULL_HANDLE) + vkDestroyPipeline(vkDevice, pkePipelines.pipelines.named.font_glyph, vkAllocator); + if (pkePipelines.pipelines.named.ui_base != VK_NULL_HANDLE) + vkDestroyPipeline(vkDevice, pkePipelines.pipelines.named.ui_base, vkAllocator); + + if (pkePipelines.pipe_layouts.named.ubo_txtr != VK_NULL_HANDLE) + vkDestroyPipelineLayout(vkDevice, pkePipelines.pipe_layouts.named.ubo_txtr, vkAllocator); + if (pkePipelines.pipe_layouts.named.txtr != VK_NULL_HANDLE) + vkDestroyPipelineLayout(vkDevice, pkePipelines.pipe_layouts.named.txtr, vkAllocator); + if (pkePipelines.pipe_layouts.named.base != VK_NULL_HANDLE) + vkDestroyPipelineLayout(vkDevice, pkePipelines.pipe_layouts.named.base, vkAllocator); + + if (pkePipelines.descr_layouts.named.ubo_txtr != VK_NULL_HANDLE) + vkDestroyDescriptorSetLayout(vkDevice, pkePipelines.descr_layouts.named.ubo_txtr, vkAllocator); + if (pkePipelines.descr_layouts.named.txtr != VK_NULL_HANDLE) + vkDestroyDescriptorSetLayout(vkDevice, pkePipelines.descr_layouts.named.txtr, vkAllocator); + if (pkePipelines.descr_layouts.named.base != VK_NULL_HANDLE) + vkDestroyDescriptorSetLayout(vkDevice, pkePipelines.descr_layouts.named.base, vkAllocator); DestroySyncObjects(); |
