From: Jason Ekstrand Date: Thu, 15 Oct 2015 22:17:27 +0000 (-0700) Subject: anv/device: Add support for combined image and sampler descriptors X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=03952b1513b7621bb0bb151d0947e8bada64ca04;p=mesa.git anv/device: Add support for combined image and sampler descriptors --- diff --git a/src/vulkan/anv_cmd_buffer.c b/src/vulkan/anv_cmd_buffer.c index 2801f730478..19ad31167bf 100644 --- a/src/vulkan/anv_cmd_buffer.c +++ b/src/vulkan/anv_cmd_buffer.c @@ -608,6 +608,7 @@ anv_cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer, switch (desc->type) { case ANV_DESCRIPTOR_TYPE_EMPTY: case ANV_DESCRIPTOR_TYPE_SAMPLER: + /* Nothing for us to do here */ continue; case ANV_DESCRIPTOR_TYPE_BUFFER_VIEW: surface_state = &desc->buffer_view->surface_state; @@ -626,13 +627,11 @@ anv_cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer, break; } case ANV_DESCRIPTOR_TYPE_IMAGE_VIEW: + case ANV_DESCRIPTOR_TYPE_IMAGE_VIEW_AND_SAMPLER: surface_state = &desc->image_view->nonrt_surface_state; bo = desc->image_view->bo; bo_offset = desc->image_view->offset; break; - case ANV_DESCRIPTOR_TYPE_IMAGE_VIEW_AND_SAMPLER: - /* Nothing for us to do here */ - break; } bt_map[bias + s] = surface_state->offset + state_offset; @@ -677,6 +676,10 @@ anv_cmd_buffer_emit_samplers(struct anv_cmd_buffer *cmd_buffer, struct anv_sampler *sampler = desc->sampler; + /* FIXME: We shouldn't have to do this */ + if (sampler == NULL) + continue; + memcpy(state->map + (s * 16), sampler->state, sizeof(sampler->state)); } diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c index d9065b05390..2ae39741fe6 100644 --- a/src/vulkan/anv_device.c +++ b/src/vulkan/anv_device.c @@ -1646,7 +1646,6 @@ void anv_UpdateDescriptorSets( switch (write->descriptorType) { case VK_DESCRIPTOR_TYPE_SAMPLER: - case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: for (uint32_t j = 0; j < write->count; j++) { ANV_FROM_HANDLE(anv_sampler, sampler, write->pDescriptors[j].sampler); @@ -1656,11 +1655,22 @@ void anv_UpdateDescriptorSets( .sampler = sampler, }; } + break; - if (write->descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) - break; + case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: + for (uint32_t j = 0; j < write->count; j++) { + ANV_FROM_HANDLE(anv_image_view, iview, + write->pDescriptors[j].imageView); + ANV_FROM_HANDLE(anv_sampler, sampler, + write->pDescriptors[j].sampler); - /* fallthrough */ + set->descriptors[write->destBinding + j] = (struct anv_descriptor) { + .type = ANV_DESCRIPTOR_TYPE_IMAGE_VIEW_AND_SAMPLER, + .image_view = iview, + .sampler = sampler, + }; + } + break; case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: