mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 08:58:02 +02:00
ilo: make ilo_image more self-contained
Add depth0, sample_count, and scanout to ilo_image.
This commit is contained in:
parent
f6ca4084c7
commit
430594c34f
2 changed files with 21 additions and 9 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue