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

Alexandre Julliard julliard at winehq.org
Thu May 14 16:17:44 CDT 2020


Module: wine
Branch: master
Commit: dbe014212c7c9758e54e56dd2baceb2770d9c670
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=dbe014212c7c9758e54e56dd2baceb2770d9c670

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Thu May 14 17:51:47 2020 +0430

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

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/context_vk.c      |  4 ++++
 dlls/wined3d/device.c          | 23 +++++++++++++++++++++++
 dlls/wined3d/wined3d_private.h |  2 ++
 3 files changed, 29 insertions(+)

diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c
index 0bd4f2260a..c53b9aa6c6 100644
--- a/dlls/wined3d/context_vk.c
+++ b/dlls/wined3d/context_vk.c
@@ -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,
                     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:
             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);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 24be8adc67..23eeed47c4 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -811,10 +811,18 @@ bool wined3d_device_vk_create_null_resources(struct wined3d_device_vk *device_vk
         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;
 
 fail:
     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)
         wined3d_null_image_vk_cleanup(&r->image_2d, context_vk, id);
     if (r->image_1d.vk_image)
@@ -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
      * 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_2d, 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
     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));
 
+    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.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)
@@ -948,6 +968,8 @@ bool wined3d_device_vk_create_null_views(struct wined3d_device_vk *device_vk, st
 fail:
     if (v->vk_info_2d_array.imageView)
         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)
         VK_CALL(vkDestroyImageView(device_vk->vk_device, v->vk_info_2dms.imageView, NULL));
     if (v->vk_info_2d.imageView)
@@ -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_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_2d.imageView, id);
     wined3d_context_vk_destroy_image_view(context_vk, v->vk_info_1d.imageView, id);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 3e87c364ab..ebbe379f2d 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3620,6 +3620,7 @@ struct wined3d_null_resources_vk
     struct wined3d_null_image_vk image_1d;
     struct wined3d_null_image_vk image_2d;
     struct wined3d_null_image_vk image_2dms;
+    struct wined3d_null_image_vk image_3d;
 };
 
 struct wined3d_null_views_vk
@@ -3630,6 +3631,7 @@ struct wined3d_null_views_vk
     VkDescriptorImageInfo vk_info_1d;
     VkDescriptorImageInfo vk_info_2d;
     VkDescriptorImageInfo vk_info_2dms;
+    VkDescriptorImageInfo vk_info_3d;
     VkDescriptorImageInfo vk_info_2d_array;
     VkDescriptorImageInfo vk_info_2dms_array;
 };




More information about the wine-cvs mailing list