vk/image: Add anv_image::h_align,v_align

Use the new fields to compute RENDER_SURFACE_STATE.Surface*Alignment.
We still hardcode them to 4, though.
This commit is contained in:
Chad Versace
2015-06-09 12:11:46 -07:00
parent 58afc24e57
commit e6162c2fef
2 changed files with 35 additions and 4 deletions
+20 -4
View File
@@ -31,6 +31,18 @@
// 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;
@@ -86,6 +98,10 @@ VkResult anv_image_create(
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.
@@ -192,8 +208,8 @@ anv_image_view_init(struct anv_surface_view *view,
.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,
@@ -283,8 +299,8 @@ anv_color_attachment_view_init(struct anv_surface_view *view,
.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,