Fix crash when signalling swapchain semaphore using MTLEvent.
Clear out some dead swapchain image code.
This commit is contained in:
parent
a87ef6bc77
commit
98d59025f3
@ -28,6 +28,7 @@ Released TBD
|
||||
- Ensure Vulkan loader magic number is set every time before returning any dispatchable Vulkan handle.
|
||||
- Fix crash when `VkDeviceCreateInfo` specifies queue families out of numerical order.
|
||||
- Fix crash in `vkDestroyPipelineLayout()`.
|
||||
- Fix crash when signalling swapchain semaphore using `MTLEvent`.
|
||||
- `vkCmdBlitImage()` support format component swizzling.
|
||||
- `vkCmdClearImage()` set error if attempt made to clear 1D image, and fix validation of depth attachment formats.
|
||||
- `vkCreateRenderPass()` return `VK_ERROR_FORMAT_NOT_SUPPORTED` if format not supported.
|
||||
|
@ -414,22 +414,6 @@ public:
|
||||
/** Binds this resource according to the specified bind information. */
|
||||
VkResult bindDeviceMemory2(const void* pBindInfo) override;
|
||||
|
||||
/** Returns the encompassing swapchain. */
|
||||
inline MVKSwapchain* getSwapchain() { return _swapchain; }
|
||||
|
||||
/** Returns the index of this image within the encompassing swapchain. */
|
||||
inline uint32_t getSwapchainIndex() { return _swapchainIndex; }
|
||||
|
||||
/**
|
||||
* Registers a semaphore and/or fence that will be signaled when this image becomes available.
|
||||
* This function accepts both a semaphore and a fence, and either none, one, or both may be provided.
|
||||
* If this image is available already, the semaphore and fence are immediately signaled.
|
||||
*/
|
||||
void signalWhenAvailable(MVKSemaphore* semaphore, MVKFence* fence);
|
||||
|
||||
/** Returns the availability status of this image, relative to other images in the swapchain. */
|
||||
const MVKSwapchainImageAvailability* getAvailability();
|
||||
|
||||
|
||||
#pragma mark Metal
|
||||
|
||||
|
@ -1259,14 +1259,6 @@ VkResult MVKSwapchainImage::bindDeviceMemory2(const void* pBindInfo) {
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
void MVKSwapchainImage::signalWhenAvailable(MVKSemaphore* semaphore, MVKFence* fence) {
|
||||
_swapchain->signalWhenAvailable( _swapchainIndex, semaphore, fence );
|
||||
}
|
||||
|
||||
const MVKSwapchainImageAvailability* MVKSwapchainImage::getAvailability() {
|
||||
return _swapchain->getAvailability( _swapchainIndex );
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Metal
|
||||
|
||||
|
@ -87,9 +87,7 @@ public:
|
||||
*/
|
||||
void signalWhenAvailable(uint32_t imageIndex, MVKSemaphore* semaphore, MVKFence* fence);
|
||||
|
||||
/** Returns the availability status of the image at the given index, relative to other images in the swapchain. */
|
||||
const MVKSwapchainImageAvailability* getAvailability(uint32_t imageIndex);
|
||||
|
||||
|
||||
#pragma mark Metal
|
||||
|
||||
/**
|
||||
|
@ -136,18 +136,18 @@ void MVKSwapchain::makeAvailable(uint32_t imgIdx) {
|
||||
|
||||
MVKSwapchainSignaler signaler;
|
||||
if (availability.isAvailable) {
|
||||
// If this image is now available, signal the semaphore and fence that were associated
|
||||
// If this image is available, signal the semaphore and fence that were associated
|
||||
// with the last time this image was acquired while available. This is a workaround for
|
||||
// when an app uses a single semaphore or fence for more than one swapchain image.
|
||||
// Becuase the semaphore or fence will be signaled by more than one image, it will
|
||||
// get out of sync, and the final use of the image would not be signaled as a result.
|
||||
|
||||
signaler = _imageAvailability[imgIdx].preSignaled;
|
||||
} else {
|
||||
// If this image is not yet available, extract and signal the first semaphore and fence.
|
||||
|
||||
signaler = _imageAvailability[imgIdx].signalers.front();
|
||||
_imageAvailability[imgIdx].signalers.erase( _imageAvailability[imgIdx].signalers.begin() );
|
||||
auto& imgSignalers = _imageAvailability[imgIdx].signalers;
|
||||
auto sigIter = imgSignalers.begin();
|
||||
signaler = *sigIter;
|
||||
imgSignalers.erase(sigIter);
|
||||
}
|
||||
|
||||
// Signal the semaphore and fence, and let them know they are no longer being tracked.
|
||||
@ -191,8 +191,11 @@ void MVKSwapchain::signal(MVKSwapchainSignaler& signaler) {
|
||||
// If present, signal the semaphore for the first waiter for the given image.
|
||||
void MVKSwapchain::signalOnDevice(uint32_t imgIdx, id<MTLCommandBuffer> mtlCmdBuff) {
|
||||
lock_guard<mutex> lock(_availabilityLock);
|
||||
MVKSemaphore* mvkSem = _imageAvailability[imgIdx].signalers.front().first;
|
||||
if (mvkSem) { mvkSem->encodeSignal(mtlCmdBuff); }
|
||||
auto& imgSignalers = _imageAvailability[imgIdx].signalers;
|
||||
if ( !imgSignalers.empty() ) {
|
||||
MVKSemaphore* mvkSem = imgSignalers.front().first;
|
||||
if (mvkSem) { mvkSem->encodeSignal(mtlCmdBuff); }
|
||||
}
|
||||
}
|
||||
|
||||
// Tell the semaphore and fence that they are being tracked for future signaling.
|
||||
@ -207,13 +210,6 @@ void MVKSwapchain::unmarkAsTracked(MVKSwapchainSignaler& signaler) {
|
||||
if (signaler.second) { signaler.second->release(); }
|
||||
}
|
||||
|
||||
const MVKSwapchainImageAvailability* MVKSwapchain::getAvailability(uint32_t imageIndex) {
|
||||
lock_guard<mutex> lock(_availabilityLock);
|
||||
auto& availability = _imageAvailability[imageIndex].status;
|
||||
availability.waitCount = (uint32_t)_imageAvailability[imageIndex].signalers.size();
|
||||
return &availability;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Rendering
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user