wined3d: Do not use vkCmdClearColorImage() to clear compressed images.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52922 Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2d72328f5d
commit
ee9bcbb9f9
|
@ -5257,9 +5257,10 @@ static void wined3d_texture_vk_download_data(struct wined3d_context *context,
|
|||
}
|
||||
}
|
||||
|
||||
static void wined3d_texture_vk_clear(struct wined3d_texture_vk *texture_vk,
|
||||
static bool wined3d_texture_vk_clear(struct wined3d_texture_vk *texture_vk,
|
||||
unsigned int sub_resource_idx, struct wined3d_context *context)
|
||||
{
|
||||
struct wined3d_texture_sub_resource *sub_resource = &texture_vk->t.sub_resources[sub_resource_idx];
|
||||
struct wined3d_context_vk *context_vk = wined3d_context_vk(context);
|
||||
const struct wined3d_format *format = texture_vk->t.resource.format;
|
||||
const struct wined3d_vk_info *vk_info = context_vk->vk_info;
|
||||
|
@ -5270,12 +5271,24 @@ static void wined3d_texture_vk_clear(struct wined3d_texture_vk *texture_vk,
|
|||
VkImageAspectFlags aspect_mask;
|
||||
VkImage vk_image;
|
||||
|
||||
if (texture_vk->t.resource.format_flags & WINED3DFMT_FLAG_COMPRESSED)
|
||||
{
|
||||
struct wined3d_bo_address addr;
|
||||
|
||||
if (!wined3d_texture_prepare_location(&texture_vk->t, sub_resource_idx, context, WINED3D_LOCATION_SYSMEM))
|
||||
return false;
|
||||
wined3d_texture_get_bo_address(&texture_vk->t, sub_resource_idx, &addr, WINED3D_LOCATION_SYSMEM);
|
||||
memset(addr.addr, 0, sub_resource->size);
|
||||
wined3d_texture_validate_location(&texture_vk->t, sub_resource_idx, WINED3D_LOCATION_SYSMEM);
|
||||
return true;
|
||||
}
|
||||
|
||||
vk_image = texture_vk->image.vk_image;
|
||||
|
||||
if (!(vk_command_buffer = wined3d_context_vk_get_command_buffer(context_vk)))
|
||||
{
|
||||
ERR("Failed to get command buffer.\n");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
aspect_mask = vk_aspect_mask_from_format(format);
|
||||
|
@ -5305,6 +5318,9 @@ static void wined3d_texture_vk_clear(struct wined3d_texture_vk *texture_vk,
|
|||
VK_ACCESS_TRANSFER_WRITE_BIT, vk_access_mask_from_bind_flags(texture_vk->t.resource.bind_flags),
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, texture_vk->layout, vk_image, &vk_range);
|
||||
wined3d_context_vk_reference_texture(context_vk, texture_vk);
|
||||
|
||||
wined3d_texture_validate_location(&texture_vk->t, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
return true;
|
||||
}
|
||||
|
||||
static BOOL wined3d_texture_vk_load_texture(struct wined3d_texture_vk *texture_vk,
|
||||
|
@ -5319,8 +5335,11 @@ static BOOL wined3d_texture_vk_load_texture(struct wined3d_texture_vk *texture_v
|
|||
|
||||
if (sub_resource->locations & WINED3D_LOCATION_CLEARED)
|
||||
{
|
||||
wined3d_texture_vk_clear(texture_vk, sub_resource_idx, context);
|
||||
return TRUE;
|
||||
if (!wined3d_texture_vk_clear(texture_vk, sub_resource_idx, context))
|
||||
return FALSE;
|
||||
|
||||
if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!(sub_resource->locations & wined3d_texture_sysmem_locations))
|
||||
|
|
Loading…
Reference in New Issue