mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-11 15:13:37 +02:00
Vulkan: Image views: The driver is probably smart enough to recognize a no-swizzle, but let's use the proper method.
This commit is contained in:
@@ -64,7 +64,7 @@ void CreateImage(VulkanContext *vulkan, VkCommandBuffer cmd, VKRImage &img, int
|
||||
VkImageAspectFlags aspects = color ? VK_IMAGE_ASPECT_COLOR_BIT : (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT);
|
||||
|
||||
VkImageViewCreateInfo ivci{ VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO };
|
||||
ivci.components = { VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A };
|
||||
ivci.components = { VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY };
|
||||
ivci.format = ici.format;
|
||||
ivci.image = img.image;
|
||||
ivci.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
@@ -161,10 +161,10 @@ void VulkanRenderManager::CreateBackbuffers() {
|
||||
|
||||
VkImageViewCreateInfo color_image_view = { VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO };
|
||||
color_image_view.format = vulkan_->GetSwapchainFormat();
|
||||
color_image_view.components.r = VK_COMPONENT_SWIZZLE_R;
|
||||
color_image_view.components.g = VK_COMPONENT_SWIZZLE_G;
|
||||
color_image_view.components.b = VK_COMPONENT_SWIZZLE_B;
|
||||
color_image_view.components.a = VK_COMPONENT_SWIZZLE_A;
|
||||
color_image_view.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
color_image_view.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
color_image_view.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
color_image_view.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
color_image_view.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
color_image_view.subresourceRange.baseMipLevel = 0;
|
||||
color_image_view.subresourceRange.levelCount = 1;
|
||||
@@ -394,6 +394,7 @@ void VulkanRenderManager::BindFramebufferAsRenderTarget(VKRFramebuffer *fb, VKRR
|
||||
if (steps_.size() && steps_.back()->render.framebuffer == fb && steps_.back()->stepType == VKRStepType::RENDER) {
|
||||
if (color != VKRRenderPassAction::CLEAR && depth != VKRRenderPassAction::CLEAR && stencil != VKRRenderPassAction::CLEAR) {
|
||||
// We don't move to a new step, this bind was unnecessary and we can safely skip it.
|
||||
// Not sure how much this is still happening but probably worth checking for nevertheless.
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -558,7 +559,6 @@ bool VulkanRenderManager::InitDepthStencilBuffer(VkCommandBuffer cmd) {
|
||||
image_info.usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
||||
image_info.flags = 0;
|
||||
|
||||
|
||||
depth_.format = depth_format;
|
||||
|
||||
VkDevice device = vulkan_->GetDevice();
|
||||
@@ -608,10 +608,10 @@ bool VulkanRenderManager::InitDepthStencilBuffer(VkCommandBuffer cmd) {
|
||||
VkImageViewCreateInfo depth_view_info = { VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO };
|
||||
depth_view_info.image = depth_.image;
|
||||
depth_view_info.format = depth_format;
|
||||
depth_view_info.components.r = VK_COMPONENT_SWIZZLE_R;
|
||||
depth_view_info.components.g = VK_COMPONENT_SWIZZLE_G;
|
||||
depth_view_info.components.b = VK_COMPONENT_SWIZZLE_B;
|
||||
depth_view_info.components.a = VK_COMPONENT_SWIZZLE_A;
|
||||
depth_view_info.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
depth_view_info.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
depth_view_info.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
depth_view_info.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
depth_view_info.subresourceRange.aspectMask = aspectMask;
|
||||
depth_view_info.subresourceRange.baseMipLevel = 0;
|
||||
depth_view_info.subresourceRange.levelCount = 1;
|
||||
|
||||
Reference in New Issue
Block a user