|
|
|
@ -684,7 +684,7 @@ VkResult create_text_descriptor(VkDevice device, VmaAllocator allocator, VkDescr
|
|
|
|
|
return VK_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VkResult create_ui_descriptor_set(VkDevice device, VmaAllocator allocator, VkExtent2D swapchain_extent, VkDescriptorSetLayout* ui_descriptor_layout, VkDescriptorPool* ui_descriptor_pool, VkDescriptorSet* ui_descriptor_set, VmaAllocation* ui_descriptor_memory, VkBuffer* ui_descriptor_buffer) {
|
|
|
|
|
VkResult create_ui_descriptor_set(VkDevice device, VmaAllocator allocator, VkExtent2D swapchain_extent, vec2 window_scale, VkDescriptorSetLayout* ui_descriptor_layout, VkDescriptorPool* ui_descriptor_pool, VkDescriptorSet* ui_descriptor_set, VmaAllocation* ui_descriptor_memory, VkBuffer* ui_descriptor_buffer) {
|
|
|
|
|
VkDescriptorSetLayoutBinding ui_descriptor_bindings[] = {
|
|
|
|
|
{
|
|
|
|
|
.binding = 0,
|
|
|
|
@ -758,7 +758,7 @@ VkResult create_ui_descriptor_set(VkDevice device, VmaAllocator allocator, VkExt
|
|
|
|
|
}
|
|
|
|
|
UIUniform ui_uniform;
|
|
|
|
|
vec3 screen_offset = {-1.0, -1.0, 0.0};
|
|
|
|
|
vec3 screen_scale = {1.0/(float)swapchain_extent.width, 1.0/(float)swapchain_extent.height, 1.0};
|
|
|
|
|
vec3 screen_scale = {1.0/(float)swapchain_extent.width*window_scale[0], 1.0/(float)swapchain_extent.height*window_scale[1], 1.0};
|
|
|
|
|
glm_mat4_identity(ui_uniform.screen);
|
|
|
|
|
glm_translate(ui_uniform.screen, screen_offset);
|
|
|
|
|
glm_scale(ui_uniform.screen, screen_scale);
|
|
|
|
@ -891,10 +891,10 @@ VkResult create_ui_rect_buffer(VkDevice device, Queue transfer_queue, VkCommandP
|
|
|
|
|
return VK_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VkResult init_pipelines(VkDevice device, VmaAllocator allocator, VkExtent2D swapchain_extent, VkRenderPass render_pass, Queue transfer_queue, VkCommandPool transfer_pool, UIContext* context) {
|
|
|
|
|
VkResult init_pipelines(VkDevice device, VmaAllocator allocator, VkExtent2D swapchain_extent, vec2 window_scale, VkRenderPass render_pass, Queue transfer_queue, VkCommandPool transfer_pool, UIContext* context) {
|
|
|
|
|
|
|
|
|
|
VkResult result;
|
|
|
|
|
result = create_ui_descriptor_set(device, allocator, swapchain_extent, &context->ui_descriptor_layout, &context->ui_descriptor_pool, &context->ui_descriptor_set, &context->ui_descriptor_memory, &context->ui_descriptor_buffer);
|
|
|
|
|
result = create_ui_descriptor_set(device, allocator, swapchain_extent, window_scale, &context->ui_descriptor_layout, &context->ui_descriptor_pool, &context->ui_descriptor_set, &context->ui_descriptor_memory, &context->ui_descriptor_buffer);
|
|
|
|
|
if(result != VK_SUCCESS) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|