add GN_SUBOPTIMAL_PRESENTATION_QUEUE return for mtlGetImage
This commit is contained in:
@@ -16,6 +16,9 @@ typedef struct gnPlatformPresentationQueue_t {
|
|||||||
uint32_tArrayList avaliableTextures;
|
uint32_tArrayList avaliableTextures;
|
||||||
|
|
||||||
mtlImageNeededArrayList neededImages;
|
mtlImageNeededArrayList neededImages;
|
||||||
|
|
||||||
|
gnVec2 createdSize;
|
||||||
|
// gnVec2 createdWindowSize;
|
||||||
} gnPlatformPresentationQueue;
|
} gnPlatformPresentationQueue;
|
||||||
|
|
||||||
gnReturnCode createMetalPresentationQueue(gnPresentationQueueHandle presentationQueue, const gnDevice device, gnPresentationQueueInfo presentationInfo);
|
gnReturnCode createMetalPresentationQueue(gnPresentationQueueHandle presentationQueue, const gnDevice device, gnPresentationQueueInfo presentationInfo);
|
||||||
|
@@ -20,6 +20,8 @@ gnReturnCode createMetalPresentationQueue(gnPresentationQueueHandle presentation
|
|||||||
}
|
}
|
||||||
|
|
||||||
presentationQueue->presentationQueue = malloc(sizeof(struct gnPlatformPresentationQueue_t));
|
presentationQueue->presentationQueue = malloc(sizeof(struct gnPlatformPresentationQueue_t));
|
||||||
|
presentationQueue->presentationQueue->createdSize.x = presentationInfo.surface->windowSurface->layer.visibleRect.size.width;
|
||||||
|
presentationQueue->presentationQueue->createdSize.y = presentationInfo.surface->windowSurface->layer.visibleRect.size.height;
|
||||||
|
|
||||||
MTLPixelFormat convertedFormat = mtlGryphnFormatToMetalFormat(presentationInfo.format.format);
|
MTLPixelFormat convertedFormat = mtlGryphnFormatToMetalFormat(presentationInfo.format.format);
|
||||||
|
|
||||||
@@ -69,12 +71,22 @@ void mtlAddImageBackToQueue(gnPresentationQueue queue, uint32_t index) {
|
|||||||
gnReturnCode getMetalPresentQueueImageAsync(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphore semaphore, uint32_t* imageIndex) {
|
gnReturnCode getMetalPresentQueueImageAsync(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphore semaphore, uint32_t* imageIndex) {
|
||||||
while(presentationQueue->presentationQueue->avaliableTextures.count == 0);
|
while(presentationQueue->presentationQueue->avaliableTextures.count == 0);
|
||||||
mtlTakeImageFromQueue(imageIndex, presentationQueue, semaphore);
|
mtlTakeImageFromQueue(imageIndex, presentationQueue, semaphore);
|
||||||
|
|
||||||
|
CGSize currentSize = presentationQueue->info.surface->windowSurface->layer.visibleRect.size;
|
||||||
|
if (currentSize.width != presentationQueue->presentationQueue->createdSize.x ||
|
||||||
|
currentSize.height != presentationQueue->presentationQueue->createdSize.y) return GN_SUBOPTIMAL_PRESENTATION_QUEUE;
|
||||||
|
|
||||||
return GN_SUCCESS;
|
return GN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
gnReturnCode getMetalPresentQueueImage(gnPresentationQueueHandle presentationQueue, uint32_t* imageIndex) {
|
gnReturnCode getMetalPresentQueueImage(gnPresentationQueueHandle presentationQueue, uint32_t* imageIndex) {
|
||||||
while (presentationQueue->presentationQueue->avaliableTextures.count == 0) {}
|
while (presentationQueue->presentationQueue->avaliableTextures.count == 0) {}
|
||||||
mtlTakeImageFromQueue(imageIndex, presentationQueue, NULL);
|
mtlTakeImageFromQueue(imageIndex, presentationQueue, NULL);
|
||||||
|
|
||||||
|
CGSize currentSize = presentationQueue->info.surface->windowSurface->layer.visibleRect.size;
|
||||||
|
if (currentSize.width != presentationQueue->presentationQueue->createdSize.x ||
|
||||||
|
currentSize.height != presentationQueue->presentationQueue->createdSize.y) return GN_SUBOPTIMAL_PRESENTATION_QUEUE;
|
||||||
|
|
||||||
return GN_SUCCESS;
|
return GN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user