mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
asahi: Allow large uniform records
Now that we've fixed the binding XML, it's obvious how to bind lots of uniforms in a single record. This is simpler and more efficient. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17198>
This commit is contained in:
parent
c045d3761c
commit
6d6dd44f82
1 changed files with 6 additions and 20 deletions
|
|
@ -1086,30 +1086,16 @@ agx_build_pipeline(struct agx_context *ctx, struct agx_compiled_shader *cs, enum
|
|||
|
||||
uint8_t *record = ptr.cpu;
|
||||
|
||||
/* There is a maximum number of half words we may push with a single
|
||||
* BIND_UNIFORM record, so split up the range to fit. We only need to call
|
||||
* agx_push_location once, however, which reduces the cost. */
|
||||
unsigned unif_records = 0;
|
||||
|
||||
for (unsigned i = 0; i < cs->info.push_ranges; ++i) {
|
||||
struct agx_push push = cs->info.push[i];
|
||||
uint64_t buffer = agx_push_location(ctx, push, stage);
|
||||
unsigned halfs_per_record = 14;
|
||||
unsigned records = DIV_ROUND_UP(push.length, halfs_per_record);
|
||||
|
||||
/* Ensure we don't overflow */
|
||||
unif_records += records;
|
||||
assert(unif_records < 16);
|
||||
|
||||
for (unsigned j = 0; j < records; ++j) {
|
||||
agx_pack(record, BIND_UNIFORM, cfg) {
|
||||
cfg.start_halfs = push.base + (j * halfs_per_record);
|
||||
cfg.size_halfs = MIN2(push.length - (j * halfs_per_record), halfs_per_record);
|
||||
cfg.buffer = buffer + (j * halfs_per_record * 2);
|
||||
}
|
||||
|
||||
record += AGX_BIND_UNIFORM_LENGTH;
|
||||
agx_pack(record, BIND_UNIFORM, cfg) {
|
||||
cfg.start_halfs = push.base;
|
||||
cfg.size_halfs = push.length;
|
||||
cfg.buffer = agx_push_location(ctx, push, stage);
|
||||
}
|
||||
|
||||
record += AGX_BIND_UNIFORM_LENGTH;
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < ctx->stage[stage].texture_count; ++i) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue