agx/tilebuffer: Support layered layouts

Just add a flag for it. We don't care about the actual # of layers when
calculating the layout, only the boolean fact of being layered or not. The
reason we need this at all is because the eMRT implementation needs to
account for layering and that is only keyed off the tilebuffer layout.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
This commit is contained in:
Alyssa Rosenzweig 2023-08-28 08:42:14 -04:00
parent b252630604
commit 041451b655
4 changed files with 13 additions and 6 deletions

View file

@ -48,9 +48,12 @@ agx_select_tile_size(unsigned bytes_per_pixel)
struct agx_tilebuffer_layout
agx_build_tilebuffer_layout(enum pipe_format *formats, uint8_t nr_cbufs,
uint8_t nr_samples)
uint8_t nr_samples, bool layered)
{
struct agx_tilebuffer_layout tib = {.nr_samples = nr_samples};
struct agx_tilebuffer_layout tib = {
.nr_samples = nr_samples,
.layered = layered,
};
uint32_t offset_B = 0;

View file

@ -53,6 +53,9 @@ struct agx_tilebuffer_layout {
/* Number of samples per pixel */
uint8_t nr_samples;
/* If layered rendering is used */
bool layered;
/* Selected tile size */
struct agx_tile_size tile_size;
};
@ -83,7 +86,7 @@ agx_tilebuffer_spills(struct agx_tilebuffer_layout *layout)
struct agx_tilebuffer_layout
agx_build_tilebuffer_layout(enum pipe_format *formats, uint8_t nr_cbufs,
uint8_t nr_samples);
uint8_t nr_samples, bool layered);
bool agx_nir_lower_tilebuffer(struct nir_shader *shader,
struct agx_tilebuffer_layout *tib,

View file

@ -143,7 +143,7 @@ TEST(Tilebuffer, Layouts)
;
struct agx_tilebuffer_layout actual = agx_build_tilebuffer_layout(
tests[i].formats, nr_cbufs, tests[i].nr_samples);
tests[i].formats, nr_cbufs, tests[i].nr_samples, false);
ASSERT_EQ(tests[i].layout.sample_size_B, actual.sample_size_B)
<< tests[i].name;

View file

@ -1545,7 +1545,7 @@ agx_compile_variant(struct agx_device *dev, struct agx_uncompiled_shader *so,
struct asahi_fs_shader_key *key = &key_->fs;
struct agx_tilebuffer_layout tib = agx_build_tilebuffer_layout(
key->rt_formats, key->nr_cbufs, key->nr_samples);
key->rt_formats, key->nr_cbufs, key->nr_samples, false);
if (dev->debug & AGX_DBG_SMALLTILE)
tib.tile_size = (struct agx_tile_size){16, 16};
@ -2585,7 +2585,8 @@ agx_batch_init_state(struct agx_batch *batch)
batch->tilebuffer_layout = agx_build_tilebuffer_layout(
formats, batch->key.nr_cbufs,
util_framebuffer_get_num_samples(&batch->key));
util_framebuffer_get_num_samples(&batch->key),
util_framebuffer_get_num_layers(&batch->key) > 1);
if (agx_device(batch->ctx->base.screen)->debug & AGX_DBG_SMALLTILE)
batch->tilebuffer_layout.tile_size = (struct agx_tile_size){16, 16};