Skip to content

Use additional command buffers to reset query pools. - #280

Open
lstalmir wants to merge 1 commit into
masterfrom
feature/query-reset
Open

lstalmir wants to merge 1 commit into
masterfrom
feature/query-reset

Conversation

@lstalmir

@lstalmir lstalmir commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Decoupling query pool resets from the profiled command buffers allows to dynamically allocate the pools inside render passes, and later suballocate and reuse them between multiple command buffers.

Decoupling query pool resets from the profiled command buffers allows to dynamically allocate the pools inside render passes, and later suballocate and reuse them between multiple command buffers.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Repeated command-buffer execution, reset-failure handling, pending-resource cleanup, and submission synchronization contain correctness issues.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Decouples query-pool resets from profiled command buffers by issuing internal reset command buffers during queue submission.

Changes:

  • Splits submission processing into batch creation, preparation, and aggregation.
  • Tracks internal reset/copy resources per submit batch.
  • Moves query-pool reset commands out of application command buffers.
File summaries
File Description
profiler.h Updates submission-processing APIs.
profiler.cpp Builds and processes per-frame submit batches.
profiler_data_aggregator.h Extends submit-batch state for internal commands.
profiler_data_aggregator.cpp Records, submits, and cleans up reset commands.
profiler_command_buffer.h Exposes query-pool resetting.
profiler_command_buffer.cpp Resets pools associated with command buffers.
profiler_command_buffer_query_pool.h Declares deferred reset support.
profiler_command_buffer_query_pool.cpp Moves resets from recording to submission.
VkSynchronization2Khr_functions.cpp Integrates batching into KHR submission.
VkQueue_functions.cpp Integrates batching into core submissions.
Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 5
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +1451 to +1452
auto DeviceProfiler::GetSubmitBatchesImpl( VkQueue queue, uint32_t submitCount, const SubmitInfoT* pSubmits )
-> DeviceProfilerSubmitBatchesPerFrame
Comment on lines +1525 to +1528
submitBatch.m_pSubmittedCommandBuffers.insert( pProfilerCommandBuffer );
submitBatch.m_pSubmittedCommandBuffers.insert(
pSecondaryCommandBuffers.begin(),
pSecondaryCommandBuffers.end() );
Comment on lines +1302 to +1305
if( submitBatch.m_QueryResetCommandBuffer )
{
assert( submitBatch.m_pInternalCommandPool != nullptr );
std::unique_lock commandPoolLock( submitBatch.m_pInternalCommandPool->GetMutex() );
Comment on lines +1073 to +1078

for( ProfilerCommandBuffer* pSecondaryCommandBuffer : m_pSecondaryCommandBuffers )
{
pSecondaryCommandBuffer->ResetQueryPools( commandBuffer );
}
}
Comment on lines +339 to +343
bool succeeded = ResetQueryPools( submitBatch );
if( !succeeded )
{
submitBatch.m_pSubmittedCommandBuffers.insert(
_submit.m_pCommandBuffers.begin(),
_submit.m_pCommandBuffers.end() );

// Track secondary command buffers as well.
for( const ProfilerCommandBuffer* pCommandBuffer : _submit.m_pCommandBuffers )
{
const std::unordered_set<ProfilerCommandBuffer*>& pSecondaryCommandBuffers =
pCommandBuffer->GetSecondaryCommandBuffers();

submitBatch.m_pSubmittedCommandBuffers.insert(
pSecondaryCommandBuffers.begin(),
pSecondaryCommandBuffers.end() );
}
FreeDynamicAllocations( submitBatch );
return;
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