Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues with calling resolve_queries multiple times per frame #80

Merged
merged 3 commits into from
Sep 12, 2024

Conversation

Wumpf
Copy link
Owner

@Wumpf Wumpf commented Sep 8, 2024

Turns out there were two issues!

The more glaring one was that wgpu-profiler ignored QUERY_RESOLVE_BUFFER_ALIGNMENT.
This however only happens when calling resolve_queries multiple times a frame: query pools are not shared across frame (sharing across frames would make it impossible to get results of a single frame in unison and would lead to awkward stitching), so the only way to have num_resolved_queries be !=0 is when there's multiple resolves in a single frame.
And sure enough a simple tests catches this!

Looking closer still though it doesn't make sense we ever use any offset at all since the result is right away copied into the "read buffer" which doesn't have such strict alignment criteria (merely wgpu::COPY_BUFFER_ALIGNMENT which is 4). This in turn reveals that HERE we always used an offset of 0 meaning that previous results were overriden 😬
Unfortunately, I don't know how to reliably unit test this part of the issue :(

@Wumpf Wumpf added the bug Something isn't working label Sep 8, 2024
@Wumpf
Copy link
Owner Author

Wumpf commented Sep 12, 2024

Confirmed working here #79 (comment)

@Wumpf Wumpf merged commit 52bf09d into main Sep 12, 2024
1 check passed
@Wumpf Wumpf deleted the fix-resolve-buffer-alignment branch September 12, 2024 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wgpu alignment validation errror on GpuProfiler::resolve_queries
1 participant