Skip to content

Commit

Permalink
PsychVulkanCore: Minor enhancements and Vulkan validation warning fixes.
Browse files Browse the repository at this point in the history
Print out supported VK_FORMAT_R8G8B8A8_UNORM in debug output listing.

Use a initialLayout of VK_IMAGE_LAYOUT_UNDEFINED instead of
VK_IMAGE_LAYOUT_PREINITIALIZED during creation of interop VkImage
when interop with OpenGL is enabled, as the old layout seems to be illegal
according to the spec, or so the validation layer says.
  • Loading branch information
kleinerm committed Nov 13, 2023
1 parent 57934d6 commit 17159b2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions PsychSourceGL/Source/Common/PsychVulkanCore/PsychVulkan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1468,6 +1468,10 @@ psych_bool PsychProbeSurfaceProperties(PsychVulkanWindow* window, PsychVulkanDev
printf("[%i] Swapchain format VK_FORMAT_B8G8R8A8_UNORM\n", i);
break;

case VK_FORMAT_R8G8B8A8_UNORM:
printf("[%i] Swapchain format VK_FORMAT_R8G8B8A8_UNORM\n", i);
break;

case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
printf("[%i] Swapchain format VK_FORMAT_A8B8G8R8_SRGB_PACK32\n", i);
break;
Expand Down Expand Up @@ -2903,7 +2907,7 @@ psych_bool PsychCreateInteropTexture(PsychVulkanWindow* window)
.tiling = tiling,
.usage = usage,
.flags = 0,
.initialLayout = VK_IMAGE_LAYOUT_PREINITIALIZED,
.initialLayout = (!bringup && extmem) ? VK_IMAGE_LAYOUT_UNDEFINED : VK_IMAGE_LAYOUT_PREINITIALIZED,
};

result = vkCreateImage(vulkan->device, &imageCreateInfo, NULL, &window->interopImage);
Expand Down Expand Up @@ -3087,7 +3091,7 @@ psych_bool PsychCreateInteropTexture(PsychVulkanWindow* window)
goto out_interop_image;
}

if (!PsychTransitionImageLayout(window->swapChainCommandBuffers[0], window->interopImage, VK_IMAGE_LAYOUT_PREINITIALIZED, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL)) {
if (!PsychTransitionImageLayout(window->swapChainCommandBuffers[0], window->interopImage, imageCreateInfo.initialLayout, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL)) {
if (verbosity > 0)
printf("PsychVulkanCore-ERROR: PsychCreateInteropTexture:PsychTransitionImageLayout() failed for window %i.\n", window->index);

Expand Down

0 comments on commit 17159b2

Please sign in to comment.