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

wined3d: Create Vulkan image views for shader resource views.

parent d9db4beb
......@@ -1318,11 +1318,12 @@ static HRESULT adapter_vk_create_shader_resource_view(const struct wined3d_view_
static void adapter_vk_destroy_shader_resource_view(struct wined3d_shader_resource_view *view)
{
struct wined3d_shader_resource_view_vk *view_vk = wined3d_shader_resource_view_vk(view);
struct wined3d_device *device = view_vk->v.resource->device;
struct wined3d_shader_resource_view_vk *srv_vk = wined3d_shader_resource_view_vk(view);
struct wined3d_device *device = srv_vk->v.resource->device;
unsigned int swapchain_count = device->swapchain_count;
struct wined3d_view_vk *view_vk = &srv_vk->view_vk;
TRACE("view_vk %p.\n", view_vk);
TRACE("srv_vk %p.\n", srv_vk);
/* Take a reference to the device, in case releasing the view's resource
* would cause the device to be destroyed. However, swapchain resources
......@@ -1330,8 +1331,8 @@ static void adapter_vk_destroy_shader_resource_view(struct wined3d_shader_resour
* the refcount on a device that's in the process of being destroyed. */
if (swapchain_count)
wined3d_device_incref(device);
wined3d_shader_resource_view_cleanup(&view_vk->v);
wined3d_cs_destroy_object(device->cs, heap_free, view_vk);
wined3d_shader_resource_view_cleanup(&srv_vk->v);
wined3d_view_vk_destroy(device, &view_vk->vk_image_info.imageView, &view_vk->command_buffer_id, srv_vk);
if (swapchain_count)
wined3d_device_decref(device);
}
......
......@@ -4484,6 +4484,24 @@ HRESULT wined3d_texture_no3d_init(struct wined3d_texture *texture_no3d, struct w
flags, device, parent, parent_ops, &texture_no3d[1], &wined3d_texture_no3d_ops);
}
void wined3d_vk_swizzle_from_color_fixup(VkComponentMapping *mapping, struct color_fixup_desc fixup)
{
static const VkComponentSwizzle swizzle_source[] =
{
VK_COMPONENT_SWIZZLE_ZERO, /* CHANNEL_SOURCE_ZERO */
VK_COMPONENT_SWIZZLE_ONE, /* CHANNEL_SOURCE_ONE */
VK_COMPONENT_SWIZZLE_R, /* CHANNEL_SOURCE_X */
VK_COMPONENT_SWIZZLE_G, /* CHANNEL_SOURCE_Y */
VK_COMPONENT_SWIZZLE_B, /* CHANNEL_SOURCE_Z */
VK_COMPONENT_SWIZZLE_A, /* CHANNEL_SOURCE_W */
};
mapping->r = swizzle_source[fixup.x_source];
mapping->g = swizzle_source[fixup.y_source];
mapping->b = swizzle_source[fixup.z_source];
mapping->a = swizzle_source[fixup.w_source];
}
const VkDescriptorImageInfo *wined3d_texture_vk_get_default_image_info(struct wined3d_texture_vk *texture_vk,
struct wined3d_context_vk *context_vk)
{
......
......@@ -4229,6 +4229,7 @@ static void init_vulkan_format_info(struct wined3d_format_vk *format,
}
format->vk_format = vk_format;
format->f.color_fixup = COLOR_FIXUP_IDENTITY;
VK_CALL(vkGetPhysicalDeviceFormatProperties(vk_physical_device, vk_format, &properties));
......
......@@ -3946,6 +3946,7 @@ HRESULT wined3d_texture_no3d_init(struct wined3d_texture *texture_no3d, struct w
uint32_t flags, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
void wined3d_gl_texture_swizzle_from_color_fixup(GLint swizzle[4], struct color_fixup_desc fixup) DECLSPEC_HIDDEN;
void wined3d_vk_swizzle_from_color_fixup(VkComponentMapping *mapping, struct color_fixup_desc fixup) DECLSPEC_HIDDEN;
struct gl_texture
{
......@@ -4593,9 +4594,16 @@ HRESULT wined3d_shader_resource_view_gl_init(struct wined3d_shader_resource_view
const struct wined3d_view_desc *desc, struct wined3d_resource *resource,
void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
struct wined3d_view_vk
{
VkDescriptorImageInfo vk_image_info;
uint64_t command_buffer_id;
};
struct wined3d_shader_resource_view_vk
{
struct wined3d_shader_resource_view v;
struct wined3d_view_vk view_vk;
};
static inline struct wined3d_shader_resource_view_vk *wined3d_shader_resource_view_vk(
......
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