Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/context_vk.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c index 11fa82ffde7..ca8409db639 100644 --- a/dlls/wined3d/context_vk.c +++ b/dlls/wined3d/context_vk.c @@ -2784,6 +2784,21 @@ static bool wined3d_context_vk_update_uav_counter_binding(struct wined3d_context VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, NULL, NULL, &uav_vk->vk_counter_view); }
+static bool wined3d_context_vk_update_sampler_binding(struct wined3d_context_vk *context_vk, + struct wined3d_shader_descriptor_writes_vk *writes, VkDescriptorSet vk_descriptor_set, + const struct wined3d_state *state, const struct wined3d_shader_resource_binding *binding) +{ + struct wined3d_sampler *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; + wined3d_context_vk_reference_sampler(context_vk, wined3d_sampler_vk(sampler)); + return true; +} + static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *context_vk, VkCommandBuffer vk_command_buffer, const struct wined3d_state *state, enum wined3d_pipeline pipeline) { @@ -2796,7 +2811,6 @@ static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *con VkPipelineLayout vk_pipeline_layout; VkPipelineBindPoint vk_bind_point; VkDescriptorSet vk_descriptor_set; - struct wined3d_sampler *sampler; VkResult vr; size_t i;
@@ -2857,12 +2871,8 @@ static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *con 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)) + if (!wined3d_context_vk_update_sampler_binding(context_vk, writes, vk_descriptor_set, state, binding)) return false; - wined3d_context_vk_reference_sampler(context_vk, wined3d_sampler_vk(sampler)); break;
default: