Commit dbe01421 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Implement Vulkan NULL 3D image shader resource view descriptors.

parent afa07536
...@@ -1348,6 +1348,10 @@ static bool wined3d_shader_resource_bindings_add_null_srv_binding(struct wined3d ...@@ -1348,6 +1348,10 @@ static bool wined3d_shader_resource_bindings_add_null_srv_binding(struct wined3d
return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set,
binding_idx, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, NULL, &v->vk_info_2dms, NULL); binding_idx, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, NULL, &v->vk_info_2dms, NULL);
case WINED3D_SHADER_RESOURCE_TEXTURE_3D:
return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set,
binding_idx, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, NULL, &v->vk_info_3d, NULL);
case WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY: case WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY:
return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set,
binding_idx, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, NULL, &v->vk_info_2d_array, NULL); binding_idx, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, NULL, &v->vk_info_2d_array, NULL);
......
...@@ -811,10 +811,18 @@ bool wined3d_device_vk_create_null_resources(struct wined3d_device_vk *device_vk ...@@ -811,10 +811,18 @@ bool wined3d_device_vk_create_null_resources(struct wined3d_device_vk *device_vk
goto fail; goto fail;
} }
if (!wined3d_null_image_vk_init(&r->image_3d, context_vk, vk_command_buffer, VK_IMAGE_TYPE_3D, 1))
{
ERR("Failed to create 3D image.\n");
goto fail;
}
return true; return true;
fail: fail:
id = context_vk->current_command_buffer.id; id = context_vk->current_command_buffer.id;
if (r->image_2dms.vk_image)
wined3d_null_image_vk_cleanup(&r->image_2dms, context_vk, id);
if (r->image_2d.vk_image) if (r->image_2d.vk_image)
wined3d_null_image_vk_cleanup(&r->image_2d, context_vk, id); wined3d_null_image_vk_cleanup(&r->image_2d, context_vk, id);
if (r->image_1d.vk_image) if (r->image_1d.vk_image)
...@@ -832,6 +840,7 @@ void wined3d_device_vk_destroy_null_resources(struct wined3d_device_vk *device_v ...@@ -832,6 +840,7 @@ void wined3d_device_vk_destroy_null_resources(struct wined3d_device_vk *device_v
/* We don't track command buffer references to NULL resources. We easily /* We don't track command buffer references to NULL resources. We easily
* could, but it doesn't seem worth it. */ * could, but it doesn't seem worth it. */
wined3d_null_image_vk_cleanup(&r->image_3d, context_vk, id);
wined3d_null_image_vk_cleanup(&r->image_2dms, context_vk, id); wined3d_null_image_vk_cleanup(&r->image_2dms, context_vk, id);
wined3d_null_image_vk_cleanup(&r->image_2d, context_vk, id); wined3d_null_image_vk_cleanup(&r->image_2d, context_vk, id);
wined3d_null_image_vk_cleanup(&r->image_1d, context_vk, id); wined3d_null_image_vk_cleanup(&r->image_1d, context_vk, id);
...@@ -921,6 +930,17 @@ bool wined3d_device_vk_create_null_views(struct wined3d_device_vk *device_vk, st ...@@ -921,6 +930,17 @@ bool wined3d_device_vk_create_null_views(struct wined3d_device_vk *device_vk, st
v->vk_info_2dms.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; v->vk_info_2dms.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
TRACE("Created 2D MSAA image view 0x%s.\n", wine_dbgstr_longlong(v->vk_info_2dms.imageView)); TRACE("Created 2D MSAA image view 0x%s.\n", wine_dbgstr_longlong(v->vk_info_2dms.imageView));
view_desc.image = r->image_3d.vk_image;
view_desc.viewType = VK_IMAGE_VIEW_TYPE_3D;
if ((vr = VK_CALL(vkCreateImageView(device_vk->vk_device, &view_desc, NULL, &v->vk_info_3d.imageView))) < 0)
{
ERR("Failed to create 3D image view, vr %s.\n", wined3d_debug_vkresult(vr));
goto fail;
}
v->vk_info_3d.sampler = VK_NULL_HANDLE;
v->vk_info_3d.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
TRACE("Created 3D image view 0x%s.\n", wine_dbgstr_longlong(v->vk_info_3d.imageView));
view_desc.image = r->image_2d.vk_image; view_desc.image = r->image_2d.vk_image;
view_desc.viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY; view_desc.viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
if ((vr = VK_CALL(vkCreateImageView(device_vk->vk_device, &view_desc, NULL, &v->vk_info_2d_array.imageView))) < 0) if ((vr = VK_CALL(vkCreateImageView(device_vk->vk_device, &view_desc, NULL, &v->vk_info_2d_array.imageView))) < 0)
...@@ -948,6 +968,8 @@ bool wined3d_device_vk_create_null_views(struct wined3d_device_vk *device_vk, st ...@@ -948,6 +968,8 @@ bool wined3d_device_vk_create_null_views(struct wined3d_device_vk *device_vk, st
fail: fail:
if (v->vk_info_2d_array.imageView) if (v->vk_info_2d_array.imageView)
VK_CALL(vkDestroyImageView(device_vk->vk_device, v->vk_info_2d_array.imageView, NULL)); VK_CALL(vkDestroyImageView(device_vk->vk_device, v->vk_info_2d_array.imageView, NULL));
if (v->vk_info_3d.imageView)
VK_CALL(vkDestroyImageView(device_vk->vk_device, v->vk_info_3d.imageView, NULL));
if (v->vk_info_2dms.imageView) if (v->vk_info_2dms.imageView)
VK_CALL(vkDestroyImageView(device_vk->vk_device, v->vk_info_2dms.imageView, NULL)); VK_CALL(vkDestroyImageView(device_vk->vk_device, v->vk_info_2dms.imageView, NULL));
if (v->vk_info_2d.imageView) if (v->vk_info_2d.imageView)
...@@ -967,6 +989,7 @@ void wined3d_device_vk_destroy_null_views(struct wined3d_device_vk *device_vk, s ...@@ -967,6 +989,7 @@ void wined3d_device_vk_destroy_null_views(struct wined3d_device_vk *device_vk, s
wined3d_context_vk_destroy_image_view(context_vk, v->vk_info_2dms_array.imageView, id); wined3d_context_vk_destroy_image_view(context_vk, v->vk_info_2dms_array.imageView, id);
wined3d_context_vk_destroy_image_view(context_vk, v->vk_info_2d_array.imageView, id); wined3d_context_vk_destroy_image_view(context_vk, v->vk_info_2d_array.imageView, id);
wined3d_context_vk_destroy_image_view(context_vk, v->vk_info_3d.imageView, id);
wined3d_context_vk_destroy_image_view(context_vk, v->vk_info_2dms.imageView, id); wined3d_context_vk_destroy_image_view(context_vk, v->vk_info_2dms.imageView, id);
wined3d_context_vk_destroy_image_view(context_vk, v->vk_info_2d.imageView, id); wined3d_context_vk_destroy_image_view(context_vk, v->vk_info_2d.imageView, id);
wined3d_context_vk_destroy_image_view(context_vk, v->vk_info_1d.imageView, id); wined3d_context_vk_destroy_image_view(context_vk, v->vk_info_1d.imageView, id);
......
...@@ -3620,6 +3620,7 @@ struct wined3d_null_resources_vk ...@@ -3620,6 +3620,7 @@ struct wined3d_null_resources_vk
struct wined3d_null_image_vk image_1d; struct wined3d_null_image_vk image_1d;
struct wined3d_null_image_vk image_2d; struct wined3d_null_image_vk image_2d;
struct wined3d_null_image_vk image_2dms; struct wined3d_null_image_vk image_2dms;
struct wined3d_null_image_vk image_3d;
}; };
struct wined3d_null_views_vk struct wined3d_null_views_vk
...@@ -3630,6 +3631,7 @@ struct wined3d_null_views_vk ...@@ -3630,6 +3631,7 @@ struct wined3d_null_views_vk
VkDescriptorImageInfo vk_info_1d; VkDescriptorImageInfo vk_info_1d;
VkDescriptorImageInfo vk_info_2d; VkDescriptorImageInfo vk_info_2d;
VkDescriptorImageInfo vk_info_2dms; VkDescriptorImageInfo vk_info_2dms;
VkDescriptorImageInfo vk_info_3d;
VkDescriptorImageInfo vk_info_2d_array; VkDescriptorImageInfo vk_info_2d_array;
VkDescriptorImageInfo vk_info_2dms_array; VkDescriptorImageInfo vk_info_2dms_array;
}; };
......
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