// Image functions
+static const uint8_t anv_halign[] = {
+ [4] = HALIGN4,
+ [8] = HALIGN8,
+ [16] = HALIGN16,
+};
+
+static const uint8_t anv_valign[] = {
+ [4] = VALIGN4,
+ [8] = VALIGN8,
+ [16] = VALIGN16,
+};
+
static const struct anv_tile_mode_info {
int32_t tile_width;
int32_t tile_height;
if (extra)
image->tile_mode = extra->tile_mode;
+ /* FINISHME: Stop hardcoding miptree image alignment */
+ image->h_align = 4;
+ image->v_align = 4;
+
if (image->tile_mode == LINEAR) {
/* Linear depth buffers must be 64 byte aligned, which is the strictest
* requirement for all kinds of linear surfaces.
.SurfaceType = SURFTYPE_2D,
.SurfaceArray = false,
.SurfaceFormat = format,
- .SurfaceVerticalAlignment = VALIGN4,
- .SurfaceHorizontalAlignment = HALIGN4,
+ .SurfaceVerticalAlignment = anv_valign[image->v_align],
+ .SurfaceHorizontalAlignment = anv_halign[image->h_align],
.TileMode = tile_mode,
.VerticalLineStride = 0,
.VerticalLineStrideOffset = 0,
.SurfaceType = SURFTYPE_2D,
.SurfaceArray = false,
.SurfaceFormat = format->format,
- .SurfaceVerticalAlignment = VALIGN4,
- .SurfaceHorizontalAlignment = HALIGN4,
+ .SurfaceVerticalAlignment = anv_valign[image->v_align],
+ .SurfaceHorizontalAlignment = anv_halign[image->h_align],
.TileMode = image->tile_mode,
.VerticalLineStride = 0,
.VerticalLineStrideOffset = 0,
VkDeviceSize offset;
struct anv_swap_chain * swap_chain;
+
+ /**
+ * \name Alignment of miptree images, in units of pixels.
+ *
+ * These fields contain the actual alignment values, not the values the
+ * hardware expects. For example, if h_align is 4, then program the hardware
+ * with HALIGN_4.
+ *
+ * \see RENDER_SURFACE_STATE.SurfaceHorizontalAlignment
+ * \see RENDER_SURFACE_STATE.SurfaceVerticalAlignment
+ * \{
+ */
+ uint8_t h_align;
+ uint8_t v_align;
+ /** \} */
};
struct anv_surface_view {