From 2c5c2dcb22c0c33a6a640b62290702fc74d2138d Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Mon, 28 Oct 2024 23:24:00 -0600 Subject: [PATCH] More synchronization attempts --- client/Makefile | 6 +++--- client/include/gpu.h | 2 -- client/shader_src/string.comp | 3 --- client/src/draw.c | 4 ++-- client/src/gpu.c | 4 ---- 5 files changed, 5 insertions(+), 14 deletions(-) diff --git a/client/Makefile b/client/Makefile index f769398..8b3485b 100644 --- a/client/Makefile +++ b/client/Makefile @@ -60,10 +60,10 @@ debug: roleplay $(EXTRA_DEBUG_REQUIREMENTS) $(SPV_FILES) $(GDB) roleplay %.vert.spv: %.vert - glslc --target-env=vulkan1.2 -o $@ $< + glslc -o $@ $< %.frag.spv: %.frag - glslc --target-env=vulkan1.2 -o $@ $< + glslc -o $@ $< %.comp.spv: %.comp - glslc --target-env=vulkan1.2 -o $@ $< + glslc -o $@ $< diff --git a/client/include/gpu.h b/client/include/gpu.h index dbbb3c8..a3a1b7c 100644 --- a/client/include/gpu.h +++ b/client/include/gpu.h @@ -28,8 +28,6 @@ #define WINDOW_MIN_WIDTH 800 #define WINDOW_MIN_HEIGHT 600 -extern PFN_vkCmdPipelineBarrier2KHR pVkCmdPipelineBarrier2KHR; - typedef struct GPUBufferStruct { VkBuffer buffers[MAX_FRAMES_IN_FLIGHT]; VmaAllocation memory[MAX_FRAMES_IN_FLIGHT]; diff --git a/client/shader_src/string.comp b/client/shader_src/string.comp index 5ac57f0..302a423 100644 --- a/client/shader_src/string.comp +++ b/client/shader_src/string.comp @@ -1,6 +1,5 @@ #version 450 #extension GL_EXT_buffer_reference : require -#extension GL_EXT_debug_printf : enable #include "ui_common.glsl" @@ -14,8 +13,6 @@ void main() { uint buffer_pos = atomicAdd(pc.layer.draw.instance_count, string.len); vec2 pen = vec2(0.0, 0.0); - debugPrintfEXT("Frame [%d] String[%d] length: %d\n", pc.frame, gID, string.len); - for(uint i = 0; i < string.len; i++) { uint code = pc.layer.codes.c[string.offset + i]; Symbol symbol = font.symbols.s[code]; diff --git a/client/src/draw.c b/client/src/draw.c index eda24c9..99cfcbc 100644 --- a/client/src/draw.c +++ b/client/src/draw.c @@ -83,7 +83,7 @@ VkResult draw_frame( } VK_RESULT(vkEndCommandBuffer(transfer_commands)); - VkPipelineStageFlags wait_stages[] = {VK_PIPELINE_STAGE_ALL_COMMANDS_BIT}; + VkPipelineStageFlags wait_stages[] = {VK_PIPELINE_STAGE_TRANSFER_BIT}; VkSemaphore transfer_signals[] = {context->frame[context->current_frame].transfer}; VkSemaphore transfer_waits[] = {context->frame[context->current_frame].frame}; uint64_t transfer_wait_values[] = {context->frame[context->current_frame].frame_index}; @@ -113,7 +113,7 @@ VkResult draw_frame( VK_RESULT(vkBeginCommandBuffer(compute_commands, &begin_info)); record_ui_compute(compute_commands, ui, context->current_frame); VK_RESULT(vkEndCommandBuffer(compute_commands)); - VkPipelineStageFlags compute_wait_stages[] = {VK_PIPELINE_STAGE_ALL_COMMANDS_BIT}; + VkPipelineStageFlags compute_wait_stages[] = {VK_PIPELINE_STAGE_TRANSFER_BIT | VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT}; context->frame[context->current_frame].compute_index += 1; VkSemaphore compute_signals[] = {context->frame[context->current_frame].compute}; uint64_t compute_signal_values[] = {context->frame[context->current_frame].compute_index}; diff --git a/client/src/gpu.c b/client/src/gpu.c index 1d617c9..6626198 100644 --- a/client/src/gpu.c +++ b/client/src/gpu.c @@ -5,8 +5,6 @@ #include "vk_mem_alloc.h" #include "vulkan/vulkan_core.h" -PFN_vkCmdPipelineBarrier2KHR pVkCmdPipelineBarrier2KHR; - const char * validation_layers[] = { "VK_LAYER_KHRONOS_validation", //"VK_LAYER_LUNARG_api_dump", @@ -885,8 +883,6 @@ VkResult init_vulkan(GLFWwindow* window, RenderContext* context) { VK_RESULT(create_logical_device(context->physical_device, context->surface, &context->graphics_queue, &context->present_queue, &context->transfer_queue, &context->device)); - pVkCmdPipelineBarrier2KHR = (PFN_vkCmdPipelineBarrier2KHR)vkGetDeviceProcAddr(context->device, "vkCmdPipelineBarrier2KHR"); - VK_RESULT(create_memory_allocator(context->instance, context->physical_device, context->device, &context->allocator)); VkCommandPoolCreateInfo extra_pool_info = {