wined3d: Implement Vulkan sampler descriptors.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2020-05-13 19:16:51 +04:30 committed by Alexandre Julliard
parent 35b27b4aec
commit 2a9142de5c
2 changed files with 22 additions and 0 deletions

View File

@ -1335,6 +1335,7 @@ static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *con
struct wined3d_resource *resource; struct wined3d_resource *resource;
VkDescriptorSet vk_descriptor_set; VkDescriptorSet vk_descriptor_set;
struct wined3d_view_vk *view_vk; struct wined3d_view_vk *view_vk;
struct wined3d_sampler *sampler;
struct wined3d_buffer *buffer; struct wined3d_buffer *buffer;
VkBufferView *buffer_view; VkBufferView *buffer_view;
VkDescriptorType type; VkDescriptorType type;
@ -1400,6 +1401,14 @@ static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *con
return false; return false;
break; break;
case WINED3D_SHADER_DESCRIPTOR_TYPE_SAMPLER:
if (!(sampler = state->sampler[binding->shader_type][binding->resource_idx]))
sampler = context_vk->c.device->null_sampler;
if (!wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, binding->binding_idx,
VK_DESCRIPTOR_TYPE_SAMPLER, NULL, &wined3d_sampler_vk(sampler)->vk_image_info, NULL))
return false;
break;
default: default:
FIXME("Unhandled descriptor type %#x.\n", binding->shader_descriptor_type); FIXME("Unhandled descriptor type %#x.\n", binding->shader_descriptor_type);
return false; return false;
@ -1506,6 +1515,7 @@ static void wined3d_context_vk_load_shader_resources(struct wined3d_context_vk *
struct wined3d_shader_resource_view_vk *srv_vk; struct wined3d_shader_resource_view_vk *srv_vk;
struct wined3d_shader_resource_view *srv; struct wined3d_shader_resource_view *srv;
struct wined3d_buffer_vk *buffer_vk; struct wined3d_buffer_vk *buffer_vk;
struct wined3d_sampler *sampler;
struct wined3d_buffer *buffer; struct wined3d_buffer *buffer;
size_t i; size_t i;
@ -1551,6 +1561,12 @@ static void wined3d_context_vk_load_shader_resources(struct wined3d_context_vk *
case WINED3D_SHADER_DESCRIPTOR_TYPE_UAV_COUNTER: case WINED3D_SHADER_DESCRIPTOR_TYPE_UAV_COUNTER:
break; break;
case WINED3D_SHADER_DESCRIPTOR_TYPE_SAMPLER:
if (!(sampler = state->sampler[binding->shader_type][binding->resource_idx]))
sampler = context_vk->c.device->null_sampler;
wined3d_context_vk_reference_sampler(context_vk, wined3d_sampler_vk(sampler));
break;
default: default:
FIXME("Unhandled descriptor type %#x.\n", binding->shader_descriptor_type); FIXME("Unhandled descriptor type %#x.\n", binding->shader_descriptor_type);
break; break;

View File

@ -5662,6 +5662,12 @@ static inline void wined3d_context_vk_reference_texture(const struct wined3d_con
texture_vk->command_buffer_id = context_vk->current_command_buffer.id; texture_vk->command_buffer_id = context_vk->current_command_buffer.id;
} }
static inline void wined3d_context_vk_reference_sampler(const struct wined3d_context_vk *context_vk,
struct wined3d_sampler_vk *sampler_vk)
{
sampler_vk->command_buffer_id = context_vk->current_command_buffer.id;
}
static inline void wined3d_context_vk_reference_rendertarget_view(const struct wined3d_context_vk *context_vk, static inline void wined3d_context_vk_reference_rendertarget_view(const struct wined3d_context_vk *context_vk,
struct wined3d_rendertarget_view_vk *rtv_vk) struct wined3d_rendertarget_view_vk *rtv_vk)
{ {