Use a different visibility buffer for each MTLCommandBuffer in a queue submit.
This commit is contained in:
parent
aa6281c4e3
commit
7a80f0249b
@ -31,6 +31,7 @@ Released TBA
|
||||
- Detect when size of surface has changed under the covers.
|
||||
- Change rounding of surface size provided by Metal from truncation to rounding-with-half-to-even.
|
||||
- Queue submissions retain wait semaphores until `MTLCommandBuffer` finishes.
|
||||
- Use a different visibility buffer for each `MTLCommandBuffer` in a queue submit.
|
||||
- Work around problems with using explicit LoD with arrayed depth images on Apple Silicon.
|
||||
- Update `VK_MVK_MOLTENVK_SPEC_VERSION` to version `37`.
|
||||
|
||||
|
@ -199,7 +199,10 @@ protected:
|
||||
#pragma mark -
|
||||
#pragma mark MVKQueueCommandBufferSubmission
|
||||
|
||||
/** Submits the commands in a set of command buffers to the queue. */
|
||||
/**
|
||||
* Submits an empty set of command buffers to the queue.
|
||||
* Used for fence-only command submissions.
|
||||
*/
|
||||
class MVKQueueCommandBufferSubmission : public MVKQueueSubmission {
|
||||
|
||||
public:
|
||||
@ -218,6 +221,7 @@ protected:
|
||||
void finish() override;
|
||||
virtual void submitCommandBuffers() {}
|
||||
|
||||
MVKCommandEncodingContext _encodingContext;
|
||||
MVKSmallVector<std::pair<MVKSemaphore*, uint64_t>> _signalSemaphores;
|
||||
MVKFence* _fence;
|
||||
id<MTLCommandBuffer> _activeMTLCommandBuffer;
|
||||
|
@ -367,12 +367,17 @@ void MVKQueueCommandBufferSubmission::commitActiveMTLCommandBuffer(bool signalCo
|
||||
// Another option to wait on emulated semaphores once is to do it in the execute function, but doing it here
|
||||
// should be more performant when prefilled command buffers aren't used, because we spend time encoding commands
|
||||
// first, thus giving the command buffer signalling these semaphores more time to complete.
|
||||
if (!_emulatedWaitDone)
|
||||
{
|
||||
if ( !_emulatedWaitDone ) {
|
||||
for (auto& ws : _waitSemaphores) { ws.first->encodeWait(nil, ws.second); }
|
||||
_emulatedWaitDone = true;
|
||||
}
|
||||
|
||||
// The visibility result buffer will be returned to its pool when the active MTLCommandBuffer
|
||||
// finishes executing, and therefore cannot be used beyond the active MTLCommandBuffer.
|
||||
// By now, it's been submitted to the MTLCommandBuffer, so remove it from the encoding context,
|
||||
// to ensure a fresh one will be used by commands executing on any subsequent MTLCommandBuffers.
|
||||
_encodingContext.visibilityResultBuffer = nullptr;
|
||||
|
||||
// If we need to signal completion, use getActiveMTLCommandBuffer() to ensure at least
|
||||
// one MTLCommandBuffer is used, otherwise if this instance has no content, it will not
|
||||
// finish(), signal the fence and semaphores ,and be destroyed.
|
||||
@ -520,8 +525,7 @@ MVKQueueCommandBufferSubmission::~MVKQueueCommandBufferSubmission() {
|
||||
template <size_t N>
|
||||
void MVKQueueFullCommandBufferSubmission<N>::submitCommandBuffers() {
|
||||
_queue->getPhysicalDevice()->startTimestampCorrelation(_cpuStart, _gpuStart);
|
||||
MVKCommandEncodingContext encodingContext;
|
||||
for (auto& cb : _cmdBuffers) { cb->submit(this, &encodingContext); }
|
||||
for (auto& cb : _cmdBuffers) { cb->submit(this, &_encodingContext); }
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
|
Loading…
x
Reference in New Issue
Block a user