Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/wined3d/texture.c | 17 +++++++++++++---- dlls/wined3d/utils.c | 10 ++++++++-- 2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index b8b90c95c5e..49373eb58ac 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -4509,6 +4509,7 @@ const VkDescriptorImageInfo *wined3d_texture_vk_get_default_image_info(struct wi const struct wined3d_vk_info *vk_info; struct wined3d_device_vk *device_vk; VkImageViewCreateInfo create_info; + struct color_fixup_desc fixup; uint32_t flags = 0; VkResult vr;
@@ -4529,10 +4530,18 @@ const VkDescriptorImageInfo *wined3d_texture_vk_get_default_image_info(struct wi create_info.image = texture_vk->vk_image; create_info.viewType = vk_image_view_type_from_wined3d(texture_vk->t.resource.type, flags); create_info.format = format_vk->vk_format; - create_info.components.r = VK_COMPONENT_SWIZZLE_IDENTITY; - create_info.components.g = VK_COMPONENT_SWIZZLE_IDENTITY; - create_info.components.b = VK_COMPONENT_SWIZZLE_IDENTITY; - create_info.components.a = VK_COMPONENT_SWIZZLE_IDENTITY; + fixup = format_vk->f.color_fixup; + if (is_identity_fixup(fixup) || !can_use_texture_swizzle(context_vk->c.d3d_info, &format_vk->f)) + { + create_info.components.r = VK_COMPONENT_SWIZZLE_IDENTITY; + create_info.components.g = VK_COMPONENT_SWIZZLE_IDENTITY; + create_info.components.b = VK_COMPONENT_SWIZZLE_IDENTITY; + create_info.components.a = VK_COMPONENT_SWIZZLE_IDENTITY; + } + else + { + wined3d_vk_swizzle_from_color_fixup(&create_info.components, fixup); + } create_info.subresourceRange.aspectMask = vk_aspect_mask_from_format(&format_vk->f); create_info.subresourceRange.baseMipLevel = 0; create_info.subresourceRange.levelCount = texture_vk->t.level_count; diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 2108eb65ba3..04e9300ee63 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -4135,6 +4135,7 @@ static void init_vulkan_format_info(struct wined3d_format_vk *format, { enum wined3d_format_id id; VkFormat vk_format; + const char *fixup; } vulkan_formats[] = { @@ -4182,7 +4183,7 @@ static void init_vulkan_format_info(struct wined3d_format_vk *format, {WINED3DFMT_R8_UINT, VK_FORMAT_R8_UINT, }, {WINED3DFMT_R8_SNORM, VK_FORMAT_R8_SNORM, }, {WINED3DFMT_R8_SINT, VK_FORMAT_R8_SINT, }, - {WINED3DFMT_A8_UNORM, VK_FORMAT_R8_UNORM, }, + {WINED3DFMT_A8_UNORM, VK_FORMAT_R8_UNORM, "000X"}, {WINED3DFMT_B8G8R8A8_UNORM, VK_FORMAT_B8G8R8A8_UNORM, }, {WINED3DFMT_B8G8R8A8_UNORM_SRGB, VK_FORMAT_B8G8R8A8_SRGB, }, {WINED3DFMT_BC1_UNORM, VK_FORMAT_BC1_RGBA_UNORM_BLOCK, }, @@ -4211,6 +4212,7 @@ static void init_vulkan_format_info(struct wined3d_format_vk *format, VkFormatProperties properties; VkImageUsageFlags vk_usage; unsigned int flags; + const char *fixup; unsigned int i; VkResult vr;
@@ -4219,6 +4221,7 @@ static void init_vulkan_format_info(struct wined3d_format_vk *format, if (vulkan_formats[i].id == format->f.id) { vk_format = vulkan_formats[i].vk_format; + fixup = vulkan_formats[i].fixup; break; } } @@ -4229,7 +4232,10 @@ static void init_vulkan_format_info(struct wined3d_format_vk *format, }
format->vk_format = vk_format; - format->f.color_fixup = COLOR_FIXUP_IDENTITY; + if (fixup) + format->f.color_fixup = create_color_fixup_desc_from_string(fixup); + else + format->f.color_fixup = COLOR_FIXUP_IDENTITY;
VK_CALL(vkGetPhysicalDeviceFormatProperties(vk_physical_device, vk_format, &properties));