anv: Use bindless handles for images
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
This commit is contained in:

committed by
Jason Ekstrand

parent
83af92e593
commit
c0d9926df7
@@ -72,6 +72,8 @@ anv_descriptor_data_for_type(const struct anv_physical_device *device,
|
||||
data = ANV_DESCRIPTOR_SURFACE_STATE;
|
||||
if (device->info.gen < 9)
|
||||
data |= ANV_DESCRIPTOR_IMAGE_PARAM;
|
||||
if (device->has_bindless_images)
|
||||
data |= ANV_DESCRIPTOR_STORAGE_IMAGE;
|
||||
break;
|
||||
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
||||
@@ -112,6 +114,9 @@ anv_descriptor_data_size(enum anv_descriptor_data data)
|
||||
if (data & ANV_DESCRIPTOR_SAMPLED_IMAGE)
|
||||
size += sizeof(struct anv_sampled_image_descriptor);
|
||||
|
||||
if (data & ANV_DESCRIPTOR_STORAGE_IMAGE)
|
||||
size += sizeof(struct anv_storage_image_descriptor);
|
||||
|
||||
if (data & ANV_DESCRIPTOR_IMAGE_PARAM)
|
||||
size += BRW_IMAGE_PARAM_SIZE * 4;
|
||||
|
||||
@@ -178,6 +183,11 @@ anv_descriptor_data_supports_bindless(const struct anv_physical_device *pdevice,
|
||||
pdevice->has_bindless_images;
|
||||
}
|
||||
|
||||
if (data & ANV_DESCRIPTOR_STORAGE_IMAGE) {
|
||||
assert(pdevice->has_bindless_images);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1135,6 +1145,18 @@ anv_descriptor_set_write_image_view(struct anv_device *device,
|
||||
MAX2(1, bind_layout->max_plane_count) * sizeof(desc_data[0]));
|
||||
}
|
||||
|
||||
if (bind_layout->data & ANV_DESCRIPTOR_STORAGE_IMAGE) {
|
||||
assert(!(bind_layout->data & ANV_DESCRIPTOR_IMAGE_PARAM));
|
||||
assert(image_view->n_planes == 1);
|
||||
struct anv_storage_image_descriptor desc_data = {
|
||||
.read_write = anv_surface_state_to_handle(
|
||||
image_view->planes[0].storage_surface_state.state),
|
||||
.write_only = anv_surface_state_to_handle(
|
||||
image_view->planes[0].writeonly_storage_surface_state.state),
|
||||
};
|
||||
memcpy(desc_map, &desc_data, sizeof(desc_data));
|
||||
}
|
||||
|
||||
if (bind_layout->data & ANV_DESCRIPTOR_IMAGE_PARAM) {
|
||||
/* Storage images can only ever have one plane */
|
||||
assert(image_view->n_planes == 1);
|
||||
@@ -1175,6 +1197,17 @@ anv_descriptor_set_write_buffer_view(struct anv_device *device,
|
||||
memcpy(desc_map, &desc_data, sizeof(desc_data));
|
||||
}
|
||||
|
||||
if (bind_layout->data & ANV_DESCRIPTOR_STORAGE_IMAGE) {
|
||||
assert(!(bind_layout->data & ANV_DESCRIPTOR_IMAGE_PARAM));
|
||||
struct anv_storage_image_descriptor desc_data = {
|
||||
.read_write = anv_surface_state_to_handle(
|
||||
buffer_view->storage_surface_state),
|
||||
.write_only = anv_surface_state_to_handle(
|
||||
buffer_view->writeonly_storage_surface_state),
|
||||
};
|
||||
memcpy(desc_map, &desc_data, sizeof(desc_data));
|
||||
}
|
||||
|
||||
if (bind_layout->data & ANV_DESCRIPTOR_IMAGE_PARAM) {
|
||||
anv_descriptor_set_write_image_param(desc_map,
|
||||
&buffer_view->storage_image_param);
|
||||
|
Reference in New Issue
Block a user