}
}
+static INLINE unsigned
+util_max_layer(struct pipe_resource *r, unsigned level)
+{
+ switch (r->target) {
+ case PIPE_TEXTURE_CUBE:
+ return 6 - 1;
+ case PIPE_TEXTURE_3D:
+ return u_minify(r->depth0, level) - 1;
+ case PIPE_TEXTURE_1D_ARRAY:
+ case PIPE_TEXTURE_2D_ARRAY:
+ case PIPE_TEXTURE_CUBE_ARRAY:
+ return r->array_size - 1;
+ default:
+ return 0;
+ }
+}
#ifdef __cplusplus
}
/* The smaller the mipmap level, the less layers there are
* as far as 3D textures are concerned. */
- max_layer = u_max_layer(&texture->resource.b.b, level);
+ max_layer = util_max_layer(&texture->resource.b.b, level);
checked_last_layer = last_layer < max_layer ? last_layer : max_layer;
for (layer = first_layer; layer <= checked_last_layer; layer++) {
/* The smaller the mipmap level, the less layers there are
* as far as 3D textures are concerned. */
- max_layer = u_max_layer(&texture->resource.b.b, level);
+ max_layer = util_max_layer(&texture->resource.b.b, level);
checked_last_layer = last_layer < max_layer ? last_layer : max_layer;
for (layer = first_layer; layer <= checked_last_layer; layer++) {
r600_can_read_depth(tex)) {
r600_blit_decompress_depth_in_place(rctx, tex,
view->u.tex.first_level, view->u.tex.last_level,
- 0, u_max_layer(&tex->resource.b.b, view->u.tex.first_level));
+ 0, util_max_layer(&tex->resource.b.b, view->u.tex.first_level));
} else {
r600_blit_decompress_depth(&rctx->context, tex, NULL,
view->u.tex.first_level, view->u.tex.last_level,
- 0, u_max_layer(&tex->resource.b.b, view->u.tex.first_level),
+ 0, util_max_layer(&tex->resource.b.b, view->u.tex.first_level),
0, u_max_sample(&tex->resource.b.b));
}
}
/* The smaller the mipmap level, the less layers there are
* as far as 3D textures are concerned. */
- max_layer = u_max_layer(&rtex->resource.b.b, level);
+ max_layer = util_max_layer(&rtex->resource.b.b, level);
checked_last_layer = last_layer < max_layer ? last_layer : max_layer;
for (layer = first_layer; layer <= checked_last_layer; layer++) {
r600_blit_decompress_color(&rctx->context, tex,
view->u.tex.first_level, view->u.tex.last_level,
- 0, u_max_layer(&tex->resource.b.b, view->u.tex.first_level));
+ 0, util_max_layer(&tex->resource.b.b, view->u.tex.first_level));
}
}
return rscreen->ws->buffer_get_virtual_address(rresource->cs_buf);
}
-static INLINE unsigned u_max_layer(struct pipe_resource *r, unsigned level)
-{
- switch (r->target) {
- case PIPE_TEXTURE_CUBE:
- return 6 - 1;
- case PIPE_TEXTURE_3D:
- return u_minify(r->depth0, level) - 1;
- case PIPE_TEXTURE_1D_ARRAY:
- case PIPE_TEXTURE_2D_ARRAY:
- case PIPE_TEXTURE_CUBE_ARRAY:
- return r->array_size - 1;
- default:
- return 0;
- }
-}
-
static INLINE void r600_context_add_resource_size(struct pipe_context *ctx, struct pipe_resource *r)
{
struct r600_context *rctx = (struct r600_context *)ctx;
{
struct r600_surface *surface = CALLOC_STRUCT(r600_surface);
- assert(templ->u.tex.first_layer <= u_max_layer(texture, templ->u.tex.level));
- assert(templ->u.tex.last_layer <= u_max_layer(texture, templ->u.tex.level));
+ assert(templ->u.tex.first_layer <= util_max_layer(texture, templ->u.tex.level));
+ assert(templ->u.tex.last_layer <= util_max_layer(texture, templ->u.tex.level));
assert(templ->u.tex.first_layer == templ->u.tex.last_layer);
if (surface == NULL)
return NULL;
resource.flags = R600_RESOURCE_FLAG_TRANSFER;
/* We must set the correct texture target and dimensions if needed for a 3D transfer. */
- if (box->depth > 1 && u_max_layer(texture, level) > 0)
+ if (box->depth > 1 && util_max_layer(texture, level) > 0)
resource.target = texture->target;
else
resource.target = PIPE_TEXTURE_2D;
/* The smaller the mipmap level, the less layers there are
* as far as 3D textures are concerned. */
- max_layer = u_max_layer(&texture->resource.b.b, level);
+ max_layer = util_max_layer(&texture->resource.b.b, level);
checked_last_layer = last_layer < max_layer ? last_layer : max_layer;
for (layer = first_layer; layer <= checked_last_layer; layer++) {
/* The smaller the mipmap level, the less layers there are
* as far as 3D textures are concerned. */
- max_layer = u_max_layer(&texture->resource.b.b, level);
+ max_layer = util_max_layer(&texture->resource.b.b, level);
checked_last_layer = last_layer < max_layer ? last_layer : max_layer;
for (layer = first_layer; layer <= checked_last_layer; layer++) {
si_blit_decompress_depth_in_place(rctx, tex,
view->u.tex.first_level, view->u.tex.last_level,
- 0, u_max_layer(&tex->resource.b.b, view->u.tex.first_level));
+ 0, util_max_layer(&tex->resource.b.b, view->u.tex.first_level));
}
}
resource.flags = R600_RESOURCE_FLAG_TRANSFER;
/* We must set the correct texture target and dimensions if needed for a 3D transfer. */
- if (box->depth > 1 && u_max_layer(texture, level) > 0)
+ if (box->depth > 1 && util_max_layer(texture, level) > 0)
resource.target = texture->target;
else
resource.target = PIPE_TEXTURE_2D;
struct r600_surface *surface = CALLOC_STRUCT(r600_surface);
unsigned level = surf_tmpl->u.tex.level;
- assert(surf_tmpl->u.tex.first_layer <= u_max_layer(texture, surf_tmpl->u.tex.level));
- assert(surf_tmpl->u.tex.last_layer <= u_max_layer(texture, surf_tmpl->u.tex.level));
+ assert(surf_tmpl->u.tex.first_layer <= util_max_layer(texture, surf_tmpl->u.tex.level));
+ assert(surf_tmpl->u.tex.last_layer <= util_max_layer(texture, surf_tmpl->u.tex.level));
assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
if (surface == NULL)
return NULL;
return rscreen->ws->buffer_get_virtual_address(rresource->cs_buf);
}
-static INLINE unsigned u_max_layer(struct pipe_resource *r, unsigned level)
-{
- switch (r->target) {
- case PIPE_TEXTURE_CUBE:
- return 6 - 1;
- case PIPE_TEXTURE_3D:
- return u_minify(r->depth0, level) - 1;
- case PIPE_TEXTURE_1D_ARRAY:
- case PIPE_TEXTURE_2D_ARRAY:
- case PIPE_TEXTURE_CUBE_ARRAY:
- return r->array_size - 1;
- default:
- return 0;
- }
-}
-
#endif