#include "gen7_pack.h"
#include "gen75_pack.h"
+static const uint8_t
+anv_surftype(const struct anv_image *image, VkImageViewType view_type)
+{
+ switch (view_type) {
+ default:
+ unreachable("bad VkImageViewType");
+ case VK_IMAGE_VIEW_TYPE_1D:
+ case VK_IMAGE_VIEW_TYPE_1D_ARRAY:
+ assert(image->type == VK_IMAGE_TYPE_1D);
+ return SURFTYPE_1D;
+ case VK_IMAGE_VIEW_TYPE_CUBE:
+ case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
+ assert(image->type == VK_IMAGE_TYPE_2D);
+ return SURFTYPE_CUBE;
+ case VK_IMAGE_VIEW_TYPE_2D:
+ case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
+ assert(image->type == VK_IMAGE_TYPE_2D);
+ return SURFTYPE_2D;
+ case VK_IMAGE_VIEW_TYPE_3D:
+ assert(image->type == VK_IMAGE_TYPE_3D);
+ return SURFTYPE_3D;
+ }
+}
+
GENX_FUNC(GEN7, GEN75) void
genX(fill_buffer_surface_state)(void *state, const struct anv_format *format,
uint32_t offset, uint32_t range,
depth = image->extent.depth;
}
- const struct isl_extent3d lod_align_sa =
- isl_surf_get_lod_alignment_sa(&surface->isl);
+ const struct isl_extent3d image_align_sa =
+ isl_surf_get_image_alignment_sa(&surface->isl);
struct GENX(RENDER_SURFACE_STATE) surface_state = {
- .SurfaceType = image->surface_type,
+ .SurfaceType = anv_surftype(image, pCreateInfo->viewType),
.SurfaceArray = image->array_size > 1,
.SurfaceFormat = format->surface_format,
- .SurfaceVerticalAlignment = anv_valign[lod_align_sa.height],
- .SurfaceHorizontalAlignment = anv_halign[lod_align_sa.width],
+ .SurfaceVerticalAlignment = anv_valign[image_align_sa.height],
+ .SurfaceHorizontalAlignment = anv_halign[image_align_sa.width],
/* From bspec (DevSNB, DevIVB): "Set Tile Walk to TILEWALK_XMAJOR if
* Tiled Surface is False."
if (!device->info.has_llc)
anv_state_clflush(iview->color_rt_surface_state);
}
+
+ if (image->needs_storage_surface_state) {
+ iview->storage_surface_state = alloc_surface_state(device, cmd_buffer);
+
+ surface_state.SurfaceFormat =
+ isl_lower_storage_image_format(&device->isl_dev,
+ format->surface_format);
+
+ surface_state.SurfaceMinLOD = range->baseMipLevel;
+ surface_state.MIPCountLOD = range->levelCount - 1;
+
+ GENX(RENDER_SURFACE_STATE_pack)(NULL, iview->storage_surface_state.map,
+ &surface_state);
+ }
}