mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 02:28:10 +02:00
asahi: support bigger buffer textures
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29607>
This commit is contained in:
parent
b88bcca459
commit
ff032297de
4 changed files with 11 additions and 11 deletions
|
|
@ -113,8 +113,8 @@ lower_tex_crawl(nir_builder *b, nir_instr *instr, UNUSED void *data)
|
|||
static nir_def *
|
||||
coords_for_buffer_texture(nir_builder *b, nir_def *coord)
|
||||
{
|
||||
return nir_vec2(b, nir_iand_imm(b, coord, BITFIELD_MASK(10)),
|
||||
nir_ushr_imm(b, coord, 10));
|
||||
return nir_vec2(b, nir_umod_imm(b, coord, AGX_TEXTURE_BUFFER_WIDTH),
|
||||
nir_udiv_imm(b, coord, AGX_TEXTURE_BUFFER_WIDTH));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -16,6 +16,12 @@ struct nir_instr;
|
|||
/* Texture backend flags */
|
||||
#define AGX_TEXTURE_FLAG_NO_CLAMP (1 << 0)
|
||||
|
||||
/* Texel buffers lowered to (at most) 16384x16384 2D textures */
|
||||
#define AGX_TEXTURE_BUFFER_WIDTH 16384
|
||||
#define AGX_TEXTURE_BUFFER_MAX_HEIGHT 16384
|
||||
#define AGX_TEXTURE_BUFFER_MAX_SIZE \
|
||||
(AGX_TEXTURE_BUFFER_WIDTH * AGX_TEXTURE_BUFFER_MAX_HEIGHT)
|
||||
|
||||
bool agx_nir_lower_texture_early(struct nir_shader *s, bool support_lod_bias);
|
||||
bool agx_nir_lower_texture(struct nir_shader *s);
|
||||
bool agx_nir_lower_multisampled_image_store(struct nir_shader *s);
|
||||
|
|
|
|||
|
|
@ -715,7 +715,7 @@ agx_pack_texture(void *out, struct agx_resource *rsrc,
|
|||
agx_texture_buffer_size_el(format, state->u.buf.size);
|
||||
|
||||
/* Use a 2D texture to increase the maximum size */
|
||||
cfg.width = 1024;
|
||||
cfg.width = AGX_TEXTURE_BUFFER_WIDTH;
|
||||
cfg.height = DIV_ROUND_UP(size_el, cfg.width);
|
||||
cfg.first_level = cfg.last_level = 0;
|
||||
|
||||
|
|
@ -1253,7 +1253,7 @@ agx_batch_upload_pbe(struct agx_batch *batch, struct agx_pbe_packed *out,
|
|||
cfg.buffer += view->u.buf.offset;
|
||||
|
||||
/* Use a 2D texture to increase the maximum size */
|
||||
cfg.width = 1024;
|
||||
cfg.width = AGX_TEXTURE_BUFFER_WIDTH;
|
||||
cfg.height = DIV_ROUND_UP(size_el, cfg.width);
|
||||
cfg.level = 0;
|
||||
cfg.stride = (cfg.width * util_format_get_blocksize(view->format)) - 4;
|
||||
|
|
@ -1273,7 +1273,7 @@ agx_batch_upload_pbe(struct agx_batch *batch, struct agx_pbe_packed *out,
|
|||
|
||||
cfg.dimension = AGX_TEXTURE_DIMENSION_2D;
|
||||
cfg.layout = AGX_LAYOUT_LINEAR;
|
||||
cfg.width = 1024;
|
||||
cfg.width = AGX_TEXTURE_BUFFER_WIDTH;
|
||||
cfg.height = DIV_ROUND_UP(size_px, cfg.width);
|
||||
cfg.stride = (cfg.width * blocksize_B) - 4;
|
||||
cfg.layers = 1;
|
||||
|
|
|
|||
|
|
@ -1160,12 +1160,6 @@ agx_render_condition_check(struct agx_context *ctx)
|
|||
return agx_render_condition_check_inner(ctx);
|
||||
}
|
||||
|
||||
/* Texel buffers lowered to (at most) 1024x16384 2D textures */
|
||||
#define AGX_TEXTURE_BUFFER_WIDTH 1024
|
||||
#define AGX_TEXTURE_BUFFER_MAX_HEIGHT 16384
|
||||
#define AGX_TEXTURE_BUFFER_MAX_SIZE \
|
||||
(AGX_TEXTURE_BUFFER_WIDTH * AGX_TEXTURE_BUFFER_MAX_HEIGHT)
|
||||
|
||||
static inline uint32_t
|
||||
agx_texture_buffer_size_el(enum pipe_format format, uint32_t size)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue