diff --git a/client/shader_src/ui_text.comp b/client/shader_src/ui_text.comp index 5578177..3b38843 100644 --- a/client/shader_src/ui_text.comp +++ b/client/shader_src/ui_text.comp @@ -38,11 +38,7 @@ layout(buffer_reference, std430) readonly buffer Strings{ String strings[]; }; -layout(set = 0, binding = 0) uniform UIUniform { - mat4 screen; -} ubo; - -layout(set = 1, binding = 0) uniform Font { +layout(set = 0, binding = 0) uniform Font { uint num_symbols; uint width; uint height; diff --git a/client/src/pipeline.c b/client/src/pipeline.c index 0844b2e..2d1603d 100644 --- a/client/src/pipeline.c +++ b/client/src/pipeline.c @@ -181,7 +181,7 @@ VkResult create_ui_pipeline( .pMultisampleState = &multisample_info, .layout = pipeline->layout, .renderPass = render_pass, - .subpass = 0, + .subpass = 1, .basePipelineHandle = VK_NULL_HANDLE, .basePipelineIndex = -1, }; @@ -304,10 +304,14 @@ VkResult create_ui_text_pipeline(VkDevice device, VkRenderPass render_pass, VkDe .size = 8, }; + VkDescriptorSetLayout compute_descriptors[] = {font_layout}; + VkPipelineLayoutCreateInfo compute_layout_info = { .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, .pushConstantRangeCount = 1, .pPushConstantRanges = &push_constant, + .setLayoutCount = sizeof(compute_descriptors)/sizeof(VkDescriptorSetLayout), + .pSetLayouts = compute_descriptors, }; result = vkCreatePipelineLayout(device, &compute_layout_info, NULL, &compute->layout); diff --git a/client/src/render.c b/client/src/render.c index ef5c9bd..aa714b5 100644 --- a/client/src/render.c +++ b/client/src/render.c @@ -1026,6 +1026,18 @@ VkResult draw_frame(RenderContext* context, UIContext* ui_context, UILayer* ui_l .clearValueCount = 2, .pClearValues = clear_values, }; + + // UI strings compute pass + vkCmdBindPipeline(command_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, ui_context->ui_compute_text.pipeline); + for(uint32_t i = 0; i < ui_layer_count; i ++) { + if(ui_layers[i].text_count > 0) { + vkCmdBindDescriptorSets(command_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, ui_context->ui_compute_text.layout, 0, 1, &ui_layers[i].font.set, 0, NULL); + vkCmdDispatch(command_buffer, 1, 1, 1); + } + } + vkCmdDispatch(command_buffer, 1, 1, 1); + + // Render Pass vkCmdBeginRenderPass(command_buffer, &render_pass_begin, VK_SUBPASS_CONTENTS_INLINE); // World subpass