diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c index 873fbc1c846..b64ac4c8309 100644 --- a/src/intel/vulkan/anv_allocator.c +++ b/src/intel/vulkan/anv_allocator.c @@ -995,6 +995,7 @@ anv_state_stream_init(struct anv_state_stream *stream, */ stream->next = block_size; + stream->total_size = 0; util_dynarray_init(&stream->all_blocks, NULL); VG(VALGRIND_CREATE_MEMPOOL(stream, 0, false)); @@ -1037,6 +1038,7 @@ anv_state_stream_alloc(struct anv_state_stream *stream, /* Reset back to the start */ stream->next = offset = 0; assert(offset + size <= stream->block.alloc_size); + stream->total_size += block_size; } const bool new_block = stream->next == 0; diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 51a51cf574d..2fa97d23528 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -742,6 +742,9 @@ struct anv_state_stream { /* Offset into the current block at which to allocate the next state */ uint32_t next; + /* Sum of all the blocks in all_blocks */ + uint32_t total_size; + /* List of all blocks allocated from this pool */ struct util_dynarray all_blocks; };