diff options
author | Chia-I Wu <[email protected]> | 2015-05-02 15:06:36 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2015-05-02 22:14:06 +0800 |
commit | 430594c34ff594b5bf47417b7240a62fc93509e9 (patch) | |
tree | f743e49d0332c659819f5526660eeadc0d2079d0 /src/gallium/drivers/ilo | |
parent | f6ca4084c7eca649e5444ac20218d94bd2a88057 (diff) |
ilo: make ilo_image more self-contained
Add depth0, sample_count, and scanout to ilo_image.
Diffstat (limited to 'src/gallium/drivers/ilo')
-rw-r--r-- | src/gallium/drivers/ilo/core/ilo_image.c | 13 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/core/ilo_image.h | 17 |
2 files changed, 21 insertions, 9 deletions
diff --git a/src/gallium/drivers/ilo/core/ilo_image.c b/src/gallium/drivers/ilo/core/ilo_image.c index 9c0f25aaefc..3a599bccc10 100644 --- a/src/gallium/drivers/ilo/core/ilo_image.c +++ b/src/gallium/drivers/ilo/core/ilo_image.c @@ -677,6 +677,8 @@ img_init_size_and_format(struct ilo_image *img, img->width0 = templ->width0; img->height0 = templ->height0; + img->depth0 = templ->depth0; + img->sample_count = (templ->nr_samples) ? templ->nr_samples : 1; /* * From the Sandy Bridge PRM, volume 2 part 1, page 317: @@ -1310,6 +1312,8 @@ img_init(struct ilo_image *img, img_align(img, params); img_calculate_bo_size(img, params); + img->scanout = (params->templ->bind & PIPE_BIND_SCANOUT); + switch (img->aux.type) { case ILO_IMAGE_AUX_HIZ: img_calculate_hiz_size(img, params); @@ -1339,12 +1343,17 @@ img_init_for_transfer(struct ilo_image *img, assert(templ->nr_samples <= 1); img->aux.type = ILO_IMAGE_AUX_NONE; + img->width0 = templ->width0; img->height0 = templ->height0; + img->depth0 = templ->depth0; + img->sample_count = 1; + img->format = templ->format; img->block_width = util_format_get_blockwidth(templ->format); img->block_height = util_format_get_blockheight(templ->format); img->block_size = util_format_get_blocksize(templ->format); + img->walk = ILO_IMAGE_WALK_LOD; img->tiling = GEN6_TILING_NONE; @@ -1421,5 +1430,9 @@ ilo_image_init_for_imported(struct ilo_image *img, img->bo_stride = bo_stride; + /* assume imported RTs are also scanouts */ + if (!img->scanout) + img->scanout = (templ->bind & PIPE_BIND_RENDER_TARGET); + return true; } diff --git a/src/gallium/drivers/ilo/core/ilo_image.h b/src/gallium/drivers/ilo/core/ilo_image.h index 0cdd8aec900..e3c51005d19 100644 --- a/src/gallium/drivers/ilo/core/ilo_image.h +++ b/src/gallium/drivers/ilo/core/ilo_image.h @@ -88,9 +88,11 @@ struct ilo_image_lod { * Texture layout. */ struct ilo_image { - /* size and format for programming hardware states */ + /* size, format, etc for programming hardware states */ unsigned width0; unsigned height0; + unsigned depth0; + unsigned sample_count; enum pipe_format format; bool separate_stencil; @@ -121,6 +123,8 @@ struct ilo_image { /* number of pixel block rows */ unsigned bo_height; + bool scanout; + struct intel_bo *bo; struct { @@ -310,17 +314,12 @@ ilo_image_get_slice_pos(const struct ilo_image *img, const unsigned sx = slice & ((1 << level) - 1); const unsigned sy = slice >> level; + assert(slice < u_minify(img->depth0, level)); + *x = img->lods[level].x + img->lods[level].slice_width * sx; *y = img->lods[level].y + img->lods[level].slice_height * sy; - - /* should not overlap with the next level */ - if (level + 1 < Elements(img->lods) && - img->lods[level + 1].y) { - assert(*y + img->lods[level].slice_height <= - img->lods[level + 1].y); - } - break; } + break; default: assert(!"unknown img walk type"); *x = 0; |