Fix #105450: Resolve box selection issue in Metal #107135

Merged
Jeroen Bakker merged 2 commits from Jason-Fielder/blender:Fix_105450 into main 2023-04-20 08:48:09 +02:00
1 changed files with 5 additions and 0 deletions

View File

@ -33,6 +33,11 @@ void MTLQueryPool::allocate()
gpu::MTLBuffer *buffer = MTLContext::get_global_memory_manager()->allocate(buffer_size_in_bytes,
true);
BLI_assert(buffer);
/* We must zero-initialize the query buffer as visibility queries with no draws between
* begin and end will not write any result to the buffer. */
memset(buffer->get_host_ptr(), 0, buffer_size_in_bytes);
buffer->flush();
buffer_.append(buffer);
}