From 1354bb1a8161b5bf949f56eb0b8aeb7afcba6695 Mon Sep 17 00:00:00 2001 From: Ivan 'provod' Avdeev Date: Tue, 10 Dec 2024 12:29:16 -0500 Subject: [PATCH] vk: minor metadata and things update Update TODO with latest state. Fixup staging write-after-write buffer tracking. Fixes #743 -- was fixed a couple of commits ago. --- ref/vk/TODO.md | 37 ++++++++++++++++++++++++++----------- ref/vk/vk_buffer.c | 1 - ref/vk/vk_combuf.c | 5 +++-- ref/vk/vk_core.c | 9 --------- ref/vk/vk_scene.c | 1 - 5 files changed, 29 insertions(+), 24 deletions(-) diff --git a/ref/vk/TODO.md b/ref/vk/TODO.md index 74fc3e745..9bd7408de 100644 --- a/ref/vk/TODO.md +++ b/ref/vk/TODO.md @@ -1,24 +1,39 @@ ## Next +- [ ] Proper staging-vs-frame tracking, replace tag with something sensitive + - currently assert fails because there's 2 frame latency, not one. + - [ ] comment for future: full staging might want to wait for previous frame to finish + +## Upcoming +- [ ] framectl frame tracking, e.g.: + - [ ] wait for frame fence only really before actually starting to build combuf in R_BeginFrame() + - why: there should be nothing to synchronize with + - why: more straightforward dependency tracking +- [ ] Remove second semaphore from submit, replace it with explicit barriers for e.g. geom buffer + - why: best practice validation complains about too wide ALL_COMMANDS semaphore + - why: explicit barriers are more clear, better perf possible too + - [ ] Do not lose barrier-tracking state between frames - [ ] Render graph - [ ] performance profiling and comparison +## 2024-12-10 E383 +- [x] Add transfer stage to submit semaphore separating command buffer: fixes sync for rt +- [x] Issue staging commit for a bunch of RT buffers (likely not all of them) +- [ ] Go through all staged buffers and make sure that they are committed +- [x] move destination buffer tracking to outside of staging: + - [x] vk_geometry + - [x] vk_light: grid, metadata + - [x] vk_ray_accel: TLAS geometries + - [x] vk_ray_model: kusochki +- [x] staging should not be aware of cmdbuf either + - [x] `R_VkStagingCommit()`: -- removed + - [x] `R_VkStagingGetCommandBuffer()` -- removed + ## 2024-05-24 E379 - [ ] refactor staging: - [ ] move destination image tracking to outside of staging - [x] vk_image ← vk_texture (E380) - [x] implement generic staging regions (E380) - [ ] implement stricter staging regions tracking - - [ ] move destination buffer tracking to outside of staging: - - [ ] vk_geometry - - [ ] vk_light: grid, metadata - - [ ] vk_ray_accel: TLAS geometries - - [ ] vk_ray_model: kusochki - - [ ] staging should not be aware of cmdbuf either - - [ ] `R_VkStagingCommit()`: - - [ ] vk_image - - [ ] vk_ray_accel - - [ ] `R_VkStagingGetCommandBuffer()` - - [ ] vk_image ## 2024-05-07 E376 - [ ] resource manager diff --git a/ref/vk/vk_buffer.c b/ref/vk/vk_buffer.c index d38f8bb39..57188a43c 100644 --- a/ref/vk/vk_buffer.c +++ b/ref/vk/vk_buffer.c @@ -226,4 +226,3 @@ void R_VkBufferStagingCommit(vk_buffer_t *buf, struct vk_combuf_s *combuf) { //FIXME R_VkCombufScopeEnd(combuf, begin_index, VK_PIPELINE_STAGE_TRANSFER_BIT); } - diff --git a/ref/vk/vk_combuf.c b/ref/vk/vk_combuf.c index f4e8ca505..118004727 100644 --- a/ref/vk/vk_combuf.c +++ b/ref/vk/vk_combuf.c @@ -313,11 +313,12 @@ void R_VkCombufIssueBarrier(vk_combuf_t* combuf, r_vkcombuf_barrier_t bar) { buf->sync.write.access = bufbar->access; buf->sync.write.stage = bar.stage; - // If there were no previous reads, there no reason to synchronize with anything - if (buf->sync.read.stage == 0) + // If there were no previous reads or writes, there no reason to synchronize with anything + if (bmb.srcStageMask == 0) continue; // Reset read state + // TOOD is_read? for read-and-write buf->sync.read.access = 0; buf->sync.read.stage = 0; } diff --git a/ref/vk/vk_core.c b/ref/vk/vk_core.c index 885933076..3df2cab69 100644 --- a/ref/vk/vk_core.c +++ b/ref/vk/vk_core.c @@ -126,15 +126,6 @@ static VkBool32 VKAPI_PTR debugCallback( if (Q_strcmp(pCallbackData->pMessageIdName, "VUID-vkMapMemory-memory-00683") == 0) return VK_FALSE; - // FIXME: remove this when new buffer staging is done, see https://github.com/w23/xash3d-fwgs/issues/743 - // For now, ignore a firehose of "inefficient srcStageMask using VK_PIPELINE_STAGE_ALL_COMMANDS_BIT" messages. - if (Q_strcmp(pCallbackData->pMessageIdName, "BestPractices-pipeline-stage-flags-compute") == 0) - return VK_FALSE; - - /* if (messageSeverity != VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) { */ - /* gEngine.Con_Printf(S_WARN "Validation: %s\n", pCallbackData->pMessage); */ - /* } */ - // TODO better messages, not only errors, what are other arguments for, ... if (messageSeverity == VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) { gEngine.Con_Printf(S_ERROR "vk/dbg: %s\n", pCallbackData->pMessage); diff --git a/ref/vk/vk_scene.c b/ref/vk/vk_scene.c index c16afdc02..6de06bbae 100644 --- a/ref/vk/vk_scene.c +++ b/ref/vk/vk_scene.c @@ -1,6 +1,5 @@ #include "vk_scene.h" #include "vk_brush.h" -#include "vk_staging.h" #include "vk_studio.h" #include "vk_lightmap.h" #include "vk_const.h"