anv/device: Add support for combined image and sampler descriptors

This commit is contained in:
Jason Ekstrand
2015-10-15 15:17:27 -07:00
parent b459b3d82c
commit 03952b1513
2 changed files with 20 additions and 7 deletions

View File

@@ -608,6 +608,7 @@ anv_cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
switch (desc->type) { switch (desc->type) {
case ANV_DESCRIPTOR_TYPE_EMPTY: case ANV_DESCRIPTOR_TYPE_EMPTY:
case ANV_DESCRIPTOR_TYPE_SAMPLER: case ANV_DESCRIPTOR_TYPE_SAMPLER:
/* Nothing for us to do here */
continue; continue;
case ANV_DESCRIPTOR_TYPE_BUFFER_VIEW: case ANV_DESCRIPTOR_TYPE_BUFFER_VIEW:
surface_state = &desc->buffer_view->surface_state; surface_state = &desc->buffer_view->surface_state;
@@ -626,13 +627,11 @@ anv_cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
break; break;
} }
case ANV_DESCRIPTOR_TYPE_IMAGE_VIEW: case ANV_DESCRIPTOR_TYPE_IMAGE_VIEW:
case ANV_DESCRIPTOR_TYPE_IMAGE_VIEW_AND_SAMPLER:
surface_state = &desc->image_view->nonrt_surface_state; surface_state = &desc->image_view->nonrt_surface_state;
bo = desc->image_view->bo; bo = desc->image_view->bo;
bo_offset = desc->image_view->offset; bo_offset = desc->image_view->offset;
break; 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; 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; struct anv_sampler *sampler = desc->sampler;
/* FIXME: We shouldn't have to do this */
if (sampler == NULL)
continue;
memcpy(state->map + (s * 16), memcpy(state->map + (s * 16),
sampler->state, sizeof(sampler->state)); sampler->state, sizeof(sampler->state));
} }

View File

@@ -1646,7 +1646,6 @@ void anv_UpdateDescriptorSets(
switch (write->descriptorType) { switch (write->descriptorType) {
case VK_DESCRIPTOR_TYPE_SAMPLER: case VK_DESCRIPTOR_TYPE_SAMPLER:
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
for (uint32_t j = 0; j < write->count; j++) { for (uint32_t j = 0; j < write->count; j++) {
ANV_FROM_HANDLE(anv_sampler, sampler, ANV_FROM_HANDLE(anv_sampler, sampler,
write->pDescriptors[j].sampler); write->pDescriptors[j].sampler);
@@ -1656,11 +1655,22 @@ void anv_UpdateDescriptorSets(
.sampler = sampler, .sampler = sampler,
}; };
} }
break;
if (write->descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
break; 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_SAMPLED_IMAGE:
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: