Skip to content

Conversation

@cqundefine
Copy link
Contributor

This is a split off from #6976 to make the amount of changes in one PR smaller and this being part being useful for other people.

VkDebugUtilsMessengerCallbackDataEXT const* pCallbackData,
void*) {
dbgln("Vulkan validation layer: {}", pCallbackData->pMessage);
// NOTE: The 11 comes from how many frames there are to skip including dump_backtrace, libVkLayer_khronos_validation and libvulkan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

11 might not always work on all platforms due to optimizations / inlining and such, maybe dial it back to 8 to be safe.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a better solution is to just not cut any frames to not risk cutting too much or too little, and just leave it as is, it's only a debugging tool afterwards.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay!

find_all_source_files "$@"
fi \
| xargs grep -E '(_DEBUG|DEBUG_)' \
| grep -v 'VK_' \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of doing this, why not add the false positives at the end of the Meta/CMake/all_the_debug_macros.cmake file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this solution is much cleaner, as we shouldn't be setting some random values in CMake just to make a linting script happy.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand, but won't the grep you are using match anything with VK_ in it, could this cause some debugs to be missed.

@rcorsi
Copy link
Contributor

rcorsi commented Jan 2, 2026

Glad you made this.

While waiting I also did my best to forward port it, seems to work well for me.

master...rcorsi:ladybird:vulkan_layer_validation

@cqundefine cqundefine force-pushed the vulkan_validation_layer branch 2 times, most recently from 215507e to 4c71ac3 Compare January 2, 2026 00:13
This allows to easily toggle Vulkan validation layers which can be
really helpful while debugging Vulkan code.
This just filters any of the "VK_*" defines that were mistaken for our
debug macros, for example VK_EXT_DEBUG_UTILS_EXTENSION_NAME.
@cqundefine cqundefine force-pushed the vulkan_validation_layer branch from 4c71ac3 to 9119eae Compare January 2, 2026 00:13
Array<char const*, 1> extensions = { VK_EXT_DEBUG_UTILS_EXTENSION_NAME };

bool validation_layer_available = check_layer_support("VK_LAYER_KHRONOS_validation"sv);
if (!validation_layer_available) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of this big if statement

dbgln("Vulkan validation layers: {}", validation_layer_available ? "active"sv : "not available"sv);

@rcorsi
Copy link
Contributor

rcorsi commented Jan 2, 2026

You have two commits, probably you are keeping the same ones as the original PR. I think it is probably best to combine everything in one commit as they all work together, and won't be used separately anyway.

@rcorsi
Copy link
Contributor

rcorsi commented Jan 2, 2026

Commit message "LibGfx: Add a debug macro to enable Vulkan validations layers", it should be validation in singular form. All the changes should be under this commit.

@rcorsi
Copy link
Contributor

rcorsi commented Jan 2, 2026

I created a small section in Documentation/AdvancedBuildInstructions.md to document the usage, see my branch

master...rcorsi:ladybird:vulkan_layer_validation

If you like it, feel free to copy it in.

@cqundefine
Copy link
Contributor Author

I created a small section in Documentation/AdvancedBuildInstructions.md to document the usage, see my branch

master...rcorsi:ladybird:vulkan_layer_validation

If you like it, feel free to copy it in.

Honestly, looking at your branch it looks to be in a much cleaner state, so if you would be willing to PR that, I could just close this PR and we could just use your version.

@cqundefine cqundefine marked this pull request as draft January 2, 2026 13:07
@rcorsi
Copy link
Contributor

rcorsi commented Jan 2, 2026

Okay, I don't mind, even though yours and mine were starting to blend together slowly. Its always a bit interesting to see two implementations and where they differ, and sometimes you can even catch some bugs in both implementations and have nice improvements in each.

I'll leave you as the author on my commit and I'll be Co-authored-by. Will PR it soon.

@cqundefine
Copy link
Contributor Author

Superseded by #7302

@cqundefine cqundefine closed this Jan 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants