mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 21:00:16 +01:00
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:
parent
58afc24e57
commit
e6162c2fef
2 changed files with 35 additions and 4 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -738,6 +738,21 @@ struct anv_image {
|
|||
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 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue