bo = desc->buffer_view->bo;
bo_offset = desc->buffer_view->offset;
break;
+ case ANV_DESCRIPTOR_TYPE_BUFFER_AND_OFFSET: {
+ struct anv_state state =
+ anv_cmd_buffer_alloc_surface_state(cmd_buffer);
+ anv_fill_buffer_surface_state(cmd_buffer->device, state.map,
+ anv_format_for_vk_format(VK_FORMAT_R32G32B32A32_SFLOAT),
+ desc->offset, desc->range);
+ surface_state = &state;
+ bo = desc->buffer_view->bo;
+ bo_offset = desc->buffer_view->offset;
+ break;
+ }
case ANV_DESCRIPTOR_TYPE_IMAGE_VIEW:
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;
cmd_buffer->state.descriptors[binding->set];
struct anv_descriptor *desc = &set->descriptors[binding->offset];
- if (desc->type != ANV_DESCRIPTOR_TYPE_SAMPLER)
+ if (desc->type != ANV_DESCRIPTOR_TYPE_SAMPLER &&
+ desc->type != ANV_DESCRIPTOR_TYPE_IMAGE_VIEW_AND_SAMPLER)
continue;
struct anv_sampler *sampler = desc->sampler;
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
for (uint32_t j = 0; j < write->count; j++) {
- ANV_FROM_HANDLE(anv_buffer_view, bview,
- write->pDescriptors[j].bufferView);
-
- set->descriptors[write->destBinding + j] = (struct anv_descriptor) {
- .type = ANV_DESCRIPTOR_TYPE_BUFFER_VIEW,
- .buffer_view = bview,
- };
+ if (write->pDescriptors[j].bufferView.handle) {
+ ANV_FROM_HANDLE(anv_buffer_view, bview,
+ write->pDescriptors[j].bufferView);
+
+ set->descriptors[write->destBinding + j] =
+ (struct anv_descriptor) {
+ .type = ANV_DESCRIPTOR_TYPE_BUFFER_VIEW,
+ .buffer_view = bview,
+ };
+ } else {
+ ANV_FROM_HANDLE(anv_buffer, buffer,
+ write->pDescriptors[j].bufferInfo.buffer);
+ assert(buffer);
+
+ set->descriptors[write->destBinding + j] =
+ (struct anv_descriptor) {
+ .type = ANV_DESCRIPTOR_TYPE_BUFFER_AND_OFFSET,
+ .buffer = buffer,
+ .offset = write->pDescriptors[j].bufferInfo.offset,
+ .range = write->pDescriptors[j].bufferInfo.range,
+ };
+ }
}
default:
enum anv_descriptor_type {
ANV_DESCRIPTOR_TYPE_EMPTY = 0,
ANV_DESCRIPTOR_TYPE_BUFFER_VIEW,
+ ANV_DESCRIPTOR_TYPE_BUFFER_AND_OFFSET,
ANV_DESCRIPTOR_TYPE_IMAGE_VIEW,
ANV_DESCRIPTOR_TYPE_SAMPLER,
+ ANV_DESCRIPTOR_TYPE_IMAGE_VIEW_AND_SAMPLER,
};
struct anv_descriptor {
+ enum anv_descriptor_type type;
+
union {
- struct anv_buffer_view *buffer_view;
- struct anv_image_view *image_view;
- struct anv_sampler *sampler;
- };
+ struct {
+ union {
+ struct anv_buffer_view *buffer_view;
+ struct anv_image_view *image_view;
+ };
+ struct anv_sampler *sampler;
+ };
- enum anv_descriptor_type type;
+ struct {
+ struct anv_buffer *buffer;
+ uint64_t offset;
+ uint64_t range;
+ };
+ };
};
struct anv_descriptor_set {