Skip to content

Commit

Permalink
vk: minor metadata and things update
Browse files Browse the repository at this point in the history
Update TODO with latest state.

Fixup staging write-after-write buffer tracking.

Fixes #743 -- was fixed a couple of commits ago.
  • Loading branch information
w23 committed Dec 10, 2024
1 parent 485e986 commit 1354bb1
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 24 deletions.
37 changes: 26 additions & 11 deletions ref/vk/TODO.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion ref/vk/vk_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

5 changes: 3 additions & 2 deletions ref/vk/vk_combuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
9 changes: 0 additions & 9 deletions ref/vk/vk_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion ref/vk/vk_scene.c
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 1354bb1

Please sign in to comment.