KhronosGroup / KhronosGroup/Vulkan-ValidationLayers

replace state tracker callbacks with state object virtual methods

Open
#4,902 1 comment 0 reactions 0 assignees View on GitHub
Enhancement
Dominant language
C++
Stars
1k
Forks
504
Avg merge
11h 35m
Merged PRs (30d)
224

Description

There are several callback function lists in ValidationStateTracker and CMD_BUFFER_STATE that can be more cleanly implemented as specializations of virtual methods on state objects:

ValidationStateTracker:
```
using SetImageViewInitialLayoutCallback = std::function;
template
void SetSetImageViewInitialLayoutCallback(Fn&& fn) {
set_image_view_initial_layout_callback.reset(new SetImageViewInitialLayoutCallback(std::forward(fn)));
}

void CallSetImageViewInitialLayoutCallback(CMD_BUFFER_STATE* cb_node, const IMAGE_VIEW_STATE& iv_state, VkImageLayout layout) {
if (set_image_view_initial_layout_callback) {
(*set_image_view_initial_layout_callback)(cb_node, iv_state, layout);
}
}
std::unique_ptr set_image_view_initial_layout_callback;

```
CMD_BUFFER_STATE:
```
// Validation functions run at primary CB queue submit time
using QueueCallback = std::function;
std::vector queue_submit_functions;
// Used by some layers to defer actions until vkCmdEndRenderPass time.
// Layers using this are responsible for inserting the callbacks into queue_submit_functions.
std::vector queue_submit_functions_after_render_pass;
// Validation functions run when secondary CB is executed in primary
std::vector>
cmd_execute_commands_functions;
std::vector> eventUpdates;
std::vector>
```

Contributor guide

Open the contributing guide

Research direction

Start by locating ValidationStateTracker and CMD_BUFFER_STATE, then trace the callback declarations, registration helpers, and call sites shown in the issue. The refactor is complete when the listed callback collections are replaced by state-object virtual methods without changing validation behavior; no specific tests are named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.