wined3d: Add a swizzle to the Vulkan format information for WINED3DFMT_A8_UNORM.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2020-05-01 15:06:21 +04:30 committed by Alexandre Julliard
parent 385d06daa5
commit a3874561cd
2 changed files with 21 additions and 6 deletions

View File

@ -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;

View File

@ -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));