mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-22 17:10:32 +01:00
gallium: delete union pipe_surface_desc
this is no longer used Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35168>
This commit is contained in:
parent
ca65f2cf1c
commit
05f8b59c90
104 changed files with 760 additions and 905 deletions
|
|
@ -112,9 +112,9 @@ static struct pipe_surface *noop_create_surface(struct pipe_context *ctx,
|
|||
surface->context = ctx;
|
||||
surface->format = surf_tmpl->format;
|
||||
surface->texture = texture;
|
||||
surface->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
|
||||
surface->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
|
||||
surface->u.tex.level = surf_tmpl->u.tex.level;
|
||||
surface->first_layer = surf_tmpl->first_layer;
|
||||
surface->last_layer = surf_tmpl->last_layer;
|
||||
surface->level = surf_tmpl->level;
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -705,26 +705,9 @@ void trace_dump_surface_template(const struct pipe_surface *state,
|
|||
trace_dump_enum(tr_util_pipe_texture_target_name(target));
|
||||
trace_dump_member_end();
|
||||
|
||||
trace_dump_member_begin("u");
|
||||
trace_dump_struct_begin(""); /* anonymous */
|
||||
if (target == PIPE_BUFFER) {
|
||||
trace_dump_member_begin("buf");
|
||||
trace_dump_struct_begin(""); /* anonymous */
|
||||
trace_dump_member(uint, &state->u.buf, first_element);
|
||||
trace_dump_member(uint, &state->u.buf, last_element);
|
||||
trace_dump_struct_end(); /* anonymous */
|
||||
trace_dump_member_end(); /* buf */
|
||||
} else {
|
||||
trace_dump_member_begin("tex");
|
||||
trace_dump_struct_begin(""); /* anonymous */
|
||||
trace_dump_member(uint, &state->u.tex, level);
|
||||
trace_dump_member(uint, &state->u.tex, first_layer);
|
||||
trace_dump_member(uint, &state->u.tex, last_layer);
|
||||
trace_dump_struct_end(); /* anonymous */
|
||||
trace_dump_member_end(); /* tex */
|
||||
}
|
||||
trace_dump_struct_end(); /* anonymous */
|
||||
trace_dump_member_end(); /* u */
|
||||
trace_dump_member(uint, state, level);
|
||||
trace_dump_member(uint, state, first_layer);
|
||||
trace_dump_member(uint, state, last_layer);
|
||||
|
||||
trace_dump_struct_end();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ pp_blit(struct pipe_context *pipe,
|
|||
blit.src.box.depth = 1;
|
||||
|
||||
blit.dst.resource = dst->texture;
|
||||
blit.dst.level = dst->u.tex.level;
|
||||
blit.dst.level = dst->level;
|
||||
blit.dst.format = dst->format;
|
||||
blit.dst.box.x = dstX0;
|
||||
blit.dst.box.y = dstY0;
|
||||
|
|
|
|||
|
|
@ -1587,9 +1587,9 @@ void util_blitter_default_dst_texture(struct pipe_surface *dst_templ,
|
|||
memset(dst_templ, 0, sizeof(*dst_templ));
|
||||
dst_templ->texture = dst;
|
||||
dst_templ->format = util_format_linear(dst->format);
|
||||
dst_templ->u.tex.level = dstlevel;
|
||||
dst_templ->u.tex.first_layer = dstz;
|
||||
dst_templ->u.tex.last_layer = dstz;
|
||||
dst_templ->level = dstlevel;
|
||||
dst_templ->first_layer = dstz;
|
||||
dst_templ->last_layer = dstz;
|
||||
}
|
||||
|
||||
static struct pipe_surface *
|
||||
|
|
@ -1600,9 +1600,9 @@ util_blitter_get_next_surface_layer(struct pipe_context *pipe,
|
|||
|
||||
memset(&dst_templ, 0, sizeof(dst_templ));
|
||||
dst_templ.format = surf->format;
|
||||
dst_templ.u.tex.level = surf->u.tex.level;
|
||||
dst_templ.u.tex.first_layer = surf->u.tex.first_layer + 1;
|
||||
dst_templ.u.tex.last_layer = surf->u.tex.last_layer + 1;
|
||||
dst_templ.level = surf->level;
|
||||
dst_templ.first_layer = surf->first_layer + 1;
|
||||
dst_templ.last_layer = surf->last_layer + 1;
|
||||
|
||||
return pipe->create_surface(pipe, surf->texture, &dst_templ);
|
||||
}
|
||||
|
|
@ -2384,7 +2384,7 @@ void util_blitter_clear_render_target(struct blitter_context *blitter,
|
|||
pipe->set_constant_buffer(pipe, PIPE_SHADER_FRAGMENT, blitter->cb_slot,
|
||||
false, &cb);
|
||||
|
||||
num_layers = dstsurf->u.tex.last_layer - dstsurf->u.tex.first_layer + 1;
|
||||
num_layers = dstsurf->last_layer - dstsurf->first_layer + 1;
|
||||
|
||||
if (num_layers > 1 && ctx->has_layered) {
|
||||
get_vs = get_vs_layered;
|
||||
|
|
@ -2462,7 +2462,7 @@ void util_blitter_clear_depth_stencil(struct blitter_context *blitter,
|
|||
|
||||
blitter_set_dst_dimensions(ctx, fb_state.width, fb_state.height);
|
||||
|
||||
num_layers = dstsurf->u.tex.last_layer - dstsurf->u.tex.first_layer + 1;
|
||||
num_layers = dstsurf->last_layer - dstsurf->first_layer + 1;
|
||||
if (num_layers > 1 && ctx->has_layered) {
|
||||
blitter_set_common_draw_rect_state(ctx, false, false);
|
||||
blitter->draw_rectangle(blitter, ctx->velem_state, get_vs_layered,
|
||||
|
|
@ -2571,15 +2571,15 @@ void util_blitter_custom_resolve_color(struct blitter_context *blitter,
|
|||
|
||||
dstsurf.format = format;
|
||||
dstsurf.texture = dst;
|
||||
dstsurf.u.tex.level = dst_level;
|
||||
dstsurf.u.tex.first_layer = dst_layer;
|
||||
dstsurf.u.tex.last_layer = dst_layer;
|
||||
dstsurf.level = dst_level;
|
||||
dstsurf.first_layer = dst_layer;
|
||||
dstsurf.last_layer = dst_layer;
|
||||
|
||||
srcsurf.format = format;
|
||||
srcsurf.texture = src;
|
||||
srcsurf.u.tex.level = 0;
|
||||
srcsurf.u.tex.first_layer = src_layer;
|
||||
srcsurf.u.tex.last_layer = src_layer;
|
||||
srcsurf.level = 0;
|
||||
srcsurf.first_layer = src_layer;
|
||||
srcsurf.last_layer = src_layer;
|
||||
|
||||
/* set a framebuffer state */
|
||||
fb_state.width = src->width0;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ debug_describe_surface(char* buf, const struct pipe_surface *ptr)
|
|||
{
|
||||
char res[128];
|
||||
debug_describe_resource(res, ptr->texture);
|
||||
sprintf(buf, "pipe_surface<%s,%u,%u,%u>", res, ptr->u.tex.level, ptr->u.tex.first_layer, ptr->u.tex.last_layer);
|
||||
sprintf(buf, "pipe_surface<%s,%u,%u,%u>", res, ptr->level, ptr->first_layer, ptr->last_layer);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -112,8 +112,8 @@ debug_dump_surface(struct pipe_context *pipe,
|
|||
* to be done here:
|
||||
*/
|
||||
texture = surface->texture;
|
||||
data = pipe_texture_map(pipe, texture, surface->u.tex.level,
|
||||
surface->u.tex.first_layer,
|
||||
data = pipe_texture_map(pipe, texture, surface->level,
|
||||
surface->first_layer,
|
||||
PIPE_MAP_READ,
|
||||
0, 0, pipe_surface_width(surface),
|
||||
pipe_surface_height(surface), &transfer);
|
||||
|
|
@ -192,8 +192,8 @@ debug_dump_surface_bmp(struct pipe_context *pipe,
|
|||
struct pipe_resource *texture = surface->texture;
|
||||
void *ptr;
|
||||
|
||||
ptr = pipe_texture_map(pipe, texture, surface->u.tex.level,
|
||||
surface->u.tex.first_layer, PIPE_MAP_READ,
|
||||
ptr = pipe_texture_map(pipe, texture, surface->level,
|
||||
surface->first_layer, PIPE_MAP_READ,
|
||||
0, 0, pipe_surface_width(surface),
|
||||
pipe_surface_height(surface), &transfer);
|
||||
|
||||
|
|
|
|||
|
|
@ -728,9 +728,9 @@ util_dump_surface(FILE *stream, const struct pipe_surface *state)
|
|||
util_dump_member(stream, format, state, format);
|
||||
|
||||
util_dump_member(stream, ptr, state, texture);
|
||||
util_dump_member(stream, uint, state, u.tex.level);
|
||||
util_dump_member(stream, uint, state, u.tex.first_layer);
|
||||
util_dump_member(stream, uint, state, u.tex.last_layer);
|
||||
util_dump_member(stream, uint, state, level);
|
||||
util_dump_member(stream, uint, state, first_layer);
|
||||
util_dump_member(stream, uint, state, last_layer);
|
||||
|
||||
util_dump_struct_end(stream);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,14 +196,13 @@ util_framebuffer_get_num_layers(const struct pipe_framebuffer_state *fb)
|
|||
|
||||
for (i = 0; i < fb->nr_cbufs; i++) {
|
||||
if (fb->cbufs[i].texture) {
|
||||
unsigned num = fb->cbufs[i].u.tex.last_layer -
|
||||
fb->cbufs[i].u.tex.first_layer + 1;
|
||||
unsigned num = fb->cbufs[i].last_layer - fb->cbufs[i].first_layer + 1;
|
||||
num_layers = MAX2(num_layers, num);
|
||||
}
|
||||
}
|
||||
if (fb->zsbuf.texture) {
|
||||
unsigned num = fb->zsbuf.u.tex.last_layer -
|
||||
fb->zsbuf.u.tex.first_layer + 1;
|
||||
unsigned num = fb->zsbuf.last_layer -
|
||||
fb->zsbuf.first_layer + 1;
|
||||
num_layers = MAX2(num_layers, num);
|
||||
}
|
||||
return num_layers;
|
||||
|
|
|
|||
|
|
@ -344,8 +344,8 @@ pipe_surface_reset(struct pipe_context *ctx, struct pipe_surface* ps,
|
|||
{
|
||||
pipe_resource_reference(&ps->texture, pt);
|
||||
ps->format = pt->format;
|
||||
ps->u.tex.level = level;
|
||||
ps->u.tex.first_layer = ps->u.tex.last_layer = layer;
|
||||
ps->level = level;
|
||||
ps->first_layer = ps->last_layer = layer;
|
||||
ps->context = ctx;
|
||||
}
|
||||
|
||||
|
|
@ -361,12 +361,7 @@ pipe_surface_init(struct pipe_context *ctx, struct pipe_surface* ps,
|
|||
static inline unsigned
|
||||
pipe_surface_width(const struct pipe_surface *ps)
|
||||
{
|
||||
if (ps->texture->target == PIPE_BUFFER) {
|
||||
/* TODO: delete clover */
|
||||
return ps->u.buf.last_element - ps->u.buf.first_element + 1;
|
||||
}
|
||||
|
||||
unsigned width = (uint16_t)u_minify(ps->texture->width0, ps->u.tex.level);
|
||||
unsigned width = (uint16_t)u_minify(ps->texture->width0, ps->level);
|
||||
|
||||
/* adjust texture view size to get full blocksize on compressed formats */
|
||||
if (!util_format_is_depth_or_stencil(ps->texture->format) && ps->format != ps->texture->format) {
|
||||
|
|
@ -386,12 +381,7 @@ pipe_surface_width(const struct pipe_surface *ps)
|
|||
static inline unsigned
|
||||
pipe_surface_height(const struct pipe_surface *ps)
|
||||
{
|
||||
if (ps->texture->target == PIPE_BUFFER) {
|
||||
/* TODO: delete clover */
|
||||
return ps->texture->height0;
|
||||
}
|
||||
|
||||
unsigned height = u_minify(ps->texture->height0, ps->u.tex.level);
|
||||
unsigned height = u_minify(ps->texture->height0, ps->level);
|
||||
|
||||
/* adjust texture view size to get full blocksize on compressed formats */
|
||||
if (!util_format_is_depth_or_stencil(ps->texture->format) && ps->format != ps->texture->format) {
|
||||
|
|
@ -426,13 +416,10 @@ pipe_surface_equal(const struct pipe_surface *s1, const struct pipe_surface *s2)
|
|||
return !!s1 == !!s2 && s1->texture == s2->texture &&
|
||||
s1->format == s2->format &&
|
||||
s1->nr_samples == s2->nr_samples &&
|
||||
((s1->texture && s1->texture->target != PIPE_BUFFER) ||
|
||||
(s1->u.buf.first_element == s2->u.buf.first_element &&
|
||||
s1->u.buf.last_element == s2->u.buf.last_element)) &&
|
||||
((s1->texture && s1->texture->target == PIPE_BUFFER) ||
|
||||
(s1->u.tex.level == s2->u.tex.level &&
|
||||
s1->u.tex.first_layer == s2->u.tex.first_layer &&
|
||||
s1->u.tex.last_layer == s2->u.tex.last_layer));
|
||||
(!s1->texture ||
|
||||
(s1->level == s2->level &&
|
||||
s1->first_layer == s2->first_layer &&
|
||||
s1->last_layer == s2->last_layer));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -426,40 +426,14 @@ util_clear_render_target(struct pipe_context *pipe,
|
|||
unsigned dstx, unsigned dsty,
|
||||
unsigned width, unsigned height)
|
||||
{
|
||||
struct pipe_transfer *dst_trans;
|
||||
uint8_t *dst_map;
|
||||
|
||||
assert(dst->texture);
|
||||
if (!dst->texture)
|
||||
return;
|
||||
|
||||
if (dst->texture->target == PIPE_BUFFER) {
|
||||
/*
|
||||
* The fill naturally works on the surface format, however
|
||||
* the transfer uses resource format which is just bytes for buffers.
|
||||
*/
|
||||
unsigned dx, w;
|
||||
unsigned pixstride = util_format_get_blocksize(dst->format);
|
||||
dx = (dst->u.buf.first_element + dstx) * pixstride;
|
||||
w = width * pixstride;
|
||||
dst_map = pipe_texture_map(pipe,
|
||||
dst->texture,
|
||||
0, 0,
|
||||
PIPE_MAP_WRITE,
|
||||
dx, 0, w, 1,
|
||||
&dst_trans);
|
||||
if (dst_map) {
|
||||
util_clear_color_texture_helper(dst_trans, dst_map, dst->format,
|
||||
color, width, height, 1);
|
||||
pipe->texture_unmap(pipe, dst_trans);
|
||||
}
|
||||
}
|
||||
else {
|
||||
unsigned depth = dst->u.tex.last_layer - dst->u.tex.first_layer + 1;
|
||||
util_clear_color_texture(pipe, dst->texture, dst->format, color,
|
||||
dst->u.tex.level, dstx, dsty,
|
||||
dst->u.tex.first_layer, width, height, depth);
|
||||
}
|
||||
unsigned depth = dst->last_layer - dst->first_layer + 1;
|
||||
util_clear_color_texture(pipe, dst->texture, dst->format, color,
|
||||
dst->level, dstx, dsty,
|
||||
dst->first_layer, width, height, depth);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -625,9 +599,9 @@ util_clear_texture_as_surface(struct pipe_context *pipe,
|
|||
struct pipe_surface tmpl = {{0}}, *sf;
|
||||
|
||||
tmpl.format = res->format;
|
||||
tmpl.u.tex.first_layer = box->z;
|
||||
tmpl.u.tex.last_layer = box->z + box->depth - 1;
|
||||
tmpl.u.tex.level = level;
|
||||
tmpl.first_layer = box->z;
|
||||
tmpl.last_layer = box->z + box->depth - 1;
|
||||
tmpl.level = level;
|
||||
|
||||
if (util_format_is_depth_or_stencil(res->format)) {
|
||||
if (!pipe->clear_depth_stencil)
|
||||
|
|
@ -806,10 +780,10 @@ util_clear_depth_stencil(struct pipe_context *pipe,
|
|||
return;
|
||||
|
||||
zstencil = util_pack64_z_stencil(dst->format, depth, stencil);
|
||||
max_layer = dst->u.tex.last_layer - dst->u.tex.first_layer;
|
||||
max_layer = dst->last_layer - dst->first_layer;
|
||||
util_clear_depth_stencil_texture(pipe, dst->texture, dst->format,
|
||||
clear_flags, zstencil, dst->u.tex.level,
|
||||
dstx, dsty, dst->u.tex.first_layer,
|
||||
clear_flags, zstencil, dst->level,
|
||||
dstx, dsty, dst->first_layer,
|
||||
width, height, max_layer + 1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -602,8 +602,8 @@ init_source(struct vl_idct *idct, struct vl_idct_buffer *buffer)
|
|||
memset(&surf_templ, 0, sizeof(surf_templ));
|
||||
surf_templ.texture = tex;
|
||||
surf_templ.format = tex->format;
|
||||
surf_templ.u.tex.first_layer = 0;
|
||||
surf_templ.u.tex.last_layer = 0;
|
||||
surf_templ.first_layer = 0;
|
||||
surf_templ.last_layer = 0;
|
||||
buffer->fb_state_mismatch.cbufs[0] = surf_templ;
|
||||
|
||||
buffer->viewport_mismatch.scale[0] = tex->width0;
|
||||
|
|
@ -645,8 +645,8 @@ init_intermediate(struct vl_idct *idct, struct vl_idct_buffer *buffer)
|
|||
memset(&surf_templ, 0, sizeof(surf_templ));
|
||||
surf_templ.format = tex->format;
|
||||
surf_templ.texture = tex;
|
||||
surf_templ.u.tex.first_layer = i;
|
||||
surf_templ.u.tex.last_layer = i;
|
||||
surf_templ.first_layer = i;
|
||||
surf_templ.last_layer = i;
|
||||
buffer->fb_state.cbufs[i] = surf_templ;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ vl_video_buffer_surfaces(struct vl_video_buffer *buf)
|
|||
|
||||
buf->surfaces[surf].texture = buf->resources[i];
|
||||
buf->surfaces[surf].format = vl_video_buffer_surface_format(buf->resources[i]->format);
|
||||
buf->surfaces[surf].u.tex.first_layer = buf->surfaces[surf].u.tex.last_layer = j;
|
||||
buf->surfaces[surf].first_layer = buf->surfaces[surf].last_layer = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1268,8 +1268,8 @@ agx_cmdbuf(struct agx_device *dev, struct drm_asahi_cmd_render *c,
|
|||
if (zsres->separate_stencil)
|
||||
sres = zsres->separate_stencil;
|
||||
|
||||
unsigned level = zsbuf->u.tex.level;
|
||||
unsigned first_layer = zsbuf->u.tex.first_layer;
|
||||
unsigned level = zsbuf->level;
|
||||
unsigned first_layer = zsbuf->first_layer;
|
||||
|
||||
if (zres) {
|
||||
c->depth.base = agx_map_texture_gpu(zres, first_layer) +
|
||||
|
|
|
|||
|
|
@ -866,7 +866,7 @@ agx_create_surface(struct pipe_context *ctx, struct pipe_resource *texture,
|
|||
if (!surface)
|
||||
return NULL;
|
||||
|
||||
unsigned level = surf_tmpl->u.tex.level;
|
||||
unsigned level = surf_tmpl->level;
|
||||
|
||||
pipe_reference_init(&surface->reference, 1);
|
||||
pipe_resource_reference(&surface->texture, texture);
|
||||
|
|
@ -877,9 +877,9 @@ agx_create_surface(struct pipe_context *ctx, struct pipe_resource *texture,
|
|||
surface->format = surf_tmpl->format;
|
||||
surface->nr_samples = surf_tmpl->nr_samples;
|
||||
surface->texture = texture;
|
||||
surface->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
|
||||
surface->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
|
||||
surface->u.tex.level = level;
|
||||
surface->first_layer = surf_tmpl->first_layer;
|
||||
surface->last_layer = surf_tmpl->last_layer;
|
||||
surface->level = level;
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
|
@ -1126,10 +1126,10 @@ image_view_for_surface(const struct pipe_surface *surf)
|
|||
.access = PIPE_IMAGE_ACCESS_READ_WRITE,
|
||||
.shader_access = PIPE_IMAGE_ACCESS_READ_WRITE,
|
||||
.u.tex.single_layer_view =
|
||||
surf->u.tex.first_layer == surf->u.tex.last_layer,
|
||||
.u.tex.first_layer = surf->u.tex.first_layer,
|
||||
.u.tex.last_layer = surf->u.tex.last_layer,
|
||||
.u.tex.level = surf->u.tex.level,
|
||||
surf->first_layer == surf->last_layer,
|
||||
.u.tex.first_layer = surf->first_layer,
|
||||
.u.tex.last_layer = surf->last_layer,
|
||||
.u.tex.level = surf->level,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1137,7 +1137,7 @@ image_view_for_surface(const struct pipe_surface *surf)
|
|||
static struct pipe_sampler_view
|
||||
sampler_view_for_surface(const struct pipe_surface *surf)
|
||||
{
|
||||
bool layered = surf->u.tex.last_layer > surf->u.tex.first_layer;
|
||||
bool layered = surf->last_layer > surf->first_layer;
|
||||
|
||||
return (struct pipe_sampler_view){
|
||||
/* To reduce shader variants, we always use a 2D texture. For reloads of
|
||||
|
|
@ -1150,10 +1150,10 @@ sampler_view_for_surface(const struct pipe_surface *surf)
|
|||
.swizzle_a = PIPE_SWIZZLE_W,
|
||||
.u.tex =
|
||||
{
|
||||
.first_layer = surf->u.tex.first_layer,
|
||||
.last_layer = surf->u.tex.last_layer,
|
||||
.first_level = surf->u.tex.level,
|
||||
.last_level = surf->u.tex.level,
|
||||
.first_layer = surf->first_layer,
|
||||
.last_layer = surf->last_layer,
|
||||
.first_level = surf->level,
|
||||
.last_level = surf->level,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
@ -3431,7 +3431,7 @@ agx_batch_init_state(struct agx_batch *batch)
|
|||
|
||||
struct agx_resource *rsrc = agx_resource(surf->texture);
|
||||
struct ail_layout *layout = &rsrc->layout;
|
||||
unsigned level = surf->u.tex.level;
|
||||
unsigned level = surf->level;
|
||||
|
||||
if (!ail_is_level_compressed(layout, level))
|
||||
continue;
|
||||
|
|
@ -3445,7 +3445,7 @@ agx_batch_init_state(struct agx_batch *batch)
|
|||
}
|
||||
|
||||
if (batch->key.zsbuf.texture) {
|
||||
unsigned level = batch->key.zsbuf.u.tex.level;
|
||||
unsigned level = batch->key.zsbuf.level;
|
||||
struct agx_resource *rsrc = agx_resource(batch->key.zsbuf.texture);
|
||||
|
||||
agx_batch_writes(batch, rsrc, level);
|
||||
|
|
@ -3457,7 +3457,7 @@ agx_batch_init_state(struct agx_batch *batch)
|
|||
for (unsigned i = 0; i < batch->key.nr_cbufs; ++i) {
|
||||
if (batch->key.cbufs[i].texture) {
|
||||
struct agx_resource *rsrc = agx_resource(batch->key.cbufs[i].texture);
|
||||
unsigned level = batch->key.cbufs[i].u.tex.level;
|
||||
unsigned level = batch->key.cbufs[i].level;
|
||||
|
||||
if (agx_resource_valid(rsrc, level))
|
||||
batch->load |= PIPE_CLEAR_COLOR0 << i;
|
||||
|
|
@ -5516,7 +5516,7 @@ agx_decompress_inplace(struct agx_batch *batch, struct pipe_surface *surf,
|
|||
struct agx_device *dev = agx_device(ctx->base.screen);
|
||||
struct agx_resource *rsrc = agx_resource(surf->texture);
|
||||
struct ail_layout *layout = &rsrc->layout;
|
||||
unsigned level = surf->u.tex.level;
|
||||
unsigned level = surf->level;
|
||||
|
||||
perf_debug(dev, "Decompressing in-place due to: %s", reason);
|
||||
|
||||
|
|
@ -5537,10 +5537,10 @@ agx_decompress_inplace(struct agx_batch *batch, struct pipe_surface *surf,
|
|||
struct agx_grid grid =
|
||||
agx_3d(ail_metadata_width_tl(layout, level) * 32,
|
||||
ail_metadata_height_tl(layout, level),
|
||||
surf->u.tex.last_layer - surf->u.tex.first_layer + 1);
|
||||
surf->last_layer - surf->first_layer + 1);
|
||||
|
||||
libagx_decompress(batch, grid, AGX_BARRIER_ALL, layout,
|
||||
surf->u.tex.first_layer, level,
|
||||
surf->first_layer, level,
|
||||
agx_map_texture_gpu(rsrc, 0), images.gpu);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -644,10 +644,10 @@ crocus_clear(struct pipe_context *ctx,
|
|||
buffers & PIPE_CLEAR_DEPTHSTENCIL, p_color, depth, stencil, false);
|
||||
} else {
|
||||
const struct pipe_surface *psurf = &cso_fb->zsbuf;
|
||||
box.depth = psurf->u.tex.last_layer - psurf->u.tex.first_layer + 1;
|
||||
box.z = psurf->u.tex.first_layer;
|
||||
box.depth = psurf->last_layer - psurf->first_layer + 1;
|
||||
box.z = psurf->first_layer;
|
||||
|
||||
clear_depth_stencil(ice, psurf->texture, psurf->u.tex.level, &box, true,
|
||||
clear_depth_stencil(ice, psurf->texture, psurf->level, &box, true,
|
||||
buffers & PIPE_CLEAR_DEPTH,
|
||||
buffers & PIPE_CLEAR_STENCIL,
|
||||
depth, stencil);
|
||||
|
|
@ -663,10 +663,10 @@ crocus_clear(struct pipe_context *ctx,
|
|||
if (buffers & (PIPE_CLEAR_COLOR0 << i)) {
|
||||
struct pipe_surface *psurf = ice->state.fb_cbufs[i];
|
||||
struct crocus_surface *isurf = (void *) psurf;
|
||||
box.depth = psurf->u.tex.last_layer - psurf->u.tex.first_layer + 1,
|
||||
box.z = psurf->u.tex.first_layer,
|
||||
box.depth = psurf->last_layer - psurf->first_layer + 1,
|
||||
box.z = psurf->first_layer,
|
||||
|
||||
clear_color(ice, psurf->texture, psurf->u.tex.level, &box,
|
||||
clear_color(ice, psurf->texture, psurf->level, &box,
|
||||
true, isurf->view.format, isurf->view.swizzle,
|
||||
*color);
|
||||
}
|
||||
|
|
@ -761,16 +761,16 @@ crocus_clear_render_target(struct pipe_context *ctx,
|
|||
struct pipe_box box = {
|
||||
.x = dst_x,
|
||||
.y = dst_y,
|
||||
.z = psurf->u.tex.first_layer,
|
||||
.z = psurf->first_layer,
|
||||
.width = width,
|
||||
.height = height,
|
||||
.depth = psurf->u.tex.last_layer - psurf->u.tex.first_layer + 1
|
||||
.depth = psurf->last_layer - psurf->first_layer + 1
|
||||
};
|
||||
|
||||
/* pipe_color_union and isl_color_value are interchangeable */
|
||||
union isl_color_value *color = (void *) p_color;
|
||||
|
||||
clear_color(ice, psurf->texture, psurf->u.tex.level, &box,
|
||||
clear_color(ice, psurf->texture, psurf->level, &box,
|
||||
render_condition_enabled,
|
||||
isurf->view.format, isurf->view.swizzle, *color);
|
||||
}
|
||||
|
|
@ -796,10 +796,10 @@ crocus_clear_depth_stencil(struct pipe_context *ctx,
|
|||
struct pipe_box box = {
|
||||
.x = dst_x,
|
||||
.y = dst_y,
|
||||
.z = psurf->u.tex.first_layer,
|
||||
.z = psurf->first_layer,
|
||||
.width = width,
|
||||
.height = height,
|
||||
.depth = psurf->u.tex.last_layer - psurf->u.tex.first_layer + 1
|
||||
.depth = psurf->last_layer - psurf->first_layer + 1
|
||||
};
|
||||
uint32_t blit_flags = 0;
|
||||
|
||||
|
|
@ -809,7 +809,7 @@ crocus_clear_depth_stencil(struct pipe_context *ctx,
|
|||
util_blitter_clear(ice->blitter, width, height,
|
||||
1, flags, NULL, depth, stencil, render_condition_enabled);
|
||||
#if 0
|
||||
clear_depth_stencil(ice, psurf->texture, psurf->u.tex.level, &box,
|
||||
clear_depth_stencil(ice, psurf->texture, psurf->level, &box,
|
||||
render_condition_enabled,
|
||||
flags & PIPE_CLEAR_DEPTH, flags & PIPE_CLEAR_STENCIL,
|
||||
depth, stencil);
|
||||
|
|
|
|||
|
|
@ -69,8 +69,8 @@ disable_rb_aux_buffer(struct crocus_context *ice,
|
|||
struct crocus_resource *rb_res = (void *) surf->base.texture;
|
||||
|
||||
if (rb_res->bo == tex_res->bo &&
|
||||
surf->base.u.tex.level >= min_level &&
|
||||
surf->base.u.tex.level < min_level + num_levels) {
|
||||
surf->base.level >= min_level &&
|
||||
surf->base.level < min_level + num_levels) {
|
||||
found = draw_aux_buffer_disabled[i] = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -170,15 +170,15 @@ crocus_update_align_res(struct crocus_batch *batch,
|
|||
struct pipe_blit_info info = { 0 };
|
||||
|
||||
info.src.resource = copy_to_wa ? surf->base.texture : surf->align_res;
|
||||
info.src.level = copy_to_wa ? surf->base.u.tex.level : 0;
|
||||
u_box_2d_zslice(0, 0, copy_to_wa ? surf->base.u.tex.first_layer : 0,
|
||||
u_minify(surf->base.texture->width0, surf->base.u.tex.level),
|
||||
u_minify(surf->base.texture->height0, surf->base.u.tex.level), &info.src.box);
|
||||
info.src.level = copy_to_wa ? surf->base.level : 0;
|
||||
u_box_2d_zslice(0, 0, copy_to_wa ? surf->base.first_layer : 0,
|
||||
u_minify(surf->base.texture->width0, surf->base.level),
|
||||
u_minify(surf->base.texture->height0, surf->base.level), &info.src.box);
|
||||
info.src.format = surf->base.texture->format;
|
||||
info.dst.resource = copy_to_wa ? surf->align_res : surf->base.texture;
|
||||
info.dst.level = copy_to_wa ? 0 : surf->base.u.tex.level;
|
||||
info.dst.level = copy_to_wa ? 0 : surf->base.level;
|
||||
info.dst.box = info.src.box;
|
||||
info.dst.box.z = copy_to_wa ? 0 : surf->base.u.tex.first_layer;
|
||||
info.dst.box.z = copy_to_wa ? 0 : surf->base.first_layer;
|
||||
info.dst.format = surf->base.texture->format;
|
||||
info.mask = util_format_is_depth_or_stencil(surf->base.texture->format) ? PIPE_MASK_ZS : PIPE_MASK_RGBA;
|
||||
info.filter = 0;
|
||||
|
|
@ -233,12 +233,12 @@ crocus_predraw_resolve_framebuffer(struct crocus_context *ice,
|
|||
struct crocus_resource *z_res, *s_res;
|
||||
crocus_get_depth_stencil_resources(devinfo, zs_surf->texture, &z_res, &s_res);
|
||||
unsigned num_layers =
|
||||
zs_surf->u.tex.last_layer - zs_surf->u.tex.first_layer + 1;
|
||||
zs_surf->last_layer - zs_surf->first_layer + 1;
|
||||
|
||||
if (z_res) {
|
||||
crocus_resource_prepare_render(ice, z_res,
|
||||
zs_surf->u.tex.level,
|
||||
zs_surf->u.tex.first_layer,
|
||||
zs_surf->level,
|
||||
zs_surf->first_layer,
|
||||
num_layers, ice->state.hiz_usage);
|
||||
crocus_cache_flush_for_depth(batch, z_res->bo);
|
||||
|
||||
|
|
@ -330,12 +330,12 @@ crocus_postdraw_update_resolve_tracking(struct crocus_context *ice,
|
|||
struct crocus_resource *z_res, *s_res;
|
||||
crocus_get_depth_stencil_resources(devinfo, zs_surf->texture, &z_res, &s_res);
|
||||
unsigned num_layers =
|
||||
zs_surf->u.tex.last_layer - zs_surf->u.tex.first_layer + 1;
|
||||
zs_surf->last_layer - zs_surf->first_layer + 1;
|
||||
|
||||
if (z_res) {
|
||||
if (may_have_resolved_depth && ice->state.depth_writes_enabled) {
|
||||
crocus_resource_finish_render(ice, z_res, zs_surf->u.tex.level,
|
||||
zs_surf->u.tex.first_layer, num_layers,
|
||||
crocus_resource_finish_render(ice, z_res, zs_surf->level,
|
||||
zs_surf->first_layer, num_layers,
|
||||
ice->state.hiz_usage);
|
||||
}
|
||||
|
||||
|
|
@ -349,8 +349,8 @@ crocus_postdraw_update_resolve_tracking(struct crocus_context *ice,
|
|||
|
||||
if (s_res) {
|
||||
if (may_have_resolved_depth && ice->state.stencil_writes_enabled) {
|
||||
crocus_resource_finish_write(ice, s_res, zs_surf->u.tex.level,
|
||||
zs_surf->u.tex.first_layer, num_layers,
|
||||
crocus_resource_finish_write(ice, s_res, zs_surf->level,
|
||||
zs_surf->first_layer, num_layers,
|
||||
s_res->aux.usage);
|
||||
}
|
||||
|
||||
|
|
@ -376,11 +376,10 @@ crocus_postdraw_update_resolve_tracking(struct crocus_context *ice,
|
|||
aux_usage);
|
||||
|
||||
if (may_have_resolved_color) {
|
||||
union pipe_surface_desc *desc = &surf->base.u;
|
||||
unsigned num_layers =
|
||||
desc->tex.last_layer - desc->tex.first_layer + 1;
|
||||
crocus_resource_finish_render(ice, res, desc->tex.level,
|
||||
desc->tex.first_layer, num_layers,
|
||||
surf->base.last_layer - surf->base.first_layer + 1;
|
||||
crocus_resource_finish_render(ice, res, surf->base.level,
|
||||
surf->base.first_layer, num_layers,
|
||||
aux_usage);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1869,7 +1869,7 @@ want_pma_fix(struct crocus_context *ice)
|
|||
/* 3DSTATE_DEPTH_BUFFER::SURFACE_TYPE != NULL &&
|
||||
* 3DSTATE_DEPTH_BUFFER::HIZ Enable &&
|
||||
*/
|
||||
if (!zres || !crocus_resource_level_has_hiz(zres, cso_fb->zsbuf.u.tex.level))
|
||||
if (!zres || !crocus_resource_level_has_hiz(zres, cso_fb->zsbuf.level))
|
||||
return false;
|
||||
|
||||
/* 3DSTATE_WM::EDSC_Mode != EDSC_PREPS */
|
||||
|
|
@ -2857,18 +2857,18 @@ crocus_create_surface(struct pipe_context *ctx,
|
|||
pipe_resource_reference(&psurf->texture, tex);
|
||||
psurf->context = ctx;
|
||||
psurf->format = tmpl->format;
|
||||
psurf->u.tex.first_layer = tmpl->u.tex.first_layer;
|
||||
psurf->u.tex.last_layer = tmpl->u.tex.last_layer;
|
||||
psurf->u.tex.level = tmpl->u.tex.level;
|
||||
psurf->first_layer = tmpl->first_layer;
|
||||
psurf->last_layer = tmpl->last_layer;
|
||||
psurf->level = tmpl->level;
|
||||
|
||||
uint32_t array_len = tmpl->u.tex.last_layer - tmpl->u.tex.first_layer + 1;
|
||||
uint32_t array_len = tmpl->last_layer - tmpl->first_layer + 1;
|
||||
|
||||
struct isl_view *view = &surf->view;
|
||||
*view = (struct isl_view) {
|
||||
.format = fmt.fmt,
|
||||
.base_level = tmpl->u.tex.level,
|
||||
.base_level = tmpl->level,
|
||||
.levels = 1,
|
||||
.base_array_layer = tmpl->u.tex.first_layer,
|
||||
.base_array_layer = tmpl->first_layer,
|
||||
.array_len = array_len,
|
||||
.swizzle = ISL_SWIZZLE_IDENTITY,
|
||||
.usage = usage,
|
||||
|
|
@ -2878,9 +2878,9 @@ crocus_create_surface(struct pipe_context *ctx,
|
|||
struct isl_view *read_view = &surf->read_view;
|
||||
*read_view = (struct isl_view) {
|
||||
.format = fmt.fmt,
|
||||
.base_level = tmpl->u.tex.level,
|
||||
.base_level = tmpl->level,
|
||||
.levels = 1,
|
||||
.base_array_layer = tmpl->u.tex.first_layer,
|
||||
.base_array_layer = tmpl->first_layer,
|
||||
.array_len = array_len,
|
||||
.swizzle = ISL_SWIZZLE_IDENTITY,
|
||||
.usage = ISL_SURF_USAGE_TEXTURE_BIT,
|
||||
|
|
@ -2899,9 +2899,9 @@ crocus_create_surface(struct pipe_context *ctx,
|
|||
uint64_t temp_offset;
|
||||
uint32_t temp_x, temp_y;
|
||||
|
||||
isl_surf_get_image_offset_B_tile_sa(&res->surf, tmpl->u.tex.level,
|
||||
res->base.b.target == PIPE_TEXTURE_3D ? 0 : tmpl->u.tex.first_layer,
|
||||
res->base.b.target == PIPE_TEXTURE_3D ? tmpl->u.tex.first_layer : 0,
|
||||
isl_surf_get_image_offset_B_tile_sa(&res->surf, tmpl->level,
|
||||
res->base.b.target == PIPE_TEXTURE_3D ? 0 : tmpl->first_layer,
|
||||
res->base.b.target == PIPE_TEXTURE_3D ? tmpl->first_layer : 0,
|
||||
&temp_offset, &temp_x, &temp_y);
|
||||
if (devinfo->verx10 == 40 && (temp_x || temp_y)) {
|
||||
/* Original gfx4 hardware couldn't draw to a non-tile-aligned
|
||||
|
|
@ -2909,8 +2909,8 @@ crocus_create_surface(struct pipe_context *ctx,
|
|||
*/
|
||||
/* move to temp */
|
||||
struct pipe_resource wa_templ = (struct pipe_resource) {
|
||||
.width0 = u_minify(res->base.b.width0, tmpl->u.tex.level),
|
||||
.height0 = u_minify(res->base.b.height0, tmpl->u.tex.level),
|
||||
.width0 = u_minify(res->base.b.width0, tmpl->level),
|
||||
.height0 = u_minify(res->base.b.height0, tmpl->level),
|
||||
.depth0 = 1,
|
||||
.array_size = 1,
|
||||
.format = res->base.b.format,
|
||||
|
|
@ -3443,7 +3443,7 @@ crocus_set_framebuffer_state(struct pipe_context *ctx,
|
|||
enum isl_aux_usage aux_usage = ISL_AUX_USAGE_NONE;
|
||||
crocus_get_depth_stencil_resources(devinfo, cso->zsbuf.texture, &zres,
|
||||
&stencil_res);
|
||||
if (zres && crocus_resource_level_has_hiz(zres, cso->zsbuf.u.tex.level)) {
|
||||
if (zres && crocus_resource_level_has_hiz(zres, cso->zsbuf.level)) {
|
||||
aux_usage = zres->aux.usage;
|
||||
}
|
||||
ice->state.hiz_usage = aux_usage;
|
||||
|
|
@ -4944,8 +4944,8 @@ emit_null_fb_surface(struct crocus_batch *batch,
|
|||
if (cso->nr_cbufs == 0 && ice->state.fb_zsbuf) {
|
||||
width = ((struct crocus_surface*)ice->state.fb_zsbuf)->surf.logical_level0_px.width;
|
||||
height = ((struct crocus_surface*)ice->state.fb_zsbuf)->surf.logical_level0_px.height;
|
||||
level = cso->zsbuf.u.tex.level;
|
||||
layer = cso->zsbuf.u.tex.first_layer;
|
||||
level = cso->zsbuf.level;
|
||||
layer = cso->zsbuf.first_layer;
|
||||
}
|
||||
emit_sized_null_surface(batch, width, height,
|
||||
layers, level, layer,
|
||||
|
|
@ -7448,9 +7448,9 @@ crocus_upload_dirty_render_state(struct crocus_context *ice,
|
|||
if (zsbuf->align_res) {
|
||||
zres = (struct crocus_resource *)zsbuf->align_res;
|
||||
}
|
||||
view.base_level = cso->zsbuf.u.tex.level;
|
||||
view.base_array_layer = cso->zsbuf.u.tex.first_layer;
|
||||
view.array_len = cso->zsbuf.u.tex.last_layer - cso->zsbuf.u.tex.first_layer + 1;
|
||||
view.base_level = cso->zsbuf.level;
|
||||
view.base_array_layer = cso->zsbuf.first_layer;
|
||||
view.array_len = cso->zsbuf.last_layer - cso->zsbuf.first_layer + 1;
|
||||
|
||||
if (zres) {
|
||||
view.usage |= ISL_SURF_USAGE_DEPTH_BIT;
|
||||
|
|
|
|||
|
|
@ -707,11 +707,11 @@ transition_surface_subresources_state(struct d3d12_context *ctx,
|
|||
start_layer = 0;
|
||||
num_layers = 1;
|
||||
} else {
|
||||
start_layer = psurf->u.tex.first_layer;
|
||||
num_layers = psurf->u.tex.last_layer - psurf->u.tex.first_layer + 1;
|
||||
start_layer = psurf->first_layer;
|
||||
num_layers = psurf->last_layer - psurf->first_layer + 1;
|
||||
}
|
||||
d3d12_transition_subresources_state(ctx, res,
|
||||
psurf->u.tex.level, 1,
|
||||
psurf->level, 1,
|
||||
start_layer, num_layers,
|
||||
d3d12_get_format_start_plane(psurf->format),
|
||||
d3d12_get_format_num_planes(psurf->format),
|
||||
|
|
|
|||
|
|
@ -97,43 +97,43 @@ initialize_dsv(struct pipe_context *pctx,
|
|||
desc.ViewDimension = view_dsv_dimension(pres->target, pres->nr_samples);
|
||||
switch (desc.ViewDimension) {
|
||||
case D3D12_DSV_DIMENSION_TEXTURE1D:
|
||||
if (tpl->u.tex.first_layer > 0)
|
||||
if (tpl->first_layer > 0)
|
||||
debug_printf("D3D12: can't create 1D DSV from layer %d\n",
|
||||
tpl->u.tex.first_layer);
|
||||
tpl->first_layer);
|
||||
|
||||
desc.Texture1D.MipSlice = tpl->u.tex.level;
|
||||
desc.Texture1D.MipSlice = tpl->level;
|
||||
break;
|
||||
|
||||
case D3D12_DSV_DIMENSION_TEXTURE1DARRAY:
|
||||
desc.Texture1DArray.MipSlice = tpl->u.tex.level;
|
||||
desc.Texture1DArray.FirstArraySlice = tpl->u.tex.first_layer;
|
||||
desc.Texture1DArray.ArraySize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1;
|
||||
desc.Texture1DArray.MipSlice = tpl->level;
|
||||
desc.Texture1DArray.FirstArraySlice = tpl->first_layer;
|
||||
desc.Texture1DArray.ArraySize = tpl->last_layer - tpl->first_layer + 1;
|
||||
break;
|
||||
|
||||
case D3D12_DSV_DIMENSION_TEXTURE2DMS:
|
||||
if (tpl->u.tex.first_layer > 0)
|
||||
if (tpl->first_layer > 0)
|
||||
debug_printf("D3D12: can't create 2DMS DSV from layer %d\n",
|
||||
tpl->u.tex.first_layer);
|
||||
tpl->first_layer);
|
||||
|
||||
break;
|
||||
|
||||
case D3D12_DSV_DIMENSION_TEXTURE2D:
|
||||
if (tpl->u.tex.first_layer > 0)
|
||||
if (tpl->first_layer > 0)
|
||||
debug_printf("D3D12: can't create 2D DSV from layer %d\n",
|
||||
tpl->u.tex.first_layer);
|
||||
tpl->first_layer);
|
||||
|
||||
desc.Texture2D.MipSlice = tpl->u.tex.level;
|
||||
desc.Texture2D.MipSlice = tpl->level;
|
||||
break;
|
||||
|
||||
case D3D12_DSV_DIMENSION_TEXTURE2DMSARRAY:
|
||||
desc.Texture2DMSArray.FirstArraySlice = tpl->u.tex.first_layer;
|
||||
desc.Texture2DMSArray.ArraySize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1;
|
||||
desc.Texture2DMSArray.FirstArraySlice = tpl->first_layer;
|
||||
desc.Texture2DMSArray.ArraySize = tpl->last_layer - tpl->first_layer + 1;
|
||||
break;
|
||||
|
||||
case D3D12_DSV_DIMENSION_TEXTURE2DARRAY:
|
||||
desc.Texture2DArray.MipSlice = tpl->u.tex.level;
|
||||
desc.Texture2DArray.FirstArraySlice = tpl->u.tex.first_layer;
|
||||
desc.Texture2DArray.ArraySize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1;
|
||||
desc.Texture2DArray.MipSlice = tpl->level;
|
||||
desc.Texture2DArray.FirstArraySlice = tpl->first_layer;
|
||||
desc.Texture2DArray.ArraySize = tpl->last_layer - tpl->first_layer + 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -169,50 +169,50 @@ initialize_rtv(struct pipe_context *pctx,
|
|||
break;
|
||||
|
||||
case D3D12_RTV_DIMENSION_TEXTURE1D:
|
||||
if (tpl->u.tex.first_layer > 0)
|
||||
if (tpl->first_layer > 0)
|
||||
debug_printf("D3D12: can't create 1D RTV from layer %d\n",
|
||||
tpl->u.tex.first_layer);
|
||||
tpl->first_layer);
|
||||
|
||||
desc.Texture1D.MipSlice = tpl->u.tex.level;
|
||||
desc.Texture1D.MipSlice = tpl->level;
|
||||
break;
|
||||
|
||||
case D3D12_RTV_DIMENSION_TEXTURE1DARRAY:
|
||||
desc.Texture1DArray.MipSlice = tpl->u.tex.level;
|
||||
desc.Texture1DArray.FirstArraySlice = tpl->u.tex.first_layer;
|
||||
desc.Texture1DArray.ArraySize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1;
|
||||
desc.Texture1DArray.MipSlice = tpl->level;
|
||||
desc.Texture1DArray.FirstArraySlice = tpl->first_layer;
|
||||
desc.Texture1DArray.ArraySize = tpl->last_layer - tpl->first_layer + 1;
|
||||
break;
|
||||
|
||||
case D3D12_RTV_DIMENSION_TEXTURE2DMS:
|
||||
if (tpl->u.tex.first_layer > 0)
|
||||
if (tpl->first_layer > 0)
|
||||
debug_printf("D3D12: can't create 2DMS RTV from layer %d\n",
|
||||
tpl->u.tex.first_layer);
|
||||
tpl->first_layer);
|
||||
break;
|
||||
|
||||
case D3D12_RTV_DIMENSION_TEXTURE2D:
|
||||
if (tpl->u.tex.first_layer > 0)
|
||||
if (tpl->first_layer > 0)
|
||||
debug_printf("D3D12: can't create 2D RTV from layer %d\n",
|
||||
tpl->u.tex.first_layer);
|
||||
tpl->first_layer);
|
||||
|
||||
desc.Texture2D.MipSlice = tpl->u.tex.level;
|
||||
desc.Texture2D.MipSlice = tpl->level;
|
||||
desc.Texture2D.PlaneSlice = res->plane_slice;
|
||||
break;
|
||||
|
||||
case D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY:
|
||||
desc.Texture2DMSArray.FirstArraySlice = tpl->u.tex.first_layer;
|
||||
desc.Texture2DMSArray.ArraySize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1;
|
||||
desc.Texture2DMSArray.FirstArraySlice = tpl->first_layer;
|
||||
desc.Texture2DMSArray.ArraySize = tpl->last_layer - tpl->first_layer + 1;
|
||||
break;
|
||||
|
||||
case D3D12_RTV_DIMENSION_TEXTURE2DARRAY:
|
||||
desc.Texture2DArray.MipSlice = tpl->u.tex.level;
|
||||
desc.Texture2DArray.FirstArraySlice = tpl->u.tex.first_layer;
|
||||
desc.Texture2DArray.ArraySize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1;
|
||||
desc.Texture2DArray.MipSlice = tpl->level;
|
||||
desc.Texture2DArray.FirstArraySlice = tpl->first_layer;
|
||||
desc.Texture2DArray.ArraySize = tpl->last_layer - tpl->first_layer + 1;
|
||||
desc.Texture2DArray.PlaneSlice = 0;
|
||||
break;
|
||||
|
||||
case D3D12_RTV_DIMENSION_TEXTURE3D:
|
||||
desc.Texture3D.MipSlice = tpl->u.tex.level;
|
||||
desc.Texture3D.FirstWSlice = tpl->u.tex.first_layer;
|
||||
desc.Texture3D.WSize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1;
|
||||
desc.Texture3D.MipSlice = tpl->level;
|
||||
desc.Texture3D.FirstWSlice = tpl->first_layer;
|
||||
desc.Texture3D.WSize = tpl->last_layer - tpl->first_layer + 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -248,9 +248,9 @@ d3d12_create_surface(struct pipe_context *pctx,
|
|||
pipe_reference_init(&surface->base.reference, 1);
|
||||
surface->base.context = pctx;
|
||||
surface->base.format = tpl->format;
|
||||
surface->base.u.tex.level = tpl->u.tex.level;
|
||||
surface->base.u.tex.first_layer = tpl->u.tex.first_layer;
|
||||
surface->base.u.tex.last_layer = tpl->u.tex.last_layer;
|
||||
surface->base.level = tpl->level;
|
||||
surface->base.first_layer = tpl->first_layer;
|
||||
surface->base.last_layer = tpl->last_layer;
|
||||
|
||||
DXGI_FORMAT dxgi_format = d3d12_get_resource_rt_format(tpl->format);
|
||||
if (is_depth_or_stencil)
|
||||
|
|
|
|||
|
|
@ -441,7 +441,7 @@ etna_blit_clear_zs_rs(struct pipe_context *pctx, struct pipe_surface *dst,
|
|||
/* If the level has valid TS state we need to flush it, as the regular
|
||||
* clear will not update the state and we must therefore invalidate it. */
|
||||
etna_copy_resource(pctx, surf->base.texture, surf->base.texture,
|
||||
surf->base.u.tex.level, surf->base.u.tex.level);
|
||||
surf->base.level, surf->base.level);
|
||||
|
||||
/* If no valid command yet generate stored command, otherwise simply
|
||||
* update clear value. */
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ etna_update_render_surface(struct pipe_context *pctx, struct etna_surface *surf)
|
|||
{
|
||||
struct etna_resource *base = etna_resource(surf->prsc);
|
||||
struct etna_resource *to = base, *from = base;
|
||||
unsigned level = surf->base.u.tex.level;
|
||||
unsigned level = surf->base.level;
|
||||
|
||||
if (base->texture &&
|
||||
etna_resource_level_newer(&etna_resource(base->texture)->levels[level],
|
||||
|
|
@ -163,8 +163,8 @@ etna_set_framebuffer_state(struct pipe_context *pctx,
|
|||
|
||||
/* Resolve TS if needed */
|
||||
if (!use_ts) {
|
||||
etna_copy_resource(pctx, &res->base, &res->base, cbuf->base.u.tex.level, cbuf->base.u.tex.level);
|
||||
etna_resource_level_ts_mark_invalid(&res->levels[cbuf->base.u.tex.level]);
|
||||
etna_copy_resource(pctx, &res->base, &res->base, cbuf->base.level, cbuf->base.level);
|
||||
etna_resource_level_ts_mark_invalid(&res->levels[cbuf->base.level]);
|
||||
}
|
||||
|
||||
assert((res->layout & ETNA_LAYOUT_BIT_TILE) ||
|
||||
|
|
|
|||
|
|
@ -75,8 +75,8 @@ etna_create_surface(struct pipe_context *pctx, struct pipe_resource *prsc,
|
|||
{
|
||||
struct etna_context *ctx = etna_context(pctx);
|
||||
struct etna_screen *screen = ctx->screen;
|
||||
unsigned layer = templat->u.tex.first_layer;
|
||||
unsigned level = templat->u.tex.level;
|
||||
unsigned layer = templat->first_layer;
|
||||
unsigned level = templat->level;
|
||||
struct etna_resource *rsc = etna_render_handle_incompatible(pctx, prsc);
|
||||
struct etna_resource_level *lev = &rsc->levels[level];
|
||||
struct etna_surface *surf = CALLOC_STRUCT(etna_surface);
|
||||
|
|
@ -84,7 +84,7 @@ etna_create_surface(struct pipe_context *pctx, struct pipe_resource *prsc,
|
|||
if (!surf)
|
||||
return NULL;
|
||||
|
||||
assert(templat->u.tex.first_layer == templat->u.tex.last_layer);
|
||||
assert(templat->first_layer == templat->last_layer);
|
||||
assert(layer <= util_max_layer(prsc, level));
|
||||
|
||||
surf->base.context = pctx;
|
||||
|
|
@ -94,7 +94,8 @@ etna_create_surface(struct pipe_context *pctx, struct pipe_resource *prsc,
|
|||
pipe_resource_reference(&surf->prsc, prsc);
|
||||
|
||||
surf->base.format = templat->format;
|
||||
surf->base.u = templat->u;
|
||||
surf->base.first_layer = templat->first_layer;
|
||||
surf->base.last_layer = templat->last_layer;
|
||||
surf->level = lev;
|
||||
|
||||
/* XXX we don't really need a copy but it's convenient */
|
||||
|
|
|
|||
|
|
@ -73,9 +73,9 @@ emit_gmem2mem_surf(struct fd_batch *batch, uint32_t base,
|
|||
struct fd_ringbuffer *ring = batch->tile_store;
|
||||
struct fd_resource *rsc = fd_resource(psurf->texture);
|
||||
uint32_t offset =
|
||||
fd_resource_offset(rsc, psurf->u.tex.level, psurf->u.tex.first_layer);
|
||||
fd_resource_offset(rsc, psurf->level, psurf->first_layer);
|
||||
enum pipe_format format = fd_gmem_restore_format(psurf->format);
|
||||
uint32_t pitch = fdl2_pitch_pixels(&rsc->layout, psurf->u.tex.level);
|
||||
uint32_t pitch = fdl2_pitch_pixels(&rsc->layout, psurf->level);
|
||||
|
||||
assert((pitch & 31) == 0);
|
||||
assert((offset & 0xfff) == 0);
|
||||
|
|
@ -217,7 +217,7 @@ emit_mem2gmem_surf(struct fd_batch *batch, uint32_t base,
|
|||
struct fd_ringbuffer *ring = batch->gmem;
|
||||
struct fd_resource *rsc = fd_resource(psurf->texture);
|
||||
uint32_t offset =
|
||||
fd_resource_offset(rsc, psurf->u.tex.level, psurf->u.tex.first_layer);
|
||||
fd_resource_offset(rsc, psurf->level, psurf->first_layer);
|
||||
enum pipe_format format = fd_gmem_restore_format(psurf->format);
|
||||
OUT_PKT3(ring, CP_SET_CONSTANT, 2);
|
||||
OUT_RING(ring, CP_REG(REG_A2XX_RB_COLOR_INFO));
|
||||
|
|
@ -231,7 +231,7 @@ emit_mem2gmem_surf(struct fd_batch *batch, uint32_t base,
|
|||
A2XX_SQ_TEX_0_CLAMP_Y(SQ_TEX_WRAP) |
|
||||
A2XX_SQ_TEX_0_CLAMP_Z(SQ_TEX_WRAP) |
|
||||
A2XX_SQ_TEX_0_PITCH(
|
||||
fdl2_pitch_pixels(&rsc->layout, psurf->u.tex.level)));
|
||||
fdl2_pitch_pixels(&rsc->layout, psurf->level)));
|
||||
OUT_RELOC(ring, rsc->bo, offset,
|
||||
A2XX_SQ_TEX_1_FORMAT(fd2_pipe2surface(format).format) |
|
||||
A2XX_SQ_TEX_1_CLAMP_POLICY(SQ_TEX_CLAMP_POLICY_OGL),
|
||||
|
|
@ -426,8 +426,8 @@ fd2_emit_sysmem_prep(struct fd_batch *batch)
|
|||
|
||||
struct fd_resource *rsc = fd_resource(psurf->texture);
|
||||
uint32_t offset =
|
||||
fd_resource_offset(rsc, psurf->u.tex.level, psurf->u.tex.first_layer);
|
||||
uint32_t pitch = fdl2_pitch_pixels(&rsc->layout, psurf->u.tex.level);
|
||||
fd_resource_offset(rsc, psurf->level, psurf->first_layer);
|
||||
uint32_t pitch = fdl2_pitch_pixels(&rsc->layout, psurf->level);
|
||||
|
||||
assert((pitch & 31) == 0);
|
||||
assert((offset & 0xfff) == 0);
|
||||
|
|
|
|||
|
|
@ -312,9 +312,9 @@ fd3_emit_gmem_restore_tex(struct fd_ringbuffer *ring,
|
|||
}
|
||||
|
||||
/* note: PIPE_BUFFER disallowed for surfaces */
|
||||
unsigned lvl = psurf[i].u.tex.level;
|
||||
unsigned lvl = psurf[i].level;
|
||||
|
||||
assert(psurf[i].u.tex.first_layer == psurf[i].u.tex.last_layer);
|
||||
assert(psurf[i].first_layer == psurf[i].last_layer);
|
||||
|
||||
OUT_RING(ring, A3XX_TEX_CONST_0_TILE_MODE(rsc->layout.tile_mode) |
|
||||
A3XX_TEX_CONST_0_FMT(fd3_pipe2tex(format)) |
|
||||
|
|
@ -342,9 +342,9 @@ fd3_emit_gmem_restore_tex(struct fd_ringbuffer *ring,
|
|||
/* Matches above logic for blit_zs shader */
|
||||
if (rsc->stencil && i == 0)
|
||||
rsc = rsc->stencil;
|
||||
unsigned lvl = psurf[i].u.tex.level;
|
||||
unsigned lvl = psurf[i].level;
|
||||
uint32_t offset =
|
||||
fd_resource_offset(rsc, lvl, psurf[i].u.tex.first_layer);
|
||||
fd_resource_offset(rsc, lvl, psurf[i].first_layer);
|
||||
OUT_RELOC(ring, rsc->bo, offset, 0, 0);
|
||||
} else {
|
||||
OUT_RING(ring, 0x00000000);
|
||||
|
|
|
|||
|
|
@ -81,10 +81,10 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs,
|
|||
else
|
||||
pformat = util_format_linear(pformat);
|
||||
|
||||
assert(psurf->u.tex.first_layer == psurf->u.tex.last_layer);
|
||||
assert(psurf->first_layer == psurf->last_layer);
|
||||
|
||||
offset = fd_resource_offset(rsc, psurf->u.tex.level,
|
||||
psurf->u.tex.first_layer);
|
||||
offset = fd_resource_offset(rsc, psurf->level,
|
||||
psurf->first_layer);
|
||||
swap = rsc->layout.tile_mode ? WZYX : fd3_pipe2swap(pformat);
|
||||
|
||||
if (bin_w) {
|
||||
|
|
@ -94,7 +94,7 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs,
|
|||
base = bases[i];
|
||||
}
|
||||
} else {
|
||||
stride = fd_resource_pitch(rsc, psurf->u.tex.level);
|
||||
stride = fd_resource_pitch(rsc, psurf->level);
|
||||
tile_mode = rsc->layout.tile_mode;
|
||||
}
|
||||
} else if (i < nr_bufs && bases) {
|
||||
|
|
@ -329,10 +329,10 @@ emit_gmem2mem_surf(struct fd_batch *batch,
|
|||
}
|
||||
|
||||
uint32_t offset =
|
||||
fd_resource_offset(rsc, psurf->u.tex.level, psurf->u.tex.first_layer);
|
||||
uint32_t pitch = fd_resource_pitch(rsc, psurf->u.tex.level);
|
||||
fd_resource_offset(rsc, psurf->level, psurf->first_layer);
|
||||
uint32_t pitch = fd_resource_pitch(rsc, psurf->level);
|
||||
|
||||
assert(psurf->u.tex.first_layer == psurf->u.tex.last_layer);
|
||||
assert(psurf->first_layer == psurf->last_layer);
|
||||
|
||||
OUT_PKT0(ring, REG_A3XX_RB_COPY_CONTROL, 4);
|
||||
OUT_RING(ring, A3XX_RB_COPY_CONTROL_MSAA_RESOLVE(MSAA_ONE) |
|
||||
|
|
@ -740,7 +740,7 @@ fd3_emit_sysmem_prep(struct fd_batch *batch) assert_dt
|
|||
if (!psurf->texture)
|
||||
continue;
|
||||
struct fd_resource *rsc = fd_resource(psurf->texture);
|
||||
pitch = fd_resource_pitch(rsc, psurf->u.tex.level) / rsc->layout.cpp;
|
||||
pitch = fd_resource_pitch(rsc, psurf->level) / rsc->layout.cpp;
|
||||
}
|
||||
|
||||
fd3_emit_restore(batch, ring);
|
||||
|
|
|
|||
|
|
@ -400,9 +400,9 @@ fd4_emit_gmem_restore_tex(struct fd_ringbuffer *ring, unsigned nr_bufs,
|
|||
}
|
||||
|
||||
/* note: PIPE_BUFFER disallowed for surfaces */
|
||||
unsigned lvl = bufs[i].u.tex.level;
|
||||
unsigned lvl = bufs[i].level;
|
||||
unsigned offset =
|
||||
fd_resource_offset(rsc, lvl, bufs[i].u.tex.first_layer);
|
||||
fd_resource_offset(rsc, lvl, bufs[i].first_layer);
|
||||
|
||||
/* z32 restore is accomplished using depth write. If there is
|
||||
* no stencil component (ie. PIPE_FORMAT_Z32_FLOAT_S8X24_UINT)
|
||||
|
|
@ -415,7 +415,7 @@ fd4_emit_gmem_restore_tex(struct fd_ringbuffer *ring, unsigned nr_bufs,
|
|||
(format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT))
|
||||
mrt_comp[i] = 0;
|
||||
|
||||
assert(bufs[i].u.tex.first_layer == bufs[i].u.tex.last_layer);
|
||||
assert(bufs[i].first_layer == bufs[i].last_layer);
|
||||
|
||||
OUT_RING(ring, A4XX_TEX_CONST_0_FMT(fd4_pipe2tex(format)) |
|
||||
A4XX_TEX_CONST_0_TYPE(A4XX_TEX_2D) |
|
||||
|
|
|
|||
|
|
@ -85,10 +85,10 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs,
|
|||
else
|
||||
pformat = util_format_linear(pformat);
|
||||
|
||||
assert(psurf->u.tex.first_layer == psurf->u.tex.last_layer);
|
||||
assert(psurf->first_layer == psurf->last_layer);
|
||||
|
||||
offset = fd_resource_offset(rsc, psurf->u.tex.level,
|
||||
psurf->u.tex.first_layer);
|
||||
offset = fd_resource_offset(rsc, psurf->level,
|
||||
psurf->first_layer);
|
||||
|
||||
if (bin_w) {
|
||||
stride = bin_w << fdl_cpp_shift(&rsc->layout);
|
||||
|
|
@ -97,7 +97,7 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs,
|
|||
base = bases[i];
|
||||
}
|
||||
} else {
|
||||
stride = fd_resource_pitch(rsc, psurf->u.tex.level);
|
||||
stride = fd_resource_pitch(rsc, psurf->level);
|
||||
}
|
||||
} else if ((i < nr_bufs) && bases) {
|
||||
base = bases[i];
|
||||
|
|
@ -166,10 +166,10 @@ emit_gmem2mem_surf(struct fd_batch *batch, bool stencil, uint32_t base,
|
|||
}
|
||||
|
||||
offset =
|
||||
fd_resource_offset(rsc, psurf->u.tex.level, psurf->u.tex.first_layer);
|
||||
pitch = fd_resource_pitch(rsc, psurf->u.tex.level);
|
||||
fd_resource_offset(rsc, psurf->level, psurf->first_layer);
|
||||
pitch = fd_resource_pitch(rsc, psurf->level);
|
||||
|
||||
assert(psurf->u.tex.first_layer == psurf->u.tex.last_layer);
|
||||
assert(psurf->first_layer == psurf->last_layer);
|
||||
|
||||
OUT_PKT0(ring, REG_A4XX_RB_COPY_CONTROL, 4);
|
||||
OUT_RING(ring, A4XX_RB_COPY_CONTROL_MSAA_RESOLVE(MSAA_ONE) |
|
||||
|
|
|
|||
|
|
@ -59,21 +59,21 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs,
|
|||
sint = util_format_is_pure_sint(pformat);
|
||||
uint = util_format_is_pure_uint(pformat);
|
||||
|
||||
assert(psurf->u.tex.first_layer == psurf->u.tex.last_layer);
|
||||
assert(psurf->first_layer == psurf->last_layer);
|
||||
|
||||
offset = fd_resource_offset(rsc, psurf->u.tex.level,
|
||||
psurf->u.tex.first_layer);
|
||||
offset = fd_resource_offset(rsc, psurf->level,
|
||||
psurf->first_layer);
|
||||
|
||||
if (gmem) {
|
||||
stride = gmem->bin_w * gmem->cbuf_cpp[i];
|
||||
size = stride * gmem->bin_h;
|
||||
base = gmem->cbuf_base[i];
|
||||
} else {
|
||||
stride = fd_resource_pitch(rsc, psurf->u.tex.level);
|
||||
size = fd_resource_layer_stride(rsc, psurf->u.tex.level);
|
||||
stride = fd_resource_pitch(rsc, psurf->level);
|
||||
size = fd_resource_layer_stride(rsc, psurf->level);
|
||||
|
||||
tile_mode =
|
||||
fd_resource_tile_mode(psurf->texture, psurf->u.tex.level);
|
||||
fd_resource_tile_mode(psurf->texture, psurf->level);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -127,8 +127,8 @@ emit_zs(struct fd_ringbuffer *ring, struct pipe_surface *zsbuf,
|
|||
stride = cpp * gmem->bin_w;
|
||||
size = stride * gmem->bin_h;
|
||||
} else {
|
||||
stride = fd_resource_pitch(rsc, zsbuf->u.tex.level);
|
||||
size = fd_resource_layer_stride(rsc, zsbuf->u.tex.level);
|
||||
stride = fd_resource_pitch(rsc, zsbuf->level);
|
||||
size = fd_resource_layer_stride(rsc, zsbuf->level);
|
||||
}
|
||||
|
||||
OUT_PKT4(ring, REG_A5XX_RB_DEPTH_BUFFER_INFO, 5);
|
||||
|
|
@ -138,7 +138,7 @@ emit_zs(struct fd_ringbuffer *ring, struct pipe_surface *zsbuf,
|
|||
OUT_RING(ring, 0x00000000); /* RB_DEPTH_BUFFER_BASE_HI */
|
||||
} else {
|
||||
OUT_RELOC(ring, rsc->bo,
|
||||
fd_resource_offset(rsc, zsbuf->u.tex.level, zsbuf->u.tex.first_layer),
|
||||
fd_resource_offset(rsc, zsbuf->level, zsbuf->first_layer),
|
||||
0, 0); /* RB_DEPTH_BUFFER_BASE_LO/HI */
|
||||
}
|
||||
OUT_RING(ring, A5XX_RB_DEPTH_BUFFER_PITCH(stride));
|
||||
|
|
@ -175,8 +175,8 @@ emit_zs(struct fd_ringbuffer *ring, struct pipe_surface *zsbuf,
|
|||
stride = 1 * gmem->bin_w;
|
||||
size = stride * gmem->bin_h;
|
||||
} else {
|
||||
stride = fd_resource_pitch(rsc->stencil, zsbuf->u.tex.level);
|
||||
size = fd_resource_layer_stride(rsc, zsbuf->u.tex.level);
|
||||
stride = fd_resource_pitch(rsc->stencil, zsbuf->level);
|
||||
size = fd_resource_layer_stride(rsc, zsbuf->level);
|
||||
}
|
||||
|
||||
OUT_PKT4(ring, REG_A5XX_RB_STENCIL_INFO, 5);
|
||||
|
|
@ -186,7 +186,7 @@ emit_zs(struct fd_ringbuffer *ring, struct pipe_surface *zsbuf,
|
|||
OUT_RING(ring, 0x00000000); /* RB_STENCIL_BASE_HI */
|
||||
} else {
|
||||
OUT_RELOC(ring, rsc->stencil->bo,
|
||||
fd_resource_offset(rsc->stencil, zsbuf->u.tex.level, zsbuf->u.tex.first_layer),
|
||||
fd_resource_offset(rsc->stencil, zsbuf->level, zsbuf->first_layer),
|
||||
0, 0); /* RB_STENCIL_BASE_LO/HI */
|
||||
}
|
||||
OUT_RING(ring, A5XX_RB_STENCIL_PITCH(stride));
|
||||
|
|
@ -494,7 +494,7 @@ emit_mem2gmem_surf(struct fd_batch *batch, uint32_t base,
|
|||
struct fd_resource *rsc = fd_resource(psurf->texture);
|
||||
uint32_t stride, size;
|
||||
|
||||
assert(psurf->u.tex.first_layer == psurf->u.tex.last_layer);
|
||||
assert(psurf->first_layer == psurf->last_layer);
|
||||
|
||||
if (buf == BLIT_S)
|
||||
rsc = rsc->stencil;
|
||||
|
|
@ -513,10 +513,10 @@ emit_mem2gmem_surf(struct fd_batch *batch, uint32_t base,
|
|||
A5XX_RB_MRT_BUF_INFO_COLOR_FORMAT(format) |
|
||||
A5XX_RB_MRT_BUF_INFO_COLOR_TILE_MODE(rsc->layout.tile_mode) |
|
||||
A5XX_RB_MRT_BUF_INFO_COLOR_SWAP(WZYX));
|
||||
OUT_RING(ring, A5XX_RB_MRT_PITCH(fd_resource_pitch(rsc, psurf->u.tex.level)));
|
||||
OUT_RING(ring, A5XX_RB_MRT_ARRAY_PITCH(fd_resource_layer_stride(rsc, psurf->u.tex.level)));
|
||||
OUT_RING(ring, A5XX_RB_MRT_PITCH(fd_resource_pitch(rsc, psurf->level)));
|
||||
OUT_RING(ring, A5XX_RB_MRT_ARRAY_PITCH(fd_resource_layer_stride(rsc, psurf->level)));
|
||||
OUT_RELOC(ring, rsc->bo,
|
||||
fd_resource_offset(rsc, psurf->u.tex.level, psurf->u.tex.first_layer),
|
||||
fd_resource_offset(rsc, psurf->level, psurf->first_layer),
|
||||
0, 0); /* BASE_LO/HI */
|
||||
|
||||
buf = BLIT_MRT0;
|
||||
|
|
@ -622,10 +622,10 @@ emit_gmem2mem_surf(struct fd_batch *batch, uint32_t base,
|
|||
rsc = rsc->stencil;
|
||||
|
||||
offset =
|
||||
fd_resource_offset(rsc, psurf->u.tex.level, psurf->u.tex.first_layer);
|
||||
pitch = fd_resource_pitch(rsc, psurf->u.tex.level);
|
||||
fd_resource_offset(rsc, psurf->level, psurf->first_layer);
|
||||
pitch = fd_resource_pitch(rsc, psurf->level);
|
||||
|
||||
assert(psurf->u.tex.first_layer == psurf->u.tex.last_layer);
|
||||
assert(psurf->first_layer == psurf->last_layer);
|
||||
|
||||
OUT_PKT4(ring, REG_A5XX_RB_BLIT_FLAG_DST_LO, 4);
|
||||
OUT_RING(ring, 0x00000000); /* RB_BLIT_FLAG_DST_LO */
|
||||
|
|
@ -633,14 +633,14 @@ emit_gmem2mem_surf(struct fd_batch *batch, uint32_t base,
|
|||
OUT_RING(ring, 0x00000000); /* RB_BLIT_FLAG_DST_PITCH */
|
||||
OUT_RING(ring, 0x00000000); /* RB_BLIT_FLAG_DST_ARRAY_PITCH */
|
||||
|
||||
tiled = fd_resource_tile_mode(psurf->texture, psurf->u.tex.level);
|
||||
tiled = fd_resource_tile_mode(psurf->texture, psurf->level);
|
||||
|
||||
OUT_PKT4(ring, REG_A5XX_RB_RESOLVE_CNTL_3, 5);
|
||||
OUT_RING(ring, 0x00000004 | /* XXX RB_RESOLVE_CNTL_3 */
|
||||
COND(tiled, A5XX_RB_RESOLVE_CNTL_3_TILED));
|
||||
OUT_RELOC(ring, rsc->bo, offset, 0, 0); /* RB_BLIT_DST_LO/HI */
|
||||
OUT_RING(ring, A5XX_RB_BLIT_DST_PITCH(pitch));
|
||||
OUT_RING(ring, A5XX_RB_BLIT_DST_ARRAY_PITCH(fd_resource_layer_stride(rsc, psurf->u.tex.level)));
|
||||
OUT_RING(ring, A5XX_RB_BLIT_DST_ARRAY_PITCH(fd_resource_layer_stride(rsc, psurf->level)));
|
||||
|
||||
OUT_PKT4(ring, REG_A5XX_RB_BLIT_CNTL, 1);
|
||||
OUT_RING(ring, A5XX_RB_BLIT_CNTL_BUF(buf));
|
||||
|
|
|
|||
|
|
@ -1009,9 +1009,9 @@ fd6_clear_surface(struct fd_context *ctx, struct fd_ringbuffer *ring,
|
|||
emit_clear_color(ring, psurf->format, &clear_color);
|
||||
emit_blit_setup<CHIP>(ring, psurf->format, false, &clear_color, unknown_8c01, ROTATE_0);
|
||||
|
||||
for (unsigned i = psurf->u.tex.first_layer; i <= psurf->u.tex.last_layer;
|
||||
for (unsigned i = psurf->first_layer; i <= psurf->last_layer;
|
||||
i++) {
|
||||
emit_blit_dst(ring, psurf->texture, psurf->format, psurf->u.tex.level, i);
|
||||
emit_blit_dst(ring, psurf->texture, psurf->format, psurf->level, i);
|
||||
|
||||
emit_blit_fini<CHIP>(ctx, ring);
|
||||
}
|
||||
|
|
@ -1081,14 +1081,10 @@ fd6_clear_texture(struct pipe_context *pctx, struct pipe_resource *prsc,
|
|||
|
||||
struct pipe_surface surf = {
|
||||
.format = prsc->format,
|
||||
.first_layer = box->z,
|
||||
.last_layer = box->depth + box->z - 1,
|
||||
.level = level,
|
||||
.texture = prsc,
|
||||
.u = {
|
||||
.tex = {
|
||||
.level = level,
|
||||
.first_layer = box->z,
|
||||
.last_layer = box->depth + box->z - 1,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
fd6_clear_surface<CHIP>(ctx, batch->draw, &surf, box, &color, 0);
|
||||
|
|
@ -1138,10 +1134,10 @@ fd6_resolve_tile(struct fd_batch *batch, struct fd_ringbuffer *ring,
|
|||
emit_blit_setup<CHIP>(ring, psurf->format, true, NULL, unknown_8c01, ROTATE_0);
|
||||
|
||||
/* We shouldn't be using GMEM in the layered rendering case: */
|
||||
assert(psurf->u.tex.first_layer == psurf->u.tex.last_layer);
|
||||
assert(psurf->first_layer == psurf->last_layer);
|
||||
|
||||
emit_blit_dst(ring, psurf->texture, psurf->format, psurf->u.tex.level,
|
||||
psurf->u.tex.first_layer);
|
||||
emit_blit_dst(ring, psurf->texture, psurf->format, psurf->level,
|
||||
psurf->first_layer);
|
||||
|
||||
enum a6xx_format sfmt = fd6_color_format(psurf->format, TILE6_LINEAR);
|
||||
enum a3xx_msaa_samples samples = fd_msaa_samples(batch->framebuffer.samples);
|
||||
|
|
|
|||
|
|
@ -87,9 +87,9 @@ emit_mrt(struct fd_ringbuffer *ring, struct pipe_framebuffer_state *pfb,
|
|||
rsc = fd_resource(psurf->texture);
|
||||
|
||||
uint32_t base = gmem ? gmem->cbuf_base[i] : 0;
|
||||
slice = fd_resource_slice(rsc, psurf->u.tex.level);
|
||||
slice = fd_resource_slice(rsc, psurf->level);
|
||||
enum a6xx_tile_mode tile_mode = (enum a6xx_tile_mode)
|
||||
fd_resource_tile_mode(psurf->texture, psurf->u.tex.level);
|
||||
fd_resource_tile_mode(psurf->texture, psurf->level);
|
||||
enum a6xx_format format = fd6_color_format(pformat, tile_mode);
|
||||
sint = util_format_is_pure_sint(pformat);
|
||||
uint = util_format_is_pure_uint(pformat);
|
||||
|
|
@ -98,13 +98,13 @@ emit_mrt(struct fd_ringbuffer *ring, struct pipe_framebuffer_state *pfb,
|
|||
srgb_cntl |= (1 << i);
|
||||
|
||||
offset =
|
||||
fd_resource_offset(rsc, psurf->u.tex.level, psurf->u.tex.first_layer);
|
||||
fd_resource_offset(rsc, psurf->level, psurf->first_layer);
|
||||
|
||||
stride = fd_resource_pitch(rsc, psurf->u.tex.level);
|
||||
array_stride = fd_resource_layer_stride(rsc, psurf->u.tex.level);
|
||||
stride = fd_resource_pitch(rsc, psurf->level);
|
||||
array_stride = fd_resource_layer_stride(rsc, psurf->level);
|
||||
swap = fd6_color_swap(pformat, (enum a6xx_tile_mode)rsc->layout.tile_mode, false);
|
||||
|
||||
max_layer_index = psurf->u.tex.last_layer - psurf->u.tex.first_layer;
|
||||
max_layer_index = psurf->last_layer - psurf->first_layer;
|
||||
|
||||
assert((offset + slice->size0) <= fd_bo_size(rsc->bo));
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ emit_mrt(struct fd_ringbuffer *ring, struct pipe_framebuffer_state *pfb,
|
|||
.color_format = format,
|
||||
.color_tile_mode = tile_mode,
|
||||
.color_swap = swap,
|
||||
.losslesscompen = fd_resource_ubwc_enabled(rsc, psurf->u.tex.level),
|
||||
.losslesscompen = fd_resource_ubwc_enabled(rsc, psurf->level),
|
||||
),
|
||||
A6XX_RB_MRT_PITCH(i, stride),
|
||||
A6XX_RB_MRT_ARRAY_PITCH(i, array_stride),
|
||||
|
|
@ -127,14 +127,14 @@ emit_mrt(struct fd_ringbuffer *ring, struct pipe_framebuffer_state *pfb,
|
|||
.color_sint = sint, .color_uint = uint));
|
||||
|
||||
OUT_PKT4(ring, REG_A6XX_RB_MRT_FLAG_BUFFER(i), 3);
|
||||
fd6_emit_flag_reference(ring, rsc, psurf->u.tex.level,
|
||||
psurf->u.tex.first_layer);
|
||||
fd6_emit_flag_reference(ring, rsc, psurf->level,
|
||||
psurf->first_layer);
|
||||
|
||||
if (i == 0)
|
||||
mrt0_format = format;
|
||||
}
|
||||
if (pfb->zsbuf.texture)
|
||||
max_layer_index = pfb->zsbuf.u.tex.last_layer - pfb->zsbuf.u.tex.first_layer;
|
||||
max_layer_index = pfb->zsbuf.last_layer - pfb->zsbuf.first_layer;
|
||||
|
||||
OUT_REG(ring, A6XX_GRAS_LRZ_MRT_BUF_INFO_0(.color_format = mrt0_format));
|
||||
|
||||
|
|
@ -152,11 +152,11 @@ emit_zs(struct fd_context *ctx, struct fd_ringbuffer *ring,
|
|||
if (zsbuf->texture) {
|
||||
struct fd_resource *rsc = fd_resource(zsbuf->texture);
|
||||
struct fd_resource *stencil = rsc->stencil;
|
||||
uint32_t stride = fd_resource_pitch(rsc, zsbuf->u.tex.level);
|
||||
uint32_t array_stride = fd_resource_layer_stride(rsc, zsbuf->u.tex.level);
|
||||
uint32_t stride = fd_resource_pitch(rsc, zsbuf->level);
|
||||
uint32_t array_stride = fd_resource_layer_stride(rsc, zsbuf->level);
|
||||
uint32_t base = gmem ? gmem->zsbuf_base[0] : 0;
|
||||
uint32_t offset =
|
||||
fd_resource_offset(rsc, zsbuf->u.tex.level, zsbuf->u.tex.first_layer);
|
||||
fd_resource_offset(rsc, zsbuf->level, zsbuf->first_layer);
|
||||
|
||||
/* We could have a depth buffer, but no draws with depth write/test
|
||||
* enabled, in which case it wouldn't have been part of the batch
|
||||
|
|
@ -172,7 +172,7 @@ emit_zs(struct fd_context *ctx, struct fd_ringbuffer *ring,
|
|||
RB_DEPTH_BUFFER_INFO(CHIP,
|
||||
.depth_format = fmt,
|
||||
.tilemode = TILE6_3,
|
||||
.losslesscompen = fd_resource_ubwc_enabled(rsc, zsbuf->u.tex.level),
|
||||
.losslesscompen = fd_resource_ubwc_enabled(rsc, zsbuf->level),
|
||||
),
|
||||
A6XX_RB_DEPTH_BUFFER_PITCH(0),
|
||||
A6XX_RB_DEPTH_BUFFER_ARRAY_PITCH(0),
|
||||
|
|
@ -189,7 +189,7 @@ emit_zs(struct fd_context *ctx, struct fd_ringbuffer *ring,
|
|||
RB_DEPTH_BUFFER_INFO(CHIP,
|
||||
.depth_format = fmt,
|
||||
.tilemode = TILE6_3,
|
||||
.losslesscompen = fd_resource_ubwc_enabled(rsc, zsbuf->u.tex.level),
|
||||
.losslesscompen = fd_resource_ubwc_enabled(rsc, zsbuf->level),
|
||||
),
|
||||
A6XX_RB_DEPTH_BUFFER_PITCH(stride),
|
||||
A6XX_RB_DEPTH_BUFFER_ARRAY_PITCH(array_stride),
|
||||
|
|
@ -199,16 +199,16 @@ emit_zs(struct fd_context *ctx, struct fd_ringbuffer *ring,
|
|||
OUT_REG(ring, A6XX_GRAS_SU_DEPTH_BUFFER_INFO(.depth_format = fmt));
|
||||
|
||||
OUT_PKT4(ring, REG_A6XX_RB_DEPTH_FLAG_BUFFER_BASE, 3);
|
||||
fd6_emit_flag_reference(ring, rsc, zsbuf->u.tex.level,
|
||||
zsbuf->u.tex.first_layer);
|
||||
fd6_emit_flag_reference(ring, rsc, zsbuf->level,
|
||||
zsbuf->first_layer);
|
||||
}
|
||||
|
||||
if (stencil) {
|
||||
stride = fd_resource_pitch(stencil, zsbuf->u.tex.level);
|
||||
array_stride = fd_resource_layer_stride(stencil, zsbuf->u.tex.level);
|
||||
stride = fd_resource_pitch(stencil, zsbuf->level);
|
||||
array_stride = fd_resource_layer_stride(stencil, zsbuf->level);
|
||||
uint32_t base = gmem ? gmem->zsbuf_base[1] : 0;
|
||||
uint32_t offset =
|
||||
fd_resource_offset(stencil, zsbuf->u.tex.level, zsbuf->u.tex.first_layer);
|
||||
fd_resource_offset(stencil, zsbuf->level, zsbuf->first_layer);
|
||||
|
||||
fd_ringbuffer_attach_bo(ring, stencil->bo);
|
||||
|
||||
|
|
@ -461,11 +461,11 @@ patch_fb_read_sysmem(struct fd_batch *batch)
|
|||
|
||||
.iova = fd_bo_get_iova(rsc->bo),
|
||||
|
||||
.base_miplevel = psurf->u.tex.level,
|
||||
.base_miplevel = psurf->level,
|
||||
.level_count = 1,
|
||||
|
||||
.base_array_layer = psurf->u.tex.first_layer,
|
||||
.layer_count = psurf->u.tex.last_layer - psurf->u.tex.first_layer + 1,
|
||||
.base_array_layer = psurf->first_layer,
|
||||
.layer_count = psurf->last_layer - psurf->first_layer + 1,
|
||||
|
||||
.swiz = {PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_Z,
|
||||
PIPE_SWIZZLE_W},
|
||||
|
|
@ -517,7 +517,7 @@ update_render_cntl(struct fd_batch *batch, struct pipe_framebuffer_state *pfb,
|
|||
if (pfb->zsbuf.texture) {
|
||||
struct fd_resource *rsc = fd_resource(pfb->zsbuf.texture);
|
||||
depth_ubwc_enable =
|
||||
fd_resource_ubwc_enabled(rsc, pfb->zsbuf.u.tex.level);
|
||||
fd_resource_ubwc_enabled(rsc, pfb->zsbuf.level);
|
||||
}
|
||||
|
||||
for (i = 0; i < pfb->nr_cbufs; i++) {
|
||||
|
|
@ -527,7 +527,7 @@ update_render_cntl(struct fd_batch *batch, struct pipe_framebuffer_state *pfb,
|
|||
struct pipe_surface *psurf = &pfb->cbufs[i];
|
||||
struct fd_resource *rsc = fd_resource(psurf->texture);
|
||||
|
||||
if (fd_resource_ubwc_enabled(rsc, psurf->u.tex.level))
|
||||
if (fd_resource_ubwc_enabled(rsc, psurf->level))
|
||||
mrts_ubwc_enable |= 1 << i;
|
||||
}
|
||||
|
||||
|
|
@ -1381,7 +1381,7 @@ emit_blit(struct fd_batch *batch, struct fd_ringbuffer *ring, uint32_t base,
|
|||
uint32_t offset;
|
||||
bool ubwc_enabled;
|
||||
|
||||
assert(psurf->u.tex.first_layer == psurf->u.tex.last_layer);
|
||||
assert(psurf->first_layer == psurf->last_layer);
|
||||
|
||||
/* separate stencil case: */
|
||||
if (stencil) {
|
||||
|
|
@ -1390,16 +1390,16 @@ emit_blit(struct fd_batch *batch, struct fd_ringbuffer *ring, uint32_t base,
|
|||
}
|
||||
|
||||
offset =
|
||||
fd_resource_offset(rsc, psurf->u.tex.level, psurf->u.tex.first_layer);
|
||||
ubwc_enabled = fd_resource_ubwc_enabled(rsc, psurf->u.tex.level);
|
||||
fd_resource_offset(rsc, psurf->level, psurf->first_layer);
|
||||
ubwc_enabled = fd_resource_ubwc_enabled(rsc, psurf->level);
|
||||
|
||||
assert(psurf->u.tex.first_layer == psurf->u.tex.last_layer);
|
||||
assert(psurf->first_layer == psurf->last_layer);
|
||||
|
||||
enum a6xx_tile_mode tile_mode = (enum a6xx_tile_mode)
|
||||
fd_resource_tile_mode(&rsc->b.b, psurf->u.tex.level);
|
||||
fd_resource_tile_mode(&rsc->b.b, psurf->level);
|
||||
enum a6xx_format format = fd6_color_format(pfmt, tile_mode);
|
||||
uint32_t stride = fd_resource_pitch(rsc, psurf->u.tex.level);
|
||||
uint32_t array_stride = fd_resource_layer_stride(rsc, psurf->u.tex.level);
|
||||
uint32_t stride = fd_resource_pitch(rsc, psurf->level);
|
||||
uint32_t array_stride = fd_resource_layer_stride(rsc, psurf->level);
|
||||
enum a3xx_color_swap swap =
|
||||
fd6_color_swap(pfmt, (enum a6xx_tile_mode)rsc->layout.tile_mode,
|
||||
false);
|
||||
|
|
@ -1421,8 +1421,8 @@ emit_blit(struct fd_batch *batch, struct fd_ringbuffer *ring, uint32_t base,
|
|||
|
||||
if (ubwc_enabled) {
|
||||
OUT_PKT4(ring, REG_A6XX_RB_BLIT_FLAG_DST, 3);
|
||||
fd6_emit_flag_reference(ring, rsc, psurf->u.tex.level,
|
||||
psurf->u.tex.first_layer);
|
||||
fd6_emit_flag_reference(ring, rsc, psurf->level,
|
||||
psurf->first_layer);
|
||||
}
|
||||
|
||||
if (CHIP >= A7XX)
|
||||
|
|
|
|||
|
|
@ -67,7 +67,9 @@ struct fd_batch_key {
|
|||
uint16_t ctx_seqno;
|
||||
struct {
|
||||
struct pipe_resource *texture;
|
||||
union pipe_surface_desc u;
|
||||
unsigned first_layer:16;
|
||||
unsigned last_layer:16;
|
||||
unsigned level;
|
||||
uint8_t pos, samples;
|
||||
uint16_t format;
|
||||
} surf[0];
|
||||
|
|
@ -511,12 +513,11 @@ batch_from_key(struct fd_context *ctx, struct fd_batch_key *key) assert_dt
|
|||
DBG("%p: hash=0x%08x, %ux%u, %u layers, %u samples", batch, hash, key->width,
|
||||
key->height, key->layers, key->samples);
|
||||
for (unsigned idx = 0; idx < key->num_surfs; idx++) {
|
||||
DBG("%p: surf[%u]: %p (%s) (%u,%u / %u,%u,%u)", batch,
|
||||
DBG("%p: surf[%u]: %p (%s) (%u,%u,%u)", batch,
|
||||
key->surf[idx].pos, key->surf[idx].texture,
|
||||
util_format_name(key->surf[idx].format),
|
||||
key->surf[idx].u.buf.first_element, key->surf[idx].u.buf.last_element,
|
||||
key->surf[idx].u.tex.first_layer, key->surf[idx].u.tex.last_layer,
|
||||
key->surf[idx].u.tex.level);
|
||||
key->surf[idx].first_layer, key->surf[idx].last_layer,
|
||||
key->surf[idx].level);
|
||||
}
|
||||
#endif
|
||||
if (!batch)
|
||||
|
|
@ -547,7 +548,9 @@ key_surf(struct fd_batch_key *key, unsigned idx, unsigned pos,
|
|||
const struct pipe_surface *psurf)
|
||||
{
|
||||
key->surf[idx].texture = psurf->texture;
|
||||
key->surf[idx].u = psurf->u;
|
||||
key->surf[idx].level = psurf->level;
|
||||
key->surf[idx].first_layer = psurf->first_layer;
|
||||
key->surf[idx].last_layer = psurf->last_layer;
|
||||
key->surf[idx].pos = pos;
|
||||
key->surf[idx].samples = MAX2(1, psurf->nr_samples);
|
||||
key->surf[idx].format = psurf->format;
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ default_dst_texture(struct pipe_surface *dst_templ, struct pipe_resource *dst,
|
|||
unsigned dstlevel, unsigned dstz)
|
||||
{
|
||||
memset(dst_templ, 0, sizeof(*dst_templ));
|
||||
dst_templ->u.tex.level = dstlevel;
|
||||
dst_templ->u.tex.first_layer = dstz;
|
||||
dst_templ->u.tex.last_layer = dstz;
|
||||
dst_templ->level = dstlevel;
|
||||
dst_templ->first_layer = dstz;
|
||||
dst_templ->last_layer = dstz;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -740,10 +740,10 @@ fd_gmem_render_tiles(struct fd_batch *batch)
|
|||
struct pipe_surface *psurf = &pfb->cbufs[i];
|
||||
if (!psurf->texture)
|
||||
continue;
|
||||
if (psurf->u.tex.first_layer < psurf->u.tex.last_layer)
|
||||
if (psurf->first_layer < psurf->last_layer)
|
||||
sysmem = true;
|
||||
}
|
||||
if (pfb->zsbuf.texture && pfb->zsbuf.u.tex.first_layer < pfb->zsbuf.u.tex.last_layer)
|
||||
if (pfb->zsbuf.texture && pfb->zsbuf.first_layer < pfb->zsbuf.last_layer)
|
||||
sysmem = true;
|
||||
|
||||
/* Tessellation doesn't seem to support tiled rendering so fall back to
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ fd_create_surface(struct pipe_context *pctx, struct pipe_resource *ptex,
|
|||
if (!psurf)
|
||||
return NULL;
|
||||
|
||||
unsigned level = surf_tmpl->u.tex.level;
|
||||
unsigned level = surf_tmpl->level;
|
||||
|
||||
pipe_reference_init(&psurf->reference, 1);
|
||||
pipe_resource_reference(&psurf->texture, ptex);
|
||||
|
|
@ -31,14 +31,9 @@ fd_create_surface(struct pipe_context *pctx, struct pipe_resource *ptex,
|
|||
psurf->format = surf_tmpl->format;
|
||||
psurf->nr_samples = surf_tmpl->nr_samples;
|
||||
|
||||
if (ptex->target == PIPE_BUFFER) {
|
||||
psurf->u.buf.first_element = surf_tmpl->u.buf.first_element;
|
||||
psurf->u.buf.last_element = surf_tmpl->u.buf.last_element;
|
||||
} else {
|
||||
psurf->u.tex.level = level;
|
||||
psurf->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
|
||||
psurf->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
|
||||
}
|
||||
psurf->level = level;
|
||||
psurf->first_layer = surf_tmpl->first_layer;
|
||||
psurf->last_layer = surf_tmpl->last_layer;
|
||||
|
||||
return psurf;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,10 +94,10 @@ update_framebuffer(struct i915_context *i915)
|
|||
i915->current.cbuf_flags = surf->buf_info;
|
||||
i915->current.cbuf_offset = 0;
|
||||
|
||||
layer = cbuf_surface->u.tex.first_layer;
|
||||
layer = cbuf_surface->first_layer;
|
||||
|
||||
x = tex->image_offset[cbuf_surface->u.tex.level][layer].nblocksx;
|
||||
y = tex->image_offset[cbuf_surface->u.tex.level][layer].nblocksy;
|
||||
x = tex->image_offset[cbuf_surface->level][layer].nblocksx;
|
||||
y = tex->image_offset[cbuf_surface->level][layer].nblocksy;
|
||||
// Use offset if buffer not within max texture size 2048
|
||||
if (y + i915->framebuffer.height >= (1 << (I915_MAX_TEXTURE_2D_LEVELS - 1))) {
|
||||
// offset should be multiple of 8 to support TILE_X
|
||||
|
|
@ -116,8 +116,8 @@ update_framebuffer(struct i915_context *i915)
|
|||
if (depth_surface) {
|
||||
struct i915_surface *surf = i915_surface(depth_surface);
|
||||
struct i915_texture *tex = i915_texture(depth_surface->texture);
|
||||
unsigned offset = i915_texture_offset(tex, depth_surface->u.tex.level,
|
||||
depth_surface->u.tex.first_layer);
|
||||
unsigned offset = i915_texture_offset(tex, depth_surface->level,
|
||||
depth_surface->first_layer);
|
||||
assert(tex);
|
||||
if (offset != 0)
|
||||
debug_printf("Depth offset is %d\n", offset);
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ i915_clear_render_target_blitter(struct pipe_context *pipe,
|
|||
struct pipe_resource *pt = &tex->b;
|
||||
union util_color uc;
|
||||
unsigned offset =
|
||||
i915_texture_offset(tex, dst->u.tex.level, dst->u.tex.first_layer);
|
||||
i915_texture_offset(tex, dst->level, dst->first_layer);
|
||||
|
||||
assert(util_format_get_blockwidth(pt->format) == 1);
|
||||
assert(util_format_get_blockheight(pt->format) == 1);
|
||||
|
|
@ -317,7 +317,7 @@ i915_clear_depth_stencil_blitter(struct pipe_context *pipe,
|
|||
unsigned packedds;
|
||||
unsigned mask = 0;
|
||||
unsigned offset =
|
||||
i915_texture_offset(tex, dst->u.tex.level, dst->u.tex.first_layer);
|
||||
i915_texture_offset(tex, dst->level, dst->first_layer);
|
||||
|
||||
assert(util_format_get_blockwidth(pt->format) == 1);
|
||||
assert(util_format_get_blockheight(pt->format) == 1);
|
||||
|
|
@ -390,9 +390,9 @@ i915_create_surface_custom(struct pipe_context *ctx, struct pipe_resource *pt,
|
|||
struct i915_texture *tex = i915_texture(pt);
|
||||
struct i915_surface *surf;
|
||||
|
||||
assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
|
||||
assert(surf_tmpl->first_layer == surf_tmpl->last_layer);
|
||||
if (pt->target != PIPE_TEXTURE_CUBE && pt->target != PIPE_TEXTURE_3D)
|
||||
assert(surf_tmpl->u.tex.first_layer == 0);
|
||||
assert(surf_tmpl->first_layer == 0);
|
||||
|
||||
surf = CALLOC_STRUCT(i915_surface);
|
||||
if (!surf)
|
||||
|
|
@ -403,9 +403,9 @@ i915_create_surface_custom(struct pipe_context *ctx, struct pipe_resource *pt,
|
|||
pipe_reference_init(&ps->reference, 1);
|
||||
pipe_resource_reference(&ps->texture, pt);
|
||||
ps->format = surf_tmpl->format;
|
||||
ps->u.tex.level = surf_tmpl->u.tex.level;
|
||||
ps->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
|
||||
ps->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
|
||||
ps->level = surf_tmpl->level;
|
||||
ps->first_layer = surf_tmpl->first_layer;
|
||||
ps->last_layer = surf_tmpl->last_layer;
|
||||
ps->context = ctx;
|
||||
|
||||
if (util_format_is_depth_or_stencil(ps->format)) {
|
||||
|
|
|
|||
|
|
@ -745,9 +745,9 @@ iris_clear(struct pipe_context *ctx,
|
|||
if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
|
||||
struct pipe_surface *psurf = &cso_fb->zsbuf;
|
||||
|
||||
box.depth = psurf->u.tex.last_layer - psurf->u.tex.first_layer + 1;
|
||||
box.z = psurf->u.tex.first_layer,
|
||||
clear_depth_stencil(ice, psurf->texture, psurf->u.tex.level, &box, true,
|
||||
box.depth = psurf->last_layer - psurf->first_layer + 1;
|
||||
box.z = psurf->first_layer,
|
||||
clear_depth_stencil(ice, psurf->texture, psurf->level, &box, true,
|
||||
buffers & PIPE_CLEAR_DEPTH,
|
||||
buffers & PIPE_CLEAR_STENCIL,
|
||||
depth, stencil);
|
||||
|
|
@ -758,10 +758,10 @@ iris_clear(struct pipe_context *ctx,
|
|||
if (buffers & (PIPE_CLEAR_COLOR0 << i)) {
|
||||
struct pipe_surface *psurf = ice->state.fb_cbufs[i];
|
||||
struct iris_surface *isurf = (void *) psurf;
|
||||
box.depth = psurf->u.tex.last_layer - psurf->u.tex.first_layer + 1,
|
||||
box.z = psurf->u.tex.first_layer,
|
||||
box.depth = psurf->last_layer - psurf->first_layer + 1,
|
||||
box.z = psurf->first_layer,
|
||||
|
||||
clear_color(ice, psurf->texture, psurf->u.tex.level, &box,
|
||||
clear_color(ice, psurf->texture, psurf->level, &box,
|
||||
true, isurf->view.format, isurf->view.swizzle,
|
||||
convert_clear_color(psurf->format, p_color));
|
||||
}
|
||||
|
|
@ -851,13 +851,13 @@ iris_clear_render_target(struct pipe_context *ctx,
|
|||
struct pipe_box box = {
|
||||
.x = dst_x,
|
||||
.y = dst_y,
|
||||
.z = psurf->u.tex.first_layer,
|
||||
.z = psurf->first_layer,
|
||||
.width = width,
|
||||
.height = height,
|
||||
.depth = psurf->u.tex.last_layer - psurf->u.tex.first_layer + 1
|
||||
.depth = psurf->last_layer - psurf->first_layer + 1
|
||||
};
|
||||
|
||||
clear_color(ice, psurf->texture, psurf->u.tex.level, &box,
|
||||
clear_color(ice, psurf->texture, psurf->level, &box,
|
||||
render_condition_enabled,
|
||||
isurf->view.format, isurf->view.swizzle,
|
||||
convert_clear_color(psurf->format, p_color));
|
||||
|
|
@ -882,15 +882,15 @@ iris_clear_depth_stencil(struct pipe_context *ctx,
|
|||
struct pipe_box box = {
|
||||
.x = dst_x,
|
||||
.y = dst_y,
|
||||
.z = psurf->u.tex.first_layer,
|
||||
.z = psurf->first_layer,
|
||||
.width = width,
|
||||
.height = height,
|
||||
.depth = psurf->u.tex.last_layer - psurf->u.tex.first_layer + 1
|
||||
.depth = psurf->last_layer - psurf->first_layer + 1
|
||||
};
|
||||
|
||||
assert(util_format_is_depth_or_stencil(psurf->texture->format));
|
||||
|
||||
clear_depth_stencil(ice, psurf->texture, psurf->u.tex.level, &box,
|
||||
clear_depth_stencil(ice, psurf->texture, psurf->level, &box,
|
||||
render_condition_enabled,
|
||||
flags & PIPE_CLEAR_DEPTH, flags & PIPE_CLEAR_STENCIL,
|
||||
depth, stencil);
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ disable_rb_aux_buffer(struct iris_context *ice,
|
|||
struct iris_resource *rb_res = (void *) surf->base.texture;
|
||||
|
||||
if (rb_res->bo == tex_res->bo &&
|
||||
surf->base.u.tex.level >= min_level &&
|
||||
surf->base.u.tex.level < min_level + num_levels) {
|
||||
surf->base.level >= min_level &&
|
||||
surf->base.level < min_level + num_levels) {
|
||||
found = draw_aux_buffer_disabled[i] = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -210,12 +210,12 @@ iris_predraw_resolve_framebuffer(struct iris_context *ice,
|
|||
struct iris_resource *z_res, *s_res;
|
||||
iris_get_depth_stencil_resources(zs_surf->texture, &z_res, &s_res);
|
||||
unsigned num_layers =
|
||||
zs_surf->u.tex.last_layer - zs_surf->u.tex.first_layer + 1;
|
||||
zs_surf->last_layer - zs_surf->first_layer + 1;
|
||||
|
||||
if (z_res) {
|
||||
iris_resource_prepare_render(ice, z_res, z_res->surf.format,
|
||||
zs_surf->u.tex.level,
|
||||
zs_surf->u.tex.first_layer,
|
||||
zs_surf->level,
|
||||
zs_surf->first_layer,
|
||||
num_layers, ice->state.hiz_usage);
|
||||
iris_emit_buffer_barrier_for(batch, z_res->bo,
|
||||
IRIS_DOMAIN_DEPTH_WRITE);
|
||||
|
|
@ -349,20 +349,20 @@ iris_postdraw_update_resolve_tracking(struct iris_context *ice)
|
|||
struct iris_resource *z_res, *s_res;
|
||||
iris_get_depth_stencil_resources(zs_surf->texture, &z_res, &s_res);
|
||||
unsigned num_layers =
|
||||
zs_surf->u.tex.last_layer - zs_surf->u.tex.first_layer + 1;
|
||||
zs_surf->last_layer - zs_surf->first_layer + 1;
|
||||
|
||||
if (z_res) {
|
||||
if (may_have_resolved_depth && ice->state.depth_writes_enabled) {
|
||||
iris_resource_finish_render(ice, z_res, zs_surf->u.tex.level,
|
||||
zs_surf->u.tex.first_layer,
|
||||
iris_resource_finish_render(ice, z_res, zs_surf->level,
|
||||
zs_surf->first_layer,
|
||||
num_layers, ice->state.hiz_usage);
|
||||
}
|
||||
}
|
||||
|
||||
if (s_res) {
|
||||
if (may_have_resolved_depth && ice->state.stencil_writes_enabled) {
|
||||
iris_resource_finish_write(ice, s_res, zs_surf->u.tex.level,
|
||||
zs_surf->u.tex.first_layer, num_layers,
|
||||
iris_resource_finish_write(ice, s_res, zs_surf->level,
|
||||
zs_surf->first_layer, num_layers,
|
||||
s_res->aux.usage);
|
||||
}
|
||||
}
|
||||
|
|
@ -380,11 +380,10 @@ iris_postdraw_update_resolve_tracking(struct iris_context *ice)
|
|||
enum isl_aux_usage aux_usage = ice->state.draw_aux_usage[i];
|
||||
|
||||
if (may_have_resolved_color) {
|
||||
union pipe_surface_desc *desc = &surf->base.u;
|
||||
unsigned num_layers =
|
||||
desc->tex.last_layer - desc->tex.first_layer + 1;
|
||||
iris_resource_finish_render(ice, res, desc->tex.level,
|
||||
desc->tex.first_layer, num_layers,
|
||||
surf->base.last_layer - surf->base.first_layer + 1;
|
||||
iris_resource_finish_render(ice, res, surf->base.level,
|
||||
surf->base.first_layer, num_layers,
|
||||
aux_usage);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2118,7 +2118,7 @@ want_pma_fix(struct iris_context *ice)
|
|||
* 3DSTATE_DEPTH_BUFFER::HIZ Enable &&
|
||||
*/
|
||||
if (!zres ||
|
||||
!iris_resource_level_has_hiz(devinfo, zres, cso_fb->zsbuf.u.tex.level))
|
||||
!iris_resource_level_has_hiz(devinfo, zres, cso_fb->zsbuf.level))
|
||||
return false;
|
||||
|
||||
/* 3DSTATE_WM::EDSC_Mode != EDSC_PREPS */
|
||||
|
|
@ -3165,14 +3165,14 @@ iris_create_surface(struct pipe_context *ctx,
|
|||
if (!surf)
|
||||
return NULL;
|
||||
|
||||
uint32_t array_len = tmpl->u.tex.last_layer - tmpl->u.tex.first_layer + 1;
|
||||
uint32_t array_len = tmpl->last_layer - tmpl->first_layer + 1;
|
||||
|
||||
struct isl_view *view = &surf->view;
|
||||
*view = (struct isl_view) {
|
||||
.format = fmt.fmt,
|
||||
.base_level = tmpl->u.tex.level,
|
||||
.base_level = tmpl->level,
|
||||
.levels = 1,
|
||||
.base_array_layer = tmpl->u.tex.first_layer,
|
||||
.base_array_layer = tmpl->first_layer,
|
||||
.array_len = array_len,
|
||||
.swizzle = ISL_SWIZZLE_IDENTITY,
|
||||
.usage = usage,
|
||||
|
|
@ -3182,9 +3182,9 @@ iris_create_surface(struct pipe_context *ctx,
|
|||
struct isl_view *read_view = &surf->read_view;
|
||||
*read_view = (struct isl_view) {
|
||||
.format = fmt.fmt,
|
||||
.base_level = tmpl->u.tex.level,
|
||||
.base_level = tmpl->level,
|
||||
.levels = 1,
|
||||
.base_array_layer = tmpl->u.tex.first_layer,
|
||||
.base_array_layer = tmpl->first_layer,
|
||||
.array_len = array_len,
|
||||
.swizzle = ISL_SWIZZLE_IDENTITY,
|
||||
.usage = ISL_SURF_USAGE_TEXTURE_BIT,
|
||||
|
|
@ -3273,9 +3273,9 @@ iris_create_surface(struct pipe_context *ctx,
|
|||
psurf->context = ctx;
|
||||
psurf->format = tmpl->format;
|
||||
psurf->texture = tex;
|
||||
psurf->u.tex.first_layer = tmpl->u.tex.first_layer;
|
||||
psurf->u.tex.last_layer = tmpl->u.tex.last_layer;
|
||||
psurf->u.tex.level = tmpl->u.tex.level;
|
||||
psurf->first_layer = tmpl->first_layer;
|
||||
psurf->last_layer = tmpl->last_layer;
|
||||
psurf->level = tmpl->level;
|
||||
|
||||
/* Bail early for depth/stencil - we don't want SURFACE_STATE for them. */
|
||||
if (res->surf.usage & (ISL_SURF_USAGE_DEPTH_BIT |
|
||||
|
|
@ -3868,10 +3868,10 @@ iris_set_framebuffer_state(struct pipe_context *ctx,
|
|||
iris_get_depth_stencil_resources(cso->zsbuf.texture, &zres,
|
||||
&stencil_res);
|
||||
|
||||
view.base_level = cso->zsbuf.u.tex.level;
|
||||
view.base_array_layer = cso->zsbuf.u.tex.first_layer;
|
||||
view.base_level = cso->zsbuf.level;
|
||||
view.base_array_layer = cso->zsbuf.first_layer;
|
||||
view.array_len =
|
||||
cso->zsbuf.u.tex.last_layer - cso->zsbuf.u.tex.first_layer + 1;
|
||||
cso->zsbuf.last_layer - cso->zsbuf.first_layer + 1;
|
||||
|
||||
if (zres) {
|
||||
view.usage |= ISL_SURF_USAGE_DEPTH_BIT;
|
||||
|
|
@ -6714,7 +6714,7 @@ calculate_tile_dimensions(struct iris_context *ice,
|
|||
/* XXX - Pessimistic, in some cases it might be helpful to neglect
|
||||
* aux surface traffic.
|
||||
*/
|
||||
if (iris_resource_level_has_hiz(devinfo, zres, cso->zsbuf.u.tex.level)) {
|
||||
if (iris_resource_level_has_hiz(devinfo, zres, cso->zsbuf.level)) {
|
||||
pixel_size += intel_calculate_surface_pixel_size(&zres->aux.surf);
|
||||
|
||||
if (isl_aux_usage_has_ccs(zres->aux.usage)) {
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ lima_pack_blit_cmd(struct lima_job *job,
|
|||
|
||||
struct lima_context *ctx = job->ctx;
|
||||
struct lima_surface *surf = lima_surface(psurf);
|
||||
int level = psurf->u.tex.level;
|
||||
unsigned first_layer = psurf->u.tex.first_layer;
|
||||
int level = psurf->level;
|
||||
unsigned first_layer = psurf->first_layer;
|
||||
float fb_width = dst->width, fb_height = dst->height;
|
||||
|
||||
uint32_t va;
|
||||
|
|
@ -183,9 +183,9 @@ lima_get_blit_surface(struct pipe_context *pctx,
|
|||
|
||||
memset(&tmpl, 0, sizeof(tmpl));
|
||||
tmpl.format = prsc->format;
|
||||
tmpl.u.tex.level = level;
|
||||
tmpl.u.tex.first_layer = 0;
|
||||
tmpl.u.tex.last_layer = 0;
|
||||
tmpl.level = level;
|
||||
tmpl.first_layer = 0;
|
||||
tmpl.last_layer = 0;
|
||||
|
||||
return pctx->create_surface(pctx, prsc, &tmpl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -740,7 +740,7 @@ lima_pack_wb_zsbuf_reg(struct lima_job *job, uint32_t *wb_reg, int wb_idx)
|
|||
struct lima_job_fb_info *fb = &job->fb;
|
||||
struct pipe_surface *zsbuf = job->key.zsbuf;
|
||||
struct lima_resource *res = lima_resource(zsbuf->texture);
|
||||
int level = zsbuf->u.tex.level;
|
||||
int level = zsbuf->level;
|
||||
uint32_t format = lima_format_get_pixel(zsbuf->format);
|
||||
|
||||
struct lima_pp_wb_reg *wb = (void *)wb_reg;
|
||||
|
|
@ -769,8 +769,8 @@ lima_pack_wb_cbuf_reg(struct lima_job *job, uint32_t *wb_reg, int wb_idx)
|
|||
struct lima_job_fb_info *fb = &job->fb;
|
||||
struct pipe_surface *cbuf = job->key.cbuf;
|
||||
struct lima_resource *res = lima_resource(cbuf->texture);
|
||||
int level = cbuf->u.tex.level;
|
||||
unsigned layer = cbuf->u.tex.first_layer;
|
||||
int level = cbuf->level;
|
||||
unsigned layer = cbuf->first_layer;
|
||||
uint32_t format = lima_format_get_pixel(cbuf->format);
|
||||
bool swap_channels = lima_format_get_pixel_swap_rb(cbuf->format);
|
||||
|
||||
|
|
|
|||
|
|
@ -570,10 +570,10 @@ lima_surface_create(struct pipe_context *pctx,
|
|||
if (!surf)
|
||||
return NULL;
|
||||
|
||||
assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
|
||||
assert(surf_tmpl->first_layer == surf_tmpl->last_layer);
|
||||
|
||||
struct pipe_surface *psurf = &surf->base;
|
||||
unsigned level = surf_tmpl->u.tex.level;
|
||||
unsigned level = surf_tmpl->level;
|
||||
|
||||
pipe_reference_init(&psurf->reference, 1);
|
||||
pipe_resource_reference(&psurf->texture, pres);
|
||||
|
|
@ -581,9 +581,9 @@ lima_surface_create(struct pipe_context *pctx,
|
|||
psurf->context = pctx;
|
||||
psurf->format = surf_tmpl->format;
|
||||
psurf->nr_samples = surf_tmpl->nr_samples;
|
||||
psurf->u.tex.level = level;
|
||||
psurf->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
|
||||
psurf->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
|
||||
psurf->level = level;
|
||||
psurf->first_layer = surf_tmpl->first_layer;
|
||||
psurf->last_layer = surf_tmpl->last_layer;
|
||||
|
||||
surf->tiled_w = align(u_minify(pres->width0, level), 16) >> 4;
|
||||
surf->tiled_h = align(u_minify(pres->height0, level), 16) >> 4;
|
||||
|
|
|
|||
|
|
@ -517,8 +517,8 @@ lp_rast_blit_tile_to_dest(struct lp_rasterizer_task *task,
|
|||
struct lp_fragment_shader_variant *variant = state->variant;
|
||||
const struct lp_jit_texture *texture = &state->jit_resources.textures[0];
|
||||
const struct pipe_surface *cbuf = &scene->fb.cbufs[0];
|
||||
const unsigned face_slice = cbuf->u.tex.first_layer;
|
||||
const unsigned level = cbuf->u.tex.level;
|
||||
const unsigned face_slice = cbuf->first_layer;
|
||||
const unsigned level = cbuf->level;
|
||||
struct llvmpipe_resource *lpt = llvmpipe_resource(cbuf->texture);
|
||||
|
||||
LP_DBG(DEBUG_RAST, "%s\n", __func__);
|
||||
|
|
|
|||
|
|
@ -167,33 +167,21 @@ init_scene_texture(struct lp_scene_surface *ssurf, struct pipe_surface *psurf)
|
|||
return;
|
||||
}
|
||||
|
||||
if (llvmpipe_resource_is_texture(psurf->texture)) {
|
||||
ssurf->stride = llvmpipe_resource_stride(psurf->texture,
|
||||
psurf->u.tex.level);
|
||||
ssurf->layer_stride = llvmpipe_layer_stride(psurf->texture,
|
||||
psurf->u.tex.level);
|
||||
ssurf->sample_stride = llvmpipe_sample_stride(psurf->texture);
|
||||
ssurf->stride = llvmpipe_resource_stride(psurf->texture,
|
||||
psurf->level);
|
||||
ssurf->layer_stride = llvmpipe_layer_stride(psurf->texture,
|
||||
psurf->level);
|
||||
ssurf->sample_stride = llvmpipe_sample_stride(psurf->texture);
|
||||
|
||||
ssurf->map = llvmpipe_resource_map(psurf->texture,
|
||||
psurf->u.tex.level,
|
||||
psurf->u.tex.first_layer,
|
||||
LP_TEX_USAGE_READ_WRITE);
|
||||
assert(ssurf->map);
|
||||
ssurf->format_bytes = util_format_get_blocksize(psurf->format);
|
||||
ssurf->nr_samples = util_res_sample_count(psurf->texture);
|
||||
ssurf->base_layer = psurf->u.tex.first_layer;
|
||||
ssurf->layer_count = psurf->u.tex.last_layer - psurf->u.tex.first_layer + 1;
|
||||
} else {
|
||||
struct llvmpipe_resource *lpr = llvmpipe_resource(psurf->texture);
|
||||
unsigned pixstride = util_format_get_blocksize(psurf->format);
|
||||
ssurf->stride = psurf->texture->width0;
|
||||
ssurf->layer_stride = 0;
|
||||
ssurf->sample_stride = 0;
|
||||
ssurf->nr_samples = 1;
|
||||
ssurf->map = lpr->data;
|
||||
ssurf->map += psurf->u.buf.first_element * pixstride;
|
||||
ssurf->format_bytes = util_format_get_blocksize(psurf->format);
|
||||
}
|
||||
ssurf->map = llvmpipe_resource_map(psurf->texture,
|
||||
psurf->level,
|
||||
psurf->first_layer,
|
||||
LP_TEX_USAGE_READ_WRITE);
|
||||
assert(ssurf->map);
|
||||
ssurf->format_bytes = util_format_get_blocksize(psurf->format);
|
||||
ssurf->nr_samples = util_res_sample_count(psurf->texture);
|
||||
ssurf->base_layer = psurf->first_layer;
|
||||
ssurf->layer_count = psurf->last_layer - psurf->first_layer + 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -226,8 +214,8 @@ lp_scene_end_rasterization(struct lp_scene *scene)
|
|||
struct pipe_surface *cbuf = &scene->fb.cbufs[i];
|
||||
if (llvmpipe_resource_is_texture(cbuf->texture)) {
|
||||
llvmpipe_resource_unmap(cbuf->texture,
|
||||
cbuf->u.tex.level,
|
||||
cbuf->u.tex.first_layer);
|
||||
cbuf->level,
|
||||
cbuf->first_layer);
|
||||
}
|
||||
scene->cbufs[i].map = NULL;
|
||||
}
|
||||
|
|
@ -237,8 +225,8 @@ lp_scene_end_rasterization(struct lp_scene *scene)
|
|||
if (scene->zsbuf.map) {
|
||||
struct pipe_surface *zsbuf = &scene->fb.zsbuf;
|
||||
llvmpipe_resource_unmap(zsbuf->texture,
|
||||
zsbuf->u.tex.level,
|
||||
zsbuf->u.tex.first_layer);
|
||||
zsbuf->level,
|
||||
zsbuf->first_layer);
|
||||
scene->zsbuf.map = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -638,7 +626,7 @@ lp_scene_begin_binning(struct lp_scene *scene,
|
|||
if (cbuf->texture) {
|
||||
if (llvmpipe_resource_is_texture(cbuf->texture)) {
|
||||
max_layer = MIN2(max_layer,
|
||||
cbuf->u.tex.last_layer - cbuf->u.tex.first_layer);
|
||||
cbuf->last_layer - cbuf->first_layer);
|
||||
} else {
|
||||
max_layer = 0;
|
||||
}
|
||||
|
|
@ -647,7 +635,7 @@ lp_scene_begin_binning(struct lp_scene *scene,
|
|||
|
||||
if (fb->zsbuf.texture) {
|
||||
struct pipe_surface *zsbuf = &scene->fb.zsbuf;
|
||||
max_layer = MIN2(max_layer, zsbuf->u.tex.last_layer - zsbuf->u.tex.first_layer);
|
||||
max_layer = MIN2(max_layer, zsbuf->last_layer - zsbuf->first_layer);
|
||||
}
|
||||
|
||||
scene->fb_max_layer = max_layer;
|
||||
|
|
|
|||
|
|
@ -232,19 +232,11 @@ llvmpipe_create_surface(struct pipe_context *pipe,
|
|||
pipe_resource_reference(&ps->texture, pt);
|
||||
ps->context = pipe;
|
||||
ps->format = surf_tmpl->format;
|
||||
if (llvmpipe_resource_is_texture(pt)) {
|
||||
assert(surf_tmpl->u.tex.level <= pt->last_level);
|
||||
assert(surf_tmpl->u.tex.first_layer <= surf_tmpl->u.tex.last_layer);
|
||||
ps->u.tex.level = surf_tmpl->u.tex.level;
|
||||
ps->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
|
||||
ps->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
|
||||
} else {
|
||||
ps->u.buf.first_element = surf_tmpl->u.buf.first_element;
|
||||
ps->u.buf.last_element = surf_tmpl->u.buf.last_element;
|
||||
assert(ps->u.buf.first_element <= ps->u.buf.last_element);
|
||||
assert(util_format_get_blocksize(surf_tmpl->format) *
|
||||
(ps->u.buf.last_element + 1) <= pt->width0);
|
||||
}
|
||||
assert(surf_tmpl->level <= pt->last_level);
|
||||
assert(surf_tmpl->first_layer <= surf_tmpl->last_layer);
|
||||
ps->level = surf_tmpl->level;
|
||||
ps->first_layer = surf_tmpl->first_layer;
|
||||
ps->last_layer = surf_tmpl->last_layer;
|
||||
}
|
||||
return ps;
|
||||
}
|
||||
|
|
@ -345,8 +337,8 @@ llvmpipe_clear_render_target(struct pipe_context *pipe,
|
|||
struct pipe_box box;
|
||||
u_box_2d(dstx, dsty, width, height, &box);
|
||||
if (dst->texture->target != PIPE_BUFFER) {
|
||||
box.z = dst->u.tex.first_layer;
|
||||
box.depth = dst->u.tex.last_layer - dst->u.tex.first_layer + 1;
|
||||
box.z = dst->first_layer;
|
||||
box.depth = dst->last_layer - dst->first_layer + 1;
|
||||
}
|
||||
for (unsigned s = 0; s < util_res_sample_count(dst->texture); s++) {
|
||||
lp_clear_color_texture_msaa(pipe, dst->texture, dst->format,
|
||||
|
|
@ -419,8 +411,8 @@ llvmpipe_clear_depth_stencil(struct pipe_context *pipe,
|
|||
struct pipe_box box;
|
||||
u_box_2d(dstx, dsty, width, height, &box);
|
||||
if (dst->texture->target != PIPE_BUFFER) {
|
||||
box.z = dst->u.tex.first_layer;
|
||||
box.depth = dst->u.tex.last_layer - dst->u.tex.first_layer + 1;
|
||||
box.z = dst->first_layer;
|
||||
box.depth = dst->last_layer - dst->first_layer + 1;
|
||||
}
|
||||
for (unsigned s = 0; s < util_res_sample_count(dst->texture); s++)
|
||||
lp_clear_depth_stencil_texture_msaa(pipe, dst->texture,
|
||||
|
|
|
|||
|
|
@ -167,10 +167,10 @@ nouveau_vp3_video_buffer_create(struct pipe_context *pipe,
|
|||
memset(&surf_templ, 0, sizeof(surf_templ));
|
||||
for (j = 0; j < buffer->num_planes; ++j) {
|
||||
u_surface_default_template(&surf_templ, buffer->resources[j]);
|
||||
surf_templ.u.tex.first_layer = surf_templ.u.tex.last_layer = 0;
|
||||
surf_templ.first_layer = surf_templ.last_layer = 0;
|
||||
buffer->surfaces[j * 2] = surf_templ;
|
||||
|
||||
surf_templ.u.tex.first_layer = surf_templ.u.tex.last_layer = 1;
|
||||
surf_templ.first_layer = surf_templ.last_layer = 1;
|
||||
buffer->surfaces[j * 2 + 1] = surf_templ;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -549,7 +549,7 @@ nv30_miptree_surface_new(struct pipe_context *pipe,
|
|||
struct nv30_miptree *mt = nv30_miptree(pt); /* guaranteed */
|
||||
struct nv30_surface *ns;
|
||||
struct pipe_surface *ps;
|
||||
struct nv30_miptree_level *lvl = &mt->level[tmpl->u.tex.level];
|
||||
struct nv30_miptree_level *lvl = &mt->level[tmpl->level];
|
||||
|
||||
ns = CALLOC_STRUCT(nv30_surface);
|
||||
if (!ns)
|
||||
|
|
@ -560,14 +560,14 @@ nv30_miptree_surface_new(struct pipe_context *pipe,
|
|||
pipe_resource_reference(&ps->texture, pt);
|
||||
ps->context = pipe;
|
||||
ps->format = tmpl->format;
|
||||
ps->u.tex.level = tmpl->u.tex.level;
|
||||
ps->u.tex.first_layer = tmpl->u.tex.first_layer;
|
||||
ps->u.tex.last_layer = tmpl->u.tex.last_layer;
|
||||
ps->level = tmpl->level;
|
||||
ps->first_layer = tmpl->first_layer;
|
||||
ps->last_layer = tmpl->last_layer;
|
||||
|
||||
ns->width = u_minify(pt->width0, ps->u.tex.level);
|
||||
ns->height = u_minify(pt->height0, ps->u.tex.level);
|
||||
ns->depth = ps->u.tex.last_layer - ps->u.tex.first_layer + 1;
|
||||
ns->offset = layer_offset(pt, ps->u.tex.level, ps->u.tex.first_layer);
|
||||
ns->width = u_minify(pt->width0, ps->level);
|
||||
ns->height = u_minify(pt->height0, ps->level);
|
||||
ns->depth = ps->last_layer - ps->first_layer + 1;
|
||||
ns->offset = layer_offset(pt, ps->level, ps->first_layer);
|
||||
if (mt->swizzled)
|
||||
ns->pitch = 4096; /* random, just something the hw won't reject.. */
|
||||
else
|
||||
|
|
|
|||
|
|
@ -476,14 +476,14 @@ nv50_surface_from_miptree(struct nv50_miptree *mt,
|
|||
pipe_resource_reference(&ps->texture, &mt->base.base);
|
||||
|
||||
ps->format = templ->format;
|
||||
ps->u.tex.level = templ->u.tex.level;
|
||||
ps->u.tex.first_layer = templ->u.tex.first_layer;
|
||||
ps->u.tex.last_layer = templ->u.tex.last_layer;
|
||||
ps->level = templ->level;
|
||||
ps->first_layer = templ->first_layer;
|
||||
ps->last_layer = templ->last_layer;
|
||||
|
||||
ns->width = u_minify(mt->base.base.width0, ps->u.tex.level);
|
||||
ns->height = u_minify(mt->base.base.height0, ps->u.tex.level);
|
||||
ns->depth = ps->u.tex.last_layer - ps->u.tex.first_layer + 1;
|
||||
ns->offset = mt->level[templ->u.tex.level].offset;
|
||||
ns->width = u_minify(mt->base.base.width0, ps->level);
|
||||
ns->height = u_minify(mt->base.base.height0, ps->level);
|
||||
ns->depth = ps->last_layer - ps->first_layer + 1;
|
||||
ns->offset = mt->level[templ->level].offset;
|
||||
|
||||
ns->width <<= mt->ms_x;
|
||||
ns->height <<= mt->ms_y;
|
||||
|
|
@ -502,9 +502,9 @@ nv50_miptree_surface_new(struct pipe_context *pipe,
|
|||
return NULL;
|
||||
ns->base.context = pipe;
|
||||
|
||||
if (ns->base.u.tex.first_layer) {
|
||||
const unsigned l = ns->base.u.tex.level;
|
||||
const unsigned z = ns->base.u.tex.first_layer;
|
||||
if (ns->base.first_layer) {
|
||||
const unsigned l = ns->base.level;
|
||||
const unsigned z = ns->base.first_layer;
|
||||
|
||||
if (mt->layout_3d) {
|
||||
ns->offset += nv50_mt_zslice_offset(mt, l, z);
|
||||
|
|
|
|||
|
|
@ -40,42 +40,11 @@ nv50_resource_from_handle(struct pipe_screen * screen,
|
|||
return nv50_miptree_from_handle(screen, templ, whandle);
|
||||
}
|
||||
|
||||
struct pipe_surface *
|
||||
nv50_surface_from_buffer(struct pipe_context *pipe,
|
||||
struct pipe_resource *pbuf,
|
||||
const struct pipe_surface *templ)
|
||||
{
|
||||
struct nv50_surface *sf = CALLOC_STRUCT(nv50_surface);
|
||||
if (!sf)
|
||||
return NULL;
|
||||
|
||||
pipe_reference_init(&sf->base.reference, 1);
|
||||
pipe_resource_reference(&sf->base.texture, pbuf);
|
||||
|
||||
sf->base.format = templ->format;
|
||||
sf->base.u.buf.first_element = templ->u.buf.first_element;
|
||||
sf->base.u.buf.last_element = templ->u.buf.last_element;
|
||||
|
||||
sf->offset =
|
||||
templ->u.buf.first_element * util_format_get_blocksize(sf->base.format);
|
||||
|
||||
sf->offset &= ~0x7f; /* FIXME: RT_ADDRESS requires 128 byte alignment */
|
||||
|
||||
sf->width = templ->u.buf.last_element - templ->u.buf.first_element + 1;
|
||||
sf->height = 1;
|
||||
sf->depth = 1;
|
||||
|
||||
sf->base.context = pipe;
|
||||
return &sf->base;
|
||||
}
|
||||
|
||||
static struct pipe_surface *
|
||||
nv50_surface_create(struct pipe_context *pipe,
|
||||
struct pipe_resource *pres,
|
||||
const struct pipe_surface *templ)
|
||||
{
|
||||
if (unlikely(pres->target == PIPE_BUFFER))
|
||||
return nv50_surface_from_buffer(pipe, pres, templ);
|
||||
return nv50_miptree_surface_new(pipe, pres, templ);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -153,11 +153,6 @@ struct nv50_surface *
|
|||
nv50_surface_from_miptree(struct nv50_miptree *mt,
|
||||
const struct pipe_surface *templ);
|
||||
|
||||
struct pipe_surface *
|
||||
nv50_surface_from_buffer(struct pipe_context *pipe,
|
||||
struct pipe_resource *pt,
|
||||
const struct pipe_surface *templ);
|
||||
|
||||
void
|
||||
nv50_surface_destroy(struct pipe_context *, struct pipe_surface *);
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ nv50_validate_fb(struct nv50_context *nv50)
|
|||
if (likely(nouveau_bo_memtype(bo))) {
|
||||
assert(sf->base.texture->target != PIPE_BUFFER);
|
||||
|
||||
PUSH_DATA (push, mt->level[sf->base.u.tex.level].tile_mode);
|
||||
PUSH_DATA (push, mt->level[sf->base.level].tile_mode);
|
||||
PUSH_DATA (push, mt->layer_stride >> 2);
|
||||
BEGIN_NV04(push, NV50_3D(RT_HORIZ(i)), 2);
|
||||
PUSH_DATA (push, sf->width);
|
||||
|
|
@ -102,7 +102,7 @@ nv50_validate_fb(struct nv50_context *nv50)
|
|||
PUSH_DATAh(push, mt->base.address + sf->offset);
|
||||
PUSH_DATA (push, mt->base.address + sf->offset);
|
||||
PUSH_DATA (push, nv50_format_table[fb->zsbuf.format].rt);
|
||||
PUSH_DATA (push, mt->level[sf->base.u.tex.level].tile_mode);
|
||||
PUSH_DATA (push, mt->level[sf->base.level].tile_mode);
|
||||
PUSH_DATA (push, mt->layer_stride >> 2);
|
||||
BEGIN_NV04(push, NV50_3D(ZETA_ENABLE), 1);
|
||||
PUSH_DATA (push, 1);
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ nv50_clear_render_target(struct pipe_context *pipe,
|
|||
PUSH_DATAh(push, mt->base.address + sf->offset);
|
||||
PUSH_DATA (push, mt->base.address + sf->offset);
|
||||
PUSH_DATA (push, nv50_format_table[dst->format].rt);
|
||||
PUSH_DATA (push, mt->level[sf->base.u.tex.level].tile_mode);
|
||||
PUSH_DATA (push, mt->level[sf->base.level].tile_mode);
|
||||
PUSH_DATA (push, mt->layer_stride >> 2);
|
||||
BEGIN_NV04(push, NV50_3D(RT_HORIZ(0)), 2);
|
||||
if (nouveau_bo_memtype(bo))
|
||||
|
|
@ -415,7 +415,7 @@ nv50_clear_depth_stencil(struct pipe_context *pipe,
|
|||
PUSH_DATAh(push, mt->base.address + sf->offset);
|
||||
PUSH_DATA (push, mt->base.address + sf->offset);
|
||||
PUSH_DATA (push, nv50_format_table[dst->format].rt);
|
||||
PUSH_DATA (push, mt->level[sf->base.u.tex.level].tile_mode);
|
||||
PUSH_DATA (push, mt->level[sf->base.level].tile_mode);
|
||||
PUSH_DATA (push, mt->layer_stride >> 2);
|
||||
BEGIN_NV04(push, NV50_3D(ZETA_ENABLE), 1);
|
||||
PUSH_DATA (push, 1);
|
||||
|
|
@ -1101,12 +1101,12 @@ nv50_blit_set_dst(struct nv50_blitctx *ctx,
|
|||
else
|
||||
templ.format = format;
|
||||
|
||||
templ.u.tex.level = level;
|
||||
templ.u.tex.first_layer = templ.u.tex.last_layer = layer;
|
||||
templ.level = level;
|
||||
templ.first_layer = templ.last_layer = layer;
|
||||
|
||||
if (layer == -1) {
|
||||
templ.u.tex.first_layer = 0;
|
||||
templ.u.tex.last_layer =
|
||||
templ.first_layer = 0;
|
||||
templ.last_layer =
|
||||
(res->target == PIPE_TEXTURE_3D ? res->depth0 : res->array_size) - 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -477,7 +477,7 @@ nv84_create_decoder(struct pipe_context *context,
|
|||
surf.height = (templ->max_references + 1) * dec->frame_mbs / 4;
|
||||
surf.depth = 1;
|
||||
surf.base.format = PIPE_FORMAT_B8G8R8A8_UNORM;
|
||||
surf.base.u.tex.level = 0;
|
||||
surf.base.level = 0;
|
||||
surf.base.texture = &mip.base.base;
|
||||
mip.level[0].tile_mode = 0;
|
||||
mip.level[0].pitch = surf.width * 4;
|
||||
|
|
@ -733,10 +733,10 @@ nv84_video_buffer_create(struct pipe_context *pipe,
|
|||
memset(&surf_templ, 0, sizeof(surf_templ));
|
||||
for (j = 0; j < 2; ++j) {
|
||||
u_surface_default_template(&surf_templ, buffer->resources[j]);
|
||||
surf_templ.u.tex.first_layer = surf_templ.u.tex.last_layer = 0;
|
||||
surf_templ.first_layer = surf_templ.last_layer = 0;
|
||||
buffer->surfaces[j * 2] = surf_templ;
|
||||
|
||||
surf_templ.u.tex.first_layer = surf_templ.u.tex.last_layer = 1;
|
||||
surf_templ.first_layer = surf_templ.last_layer = 1;
|
||||
buffer->surfaces[j * 2 + 1] = surf_templ;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,8 +131,6 @@ nvc0_surface_create(struct pipe_context *pipe,
|
|||
struct pipe_resource *pres,
|
||||
const struct pipe_surface *templ)
|
||||
{
|
||||
if (unlikely(pres->target == PIPE_BUFFER))
|
||||
return nv50_surface_from_buffer(pipe, pres, templ);
|
||||
return nvc0_miptree_surface_new(pipe, pres, templ);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -182,10 +182,10 @@ nvc0_validate_fb(struct nvc0_context *nvc0)
|
|||
PUSH_DATA(push, sf->height);
|
||||
PUSH_DATA(push, nvc0_format_table[sf->base.format].rt);
|
||||
PUSH_DATA(push, (mt->layout_3d << 16) |
|
||||
mt->level[sf->base.u.tex.level].tile_mode);
|
||||
PUSH_DATA(push, sf->base.u.tex.first_layer + sf->depth);
|
||||
mt->level[sf->base.level].tile_mode);
|
||||
PUSH_DATA(push, sf->base.first_layer + sf->depth);
|
||||
PUSH_DATA(push, mt->layer_stride >> 2);
|
||||
PUSH_DATA(push, sf->base.u.tex.first_layer);
|
||||
PUSH_DATA(push, sf->base.first_layer);
|
||||
|
||||
ms_mode = mt->ms_mode;
|
||||
} else {
|
||||
|
|
@ -225,7 +225,7 @@ nvc0_validate_fb(struct nvc0_context *nvc0)
|
|||
PUSH_DATAh(push, mt->base.address + sf->offset);
|
||||
PUSH_DATA (push, mt->base.address + sf->offset);
|
||||
PUSH_DATA (push, nvc0_format_table[fb->zsbuf.format].rt);
|
||||
PUSH_DATA (push, mt->level[sf->base.u.tex.level].tile_mode);
|
||||
PUSH_DATA (push, mt->level[sf->base.level].tile_mode);
|
||||
PUSH_DATA (push, mt->layer_stride >> 2);
|
||||
BEGIN_NVC0(push, NVC0_3D(ZETA_ENABLE), 1);
|
||||
PUSH_DATA (push, 1);
|
||||
|
|
@ -233,9 +233,9 @@ nvc0_validate_fb(struct nvc0_context *nvc0)
|
|||
PUSH_DATA (push, sf->width);
|
||||
PUSH_DATA (push, sf->height);
|
||||
PUSH_DATA (push, (unk << 16) |
|
||||
(sf->base.u.tex.first_layer + sf->depth));
|
||||
(sf->base.first_layer + sf->depth));
|
||||
BEGIN_NVC0(push, NVC0_3D(ZETA_BASE_LAYER), 1);
|
||||
PUSH_DATA (push, sf->base.u.tex.first_layer);
|
||||
PUSH_DATA (push, sf->base.first_layer);
|
||||
|
||||
ms_mode = mt->ms_mode;
|
||||
|
||||
|
|
@ -745,9 +745,9 @@ nvc0_validate_fbread(struct nvc0_context *nvc0)
|
|||
|
||||
tmpl.target = PIPE_TEXTURE_2D_ARRAY;
|
||||
tmpl.format = sf->format;
|
||||
tmpl.u.tex.first_level = tmpl.u.tex.last_level = sf->u.tex.level;
|
||||
tmpl.u.tex.first_layer = sf->u.tex.first_layer;
|
||||
tmpl.u.tex.last_layer = sf->u.tex.last_layer;
|
||||
tmpl.u.tex.first_level = tmpl.u.tex.last_level = sf->level;
|
||||
tmpl.u.tex.first_layer = sf->first_layer;
|
||||
tmpl.u.tex.last_layer = sf->last_layer;
|
||||
tmpl.swizzle_r = PIPE_SWIZZLE_X;
|
||||
tmpl.swizzle_g = PIPE_SWIZZLE_Y;
|
||||
tmpl.swizzle_b = PIPE_SWIZZLE_Z;
|
||||
|
|
@ -756,9 +756,9 @@ nvc0_validate_fbread(struct nvc0_context *nvc0)
|
|||
/* Bail if it's the same parameters */
|
||||
if (old_view && old_view->texture == sf->texture &&
|
||||
old_view->format == sf->format &&
|
||||
old_view->u.tex.first_level == sf->u.tex.level &&
|
||||
old_view->u.tex.first_layer == sf->u.tex.first_layer &&
|
||||
old_view->u.tex.last_layer == sf->u.tex.last_layer)
|
||||
old_view->u.tex.first_level == sf->level &&
|
||||
old_view->u.tex.first_layer == sf->first_layer &&
|
||||
old_view->u.tex.last_layer == sf->last_layer)
|
||||
return;
|
||||
|
||||
new_view = pipe->create_sampler_view(pipe, sf->texture, &tmpl);
|
||||
|
|
|
|||
|
|
@ -328,10 +328,10 @@ nvc0_clear_render_target(struct pipe_context *pipe,
|
|||
PUSH_DATA(push, sf->height);
|
||||
PUSH_DATA(push, nvc0_format_table[dst->format].rt);
|
||||
PUSH_DATA(push, (mt->layout_3d << 16) |
|
||||
mt->level[sf->base.u.tex.level].tile_mode);
|
||||
PUSH_DATA(push, dst->u.tex.first_layer + sf->depth);
|
||||
mt->level[sf->base.level].tile_mode);
|
||||
PUSH_DATA(push, dst->first_layer + sf->depth);
|
||||
PUSH_DATA(push, mt->layer_stride >> 2);
|
||||
PUSH_DATA(push, dst->u.tex.first_layer);
|
||||
PUSH_DATA(push, dst->first_layer);
|
||||
IMMED_NVC0(push, NVC0_3D(MULTISAMPLE_MODE), mt->ms_mode);
|
||||
} else {
|
||||
if (res->base.target == PIPE_BUFFER) {
|
||||
|
|
@ -664,16 +664,16 @@ nvc0_clear_depth_stencil(struct pipe_context *pipe,
|
|||
PUSH_DATAh(push, mt->base.address + sf->offset);
|
||||
PUSH_DATA (push, mt->base.address + sf->offset);
|
||||
PUSH_DATA (push, nvc0_format_table[dst->format].rt);
|
||||
PUSH_DATA (push, mt->level[sf->base.u.tex.level].tile_mode);
|
||||
PUSH_DATA (push, mt->level[sf->base.level].tile_mode);
|
||||
PUSH_DATA (push, mt->layer_stride >> 2);
|
||||
BEGIN_NVC0(push, NVC0_3D(ZETA_ENABLE), 1);
|
||||
PUSH_DATA (push, 1);
|
||||
BEGIN_NVC0(push, NVC0_3D(ZETA_HORIZ), 3);
|
||||
PUSH_DATA (push, sf->width);
|
||||
PUSH_DATA (push, sf->height);
|
||||
PUSH_DATA (push, (unk << 16) | (dst->u.tex.first_layer + sf->depth));
|
||||
PUSH_DATA (push, (unk << 16) | (dst->first_layer + sf->depth));
|
||||
BEGIN_NVC0(push, NVC0_3D(ZETA_BASE_LAYER), 1);
|
||||
PUSH_DATA (push, dst->u.tex.first_layer);
|
||||
PUSH_DATA (push, dst->first_layer);
|
||||
IMMED_NVC0(push, NVC0_3D(MULTISAMPLE_MODE), mt->ms_mode);
|
||||
|
||||
if (!render_condition_enabled)
|
||||
|
|
@ -749,11 +749,11 @@ nvc0_clear(struct pipe_context *pipe, unsigned buffers,
|
|||
if (mode) {
|
||||
int zs_layers = 0, color0_layers = 0;
|
||||
if (fb->cbufs[0].texture && (mode & 0x3c))
|
||||
color0_layers = fb->cbufs[0].u.tex.last_layer -
|
||||
fb->cbufs[0].u.tex.first_layer + 1;
|
||||
color0_layers = fb->cbufs[0].last_layer -
|
||||
fb->cbufs[0].first_layer + 1;
|
||||
if (fb->zsbuf.texture && (mode & ~0x3c))
|
||||
zs_layers = fb->zsbuf.u.tex.last_layer -
|
||||
fb->zsbuf.u.tex.first_layer + 1;
|
||||
zs_layers = fb->zsbuf.last_layer -
|
||||
fb->zsbuf.first_layer + 1;
|
||||
|
||||
for (j = 0; j < MIN2(zs_layers, color0_layers); j++) {
|
||||
BEGIN_NVC0(push, NVC0_3D(CLEAR_BUFFERS), 1);
|
||||
|
|
@ -773,7 +773,7 @@ nvc0_clear(struct pipe_context *pipe, unsigned buffers,
|
|||
const struct pipe_surface *sf = &fb->cbufs[i];
|
||||
if (!sf->texture || !(buffers & (PIPE_CLEAR_COLOR0 << i)))
|
||||
continue;
|
||||
for (j = 0; j <= sf->u.tex.last_layer - sf->u.tex.first_layer; j++) {
|
||||
for (j = 0; j <= sf->last_layer - sf->first_layer; j++) {
|
||||
BEGIN_NVC0(push, NVC0_3D(CLEAR_BUFFERS), 1);
|
||||
PUSH_DATA (push, (i << 6) | 0x3c |
|
||||
(j << NVC0_3D_CLEAR_BUFFERS_LAYER__SHIFT));
|
||||
|
|
@ -969,12 +969,12 @@ nvc0_blit_set_dst(struct nvc0_blitctx *ctx,
|
|||
else
|
||||
templ.format = format;
|
||||
|
||||
templ.u.tex.level = level;
|
||||
templ.u.tex.first_layer = templ.u.tex.last_layer = layer;
|
||||
templ.level = level;
|
||||
templ.first_layer = templ.last_layer = layer;
|
||||
|
||||
if (layer == -1) {
|
||||
templ.u.tex.first_layer = 0;
|
||||
templ.u.tex.last_layer =
|
||||
templ.first_layer = 0;
|
||||
templ.last_layer =
|
||||
(res->target == PIPE_TEXTURE_3D ? res->depth0 : res->array_size) - 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2819,11 +2819,11 @@ panfrost_initialize_surface(struct panfrost_batch *batch,
|
|||
{
|
||||
if (surf->texture) {
|
||||
struct panfrost_resource *rsrc = pan_resource(surf->texture);
|
||||
BITSET_SET(rsrc->valid.data, surf->u.tex.level);
|
||||
BITSET_SET(rsrc->valid.data, surf->level);
|
||||
if (rsrc->separate_stencil)
|
||||
BITSET_SET(rsrc->separate_stencil->valid.data, surf->u.tex.level);
|
||||
BITSET_SET(rsrc->separate_stencil->valid.data, surf->level);
|
||||
if (rsrc->shadow_image)
|
||||
BITSET_SET(rsrc->shadow_image->valid.data, surf->u.tex.level);
|
||||
BITSET_SET(rsrc->shadow_image->valid.data, surf->level);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -532,9 +532,9 @@ panfrost_batch_to_fb_info(const struct panfrost_batch *batch,
|
|||
|
||||
rts[i].format = surf->format;
|
||||
rts[i].dim = MALI_TEXTURE_DIMENSION_2D;
|
||||
rts[i].last_level = rts[i].first_level = surf->u.tex.level;
|
||||
rts[i].first_layer = surf->u.tex.first_layer;
|
||||
rts[i].last_layer = surf->u.tex.last_layer;
|
||||
rts[i].last_level = rts[i].first_level = surf->level;
|
||||
rts[i].first_layer = surf->first_layer;
|
||||
rts[i].last_layer = surf->last_layer;
|
||||
panfrost_set_image_view_planes(&rts[i], surf->texture);
|
||||
rts[i].nr_samples =
|
||||
surf->nr_samples ?: MAX2(surf->texture->nr_samples, 1);
|
||||
|
|
@ -561,9 +561,9 @@ panfrost_batch_to_fb_info(const struct panfrost_batch *batch,
|
|||
? PIPE_FORMAT_Z32_FLOAT
|
||||
: surf->format;
|
||||
zs->dim = MALI_TEXTURE_DIMENSION_2D;
|
||||
zs->last_level = zs->first_level = surf->u.tex.level;
|
||||
zs->first_layer = surf->u.tex.first_layer;
|
||||
zs->last_layer = surf->u.tex.last_layer;
|
||||
zs->last_level = zs->first_level = surf->level;
|
||||
zs->first_layer = surf->first_layer;
|
||||
zs->last_layer = surf->last_layer;
|
||||
zs->planes[0] = &z_rsrc->image;
|
||||
zs->nr_samples = surf->nr_samples ?: MAX2(surf->texture->nr_samples, 1);
|
||||
memcpy(zs->swizzle, id_swz, sizeof(zs->swizzle));
|
||||
|
|
@ -578,9 +578,9 @@ panfrost_batch_to_fb_info(const struct panfrost_batch *batch,
|
|||
s_rsrc = z_rsrc->separate_stencil;
|
||||
s->format = PIPE_FORMAT_S8_UINT;
|
||||
s->dim = MALI_TEXTURE_DIMENSION_2D;
|
||||
s->last_level = s->first_level = surf->u.tex.level;
|
||||
s->first_layer = surf->u.tex.first_layer;
|
||||
s->last_layer = surf->u.tex.last_layer;
|
||||
s->last_level = s->first_level = surf->level;
|
||||
s->first_layer = surf->first_layer;
|
||||
s->last_layer = surf->last_layer;
|
||||
s->planes[0] = &s_rsrc->image;
|
||||
s->nr_samples = surf->nr_samples ?: MAX2(surf->texture->nr_samples, 1);
|
||||
memcpy(s->swizzle, id_swz, sizeof(s->swizzle));
|
||||
|
|
@ -673,7 +673,7 @@ panfrost_batch_submit(struct panfrost_context *ctx,
|
|||
struct panfrost_resource *z_rsrc = pan_resource(surf->texture);
|
||||
|
||||
/* if there are multiple levels or layers, we optimize only the first */
|
||||
if (surf->u.tex.level == 0 && surf->u.tex.first_layer == 0) {
|
||||
if (surf->level == 0 && surf->first_layer == 0) {
|
||||
/* Shared depth/stencil resources are not supported, and would
|
||||
* break this optimisation. */
|
||||
assert(!(z_rsrc->base.bind & PAN_BIND_SHARED_MASK));
|
||||
|
|
|
|||
|
|
@ -279,17 +279,11 @@ panfrost_create_surface(struct pipe_context *pipe, struct pipe_resource *pt,
|
|||
ps->context = pipe;
|
||||
ps->format = surf_tmpl->format;
|
||||
|
||||
if (pt->target != PIPE_BUFFER) {
|
||||
assert(surf_tmpl->u.tex.level <= pt->last_level);
|
||||
ps->nr_samples = surf_tmpl->nr_samples;
|
||||
ps->u.tex.level = surf_tmpl->u.tex.level;
|
||||
ps->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
|
||||
ps->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
|
||||
} else {
|
||||
ps->u.buf.first_element = surf_tmpl->u.buf.first_element;
|
||||
ps->u.buf.last_element = surf_tmpl->u.buf.last_element;
|
||||
assert(ps->u.buf.first_element <= ps->u.buf.last_element);
|
||||
}
|
||||
assert(surf_tmpl->level <= pt->last_level);
|
||||
ps->nr_samples = surf_tmpl->nr_samples;
|
||||
ps->level = surf_tmpl->level;
|
||||
ps->first_layer = surf_tmpl->first_layer;
|
||||
ps->last_layer = surf_tmpl->last_layer;
|
||||
}
|
||||
|
||||
return ps;
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ static bool r300_fast_zclear_allowed(struct r300_context *r300,
|
|||
struct pipe_framebuffer_state *fb =
|
||||
(struct pipe_framebuffer_state*)r300->fb_state.state;
|
||||
|
||||
return r300_resource(fb->zsbuf.texture)->tex.zmask_dwords[fb->zsbuf.u.tex.level] != 0;
|
||||
return r300_resource(fb->zsbuf.texture)->tex.zmask_dwords[fb->zsbuf.level] != 0;
|
||||
}
|
||||
|
||||
static bool r300_hiz_clear_allowed(struct r300_context *r300)
|
||||
|
|
@ -143,7 +143,7 @@ static bool r300_hiz_clear_allowed(struct r300_context *r300)
|
|||
struct pipe_framebuffer_state *fb =
|
||||
(struct pipe_framebuffer_state*)r300->fb_state.state;
|
||||
|
||||
return r300_resource(fb->zsbuf.texture)->tex.hiz_dwords[fb->zsbuf.u.tex.level] != 0;
|
||||
return r300_resource(fb->zsbuf.texture)->tex.hiz_dwords[fb->zsbuf.level] != 0;
|
||||
}
|
||||
|
||||
static uint32_t r300_depth_clear_value(enum pipe_format format,
|
||||
|
|
@ -719,9 +719,9 @@ static void r300_simple_msaa_resolve(struct pipe_context *pipe,
|
|||
srcsurf = r300_surface(pipe->create_surface(pipe, src, &surf_tmpl));
|
||||
|
||||
surf_tmpl.format = format;
|
||||
surf_tmpl.u.tex.level = dst_level;
|
||||
surf_tmpl.u.tex.first_layer =
|
||||
surf_tmpl.u.tex.last_layer = dst_layer;
|
||||
surf_tmpl.level = dst_level;
|
||||
surf_tmpl.first_layer =
|
||||
surf_tmpl.last_layer = dst_layer;
|
||||
dstsurf = r300_surface(pipe->create_surface(pipe, dst, &surf_tmpl));
|
||||
|
||||
/* COLORPITCH should contain the tiling info of the resolve buffer.
|
||||
|
|
|
|||
|
|
@ -1226,7 +1226,7 @@ void r300_emit_hiz_clear(struct r300_context *r300, unsigned size, void *state)
|
|||
BEGIN_CS(size);
|
||||
OUT_CS_PKT3(R300_PACKET3_3D_CLEAR_HIZ, 2);
|
||||
OUT_CS(0);
|
||||
OUT_CS(tex->tex.hiz_dwords[fb->zsbuf.u.tex.level]);
|
||||
OUT_CS(tex->tex.hiz_dwords[fb->zsbuf.level]);
|
||||
OUT_CS(r300->hiz_clear_value);
|
||||
END_CS;
|
||||
|
||||
|
|
@ -1248,7 +1248,7 @@ void r300_emit_zmask_clear(struct r300_context *r300, unsigned size, void *state
|
|||
BEGIN_CS(size);
|
||||
OUT_CS_PKT3(R300_PACKET3_3D_CLEAR_ZMASK, 2);
|
||||
OUT_CS(0);
|
||||
OUT_CS(tex->tex.zmask_dwords[fb->zsbuf.u.tex.level]);
|
||||
OUT_CS(tex->tex.zmask_dwords[fb->zsbuf.level]);
|
||||
OUT_CS(0);
|
||||
END_CS;
|
||||
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ static void r300_update_hyperz(struct r300_context* r300)
|
|||
return;
|
||||
|
||||
/* Set the size of ZMASK tiles. */
|
||||
if (zstex->tex.zcomp8x8[fb->zsbuf.u.tex.level]) {
|
||||
if (zstex->tex.zcomp8x8[fb->zsbuf.level]) {
|
||||
z->gb_z_peq_config |= R300_GB_Z_PEQ_CONFIG_Z_PEQ_SIZE_8_8;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -831,7 +831,7 @@ static void r300_print_fb_surf_info(const struct pipe_surface *surf, unsigned in
|
|||
|
||||
binding, index, pipe_surface_width(surf),
|
||||
pipe_surface_height(surf),
|
||||
surf->u.tex.first_layer, surf->u.tex.last_layer, surf->u.tex.level,
|
||||
surf->first_layer, surf->last_layer, surf->level,
|
||||
util_format_short_name(surf->format),
|
||||
|
||||
rtex->tex.macrotile[0] ? "YES" : " NO",
|
||||
|
|
|
|||
|
|
@ -960,7 +960,7 @@ void r300_texture_setup_format_state(struct r300_screen *screen,
|
|||
static void r300_texture_setup_fb_state(struct r300_surface *surf)
|
||||
{
|
||||
struct r300_resource *tex = r300_resource(surf->base.texture);
|
||||
unsigned level = surf->base.u.tex.level;
|
||||
unsigned level = surf->base.level;
|
||||
unsigned stride =
|
||||
r300_stride_to_width(surf->base.format, tex->tex.stride_in_bytes[level]);
|
||||
|
||||
|
|
@ -1169,9 +1169,9 @@ struct pipe_surface* r300_create_surface_custom(struct pipe_context * ctx,
|
|||
{
|
||||
struct r300_resource* tex = r300_resource(texture);
|
||||
struct r300_surface* surface = CALLOC_STRUCT(r300_surface);
|
||||
unsigned level = surf_tmpl->u.tex.level;
|
||||
unsigned level = surf_tmpl->level;
|
||||
|
||||
assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
|
||||
assert(surf_tmpl->first_layer == surf_tmpl->last_layer);
|
||||
|
||||
if (surface) {
|
||||
uint32_t offset, tile_height;
|
||||
|
|
@ -1180,9 +1180,9 @@ struct pipe_surface* r300_create_surface_custom(struct pipe_context * ctx,
|
|||
pipe_resource_reference(&surface->base.texture, texture);
|
||||
surface->base.context = ctx;
|
||||
surface->base.format = surf_tmpl->format;
|
||||
surface->base.u.tex.level = level;
|
||||
surface->base.u.tex.first_layer = surf_tmpl->u.tex.first_layer;
|
||||
surface->base.u.tex.last_layer = surf_tmpl->u.tex.last_layer;
|
||||
surface->base.level = level;
|
||||
surface->base.first_layer = surf_tmpl->first_layer;
|
||||
surface->base.last_layer = surf_tmpl->last_layer;
|
||||
|
||||
surface->buf = tex->buf;
|
||||
|
||||
|
|
@ -1192,7 +1192,7 @@ struct pipe_surface* r300_create_surface_custom(struct pipe_context * ctx,
|
|||
surface->domain &= ~RADEON_DOMAIN_GTT;
|
||||
|
||||
surface->offset = r300_texture_get_offset(tex, level,
|
||||
surf_tmpl->u.tex.first_layer);
|
||||
surf_tmpl->first_layer);
|
||||
r300_texture_setup_fb_state(surface);
|
||||
|
||||
/* Parameters for the CBZB clear. */
|
||||
|
|
|
|||
|
|
@ -94,9 +94,9 @@ static void evergreen_set_rat(struct r600_pipe_compute *pipe,
|
|||
memset(&rat_templ, 0, sizeof(rat_templ));
|
||||
rat_templ.format = PIPE_FORMAT_R32_UINT;
|
||||
rat_templ.texture = &bo->b.b;
|
||||
rat_templ.u.tex.level = 0;
|
||||
rat_templ.u.tex.first_layer = 0;
|
||||
rat_templ.u.tex.last_layer = 0;
|
||||
rat_templ.level = 0;
|
||||
rat_templ.first_layer = 0;
|
||||
rat_templ.last_layer = 0;
|
||||
|
||||
/* Add the RAT the list of color buffers. Drop the old buffer first. */
|
||||
pipe->ctx->framebuffer.state.cbufs[id] = rat_templ;
|
||||
|
|
|
|||
|
|
@ -1326,12 +1326,12 @@ void evergreen_init_color_surface(struct r600_context *rctx,
|
|||
struct r600_surface *surf)
|
||||
{
|
||||
struct r600_texture *rtex = (struct r600_texture*)surf->base.texture;
|
||||
unsigned level = surf->base.u.tex.level;
|
||||
unsigned level = surf->base.level;
|
||||
struct r600_tex_color_info color;
|
||||
|
||||
evergreen_set_color_surface_common(rctx, rtex, level,
|
||||
surf->base.u.tex.first_layer,
|
||||
surf->base.u.tex.last_layer,
|
||||
surf->base.first_layer,
|
||||
surf->base.last_layer,
|
||||
surf->base.format,
|
||||
&color);
|
||||
|
||||
|
|
@ -1358,7 +1358,7 @@ static void evergreen_init_depth_surface(struct r600_context *rctx,
|
|||
{
|
||||
struct r600_screen *rscreen = rctx->screen;
|
||||
struct r600_texture *rtex = (struct r600_texture*)surf->base.texture;
|
||||
unsigned level = surf->base.u.tex.level;
|
||||
unsigned level = surf->base.level;
|
||||
struct legacy_surf_level *levelinfo = &rtex->surface.u.legacy.level[level];
|
||||
uint64_t offset;
|
||||
unsigned format, array_mode;
|
||||
|
|
@ -1406,8 +1406,8 @@ static void evergreen_init_depth_surface(struct r600_context *rctx,
|
|||
assert(levelinfo->nblk_x % 8 == 0 && levelinfo->nblk_y % 8 == 0);
|
||||
|
||||
surf->db_depth_base = offset;
|
||||
surf->db_depth_view = S_028008_SLICE_START(surf->base.u.tex.first_layer) |
|
||||
S_028008_SLICE_MAX(surf->base.u.tex.last_layer);
|
||||
surf->db_depth_view = S_028008_SLICE_START(surf->base.first_layer) |
|
||||
S_028008_SLICE_MAX(surf->base.last_layer);
|
||||
surf->db_depth_size = S_028058_PITCH_TILE_MAX(levelinfo->nblk_x / 8 - 1) |
|
||||
S_028058_HEIGHT_TILE_MAX(levelinfo->nblk_y / 8 - 1);
|
||||
surf->db_depth_slice = S_02805C_SLICE_TILE_MAX(levelinfo->nblk_x *
|
||||
|
|
|
|||
|
|
@ -167,9 +167,9 @@ static void r600_blit_decompress_depth(struct pipe_context *ctx,
|
|||
}
|
||||
|
||||
surf_tmpl.format = texture->resource.b.b.format;
|
||||
surf_tmpl.u.tex.level = level;
|
||||
surf_tmpl.u.tex.first_layer = layer;
|
||||
surf_tmpl.u.tex.last_layer = layer;
|
||||
surf_tmpl.level = level;
|
||||
surf_tmpl.first_layer = layer;
|
||||
surf_tmpl.last_layer = layer;
|
||||
|
||||
zsurf = ctx->create_surface(ctx, &texture->resource.b.b, &surf_tmpl);
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ static void r600_blit_decompress_depth_in_place(struct r600_context *rctx,
|
|||
if (!(*dirty_level_mask & (1 << level)))
|
||||
continue;
|
||||
|
||||
surf_tmpl.u.tex.level = level;
|
||||
surf_tmpl.level = level;
|
||||
|
||||
/* The smaller the mipmap level, the less layers there are
|
||||
* as far as 3D textures are concerned. */
|
||||
|
|
@ -235,8 +235,8 @@ static void r600_blit_decompress_depth_in_place(struct r600_context *rctx,
|
|||
checked_last_layer = last_layer < max_layer ? last_layer : max_layer;
|
||||
|
||||
for (layer = first_layer; layer <= checked_last_layer; layer++) {
|
||||
surf_tmpl.u.tex.first_layer = layer;
|
||||
surf_tmpl.u.tex.last_layer = layer;
|
||||
surf_tmpl.first_layer = layer;
|
||||
surf_tmpl.last_layer = layer;
|
||||
|
||||
zsurf = rctx->b.b.create_surface(&rctx->b.b, &texture->resource.b.b, &surf_tmpl);
|
||||
|
||||
|
|
@ -353,9 +353,9 @@ static void r600_blit_decompress_color(struct pipe_context *ctx,
|
|||
struct pipe_surface *cbsurf, surf_tmpl;
|
||||
|
||||
surf_tmpl.format = rtex->resource.b.b.format;
|
||||
surf_tmpl.u.tex.level = level;
|
||||
surf_tmpl.u.tex.first_layer = layer;
|
||||
surf_tmpl.u.tex.last_layer = layer;
|
||||
surf_tmpl.level = level;
|
||||
surf_tmpl.first_layer = layer;
|
||||
surf_tmpl.last_layer = layer;
|
||||
cbsurf = ctx->create_surface(ctx, &rtex->resource.b.b, &surf_tmpl);
|
||||
|
||||
r600_blitter_begin(ctx, R600_DECOMPRESS);
|
||||
|
|
@ -518,8 +518,8 @@ evergreen_do_fast_color_clear(struct r600_context *rctx,
|
|||
tex = (struct r600_texture *)rctx->framebuffer.fb_cbufs[i]->texture;
|
||||
|
||||
/* the clear is allowed if all layers are bound */
|
||||
if (fb->cbufs[i].u.tex.first_layer != 0 ||
|
||||
fb->cbufs[i].u.tex.last_layer != util_max_layer(&tex->resource.b.b, 0)) {
|
||||
if (fb->cbufs[i].first_layer != 0 ||
|
||||
fb->cbufs[i].last_layer != util_max_layer(&tex->resource.b.b, 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -570,7 +570,7 @@ evergreen_do_fast_color_clear(struct r600_context *rctx,
|
|||
|
||||
bool need_compressed_update = !tex->dirty_level_mask;
|
||||
|
||||
tex->dirty_level_mask |= 1 << fb->cbufs[i].u.tex.level;
|
||||
tex->dirty_level_mask |= 1 << fb->cbufs[i].level;
|
||||
|
||||
if (need_compressed_update)
|
||||
p_atomic_inc(&rctx->b.screen->compressed_colortex_counter);
|
||||
|
|
@ -616,14 +616,14 @@ static void r600_clear(struct pipe_context *ctx, unsigned buffers,
|
|||
|
||||
tex = (struct r600_texture *)fb->cbufs[i].texture;
|
||||
if (tex->fmask.size == 0)
|
||||
tex->dirty_level_mask &= ~(1 << fb->cbufs[i].u.tex.level);
|
||||
tex->dirty_level_mask &= ~(1 << fb->cbufs[i].level);
|
||||
}
|
||||
}
|
||||
|
||||
/* if hyperz enabled just clear hyperz */
|
||||
if (fb->zsbuf.texture && (buffers & PIPE_CLEAR_DEPTH)) {
|
||||
struct r600_texture *rtex;
|
||||
unsigned level = fb->zsbuf.u.tex.level;
|
||||
unsigned level = fb->zsbuf.level;
|
||||
|
||||
rtex = (struct r600_texture*)fb->zsbuf.texture;
|
||||
|
||||
|
|
@ -632,8 +632,8 @@ static void r600_clear(struct pipe_context *ctx, unsigned buffers,
|
|||
* disable fast clear for texture array.
|
||||
*/
|
||||
if (r600_htile_enabled(rtex, level) &&
|
||||
fb->zsbuf.u.tex.first_layer == 0 &&
|
||||
fb->zsbuf.u.tex.last_layer == util_max_layer(&rtex->resource.b.b, level)) {
|
||||
fb->zsbuf.first_layer == 0 &&
|
||||
fb->zsbuf.last_layer == util_max_layer(&rtex->resource.b.b, level)) {
|
||||
if (rtex->depth_clear_value != depth) {
|
||||
rtex->depth_clear_value = depth;
|
||||
r600_mark_atom_dirty(rctx, &rctx->db_state.atom);
|
||||
|
|
|
|||
|
|
@ -803,7 +803,7 @@ static void r600_init_color_surface(struct r600_context *rctx,
|
|||
{
|
||||
struct r600_screen *rscreen = rctx->screen;
|
||||
struct r600_texture *rtex = (struct r600_texture*)surf->base.texture;
|
||||
unsigned level = surf->base.u.tex.level;
|
||||
unsigned level = surf->base.level;
|
||||
unsigned pitch, slice;
|
||||
unsigned color_info;
|
||||
unsigned color_view;
|
||||
|
|
@ -820,8 +820,8 @@ static void r600_init_color_surface(struct r600_context *rctx,
|
|||
}
|
||||
|
||||
offset = (uint64_t)rtex->surface.u.legacy.level[level].offset_256B * 256;
|
||||
color_view = S_028080_SLICE_START(surf->base.u.tex.first_layer) |
|
||||
S_028080_SLICE_MAX(surf->base.u.tex.last_layer);
|
||||
color_view = S_028080_SLICE_START(surf->base.first_layer) |
|
||||
S_028080_SLICE_MAX(surf->base.last_layer);
|
||||
|
||||
pitch = rtex->surface.u.legacy.level[level].nblk_x / 8 - 1;
|
||||
slice = (rtex->surface.u.legacy.level[level].nblk_x * rtex->surface.u.legacy.level[level].nblk_y) / 64;
|
||||
|
|
@ -1031,7 +1031,7 @@ static void r600_init_depth_surface(struct r600_context *rctx,
|
|||
struct r600_texture *rtex = (struct r600_texture*)surf->base.texture;
|
||||
unsigned level, pitch, slice, format, offset, array_mode;
|
||||
|
||||
level = surf->base.u.tex.level;
|
||||
level = surf->base.level;
|
||||
offset = (uint64_t)rtex->surface.u.legacy.level[level].offset_256B * 256;
|
||||
pitch = rtex->surface.u.legacy.level[level].nblk_x / 8 - 1;
|
||||
slice = (rtex->surface.u.legacy.level[level].nblk_x * rtex->surface.u.legacy.level[level].nblk_y) / 64;
|
||||
|
|
@ -1054,8 +1054,8 @@ static void r600_init_depth_surface(struct r600_context *rctx,
|
|||
|
||||
surf->db_depth_info = S_028010_ARRAY_MODE(array_mode) | S_028010_FORMAT(format);
|
||||
surf->db_depth_base = offset >> 8;
|
||||
surf->db_depth_view = S_028004_SLICE_START(surf->base.u.tex.first_layer) |
|
||||
S_028004_SLICE_MAX(surf->base.u.tex.last_layer);
|
||||
surf->db_depth_view = S_028004_SLICE_START(surf->base.first_layer) |
|
||||
S_028004_SLICE_MAX(surf->base.last_layer);
|
||||
surf->db_depth_size = S_028000_PITCH_TILE_MAX(pitch) | S_028000_SLICE_TILE_MAX(slice);
|
||||
surf->db_prefetch_limit = (rtex->surface.u.legacy.level[level].nblk_y / 8) - 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -2550,10 +2550,10 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info
|
|||
struct pipe_surface *surf = &rctx->framebuffer.state.zsbuf;
|
||||
struct r600_texture *rtex = (struct r600_texture *)surf->texture;
|
||||
|
||||
rtex->dirty_level_mask |= 1 << surf->u.tex.level;
|
||||
rtex->dirty_level_mask |= 1 << surf->level;
|
||||
|
||||
if (rtex->surface.has_stencil)
|
||||
rtex->stencil_dirty_level_mask |= 1 << surf->u.tex.level;
|
||||
rtex->stencil_dirty_level_mask |= 1 << surf->level;
|
||||
}
|
||||
if (rctx->framebuffer.compressed_cb_mask) {
|
||||
struct pipe_surface *surf;
|
||||
|
|
@ -2565,7 +2565,7 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info
|
|||
surf = rctx->framebuffer.fb_cbufs[i];
|
||||
rtex = (struct r600_texture*)surf->texture;
|
||||
|
||||
rtex->dirty_level_mask |= 1 << surf->u.tex.level;
|
||||
rtex->dirty_level_mask |= 1 << surf->level;
|
||||
|
||||
} while (mask);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1497,14 +1497,16 @@ struct pipe_surface *r600_create_surface_custom(struct pipe_context *pipe,
|
|||
if (!surface)
|
||||
return NULL;
|
||||
|
||||
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->first_layer <= util_max_layer(texture, templ->level));
|
||||
assert(templ->last_layer <= util_max_layer(texture, templ->level));
|
||||
|
||||
pipe_reference_init(&surface->base.reference, 1);
|
||||
pipe_resource_reference(&surface->base.texture, texture);
|
||||
surface->base.context = pipe;
|
||||
surface->base.format = templ->format;
|
||||
surface->base.u = templ->u;
|
||||
surface->base.level = templ->level;
|
||||
surface->base.first_layer = templ->first_layer;
|
||||
surface->base.last_layer = templ->last_layer;
|
||||
|
||||
surface->width0 = width0;
|
||||
surface->height0 = height0;
|
||||
|
|
|
|||
|
|
@ -747,10 +747,10 @@ void si_fb_barrier_after_rendering(struct si_context *sctx, unsigned flags)
|
|||
struct pipe_surface *surf = &sctx->framebuffer.state.zsbuf;
|
||||
struct si_texture *tex = (struct si_texture *)surf->texture;
|
||||
|
||||
tex->dirty_level_mask |= 1 << surf->u.tex.level;
|
||||
tex->dirty_level_mask |= 1 << surf->level;
|
||||
|
||||
if (tex->surface.has_stencil)
|
||||
tex->stencil_dirty_level_mask |= 1 << surf->u.tex.level;
|
||||
tex->stencil_dirty_level_mask |= 1 << surf->level;
|
||||
|
||||
si_set_sampler_depth_decompress_mask(sctx, tex);
|
||||
}
|
||||
|
|
@ -762,7 +762,7 @@ void si_fb_barrier_after_rendering(struct si_context *sctx, unsigned flags)
|
|||
struct si_texture *tex = (struct si_texture *)surf->texture;
|
||||
|
||||
if (tex->surface.fmask_offset) {
|
||||
tex->dirty_level_mask |= 1 << surf->u.tex.level;
|
||||
tex->dirty_level_mask |= 1 << surf->level;
|
||||
tex->fmask_is_identity = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,14 +141,14 @@ static unsigned si_blit_dbcb_copy(struct si_context *sctx, struct si_texture *sr
|
|||
max_layer = util_max_layer(&src->buffer.b.b, level);
|
||||
checked_last_layer = MIN2(last_layer, max_layer);
|
||||
|
||||
surf_tmpl.u.tex.level = level;
|
||||
surf_tmpl.level = level;
|
||||
|
||||
for (layer = first_layer; layer <= checked_last_layer; layer++) {
|
||||
struct pipe_surface *zsurf, *cbsurf;
|
||||
|
||||
surf_tmpl.format = src->buffer.b.b.format;
|
||||
surf_tmpl.u.tex.first_layer = layer;
|
||||
surf_tmpl.u.tex.last_layer = layer;
|
||||
surf_tmpl.first_layer = layer;
|
||||
surf_tmpl.last_layer = layer;
|
||||
|
||||
zsurf = sctx->b.create_surface(&sctx->b, &src->buffer.b.b, &surf_tmpl);
|
||||
|
||||
|
|
@ -213,7 +213,7 @@ static void si_blit_decompress_zs_planes_in_place(struct si_context *sctx,
|
|||
while (level_mask) {
|
||||
unsigned level = u_bit_scan(&level_mask);
|
||||
|
||||
surf_tmpl.u.tex.level = level;
|
||||
surf_tmpl.level = level;
|
||||
|
||||
/* The smaller the mipmap level, the less layers there are
|
||||
* as far as 3D textures are concerned. */
|
||||
|
|
@ -221,8 +221,8 @@ static void si_blit_decompress_zs_planes_in_place(struct si_context *sctx,
|
|||
checked_last_layer = MIN2(last_layer, max_layer);
|
||||
|
||||
for (layer = first_layer; layer <= checked_last_layer; layer++) {
|
||||
surf_tmpl.u.tex.first_layer = layer;
|
||||
surf_tmpl.u.tex.last_layer = layer;
|
||||
surf_tmpl.first_layer = layer;
|
||||
surf_tmpl.last_layer = layer;
|
||||
|
||||
zsurf = sctx->b.create_surface(&sctx->b, &texture->buffer.b.b, &surf_tmpl);
|
||||
|
||||
|
|
@ -500,9 +500,9 @@ static void si_blit_decompress_color(struct si_context *sctx, struct si_texture
|
|||
struct pipe_surface *cbsurf, surf_tmpl;
|
||||
|
||||
surf_tmpl.format = tex->buffer.b.b.format;
|
||||
surf_tmpl.u.tex.level = level;
|
||||
surf_tmpl.u.tex.first_layer = layer;
|
||||
surf_tmpl.u.tex.last_layer = layer;
|
||||
surf_tmpl.level = level;
|
||||
surf_tmpl.first_layer = layer;
|
||||
surf_tmpl.last_layer = layer;
|
||||
cbsurf = sctx->b.create_surface(&sctx->b, &tex->buffer.b.b, &surf_tmpl);
|
||||
|
||||
/* Required before and after FMASK and DCC_DECOMPRESS. */
|
||||
|
|
@ -646,9 +646,9 @@ static void si_check_render_feedback_texture(struct si_context *sctx, struct si_
|
|||
if (!sctx->framebuffer.state.cbufs[j].texture)
|
||||
continue;
|
||||
|
||||
if (tex == (struct si_texture *)surf->texture && surf->u.tex.level >= first_level &&
|
||||
surf->u.tex.level <= last_level && surf->u.tex.first_layer <= last_layer &&
|
||||
surf->u.tex.last_layer >= first_layer) {
|
||||
if (tex == (struct si_texture *)surf->texture && surf->level >= first_level &&
|
||||
surf->level <= last_level && surf->first_layer <= last_layer &&
|
||||
surf->last_layer >= first_layer) {
|
||||
render_feedback = true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -868,7 +868,7 @@ void gfx6_decompress_textures(struct si_context *sctx, unsigned shader_mask)
|
|||
if (sctx->ps_uses_fbfetch) {
|
||||
struct pipe_surface *cb0 = &sctx->framebuffer.state.cbufs[0];
|
||||
si_decompress_color_texture(sctx, (struct si_texture *)cb0->texture,
|
||||
cb0->u.tex.first_layer, cb0->u.tex.last_layer, false);
|
||||
cb0->first_layer, cb0->last_layer, false);
|
||||
}
|
||||
|
||||
si_check_render_feedback(sctx);
|
||||
|
|
@ -930,7 +930,7 @@ void si_decompress_subresource(struct pipe_context *ctx, struct pipe_resource *t
|
|||
* source, make sure the decompression pass is invoked
|
||||
* by dirtying the framebuffer.
|
||||
*/
|
||||
if (sctx->framebuffer.state.zsbuf.u.tex.level == level &&
|
||||
if (sctx->framebuffer.state.zsbuf.level == level &&
|
||||
sctx->framebuffer.state.zsbuf.texture == tex)
|
||||
si_fb_barrier_after_rendering(sctx, SI_FB_BARRIER_SYNC_DB);
|
||||
|
||||
|
|
@ -942,7 +942,7 @@ void si_decompress_subresource(struct pipe_context *ctx, struct pipe_resource *t
|
|||
* by dirtying the framebuffer.
|
||||
*/
|
||||
for (unsigned i = 0; i < sctx->framebuffer.state.nr_cbufs; i++) {
|
||||
if (sctx->framebuffer.state.cbufs[i].u.tex.level == level &&
|
||||
if (sctx->framebuffer.state.cbufs[i].level == level &&
|
||||
sctx->framebuffer.state.cbufs[i].texture == tex) {
|
||||
si_fb_barrier_after_rendering(sctx, SI_FB_BARRIER_SYNC_CB);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -661,12 +661,12 @@ static void si_fast_clear(struct si_context *sctx, unsigned *buffers,
|
|||
unsigned i = u_bit_scan(&color_buffer_mask);
|
||||
|
||||
struct si_texture *tex = (struct si_texture *)fb->cbufs[i].texture;
|
||||
unsigned level = fb->cbufs[i].u.tex.level;
|
||||
unsigned level = fb->cbufs[i].level;
|
||||
unsigned num_layers = util_num_layers(&tex->buffer.b.b, level);
|
||||
|
||||
/* the clear is allowed if all layers are bound */
|
||||
if (fb->cbufs[i].u.tex.first_layer != 0 ||
|
||||
fb->cbufs[i].u.tex.last_layer != num_layers - 1) {
|
||||
if (fb->cbufs[i].first_layer != 0 ||
|
||||
fb->cbufs[i].last_layer != num_layers - 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -893,12 +893,12 @@ static void si_fast_clear(struct si_context *sctx, unsigned *buffers,
|
|||
|
||||
/* Depth/stencil clears. */
|
||||
struct si_texture *zstex = (struct si_texture *)fb->zsbuf.texture;
|
||||
unsigned zs_num_layers = zstex ? util_num_layers(&zstex->buffer.b.b, fb->zsbuf.u.tex.level) : 0;
|
||||
unsigned zs_num_layers = zstex ? util_num_layers(&zstex->buffer.b.b, fb->zsbuf.level) : 0;
|
||||
|
||||
if (zstex && fb->zsbuf.u.tex.first_layer == 0 &&
|
||||
fb->zsbuf.u.tex.last_layer == zs_num_layers - 1 &&
|
||||
si_htile_enabled(zstex, fb->zsbuf.u.tex.level, PIPE_MASK_ZS)) {
|
||||
unsigned level = fb->zsbuf.u.tex.level;
|
||||
if (zstex && fb->zsbuf.first_layer == 0 &&
|
||||
fb->zsbuf.last_layer == zs_num_layers - 1 &&
|
||||
si_htile_enabled(zstex, fb->zsbuf.level, PIPE_MASK_ZS)) {
|
||||
unsigned level = fb->zsbuf.level;
|
||||
bool update_db_depth_clear = false;
|
||||
bool update_db_stencil_clear = false;
|
||||
bool fb_too_small = num_pixels * zs_num_layers <= 512 * 512;
|
||||
|
|
@ -1067,13 +1067,13 @@ static void si_fb_clear_via_compute(struct si_context *sctx, unsigned *buffers,
|
|||
unsigned i = u_bit_scan(&color_buffer_mask);
|
||||
|
||||
struct pipe_surface *surf = &fb->cbufs[i];
|
||||
unsigned depth = surf->u.tex.last_layer - surf->u.tex.first_layer + 1;
|
||||
unsigned depth = surf->last_layer - surf->first_layer + 1;
|
||||
struct si_texture *tex = (struct si_texture *)surf->texture;
|
||||
|
||||
/* If DCC is enable (which can happen with thick tiling on gfx8, don't use compute to get
|
||||
* compressed clears.
|
||||
*/
|
||||
if (vi_dcc_enabled(tex, surf->u.tex.level))
|
||||
if (vi_dcc_enabled(tex, surf->level))
|
||||
continue;
|
||||
|
||||
uint16_t width, height;
|
||||
|
|
@ -1083,9 +1083,9 @@ static void si_fb_clear_via_compute(struct si_context *sctx, unsigned *buffers,
|
|||
(tex->surface.is_linear && (height > 1 || depth > 1 || width >= 8192))) {
|
||||
struct pipe_box box;
|
||||
|
||||
u_box_3d(0, 0, surf->u.tex.first_layer, width, height, depth, &box);
|
||||
u_box_3d(0, 0, surf->first_layer, width, height, depth, &box);
|
||||
|
||||
if (si_compute_clear_image(sctx, &tex->buffer.b.b, surf->format, surf->u.tex.level, &box,
|
||||
if (si_compute_clear_image(sctx, &tex->buffer.b.b, surf->format, surf->level, &box,
|
||||
color, sctx->render_cond_enabled, true))
|
||||
*buffers &= ~(PIPE_CLEAR_COLOR0 << i); /* success */
|
||||
}
|
||||
|
|
@ -1125,13 +1125,13 @@ static void gfx6_clear(struct pipe_context *ctx, unsigned buffers,
|
|||
unsigned i = u_bit_scan(&color_buffer_mask);
|
||||
struct si_texture *tex = (struct si_texture *)fb->cbufs[i].texture;
|
||||
if (tex->surface.fmask_size == 0)
|
||||
tex->dirty_level_mask &= ~(1 << fb->cbufs[i].u.tex.level);
|
||||
tex->dirty_level_mask &= ~(1 << fb->cbufs[i].level);
|
||||
}
|
||||
}
|
||||
|
||||
if (zstex && fb->zsbuf.u.tex.first_layer == 0 &&
|
||||
fb->zsbuf.u.tex.last_layer == util_max_layer(&zstex->buffer.b.b, 0)) {
|
||||
unsigned level = fb->zsbuf.u.tex.level;
|
||||
if (zstex && fb->zsbuf.first_layer == 0 &&
|
||||
fb->zsbuf.last_layer == util_max_layer(&zstex->buffer.b.b, 0)) {
|
||||
unsigned level = fb->zsbuf.level;
|
||||
|
||||
if (si_can_fast_clear_depth(zstex, level, depth, buffers)) {
|
||||
/* Need to disable EXPCLEAR temporarily if clearing
|
||||
|
|
@ -1201,15 +1201,15 @@ static void gfx6_clear(struct pipe_context *ctx, unsigned buffers,
|
|||
if (sctx->db_depth_clear) {
|
||||
sctx->db_depth_clear = false;
|
||||
sctx->db_depth_disable_expclear = false;
|
||||
zstex->depth_cleared_level_mask_once |= BITFIELD_BIT(fb->zsbuf.u.tex.level);
|
||||
zstex->depth_cleared_level_mask |= BITFIELD_BIT(fb->zsbuf.u.tex.level);
|
||||
zstex->depth_cleared_level_mask_once |= BITFIELD_BIT(fb->zsbuf.level);
|
||||
zstex->depth_cleared_level_mask |= BITFIELD_BIT(fb->zsbuf.level);
|
||||
si_mark_atom_dirty(sctx, &sctx->atoms.s.db_render_state);
|
||||
}
|
||||
|
||||
if (sctx->db_stencil_clear) {
|
||||
sctx->db_stencil_clear = false;
|
||||
sctx->db_stencil_disable_expclear = false;
|
||||
zstex->stencil_cleared_level_mask_once |= BITFIELD_BIT(fb->zsbuf.u.tex.level);
|
||||
zstex->stencil_cleared_level_mask_once |= BITFIELD_BIT(fb->zsbuf.level);
|
||||
si_mark_atom_dirty(sctx, &sctx->atoms.s.db_render_state);
|
||||
}
|
||||
}
|
||||
|
|
@ -1246,8 +1246,8 @@ static void gfx12_clear(struct pipe_context *ctx, unsigned buffers,
|
|||
|
||||
/* This is only used by the driver, not the hw. */
|
||||
if (buffers & PIPE_CLEAR_DEPTH) {
|
||||
zstex->depth_cleared_level_mask |= BITFIELD_BIT(fb->zsbuf.u.tex.level);
|
||||
zstex->depth_clear_value[fb->zsbuf.u.tex.level] = depth;
|
||||
zstex->depth_cleared_level_mask |= BITFIELD_BIT(fb->zsbuf.level);
|
||||
zstex->depth_clear_value[fb->zsbuf.level] = depth;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1263,8 +1263,8 @@ static bool si_try_normal_clear(struct si_context *sctx, struct pipe_surface *ds
|
|||
if (dstx == 0 && dsty == 0 &&
|
||||
width == surf_width &&
|
||||
height == surf_height &&
|
||||
dst->u.tex.first_layer == 0 &&
|
||||
dst->u.tex.last_layer == util_max_layer(dst->texture, dst->u.tex.level) &&
|
||||
dst->first_layer == 0 &&
|
||||
dst->last_layer == util_max_layer(dst->texture, dst->level) &&
|
||||
/* pipe->clear honors render_condition, so only use it if it's unset or if it's set and enabled. */
|
||||
(!sctx->render_cond || render_condition_enabled) &&
|
||||
sctx->has_graphics) {
|
||||
|
|
@ -1378,7 +1378,7 @@ static void si_clear_render_target(struct pipe_context *ctx, struct pipe_surface
|
|||
* or CMASK).
|
||||
*/
|
||||
if (sctx->gfx_level <= GFX10_3 &&
|
||||
(vi_dcc_enabled(sdst, dst->u.tex.level) ||
|
||||
(vi_dcc_enabled(sdst, dst->level) ||
|
||||
/* GFX6-9 allow CMASK without MSAA and allocate it on demand, but only 8-64bpp. */
|
||||
(sctx->gfx_level <= GFX9 && sdst->surface.bpe <= 8)) &&
|
||||
si_try_normal_clear(sctx, dst, dstx, dsty, width, height, render_condition_enabled,
|
||||
|
|
@ -1386,14 +1386,14 @@ static void si_clear_render_target(struct pipe_context *ctx, struct pipe_surface
|
|||
return;
|
||||
|
||||
struct pipe_box box;
|
||||
u_box_3d(dstx, dsty, dst->u.tex.first_layer, width, height,
|
||||
dst->u.tex.last_layer - dst->u.tex.first_layer + 1, &box);
|
||||
u_box_3d(dstx, dsty, dst->first_layer, width, height,
|
||||
dst->last_layer - dst->first_layer + 1, &box);
|
||||
|
||||
if (si_compute_fast_clear_image(sctx, dst->texture, dst->format, dst->u.tex.level, &box, color,
|
||||
if (si_compute_fast_clear_image(sctx, dst->texture, dst->format, dst->level, &box, color,
|
||||
render_condition_enabled, true))
|
||||
return;
|
||||
|
||||
if (si_compute_clear_image(sctx, dst->texture, dst->format, dst->u.tex.level, &box, color,
|
||||
if (si_compute_clear_image(sctx, dst->texture, dst->format, dst->level, &box, color,
|
||||
render_condition_enabled, true))
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -929,9 +929,9 @@ void si_update_ps_colorbuf0_slot(struct si_context *sctx)
|
|||
view.resource = surf->texture;
|
||||
view.format = surf->format;
|
||||
view.access = PIPE_IMAGE_ACCESS_READ;
|
||||
view.u.tex.first_layer = surf->u.tex.first_layer;
|
||||
view.u.tex.last_layer = surf->u.tex.last_layer;
|
||||
view.u.tex.level = surf->u.tex.level;
|
||||
view.u.tex.first_layer = surf->first_layer;
|
||||
view.u.tex.last_layer = surf->last_layer;
|
||||
view.u.tex.level = surf->level;
|
||||
|
||||
/* Set the descriptor. */
|
||||
uint32_t *desc = descs->list + slot * 4;
|
||||
|
|
|
|||
|
|
@ -2430,12 +2430,12 @@ static void si_initialize_color_surface(struct si_context *sctx, struct si_surfa
|
|||
.format = surf->base.format,
|
||||
.width = surf->width0,
|
||||
.height = surf->height0,
|
||||
.first_layer = surf->base.u.tex.first_layer,
|
||||
.last_layer = surf->base.u.tex.last_layer,
|
||||
.first_layer = surf->base.first_layer,
|
||||
.last_layer = surf->base.last_layer,
|
||||
.num_layers = util_max_layer(&tex->buffer.b.b, 0),
|
||||
.num_samples = tex->buffer.b.b.nr_samples,
|
||||
.num_storage_samples = tex->buffer.b.b.nr_storage_samples,
|
||||
.base_level = surf->base.u.tex.level,
|
||||
.base_level = surf->base.level,
|
||||
.num_levels = tex->buffer.b.b.last_level + 1,
|
||||
};
|
||||
|
||||
|
|
@ -2450,7 +2450,7 @@ static void si_initialize_color_surface(struct si_context *sctx, struct si_surfa
|
|||
static void si_init_depth_surface(struct si_context *sctx, struct si_surface *surf)
|
||||
{
|
||||
struct si_texture *tex = (struct si_texture *)surf->base.texture;
|
||||
unsigned level = surf->base.u.tex.level;
|
||||
unsigned level = surf->base.level;
|
||||
unsigned format;
|
||||
|
||||
format = ac_translate_dbformat(tex->db_render_format);
|
||||
|
|
@ -2486,8 +2486,8 @@ static void si_init_depth_surface(struct si_context *sctx, struct si_surface *su
|
|||
.level = level,
|
||||
.num_levels = tex->buffer.b.b.last_level + 1,
|
||||
.num_samples = tex->buffer.b.b.nr_samples,
|
||||
.first_layer = surf->base.u.tex.first_layer,
|
||||
.last_layer = surf->base.u.tex.last_layer,
|
||||
.first_layer = surf->base.first_layer,
|
||||
.last_layer = surf->base.last_layer,
|
||||
.allow_expclear = true,
|
||||
.htile_enabled = sctx->gfx_level < GFX12 && si_htile_enabled(tex, level, PIPE_MASK_ZS),
|
||||
.htile_stencil_disabled = tex->htile_stencil_disabled,
|
||||
|
|
@ -2592,7 +2592,7 @@ static void si_set_framebuffer_state(struct pipe_context *ctx,
|
|||
if (!surf->dcc_incompatible)
|
||||
continue;
|
||||
|
||||
if (vi_dcc_enabled(tex, surf->base.u.tex.level))
|
||||
if (vi_dcc_enabled(tex, surf->base.level))
|
||||
if (!si_texture_disable_dcc(sctx, tex))
|
||||
si_decompress_dcc(sctx, tex);
|
||||
|
||||
|
|
@ -2670,7 +2670,7 @@ static void si_set_framebuffer_state(struct pipe_context *ctx,
|
|||
if (tex->surface.is_linear)
|
||||
sctx->framebuffer.any_dst_linear = true;
|
||||
|
||||
if (vi_dcc_enabled(tex, surf->base.u.tex.level)) {
|
||||
if (vi_dcc_enabled(tex, surf->base.level)) {
|
||||
sctx->framebuffer.CB_has_shader_readable_metadata = true;
|
||||
|
||||
if (sctx->gfx_level >= GFX9 && sctx->gfx_level < GFX12 &&
|
||||
|
|
@ -2708,7 +2708,7 @@ static void si_set_framebuffer_state(struct pipe_context *ctx,
|
|||
}
|
||||
|
||||
if (sctx->gfx_level < GFX12 &&
|
||||
vi_tc_compat_htile_enabled(zstex, surf->base.u.tex.level, PIPE_MASK_ZS))
|
||||
vi_tc_compat_htile_enabled(zstex, surf->base.level, PIPE_MASK_ZS))
|
||||
sctx->framebuffer.DB_has_shader_readable_metadata = true;
|
||||
|
||||
/* Update the minimum but don't keep 0. */
|
||||
|
|
@ -2843,13 +2843,13 @@ static void gfx6_emit_framebuffer_state(struct si_context *sctx, unsigned index)
|
|||
.surf = &tex->surface,
|
||||
.cb = &cb->cb,
|
||||
.va = tex->buffer.gpu_address,
|
||||
.base_level = cb->base.u.tex.level,
|
||||
.base_level = cb->base.level,
|
||||
.num_samples = cb->base.texture->nr_samples,
|
||||
.fmask_enabled = !!tex->surface.fmask_offset,
|
||||
/* CMASK and fast clears are configured elsewhere. */
|
||||
.cmask_enabled = false,
|
||||
.fast_clear_enabled = false,
|
||||
.dcc_enabled = vi_dcc_enabled(tex, cb->base.u.tex.level) &&
|
||||
.dcc_enabled = vi_dcc_enabled(tex, cb->base.level) &&
|
||||
(i != 1 || !is_msaa_resolve),
|
||||
};
|
||||
struct ac_cb_surface cb_surf;
|
||||
|
|
@ -2873,7 +2873,7 @@ static void gfx6_emit_framebuffer_state(struct si_context *sctx, unsigned index)
|
|||
cb_surf.cb_color_info |= S_028C70_COMP_SWAP(swap);
|
||||
}
|
||||
|
||||
if (cb->base.u.tex.level > 0)
|
||||
if (cb->base.level > 0)
|
||||
cb_surf.cb_color_info &= C_028C70_FAST_CLEAR;
|
||||
else
|
||||
cb_surf.cb_color_cmask = tex->cmask_base_address_reg;
|
||||
|
|
@ -2972,7 +2972,7 @@ static void gfx6_emit_framebuffer_state(struct si_context *sctx, unsigned index)
|
|||
(zb->base.texture->nr_samples > 1 ? RADEON_PRIO_DEPTH_BUFFER_MSAA
|
||||
: RADEON_PRIO_DEPTH_BUFFER));
|
||||
|
||||
const unsigned level = zb->base.u.tex.level;
|
||||
const unsigned level = zb->base.level;
|
||||
|
||||
/* Set mutable fields. */
|
||||
const struct ac_mutable_ds_state mutable_ds_state = {
|
||||
|
|
@ -3141,7 +3141,7 @@ static void gfx11_dgpu_emit_framebuffer_state(struct si_context *sctx, unsigned
|
|||
.cb = &cb->cb,
|
||||
.va = tex->buffer.gpu_address,
|
||||
.num_samples = cb->base.texture->nr_samples,
|
||||
.dcc_enabled = vi_dcc_enabled(tex, cb->base.u.tex.level),
|
||||
.dcc_enabled = vi_dcc_enabled(tex, cb->base.level),
|
||||
};
|
||||
struct ac_cb_surface cb_surf;
|
||||
|
||||
|
|
@ -3173,7 +3173,7 @@ static void gfx11_dgpu_emit_framebuffer_state(struct si_context *sctx, unsigned
|
|||
(zb->base.texture->nr_samples > 1 ? RADEON_PRIO_DEPTH_BUFFER_MSAA
|
||||
: RADEON_PRIO_DEPTH_BUFFER));
|
||||
|
||||
const unsigned level = zb->base.u.tex.level;
|
||||
const unsigned level = zb->base.level;
|
||||
|
||||
/* Set mutable fields. */
|
||||
const struct ac_mutable_ds_state mutable_ds_state = {
|
||||
|
|
|
|||
|
|
@ -2461,7 +2461,7 @@ static void si_draw(struct pipe_context *ctx,
|
|||
/* On Gfx12, this is only used to detect whether a depth texture is in the cleared state. */
|
||||
if (sctx->framebuffer.state.zsbuf.texture) {
|
||||
struct si_texture *zstex = (struct si_texture *)sctx->framebuffer.state.zsbuf.texture;
|
||||
zstex->depth_cleared_level_mask &= ~BITFIELD_BIT(sctx->framebuffer.state.zsbuf.u.tex.level);
|
||||
zstex->depth_cleared_level_mask &= ~BITFIELD_BIT(sctx->framebuffer.state.zsbuf.level);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PERFETTO
|
||||
|
|
|
|||
|
|
@ -508,7 +508,7 @@ void si_test_blit_perf(struct si_screen *sscreen)
|
|||
if (test_flavor == TEST_FB_CLEAR || test_flavor == TEST_CLEAR) {
|
||||
|
||||
u_surface_default_template(&surf_templ, dst[size_factor]);
|
||||
surf_templ.u.tex.last_layer = dst[size_factor]->depth0 - 1;
|
||||
surf_templ.last_layer = dst[size_factor]->depth0 - 1;
|
||||
|
||||
/* Bind the colorbuffer for FB clears. */
|
||||
if (box_flavor == BOX_FULL) {
|
||||
|
|
|
|||
|
|
@ -2259,7 +2259,7 @@ void vi_disable_dcc_if_incompatible_format(struct si_context *sctx, struct pipe_
|
|||
static struct pipe_surface *si_create_surface(struct pipe_context *pipe, struct pipe_resource *tex,
|
||||
const struct pipe_surface *templ)
|
||||
{
|
||||
unsigned level = templ->u.tex.level;
|
||||
unsigned level = templ->level;
|
||||
unsigned width = u_minify(tex->width0, level);
|
||||
unsigned height = u_minify(tex->height0, level);
|
||||
unsigned width0 = tex->width0;
|
||||
|
|
@ -2291,21 +2291,23 @@ static struct pipe_surface *si_create_surface(struct pipe_context *pipe, struct
|
|||
if (!surface)
|
||||
return NULL;
|
||||
|
||||
assert(templ->u.tex.first_layer <= util_max_layer(tex, templ->u.tex.level));
|
||||
assert(templ->u.tex.last_layer <= util_max_layer(tex, templ->u.tex.level));
|
||||
assert(templ->first_layer <= util_max_layer(tex, templ->level));
|
||||
assert(templ->last_layer <= util_max_layer(tex, templ->level));
|
||||
|
||||
pipe_reference_init(&surface->base.reference, 1);
|
||||
pipe_resource_reference(&surface->base.texture, tex);
|
||||
surface->base.context = pipe;
|
||||
surface->base.format = templ->format;
|
||||
surface->base.u = templ->u;
|
||||
surface->base.level = templ->level;
|
||||
surface->base.first_layer = templ->first_layer;
|
||||
surface->base.last_layer = templ->last_layer;
|
||||
|
||||
surface->width0 = width0;
|
||||
surface->height0 = height0;
|
||||
|
||||
surface->dcc_incompatible =
|
||||
tex->target != PIPE_BUFFER &&
|
||||
vi_dcc_formats_are_incompatible(tex, templ->u.tex.level, templ->format);
|
||||
vi_dcc_formats_are_incompatible(tex, templ->level, templ->format);
|
||||
return &surface->base;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1384,7 +1384,7 @@ sp_setup_prepare(struct setup_context *setup)
|
|||
const struct pipe_surface *cbuf = &setup->softpipe->framebuffer.cbufs[i];
|
||||
if (cbuf->texture) {
|
||||
max_layer = MIN2(max_layer,
|
||||
cbuf->u.tex.last_layer - cbuf->u.tex.first_layer);
|
||||
cbuf->last_layer - cbuf->first_layer);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -300,19 +300,12 @@ softpipe_create_surface(struct pipe_context *pipe,
|
|||
pipe_resource_reference(&ps->texture, pt);
|
||||
ps->context = pipe;
|
||||
ps->format = surf_tmpl->format;
|
||||
if (pt->target != PIPE_BUFFER) {
|
||||
assert(surf_tmpl->u.tex.level <= pt->last_level);
|
||||
ps->u.tex.level = surf_tmpl->u.tex.level;
|
||||
ps->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
|
||||
ps->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
|
||||
if (ps->u.tex.first_layer != ps->u.tex.last_layer) {
|
||||
debug_printf("creating surface with multiple layers, rendering to first layer only\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
ps->u.buf.first_element = surf_tmpl->u.buf.first_element;
|
||||
ps->u.buf.last_element = surf_tmpl->u.buf.last_element;
|
||||
assert(ps->u.buf.first_element <= ps->u.buf.last_element);
|
||||
assert(surf_tmpl->level <= pt->last_level);
|
||||
ps->level = surf_tmpl->level;
|
||||
ps->first_layer = surf_tmpl->first_layer;
|
||||
ps->last_layer = surf_tmpl->last_layer;
|
||||
if (ps->first_layer != ps->last_layer) {
|
||||
debug_printf("creating surface with multiple layers, rendering to first layer only\n");
|
||||
}
|
||||
}
|
||||
return ps;
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ sp_tile_cache_set_surface(struct softpipe_tile_cache *tc,
|
|||
tc->surface = *ps;
|
||||
|
||||
if (ps->texture) {
|
||||
tc->num_maps = ps->u.tex.last_layer - ps->u.tex.first_layer + 1;
|
||||
tc->num_maps = ps->last_layer - ps->first_layer + 1;
|
||||
tc->transfer = CALLOC(tc->num_maps, sizeof(struct pipe_transfer *));
|
||||
tc->transfer_map = CALLOC(tc->num_maps, sizeof(void *));
|
||||
|
||||
|
|
@ -200,7 +200,7 @@ sp_tile_cache_set_surface(struct softpipe_tile_cache *tc,
|
|||
if (ps->texture->target != PIPE_BUFFER) {
|
||||
for (i = 0; i < tc->num_maps; i++) {
|
||||
tc->transfer_map[i] = pipe_texture_map(pipe, ps->texture,
|
||||
ps->u.tex.level, ps->u.tex.first_layer + i,
|
||||
ps->level, ps->first_layer + i,
|
||||
PIPE_MAP_READ_WRITE |
|
||||
PIPE_MAP_UNSYNCHRONIZED,
|
||||
0, 0,
|
||||
|
|
|
|||
|
|
@ -274,9 +274,9 @@ svga_clear_texture(struct pipe_context *pipe,
|
|||
|
||||
memset(&tmpl, 0, sizeof(tmpl));
|
||||
tmpl.format = res->format;
|
||||
tmpl.u.tex.first_layer = box->z;
|
||||
tmpl.u.tex.last_layer = box->z + box->depth - 1;
|
||||
tmpl.u.tex.level = level;
|
||||
tmpl.first_layer = box->z;
|
||||
tmpl.last_layer = box->z + box->depth - 1;
|
||||
tmpl.level = level;
|
||||
|
||||
surface = pipe->create_surface(pipe, res, &tmpl);
|
||||
if (surface == NULL) {
|
||||
|
|
@ -422,19 +422,19 @@ svga_clear_texture(struct pipe_context *pipe,
|
|||
/* clear with map/write/unmap */
|
||||
|
||||
/* store layer values */
|
||||
unsigned first_layer = rtv->u.tex.first_layer;
|
||||
unsigned last_layer = rtv->u.tex.last_layer;
|
||||
unsigned first_layer = rtv->first_layer;
|
||||
unsigned last_layer = rtv->last_layer;
|
||||
unsigned box_depth = last_layer - first_layer + 1;
|
||||
|
||||
for (unsigned i = 0; i < box_depth; i++) {
|
||||
rtv->u.tex.first_layer = rtv->u.tex.last_layer =
|
||||
rtv->first_layer = rtv->last_layer =
|
||||
first_layer + i;
|
||||
util_clear_render_target(pipe, rtv, &color, box->x, box->y,
|
||||
box->width, box->height);
|
||||
}
|
||||
/* restore layer values */
|
||||
rtv->u.tex.first_layer = first_layer;
|
||||
rtv->u.tex.last_layer = last_layer;
|
||||
rtv->first_layer = first_layer;
|
||||
rtv->last_layer = last_layer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -286,28 +286,28 @@ svga_create_surface_view(struct pipe_context *pipe,
|
|||
SVGA_STATS_TIME_PUSH(ss->sws, SVGA_STATS_TIME_CREATESURFACEVIEW);
|
||||
|
||||
if (pt->target == PIPE_TEXTURE_CUBE) {
|
||||
layer = surf_tmpl->u.tex.first_layer;
|
||||
layer = surf_tmpl->first_layer;
|
||||
zslice = 0;
|
||||
}
|
||||
else if (pt->target == PIPE_TEXTURE_1D_ARRAY ||
|
||||
pt->target == PIPE_TEXTURE_2D_ARRAY ||
|
||||
pt->target == PIPE_TEXTURE_CUBE_ARRAY) {
|
||||
layer = surf_tmpl->u.tex.first_layer;
|
||||
layer = surf_tmpl->first_layer;
|
||||
zslice = 0;
|
||||
nlayers = surf_tmpl->u.tex.last_layer - surf_tmpl->u.tex.first_layer + 1;
|
||||
nlayers = surf_tmpl->last_layer - surf_tmpl->first_layer + 1;
|
||||
}
|
||||
else {
|
||||
layer = 0;
|
||||
zslice = surf_tmpl->u.tex.first_layer;
|
||||
zslice = surf_tmpl->first_layer;
|
||||
}
|
||||
|
||||
pipe_reference_init(&s->base.reference, 1);
|
||||
pipe_resource_reference(&s->base.texture, pt);
|
||||
s->base.context = pipe;
|
||||
s->base.format = surf_tmpl->format;
|
||||
s->base.u.tex.level = surf_tmpl->u.tex.level;
|
||||
s->base.u.tex.first_layer = surf_tmpl->u.tex.first_layer;
|
||||
s->base.u.tex.last_layer = surf_tmpl->u.tex.last_layer;
|
||||
s->base.level = surf_tmpl->level;
|
||||
s->base.first_layer = surf_tmpl->first_layer;
|
||||
s->base.last_layer = surf_tmpl->last_layer;
|
||||
s->view_id = SVGA3D_INVALID_ID;
|
||||
|
||||
s->backed = NULL;
|
||||
|
|
@ -340,7 +340,7 @@ svga_create_surface_view(struct pipe_context *pipe,
|
|||
if (clone_resource) {
|
||||
SVGA_DBG(DEBUG_VIEWS,
|
||||
"New backed surface view: resource %p, level %u layer %u z %u, %p\n",
|
||||
pt, surf_tmpl->u.tex.level, layer, zslice, s);
|
||||
pt, surf_tmpl->level, layer, zslice, s);
|
||||
|
||||
if (svga_have_vgpu10(svga)) {
|
||||
switch (pt->target) {
|
||||
|
|
@ -374,7 +374,7 @@ svga_create_surface_view(struct pipe_context *pipe,
|
|||
*/
|
||||
s->handle = svga_texture_view_surface(svga, tex, bind, flags,
|
||||
tex->key.format,
|
||||
surf_tmpl->u.tex.level, 1,
|
||||
surf_tmpl->level, 1,
|
||||
layer, nlayers, zslice,
|
||||
true, &s->key);
|
||||
if (!s->handle) {
|
||||
|
|
@ -389,14 +389,14 @@ svga_create_surface_view(struct pipe_context *pipe,
|
|||
} else {
|
||||
SVGA_DBG(DEBUG_VIEWS,
|
||||
"New surface view: resource %p, level %u, layer %u, z %u, %p\n",
|
||||
pt, surf_tmpl->u.tex.level, layer, zslice, s);
|
||||
pt, surf_tmpl->level, layer, zslice, s);
|
||||
|
||||
memset(&s->key, 0, sizeof s->key);
|
||||
s->key.format = format;
|
||||
s->handle = tex->handle;
|
||||
s->real_layer = layer;
|
||||
s->real_zslice = zslice;
|
||||
s->real_level = surf_tmpl->u.tex.level;
|
||||
s->real_level = surf_tmpl->level;
|
||||
}
|
||||
|
||||
svga->hud.num_surface_views++;
|
||||
|
|
@ -423,7 +423,7 @@ svga_create_surface(struct pipe_context *pipe,
|
|||
if (svga_screen(screen)->debug.force_surface_view)
|
||||
view = true;
|
||||
|
||||
if (surf_tmpl->u.tex.level != 0 &&
|
||||
if (surf_tmpl->level != 0 &&
|
||||
svga_screen(screen)->debug.force_level_surface_view)
|
||||
view = true;
|
||||
|
||||
|
|
@ -484,18 +484,18 @@ create_backed_surface_view(struct svga_context *svga, struct svga_surface *s,
|
|||
case PIPE_TEXTURE_CUBE_ARRAY:
|
||||
case PIPE_TEXTURE_1D_ARRAY:
|
||||
case PIPE_TEXTURE_2D_ARRAY:
|
||||
layer = s->base.u.tex.first_layer;
|
||||
layer = s->base.first_layer;
|
||||
zslice = 0;
|
||||
break;
|
||||
default:
|
||||
layer = 0;
|
||||
zslice = s->base.u.tex.first_layer;
|
||||
zslice = s->base.first_layer;
|
||||
}
|
||||
|
||||
svga_texture_copy_handle_resource(svga, tex, bs->handle,
|
||||
bs->key.numMipLevels,
|
||||
bs->key.numFaces * bs->key.arraySize,
|
||||
zslice, s->base.u.tex.level, layer);
|
||||
zslice, s->base.level, layer);
|
||||
}
|
||||
|
||||
svga_mark_surface_dirty(&s->backed->base);
|
||||
|
|
@ -577,7 +577,7 @@ svga_validate_surface_view(struct svga_context *svga, struct svga_surface *s)
|
|||
desc.tex.mipSlice = s->real_level;
|
||||
desc.tex.firstArraySlice = s->real_layer + s->real_zslice;
|
||||
desc.tex.arraySize =
|
||||
s->base.u.tex.last_layer - s->base.u.tex.first_layer + 1;
|
||||
s->base.last_layer - s->base.first_layer + 1;
|
||||
|
||||
resType = svga_resource_type(s->base.texture->target);
|
||||
|
||||
|
|
@ -706,8 +706,8 @@ svga_mark_surface_dirty(struct pipe_surface *surf)
|
|||
|
||||
if (s->handle == tex->handle) {
|
||||
/* hmm so 3d textures always have all their slices marked ? */
|
||||
svga_define_texture_level(tex, surf->u.tex.first_layer,
|
||||
surf->u.tex.level);
|
||||
svga_define_texture_level(tex, surf->first_layer,
|
||||
surf->level);
|
||||
}
|
||||
else {
|
||||
/* this will happen later in svga_propagate_surface */
|
||||
|
|
@ -720,7 +720,7 @@ svga_mark_surface_dirty(struct pipe_surface *surf)
|
|||
* backed surface is propagated to the original surface.
|
||||
*/
|
||||
if (s->handle == tex->handle)
|
||||
svga_age_texture_view(tex, surf->u.tex.level);
|
||||
svga_age_texture_view(tex, surf->level);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -778,7 +778,7 @@ svga_propagate_surface(struct svga_context *svga, struct pipe_surface *surf,
|
|||
s->dirty = !reset;
|
||||
|
||||
ss->texture_timestamp++;
|
||||
svga_age_texture_view(tex, surf->u.tex.level);
|
||||
svga_age_texture_view(tex, surf->level);
|
||||
|
||||
if (s->handle != tex->handle) {
|
||||
unsigned zslice, layer;
|
||||
|
|
@ -786,29 +786,29 @@ svga_propagate_surface(struct svga_context *svga, struct pipe_surface *surf,
|
|||
unsigned i;
|
||||
unsigned numMipLevels = tex->b.last_level + 1;
|
||||
unsigned srcLevel = s->real_level;
|
||||
unsigned dstLevel = surf->u.tex.level;
|
||||
unsigned dstLevel = surf->level;
|
||||
unsigned width = u_minify(tex->b.width0, dstLevel);
|
||||
unsigned height = u_minify(tex->b.height0, dstLevel);
|
||||
|
||||
if (surf->texture->target == PIPE_TEXTURE_CUBE) {
|
||||
zslice = 0;
|
||||
layer = surf->u.tex.first_layer;
|
||||
layer = surf->first_layer;
|
||||
}
|
||||
else if (surf->texture->target == PIPE_TEXTURE_1D_ARRAY ||
|
||||
surf->texture->target == PIPE_TEXTURE_2D_ARRAY ||
|
||||
surf->texture->target == PIPE_TEXTURE_CUBE_ARRAY) {
|
||||
zslice = 0;
|
||||
layer = surf->u.tex.first_layer;
|
||||
nlayers = surf->u.tex.last_layer - surf->u.tex.first_layer + 1;
|
||||
layer = surf->first_layer;
|
||||
nlayers = surf->last_layer - surf->first_layer + 1;
|
||||
}
|
||||
else {
|
||||
zslice = surf->u.tex.first_layer;
|
||||
zslice = surf->first_layer;
|
||||
layer = 0;
|
||||
}
|
||||
|
||||
SVGA_DBG(DEBUG_VIEWS,
|
||||
"Propagate surface %p to resource %p, level %u\n",
|
||||
surf, tex, surf->u.tex.level);
|
||||
surf, tex, surf->level);
|
||||
|
||||
if (svga_have_vgpu10(svga)) {
|
||||
unsigned srcSubResource, dstSubResource;
|
||||
|
|
|
|||
|
|
@ -171,12 +171,10 @@ v3d_stencil_blit(struct pipe_context *ctx, struct pipe_blit_info *info)
|
|||
|
||||
/* Initialize the surface. */
|
||||
struct pipe_surface dst_tmpl = {
|
||||
.u.tex = {
|
||||
.level = info->dst.level,
|
||||
.first_layer = info->dst.box.z,
|
||||
.last_layer = info->dst.box.z,
|
||||
},
|
||||
.format = dst_format,
|
||||
.first_layer = info->dst.box.z,
|
||||
.last_layer = info->dst.box.z,
|
||||
.level = info->dst.level,
|
||||
};
|
||||
struct pipe_surface *dst_surf =
|
||||
ctx->create_surface(ctx, &dst->base, &dst_tmpl);
|
||||
|
|
@ -300,9 +298,9 @@ v3d_get_blit_surface(struct pipe_context *pctx,
|
|||
struct pipe_surface tmpl;
|
||||
|
||||
tmpl.format = format;
|
||||
tmpl.u.tex.level = level;
|
||||
tmpl.u.tex.first_layer = layer;
|
||||
tmpl.u.tex.last_layer = layer;
|
||||
tmpl.level = level;
|
||||
tmpl.first_layer = layer;
|
||||
tmpl.last_layer = layer;
|
||||
|
||||
return pctx->create_surface(pctx, prsc, &tmpl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1087,7 +1087,7 @@ v3d_create_surface(struct pipe_context *pctx,
|
|||
return NULL;
|
||||
|
||||
struct pipe_surface *psurf = &surface->base;
|
||||
unsigned level = surf_tmpl->u.tex.level;
|
||||
unsigned level = surf_tmpl->level;
|
||||
struct v3d_resource_slice *slice = &rsc->slices[level];
|
||||
|
||||
pipe_reference_init(&psurf->reference, 1);
|
||||
|
|
@ -1095,12 +1095,12 @@ v3d_create_surface(struct pipe_context *pctx,
|
|||
|
||||
psurf->context = pctx;
|
||||
psurf->format = surf_tmpl->format;
|
||||
psurf->u.tex.level = level;
|
||||
psurf->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
|
||||
psurf->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
|
||||
psurf->level = level;
|
||||
psurf->first_layer = surf_tmpl->first_layer;
|
||||
psurf->last_layer = surf_tmpl->last_layer;
|
||||
|
||||
surface->offset = v3d_layer_offset(ptex, level,
|
||||
psurf->u.tex.first_layer);
|
||||
psurf->first_layer);
|
||||
surface->tiling = slice->tiling;
|
||||
|
||||
surface->format = v3d_get_rt_format(devinfo, psurf->format);
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ load_general(struct v3d_cl *cl, struct pipe_surface *psurf, int buffer,
|
|||
struct v3d_resource *rsc = v3d_resource(psurf->texture);
|
||||
|
||||
uint32_t layer_offset =
|
||||
v3d_layer_offset(&rsc->base, psurf->u.tex.level,
|
||||
psurf->u.tex.first_layer + layer);
|
||||
v3d_layer_offset(&rsc->base, psurf->level,
|
||||
psurf->first_layer + layer);
|
||||
cl_emit(cl, LOAD_TILE_BUFFER_GENERAL, load) {
|
||||
load.buffer_to_load = buffer;
|
||||
load.address = cl_address(rsc->bo, layer_offset);
|
||||
|
|
@ -69,7 +69,7 @@ load_general(struct v3d_cl *cl, struct pipe_surface *psurf, int buffer,
|
|||
surf->padded_height_of_output_image_in_uif_blocks;
|
||||
} else if (surf->tiling == V3D_TILING_RASTER) {
|
||||
struct v3d_resource_slice *slice =
|
||||
&rsc->slices[psurf->u.tex.level];
|
||||
&rsc->slices[psurf->level];
|
||||
load.height_in_ub_or_stride = slice->stride;
|
||||
}
|
||||
|
||||
|
|
@ -106,8 +106,8 @@ store_general(struct v3d_job *job,
|
|||
rsc->graphics_written = true;
|
||||
|
||||
uint32_t layer_offset =
|
||||
v3d_layer_offset(&rsc->base, psurf->u.tex.level,
|
||||
psurf->u.tex.first_layer + layer);
|
||||
v3d_layer_offset(&rsc->base, psurf->level,
|
||||
psurf->first_layer + layer);
|
||||
cl_emit(cl, STORE_TILE_BUFFER_GENERAL, store) {
|
||||
store.buffer_to_store = buffer;
|
||||
store.address = cl_address(rsc->bo, layer_offset);
|
||||
|
|
@ -128,7 +128,7 @@ store_general(struct v3d_job *job,
|
|||
surf->padded_height_of_output_image_in_uif_blocks;
|
||||
} else if (surf->tiling == V3D_TILING_RASTER) {
|
||||
struct v3d_resource_slice *slice =
|
||||
&rsc->slices[psurf->u.tex.level];
|
||||
&rsc->slices[psurf->level];
|
||||
store.height_in_ub_or_stride = slice->stride;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ vc4_get_blit_surface(struct pipe_context *pctx,
|
|||
|
||||
memset(&tmpl, 0, sizeof(tmpl));
|
||||
tmpl.format = prsc->format;
|
||||
tmpl.u.tex.level = level;
|
||||
tmpl.u.tex.first_layer = tmpl.u.tex.last_layer = layer;
|
||||
tmpl.level = level;
|
||||
tmpl.first_layer = tmpl.last_layer = layer;
|
||||
|
||||
return pctx->create_surface(pctx, prsc, &tmpl);
|
||||
}
|
||||
|
|
@ -492,12 +492,10 @@ vc4_stencil_blit(struct pipe_context *ctx, struct pipe_blit_info *info)
|
|||
|
||||
/* Initialize the surface */
|
||||
struct pipe_surface dst_tmpl = {
|
||||
.u.tex = {
|
||||
.level = info->dst.level,
|
||||
.first_layer = info->dst.box.z,
|
||||
.last_layer = info->dst.box.z,
|
||||
},
|
||||
.format = dst_format,
|
||||
.first_layer = info->dst.box.z,
|
||||
.last_layer = info->dst.box.z,
|
||||
.level = info->dst.level,
|
||||
};
|
||||
struct pipe_surface *dst_surf =
|
||||
ctx->create_surface(ctx, &dst->base, &dst_tmpl);
|
||||
|
|
|
|||
|
|
@ -768,21 +768,21 @@ vc4_create_surface(struct pipe_context *pctx,
|
|||
if (!surface)
|
||||
return NULL;
|
||||
|
||||
assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
|
||||
assert(surf_tmpl->first_layer == surf_tmpl->last_layer);
|
||||
|
||||
struct pipe_surface *psurf = &surface->base;
|
||||
unsigned level = surf_tmpl->u.tex.level;
|
||||
unsigned level = surf_tmpl->level;
|
||||
|
||||
pipe_reference_init(&psurf->reference, 1);
|
||||
pipe_resource_reference(&psurf->texture, ptex);
|
||||
|
||||
psurf->context = pctx;
|
||||
psurf->format = surf_tmpl->format;
|
||||
psurf->u.tex.level = level;
|
||||
psurf->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
|
||||
psurf->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
|
||||
psurf->level = level;
|
||||
psurf->first_layer = surf_tmpl->first_layer;
|
||||
psurf->last_layer = surf_tmpl->last_layer;
|
||||
surface->offset = (rsc->slices[level].offset +
|
||||
psurf->u.tex.first_layer * rsc->cube_map_stride);
|
||||
psurf->first_layer * rsc->cube_map_stride);
|
||||
surface->tiling = rsc->slices[level].tiling;
|
||||
|
||||
return &surface->base;
|
||||
|
|
|
|||
|
|
@ -425,17 +425,17 @@ vc4_set_framebuffer_state(struct pipe_context *pctx,
|
|||
* framebuffer. Note that if the z/color buffers were mismatched
|
||||
* sizes, we wouldn't be able to do this.
|
||||
*/
|
||||
if (cso->cbufs[0].texture && cso->cbufs[0].u.tex.level) {
|
||||
if (cso->cbufs[0].texture && cso->cbufs[0].level) {
|
||||
struct vc4_resource *rsc =
|
||||
vc4_resource(cso->cbufs[0].texture);
|
||||
cso->width =
|
||||
(rsc->slices[cso->cbufs[0].u.tex.level].stride /
|
||||
(rsc->slices[cso->cbufs[0].level].stride /
|
||||
rsc->cpp);
|
||||
} else if (cso->zsbuf.texture && cso->zsbuf.u.tex.level){
|
||||
} else if (cso->zsbuf.texture && cso->zsbuf.level){
|
||||
struct vc4_resource *rsc =
|
||||
vc4_resource(cso->zsbuf.texture);
|
||||
cso->width =
|
||||
(rsc->slices[cso->zsbuf.u.tex.level].stride /
|
||||
(rsc->slices[cso->zsbuf.level].stride /
|
||||
rsc->cpp);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -179,14 +179,14 @@ static void virgl_attach_res_framebuffer(struct virgl_context *vctx)
|
|||
res = virgl_resource(surf->texture);
|
||||
if (res) {
|
||||
vws->emit_res(vws, vctx->cbuf, res->hw_res, false);
|
||||
virgl_resource_dirty(res, surf->u.tex.level);
|
||||
virgl_resource_dirty(res, surf->level);
|
||||
}
|
||||
for (i = 0; i < vctx->framebuffer.nr_cbufs; i++) {
|
||||
surf = &vctx->framebuffer.cbufs[i];
|
||||
res = virgl_resource(surf->texture);
|
||||
if (res) {
|
||||
vws->emit_res(vws, vctx->cbuf, res->hw_res, false);
|
||||
virgl_resource_dirty(res, surf->u.tex.level);
|
||||
virgl_resource_dirty(res, surf->level);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -369,9 +369,9 @@ static struct pipe_surface *virgl_create_surface(struct pipe_context *ctx,
|
|||
surf->base.context = ctx;
|
||||
surf->base.format = templ->format;
|
||||
|
||||
surf->base.u.tex.level = templ->u.tex.level;
|
||||
surf->base.u.tex.first_layer = templ->u.tex.first_layer;
|
||||
surf->base.u.tex.last_layer = templ->u.tex.last_layer;
|
||||
surf->base.level = templ->level;
|
||||
surf->base.first_layer = templ->first_layer;
|
||||
surf->base.last_layer = templ->last_layer;
|
||||
surf->base.nr_samples = templ->nr_samples;
|
||||
|
||||
virgl_encoder_create_surface(vctx, handle, res, &surf->base);
|
||||
|
|
@ -921,7 +921,7 @@ static void virgl_clear_render_target(struct pipe_context *ctx,
|
|||
* without going through the corresponding guest side resource, and
|
||||
* hence the two will diverge.
|
||||
*/
|
||||
virgl_resource_dirty(virgl_resource(dst->texture), dst->u.tex.level);
|
||||
virgl_resource_dirty(virgl_resource(dst->texture), dst->level);
|
||||
}
|
||||
|
||||
static void virgl_clear_depth_stencil(struct pipe_context *ctx,
|
||||
|
|
@ -946,7 +946,7 @@ static void virgl_clear_depth_stencil(struct pipe_context *ctx,
|
|||
* without going through the corresponding guest side resource, and
|
||||
* hence the two will diverge.
|
||||
*/
|
||||
virgl_resource_dirty(virgl_resource(dst->texture), dst->u.tex.level);
|
||||
virgl_resource_dirty(virgl_resource(dst->texture), dst->level);
|
||||
}
|
||||
|
||||
static void virgl_clear_render_target_stub(struct pipe_context *ctx,
|
||||
|
|
|
|||
|
|
@ -1008,8 +1008,8 @@ static int virgl_encoder_create_surface_common(struct virgl_context *ctx,
|
|||
virgl_encoder_write_dword(ctx->cbuf, pipe_to_virgl_format(templat->format));
|
||||
|
||||
assert(templat->texture->target != PIPE_BUFFER);
|
||||
virgl_encoder_write_dword(ctx->cbuf, templat->u.tex.level);
|
||||
virgl_encoder_write_dword(ctx->cbuf, templat->u.tex.first_layer | (templat->u.tex.last_layer << 16));
|
||||
virgl_encoder_write_dword(ctx->cbuf, templat->level);
|
||||
virgl_encoder_write_dword(ctx->cbuf, templat->first_layer | (templat->last_layer << 16));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -407,9 +407,9 @@ create_clear_surface(struct pipe_context *pctx, struct pipe_resource *pres, unsi
|
|||
struct pipe_surface tmpl = {{0}};
|
||||
|
||||
tmpl.format = pres->format;
|
||||
tmpl.u.tex.first_layer = box->z;
|
||||
tmpl.u.tex.last_layer = box->z + box->depth - 1;
|
||||
tmpl.u.tex.level = level;
|
||||
tmpl.first_layer = box->z;
|
||||
tmpl.last_layer = box->z + box->depth - 1;
|
||||
tmpl.level = level;
|
||||
return tmpl;
|
||||
}
|
||||
|
||||
|
|
@ -699,8 +699,8 @@ zink_fb_clear_reset(struct zink_context *ctx, unsigned i)
|
|||
static bool
|
||||
fb_depth_intersects(const struct pipe_surface *psurf, int z, int depth)
|
||||
{
|
||||
return (z >= psurf->u.tex.first_layer && z + depth - 1 <= psurf->u.tex.last_layer) ||
|
||||
(psurf->u.tex.first_layer >= z && psurf->u.tex.last_layer <= z + depth - 1);
|
||||
return (z >= psurf->first_layer && z + depth - 1 <= psurf->last_layer) ||
|
||||
(psurf->first_layer >= z && psurf->last_layer <= z + depth - 1);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -796,7 +796,7 @@ fb_clears_apply_or_discard_internal(struct zink_context *ctx, struct pipe_resour
|
|||
static bool
|
||||
fb_depth_fills(const struct pipe_surface *psurf, int z, int depth)
|
||||
{
|
||||
return z == psurf->u.tex.first_layer && z + depth - 1 >= psurf->u.tex.last_layer;
|
||||
return z == psurf->first_layer && z + depth - 1 >= psurf->last_layer;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -1163,14 +1163,14 @@ zink_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *pres,
|
|||
}
|
||||
struct pipe_surface templ = {0};
|
||||
if (!state->is_tex2d_from_buf)
|
||||
templ.u.tex.level = state->u.tex.first_level;
|
||||
templ.level = state->u.tex.first_level;
|
||||
templ.format = state->format;
|
||||
/* avoid needing mutable for depth/stencil sampling */
|
||||
if (util_format_is_depth_and_stencil(pres->format))
|
||||
templ.format = pres->format;
|
||||
if (target != PIPE_TEXTURE_3D && !state->is_tex2d_from_buf) {
|
||||
templ.u.tex.first_layer = state->u.tex.first_layer;
|
||||
templ.u.tex.last_layer = state->u.tex.last_layer;
|
||||
templ.first_layer = state->u.tex.first_layer;
|
||||
templ.last_layer = state->u.tex.last_layer;
|
||||
}
|
||||
|
||||
if (zink_is_swapchain(res)) {
|
||||
|
|
@ -1941,11 +1941,11 @@ create_image_surface(struct zink_context *ctx, const struct pipe_image_view *vie
|
|||
res = zink_resource(import);
|
||||
pres = import;
|
||||
} else {
|
||||
tmpl.u.tex.level = view->u.tex.level;
|
||||
tmpl.u.tex.first_layer = view->u.tex.first_layer;
|
||||
tmpl.u.tex.last_layer = view->u.tex.last_layer;
|
||||
depth += tmpl.u.tex.last_layer - tmpl.u.tex.first_layer;
|
||||
z = tmpl.u.tex.first_layer;
|
||||
tmpl.level = view->u.tex.level;
|
||||
tmpl.first_layer = view->u.tex.first_layer;
|
||||
tmpl.last_layer = view->u.tex.last_layer;
|
||||
depth += tmpl.last_layer - tmpl.first_layer;
|
||||
z = tmpl.first_layer;
|
||||
}
|
||||
switch (target) {
|
||||
case PIPE_TEXTURE_3D:
|
||||
|
|
@ -1958,8 +1958,8 @@ create_image_surface(struct zink_context *ctx, const struct pipe_image_view *vie
|
|||
warn_missing_feature(warned, "image2DViewOf3D");
|
||||
}
|
||||
} else {
|
||||
assert(tmpl.u.tex.first_layer == 0);
|
||||
tmpl.u.tex.last_layer = 0;
|
||||
assert(tmpl.first_layer == 0);
|
||||
tmpl.last_layer = 0;
|
||||
}
|
||||
break;
|
||||
case PIPE_TEXTURE_2D_ARRAY:
|
||||
|
|
@ -2543,7 +2543,7 @@ zink_make_texture_handle_resident(struct pipe_context *pctx, uint64_t handle, bo
|
|||
ii->sampler = bd->sampler->sampler;
|
||||
ii->imageView = ds->surface->image_view;
|
||||
ii->imageLayout = zink_descriptor_util_image_layout_eval(ctx, res, false);
|
||||
flush_pending_clears(ctx, res, ds->surface->base.u.tex.first_layer, ds->surface->base.u.tex.last_layer - ds->surface->base.u.tex.first_layer + 1);
|
||||
flush_pending_clears(ctx, res, ds->surface->base.first_layer, ds->surface->base.last_layer - ds->surface->base.first_layer + 1);
|
||||
if (!check_for_layout_update(ctx, res, false)) {
|
||||
res->obj->unordered_read = false;
|
||||
// TODO: figure out a way to link up layouts between unordered and main cmdbuf
|
||||
|
|
@ -3208,14 +3208,14 @@ framebuffer_get_num_layers(const struct pipe_framebuffer_state *fb)
|
|||
|
||||
for (i = 0; i < fb->nr_cbufs; i++) {
|
||||
if (fb->cbufs[i].texture) {
|
||||
unsigned num = fb->cbufs[i].u.tex.last_layer -
|
||||
fb->cbufs[i].u.tex.first_layer + 1;
|
||||
unsigned num = fb->cbufs[i].last_layer -
|
||||
fb->cbufs[i].first_layer + 1;
|
||||
num_layers = MIN2(num_layers, num);
|
||||
}
|
||||
}
|
||||
if (fb->zsbuf.texture) {
|
||||
unsigned num = fb->zsbuf.u.tex.last_layer -
|
||||
fb->zsbuf.u.tex.first_layer + 1;
|
||||
unsigned num = fb->zsbuf.last_layer -
|
||||
fb->zsbuf.first_layer + 1;
|
||||
num_layers = MIN2(num_layers, num);
|
||||
}
|
||||
return MAX2(num_layers, 1);
|
||||
|
|
@ -3859,7 +3859,7 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
|
|||
else if (zink_fb_clear_enabled(ctx, i) && !pipe_surface_equal(&ctx->fb_state.cbufs[i], &state->cbufs[i])) {
|
||||
struct zink_surface *a = zink_csurface(ctx->fb_cbufs[i]);
|
||||
const struct pipe_surface *b = &state->cbufs[i];
|
||||
if (!a || !b->texture || framebuffer_surface_needs_mutable(b->texture, b) || memcmp(&a->base.u.tex, &b->u.tex, sizeof(b->u.tex)) ||
|
||||
if (!a || !b->texture || framebuffer_surface_needs_mutable(b->texture, b) || a->base.level != b->level || a->base.first_layer != b->first_layer || a->base.last_layer != b->last_layer ||
|
||||
a->base.texture != b->texture)
|
||||
flush_clears = true;
|
||||
else if (ctx->fb_state.cbufs[i].format != state->cbufs[i].format)
|
||||
|
|
@ -5779,9 +5779,9 @@ add_implicit_feedback_loop(struct zink_context *ctx, struct zink_resource *res)
|
|||
struct pipe_sampler_view *sv = ctx->sampler_views[stage][slot];
|
||||
|
||||
for (unsigned i = 0; i < surf_idx; i++) {
|
||||
if (sv->u.tex.first_level > psurfs[i]->u.tex.level || sv->u.tex.last_level < psurfs[i]->u.tex.level)
|
||||
if (sv->u.tex.first_level > psurfs[i]->level || sv->u.tex.last_level < psurfs[i]->level)
|
||||
continue;
|
||||
if (sv->u.tex.first_layer > psurfs[i]->u.tex.last_layer || sv->u.tex.last_layer < psurfs[i]->u.tex.first_layer)
|
||||
if (sv->u.tex.first_layer > psurfs[i]->last_layer || sv->u.tex.last_layer < psurfs[i]->first_layer)
|
||||
continue;
|
||||
is_feedback = true;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -208,9 +208,9 @@ zink_render_msaa_expand(struct zink_context *ctx, uint32_t msaa_expand_mask)
|
|||
struct pipe_box dstbox;
|
||||
|
||||
u_box_3d(0, 0, 0, ctx->fb_state.width, ctx->fb_state.height,
|
||||
1 + dst_view->u.tex.last_layer - dst_view->u.tex.first_layer, &dstbox);
|
||||
1 + dst_view->last_layer - dst_view->first_layer, &dstbox);
|
||||
|
||||
util_blitter_default_src_texture(ctx->blitter, &src_templ, src, ctx->fb_state.cbufs[i].u.tex.level);
|
||||
util_blitter_default_src_texture(ctx->blitter, &src_templ, src, ctx->fb_state.cbufs[i].level);
|
||||
src_view = ctx->base.create_sampler_view(&ctx->base, src, &src_templ);
|
||||
|
||||
zink_blit_begin(ctx, ZINK_BLIT_SAVE_FB | ZINK_BLIT_SAVE_FS | ZINK_BLIT_SAVE_TEXTURES);
|
||||
|
|
|
|||
|
|
@ -95,14 +95,14 @@ create_ivci(struct zink_screen *screen,
|
|||
ivci.components.a = VK_COMPONENT_SWIZZLE_A;
|
||||
|
||||
ivci.subresourceRange.aspectMask = res->aspect;
|
||||
ivci.subresourceRange.baseMipLevel = templ->u.tex.level;
|
||||
ivci.subresourceRange.baseMipLevel = templ->level;
|
||||
ivci.subresourceRange.levelCount = 1;
|
||||
ivci.subresourceRange.baseArrayLayer = templ->u.tex.first_layer;
|
||||
ivci.subresourceRange.layerCount = 1 + templ->u.tex.last_layer - templ->u.tex.first_layer;
|
||||
ivci.subresourceRange.baseArrayLayer = templ->first_layer;
|
||||
ivci.subresourceRange.layerCount = 1 + templ->last_layer - templ->first_layer;
|
||||
assert(ivci.viewType != VK_IMAGE_VIEW_TYPE_3D || ivci.subresourceRange.baseArrayLayer == 0);
|
||||
assert(ivci.viewType != VK_IMAGE_VIEW_TYPE_3D || ivci.subresourceRange.layerCount == 1);
|
||||
/* ensure cube image types get clamped to 2D/2D_ARRAY as expected for partial views */
|
||||
ivci.viewType = zink_surface_clamp_viewtype(ivci.viewType, templ->u.tex.first_layer, templ->u.tex.last_layer, res->base.b.array_size);
|
||||
ivci.viewType = zink_surface_clamp_viewtype(ivci.viewType, templ->first_layer, templ->last_layer, res->base.b.array_size);
|
||||
|
||||
return ivci;
|
||||
}
|
||||
|
|
@ -110,13 +110,13 @@ create_ivci(struct zink_screen *screen,
|
|||
static void
|
||||
init_pipe_surface_info(struct pipe_context *pctx, struct pipe_surface *psurf, const struct pipe_surface *templ, const struct pipe_resource *pres)
|
||||
{
|
||||
unsigned int level = templ->u.tex.level;
|
||||
unsigned int level = templ->level;
|
||||
psurf->context = pctx;
|
||||
psurf->format = templ->format;
|
||||
psurf->nr_samples = templ->nr_samples;
|
||||
psurf->u.tex.level = level;
|
||||
psurf->u.tex.first_layer = templ->u.tex.first_layer;
|
||||
psurf->u.tex.last_layer = templ->u.tex.last_layer;
|
||||
psurf->level = level;
|
||||
psurf->first_layer = templ->first_layer;
|
||||
psurf->last_layer = templ->last_layer;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -276,7 +276,7 @@ zink_create_surface(struct pipe_context *pctx,
|
|||
{
|
||||
struct zink_resource *res = zink_resource(pres);
|
||||
struct zink_screen *screen = zink_screen(pctx->screen);
|
||||
bool is_array = templ->u.tex.last_layer != templ->u.tex.first_layer;
|
||||
bool is_array = templ->last_layer != templ->first_layer;
|
||||
bool needs_mutable = false;
|
||||
enum pipe_texture_target target_2d[] = {PIPE_TEXTURE_2D, PIPE_TEXTURE_2D_ARRAY};
|
||||
if (!res->obj->dt && zink_format_needs_mutable(pres->format, templ->format)) {
|
||||
|
|
@ -290,7 +290,7 @@ zink_create_surface(struct pipe_context *pctx,
|
|||
|
||||
...but this is allowed with a maintenance6 property
|
||||
*/
|
||||
if (util_format_is_compressed(pres->format) && templ->u.tex.first_layer != templ->u.tex.last_layer &&
|
||||
if (util_format_is_compressed(pres->format) && templ->first_layer != templ->last_layer &&
|
||||
(!screen->info.have_KHR_maintenance6 || !screen->info.maint6_props.blockTexelViewCompatibleMultipleLayers))
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1228,9 +1228,9 @@ static struct pipe_surface *create_img_surface_bo(struct rendering_state *state,
|
|||
|
||||
const struct pipe_surface template = {
|
||||
.format = pformat,
|
||||
.u.tex.first_layer = range->baseArrayLayer + base_layer,
|
||||
.u.tex.last_layer = range->baseArrayLayer + base_layer + layer_count - 1,
|
||||
.u.tex.level = range->baseMipLevel + level,
|
||||
.first_layer = range->baseArrayLayer + base_layer,
|
||||
.last_layer = range->baseArrayLayer + base_layer + layer_count - 1,
|
||||
.level = range->baseMipLevel + level,
|
||||
};
|
||||
|
||||
return state->pctx->create_surface(state->pctx,
|
||||
|
|
@ -1255,7 +1255,7 @@ static void add_img_view_surface(struct rendering_state *state,
|
|||
int layer_count)
|
||||
{
|
||||
if (imgv->surface) {
|
||||
if ((imgv->surface->u.tex.last_layer - imgv->surface->u.tex.first_layer) != (layer_count - 1))
|
||||
if ((imgv->surface->last_layer - imgv->surface->first_layer) != (layer_count - 1))
|
||||
pipe_surface_reference(&imgv->surface, NULL);
|
||||
}
|
||||
|
||||
|
|
@ -1580,7 +1580,7 @@ replicate_attachment(struct rendering_state *state,
|
|||
struct lvp_image_view *src,
|
||||
struct lvp_image_view *dst)
|
||||
{
|
||||
unsigned level = dst->surface->u.tex.level;
|
||||
unsigned level = dst->surface->level;
|
||||
const struct pipe_box box = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
|
|
|
|||
|
|
@ -525,7 +525,7 @@ VdpStatus vlVdpVideoSurfaceDMABuf(VdpVideoSurface surface,
|
|||
|
||||
memset(&whandle, 0, sizeof(struct winsys_handle));
|
||||
whandle.type = WINSYS_HANDLE_TYPE_FD;
|
||||
whandle.layer = surf->u.tex.first_layer;
|
||||
whandle.layer = surf->first_layer;
|
||||
|
||||
pscreen = surf->texture->screen;
|
||||
if (!pscreen->resource_get_handle(pscreen, p_surf->device->context,
|
||||
|
|
|
|||
|
|
@ -390,18 +390,6 @@ struct pipe_stencil_ref
|
|||
uint8_t ref_value[2];
|
||||
};
|
||||
|
||||
union pipe_surface_desc {
|
||||
struct {
|
||||
unsigned level;
|
||||
unsigned first_layer:16;
|
||||
unsigned last_layer:16;
|
||||
} tex;
|
||||
struct {
|
||||
unsigned first_element;
|
||||
unsigned last_element;
|
||||
} buf;
|
||||
};
|
||||
|
||||
/**
|
||||
* A view into a texture that can be bound to a color render target /
|
||||
* depth stencil attachment point.
|
||||
|
|
@ -410,17 +398,19 @@ struct pipe_surface
|
|||
{
|
||||
struct pipe_reference reference;
|
||||
enum pipe_format format:16;
|
||||
struct pipe_resource *texture; /**< resource into which this is a view */
|
||||
struct pipe_context *context; /**< context this surface belongs to */
|
||||
|
||||
/**
|
||||
* Number of samples for the surface. This will be 0 if rendering
|
||||
* should use the resource's nr_samples, or another value if the resource
|
||||
* is bound using FramebufferTexture2DMultisampleEXT.
|
||||
*/
|
||||
unsigned nr_samples:8;
|
||||
unsigned nr_samples:16;
|
||||
|
||||
union pipe_surface_desc u;
|
||||
unsigned first_layer:16;
|
||||
unsigned last_layer:16;
|
||||
unsigned level;
|
||||
|
||||
struct pipe_resource *texture; /**< resource into which this is a view */
|
||||
struct pipe_context *context; /**< context this surface belongs to */
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -369,14 +369,14 @@ blit_info_from_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *srcR
|
|||
{
|
||||
if (srcRb) {
|
||||
blit->src.resource = srcRb->texture;
|
||||
blit->src.level = srcRb->surface.u.tex.level;
|
||||
blit->src.box.z = srcRb->surface.u.tex.first_layer;
|
||||
blit->src.level = srcRb->surface.level;
|
||||
blit->src.box.z = srcRb->surface.first_layer;
|
||||
blit->src.format = _mesa_renderbuffer_get_format(ctx, srcRb);
|
||||
}
|
||||
if (dstRb) {
|
||||
blit->dst.resource = dstRb->texture;
|
||||
blit->dst.level = dstRb->surface.u.tex.level;
|
||||
blit->dst.box.z = dstRb->surface.u.tex.first_layer;
|
||||
blit->dst.level = dstRb->surface.level;
|
||||
blit->dst.box.z = dstRb->surface.first_layer;
|
||||
blit->dst.format = _mesa_renderbuffer_get_format(ctx, dstRb);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -483,8 +483,8 @@ _mesa_map_renderbuffer(struct gl_context *ctx,
|
|||
_mesa_update_renderbuffer_surface(ctx, rb);
|
||||
map = pipe_texture_map(pipe,
|
||||
rb->texture,
|
||||
rb->surface.u.tex.level,
|
||||
rb->surface.u.tex.first_layer,
|
||||
rb->surface.level,
|
||||
rb->surface.first_layer,
|
||||
transfer_flags, x, y2, w, h, &rb->transfer);
|
||||
if (map) {
|
||||
if (invert) {
|
||||
|
|
@ -638,7 +638,7 @@ _mesa_update_renderbuffer_surface(struct gl_context *ctx,
|
|||
rb->surface.format = format;
|
||||
rb->surface.texture = rb->texture;
|
||||
rb->surface.nr_samples = nr_samples;
|
||||
rb->surface.u.tex.level = level;
|
||||
rb->surface.u.tex.first_layer = first_layer;
|
||||
rb->surface.u.tex.last_layer = last_layer;
|
||||
rb->surface.level = level;
|
||||
rb->surface.first_layer = first_layer;
|
||||
rb->surface.last_layer = last_layer;
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue