Commit b6ca5e50 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Use the texture level count to calculate sub-resource indices for…

wined3d: Use the texture level count to calculate sub-resource indices for Vulkan mip-map generation. Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 27845d2f
...@@ -1266,7 +1266,7 @@ void wined3d_shader_resource_view_gl_generate_mipmap(struct wined3d_shader_resou ...@@ -1266,7 +1266,7 @@ void wined3d_shader_resource_view_gl_generate_mipmap(struct wined3d_shader_resou
void wined3d_shader_resource_view_vk_generate_mipmap(struct wined3d_shader_resource_view_vk *srv_vk, void wined3d_shader_resource_view_vk_generate_mipmap(struct wined3d_shader_resource_view_vk *srv_vk,
struct wined3d_context_vk *context_vk) struct wined3d_context_vk *context_vk)
{ {
unsigned int i, j, layer_count, level_count, base_level, base_layer; unsigned int i, j, layer_count, level_count, base_level, base_layer, sub_resource_idx;
const struct wined3d_vk_info *vk_info = context_vk->vk_info; const struct wined3d_vk_info *vk_info = context_vk->vk_info;
VkImageSubresourceRange vk_src_range, vk_dst_range; VkImageSubresourceRange vk_src_range, vk_dst_range;
struct wined3d_texture_vk *texture_vk; struct wined3d_texture_vk *texture_vk;
...@@ -1283,8 +1283,9 @@ void wined3d_shader_resource_view_vk_generate_mipmap(struct wined3d_shader_resou ...@@ -1283,8 +1283,9 @@ void wined3d_shader_resource_view_vk_generate_mipmap(struct wined3d_shader_resou
texture_vk = wined3d_texture_vk(texture_from_resource(srv_vk->v.resource)); texture_vk = wined3d_texture_vk(texture_from_resource(srv_vk->v.resource));
for (i = 0; i < layer_count; ++i) for (i = 0; i < layer_count; ++i)
{ {
if (!wined3d_texture_load_location(&texture_vk->t, sub_resource_idx = (base_layer + i) * texture_vk->t.level_count + base_level;
(base_layer + i) * level_count + base_level, &context_vk->c, WINED3D_LOCATION_TEXTURE_RGB)) if (!wined3d_texture_load_location(&texture_vk->t, sub_resource_idx,
&context_vk->c, WINED3D_LOCATION_TEXTURE_RGB))
ERR("Failed to load source layer %u.\n", base_layer + i); ERR("Failed to load source layer %u.\n", base_layer + i);
} }
...@@ -1393,10 +1394,9 @@ void wined3d_shader_resource_view_vk_generate_mipmap(struct wined3d_shader_resou ...@@ -1393,10 +1394,9 @@ void wined3d_shader_resource_view_vk_generate_mipmap(struct wined3d_shader_resou
{ {
for (j = 1; j < level_count; ++j) for (j = 1; j < level_count; ++j)
{ {
wined3d_texture_validate_location(&texture_vk->t, sub_resource_idx = (base_layer + i) * texture_vk->t.level_count + base_level + j;
(base_layer + i) * level_count + base_level + j, WINED3D_LOCATION_TEXTURE_RGB); wined3d_texture_validate_location(&texture_vk->t, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
wined3d_texture_invalidate_location(&texture_vk->t, wined3d_texture_invalidate_location(&texture_vk->t, sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB);
(base_layer + i) * level_count + base_level + j, ~WINED3D_LOCATION_TEXTURE_RGB);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment