get image views
This commit is contained in:
@@ -76,8 +76,29 @@ gnReturnCode gnCreatePresentationQueueFn(gnPresentationQueue* presentationQueue,
|
||||
|
||||
vkGetSwapchainImagesKHR(device->outputDevice->device, presentationQueue->presentationQueue->swapChain, &presentationQueue->imageCount, NULL);
|
||||
presentationQueue->presentationQueue->swapChainImages = malloc(sizeof(VkImage) * presentationQueue->imageCount);
|
||||
presentationQueue->presentationQueue->swapChainImageViews = malloc(sizeof(VkImageView) * presentationQueue->imageCount);
|
||||
vkGetSwapchainImagesKHR(device->outputDevice->device, presentationQueue->presentationQueue->swapChain, &presentationQueue->imageCount, presentationQueue->presentationQueue->swapChainImages);
|
||||
|
||||
VkImageViewCreateInfo imageViewCreateInfo = {};
|
||||
imageViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
imageViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
imageViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
imageViewCreateInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
imageViewCreateInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
imageViewCreateInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
imageViewCreateInfo.subresourceRange.baseMipLevel = 0;
|
||||
imageViewCreateInfo.subresourceRange.levelCount = 1;
|
||||
imageViewCreateInfo.subresourceRange.baseArrayLayer = 0;
|
||||
imageViewCreateInfo.subresourceRange.layerCount = 1;
|
||||
|
||||
for (int i = 0; i < presentationQueue->imageCount; i++) {
|
||||
imageViewCreateInfo.image = presentationQueue->presentationQueue->swapChainImages[i];
|
||||
if (vkCreateImageView(device, &imageViewCreateInfo, NULL, &presentationQueue->presentationQueue->swapChainImageViews[i]) != VK_SUCCESS) {
|
||||
return GN_FAILED_TO_CREATE_IMAGE_VIEW;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
|
||||
|
@@ -6,4 +6,5 @@ typedef struct gnPlatformPresentationQueue_t {
|
||||
VkSwapchainKHR swapChain;
|
||||
|
||||
VkImage* swapChainImages;
|
||||
VkImageView* swapChainImageViews;
|
||||
} gnPlatformPresentationQueue;
|
||||
|
@@ -15,7 +15,8 @@ typedef enum gnReturnCode_t {
|
||||
GN_NO_SUPPORTED_PRESENT_MODES,
|
||||
GN_UNKNOWN_IMAGE_FORMAT,
|
||||
GN_FAILED_TO_CREATE_PRESENTATION_QUEUE,
|
||||
GN_UNSUPPORTED_IMAGE_COUNT
|
||||
GN_UNSUPPORTED_IMAGE_COUNT,
|
||||
GN_FAILED_TO_CREATE_IMAGE_VIEW
|
||||
|
||||
// GN_UNKNOWN_FRAMEBUFFER_ATTACHMENT,
|
||||
// GN_UNKNOWN_SHADER_MODULE,
|
||||
@@ -46,5 +47,6 @@ static const char* gnErrorCodeToCString(enum gnReturnCode_t returnCode) {
|
||||
case GN_UNKNOWN_IMAGE_FORMAT: return "GN_UNKNOWN_IMAGE_FORMAT";
|
||||
case GN_FAILED_TO_CREATE_PRESENTATION_QUEUE: return "GN_FAILED_TO_CREATE_PRESENTATION_QUEUE";
|
||||
case GN_UNSUPPORTED_IMAGE_COUNT: return "GN_UNSUPPORTED_IMAGE_COUNT";
|
||||
case GN_FAILED_TO_CREATE_IMAGE_VIEW: return "GN_FAILED_TO_CREATE_IMAGE_VIEW";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user