summaryrefslogtreecommitdiffstats
path: root/src/vulkan/anv_allocator.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-10-02 16:24:42 -0700
committerJason Ekstrand <[email protected]>2015-10-02 16:24:42 -0700
commit10f97718c353e101c64fa60fcde91e1550e39957 (patch)
treeabdf97065fa7f22f0eeebea88ea8fb88ab8d7a3f /src/vulkan/anv_allocator.c
parent002e7b0cc3c34c626fede219903b8b086a14ae5a (diff)
anv/allocator: Add a sanity assertion in state stream finish.
We assert that the block offset we got while walking the list of blocks is actually a multiple of the block size. If something goes wrong and the GPU decides to stomp on the surface state buffer we can end up getting corruptions in our list of blocks. This assertion makes such corruptions a crash with a meaningful message rather than an infinite loop.
Diffstat (limited to 'src/vulkan/anv_allocator.c')
-rw-r--r--src/vulkan/anv_allocator.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/vulkan/anv_allocator.c b/src/vulkan/anv_allocator.c
index 05126305b51..db04a2c236c 100644
--- a/src/vulkan/anv_allocator.c
+++ b/src/vulkan/anv_allocator.c
@@ -697,6 +697,7 @@ anv_state_stream_finish(struct anv_state_stream *stream)
block = stream->current_block;
while (block != NULL_BLOCK) {
+ assert(block % stream->block_pool->block_size == 0);
sb = stream->block_pool->map + block;
next_block = VG_NOACCESS_READ(&sb->next);
VG(VALGRIND_MEMPOOL_FREE(stream, VG_NOACCESS_READ(&sb->_vg_ptr)));