[PATCH vkd3d 6/6] libs/vkd3d: Use VK_COMPONENT_SWIZZLE_IDENTITY in vkd3d_set_view_swizzle_for_format().

Józef Kucia joseph.kucia at gmail.com
Tue May 29 05:50:33 CDT 2018


From: Józef Kucia <jkucia at codeweavers.com>

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 libs/vkd3d/resource.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c
index e37b03bc005f..acd3bada63ec 100644
--- a/libs/vkd3d/resource.c
+++ b/libs/vkd3d/resource.c
@@ -999,6 +999,11 @@ static bool vkd3d_create_buffer_view(struct d3d12_device *device,
 static void vkd3d_set_view_swizzle_for_format(VkComponentMapping *components,
         const struct vkd3d_format *format, bool allowed_swizzle)
 {
+    components->r = VK_COMPONENT_SWIZZLE_IDENTITY;
+    components->g = VK_COMPONENT_SWIZZLE_IDENTITY;
+    components->b = VK_COMPONENT_SWIZZLE_IDENTITY;
+    components->a = VK_COMPONENT_SWIZZLE_IDENTITY;
+
     if (format->vk_aspect_mask == VK_IMAGE_ASPECT_STENCIL_BIT)
     {
         if (allowed_swizzle)
@@ -1007,7 +1012,6 @@ static void vkd3d_set_view_swizzle_for_format(VkComponentMapping *components,
             components->g = VK_COMPONENT_SWIZZLE_R;
             components->b = VK_COMPONENT_SWIZZLE_ZERO;
             components->a = VK_COMPONENT_SWIZZLE_ZERO;
-            return;
         }
         else
         {
@@ -1024,18 +1028,12 @@ static void vkd3d_set_view_swizzle_for_format(VkComponentMapping *components,
             components->g = VK_COMPONENT_SWIZZLE_ZERO;
             components->b = VK_COMPONENT_SWIZZLE_ZERO;
             components->a = VK_COMPONENT_SWIZZLE_R;
-            return;
         }
         else
         {
             FIXME("Alpha swizzle is not supported.\n");
         }
     }
-
-    components->r = VK_COMPONENT_SWIZZLE_R;
-    components->g = VK_COMPONENT_SWIZZLE_G;
-    components->b = VK_COMPONENT_SWIZZLE_B;
-    components->a = VK_COMPONENT_SWIZZLE_A;
 }
 
 static VkResult vkd3d_create_texture_view(struct d3d12_device *device,
-- 
2.16.1




More information about the wine-devel mailing list