panfrost: Make instancing code more obvious

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>
This commit is contained in:
Alyssa Rosenzweig 2021-06-03 15:14:00 -04:00 committed by Marge Bot
parent 552fdc7ea4
commit 4b52b0841f

View file

@ -1724,23 +1724,24 @@ panfrost_emit_vertex_data(struct panfrost_batch *batch,
unsigned hw_divisor = ctx->padded_count * divisor;
/* If there's a divisor(=1) but no instancing, we want every
* attribute to be the same */
if (ctx->instance_count <= 1) {
/* Per-instance would be every attribute equal */
if (divisor)
stride = 0;
if (divisor && ctx->instance_count == 1)
stride = 0;
if (!divisor || ctx->instance_count <= 1) {
pan_pack(bufs + k, ATTRIBUTE_BUFFER, cfg) {
if (ctx->instance_count > 1) {
cfg.type = MALI_ATTRIBUTE_TYPE_1D_MODULUS;
cfg.divisor = ctx->padded_count;
}
cfg.pointer = addr;
cfg.stride = stride;
cfg.size = size;
}
} else if (!divisor) {
pan_pack(bufs + k, ATTRIBUTE_BUFFER, cfg) {
cfg.type = MALI_ATTRIBUTE_TYPE_1D_MODULUS;
cfg.pointer = addr;
cfg.stride = stride;
cfg.size = size;
cfg.divisor = ctx->padded_count;
}
} else if (util_is_power_of_two_or_zero(hw_divisor)) {
pan_pack(bufs + k, ATTRIBUTE_BUFFER, cfg) {
cfg.type = MALI_ATTRIBUTE_TYPE_1D_POT_DIVISOR;