Fix sporadic crash on vkDestroySwapchainKHR().

MVKSwapchain & MVKSurface init _layerObserver to nil.
This commit is contained in:
Bill Hollings 2019-05-20 16:13:52 -04:00
parent ffa9ca1b3c
commit b773e7aaab
3 changed files with 4 additions and 0 deletions

View File

@ -32,6 +32,7 @@ Released TBD
- Fix zero local threadgroup size in indirect tessellated rendering.
- Fix crash when clearing attachments using layered rendering on older macOS devices.
- Fixes to Metal renderpass layered rendering settings.
- Fix sporadic crash on `vkDestroySwapchainKHR()`.
- `MoltenVKShaderConverter` tool: Add MSL version and platform command-line options.
- Allow building external dependency libraries in `Debug` mode.
- Enable AMD and NV GLSL extensions when building `glslang` for `MoltenVKGLSLToSPIRVConverter`.

View File

@ -45,6 +45,8 @@ MVKSurface::MVKSurface(MVKInstance* mvkInstance,
obj = ((PLATFORM_VIEW_CLASS*)obj).layer;
}
_layerObserver = nil;
// Confirm that we were provided with a CAMetalLayer
if ([obj isKindOfClass: [CAMetalLayer class]]) {
_mtlCAMetalLayer = (CAMetalLayer*)[obj retain]; // retained

View File

@ -179,6 +179,7 @@ id<CAMetalDrawable> MVKSwapchain::getNextCAMetalDrawable() {
MVKSwapchain::MVKSwapchain(MVKDevice* device,
const VkSwapchainCreateInfoKHR* pCreateInfo) : MVKVulkanAPIDeviceObject(device), _surfaceLost(false) {
_currentAcquisitionID = 0;
_layerObserver = nil;
// If applicable, release any surfaces (not currently being displayed) from the old swapchain.
MVKSwapchain* oldSwapchain = (MVKSwapchain*)pCreateInfo->oldSwapchain;