*/
#include "gen8_pack.h"
-static const uint8_t anv_surf_type_from_image_type[] = {
- [VK_IMAGE_TYPE_1D] = SURFTYPE_1D,
- [VK_IMAGE_TYPE_2D] = SURFTYPE_2D,
- [VK_IMAGE_TYPE_3D] = SURFTYPE_3D,
-};
-
/**
* The \a format argument is required and overrides any format found in struct
* anv_image_create_info. Exactly one bit must be set in \a aspect.
anv_assert(pCreateInfo->extent.height > 0);
anv_assert(pCreateInfo->extent.depth > 0);
- /* TODO(chadv): How should we validate inputs? */
- const uint8_t surf_type =
- anv_surf_type_from_image_type[pCreateInfo->imageType];
-
image = anv_alloc2(&device->alloc, alloc, sizeof(*image), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!image)
image->levels = pCreateInfo->mipLevels;
image->array_size = pCreateInfo->arrayLayers;
image->usage = anv_image_get_full_usage(pCreateInfo);
- image->surface_type = surf_type;
if (image->usage & VK_IMAGE_USAGE_SAMPLED_BIT) {
image->needs_nonrt_surface_state = true;
if (!view)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
- view->buffer = buffer;
+ view->bo = buffer->bo;
+ view->offset = buffer->offset + pCreateInfo->offset;
+
view->surface_state =
anv_state_pool_alloc(&device->surface_state_pool, 64, 64);
anv_format_for_vk_format(pCreateInfo->format);
anv_fill_buffer_surface_state(device, view->surface_state.map, format,
- pCreateInfo->offset, pCreateInfo->range,
+ view->offset, pCreateInfo->range,
format->isl_layout->bpb / 8);
*pView = anv_buffer_view_to_handle(view);