diff options
author | Rohan Garg <[email protected]> | 2019-07-17 18:50:13 +0200 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-08-06 17:18:19 -0700 |
commit | 16edd56fccad7ba0e1b938a60f0f5e927a104585 (patch) | |
tree | 76dd9dcc3475b4883bfb295a5fef8f8f9020d937 /src/panfrost | |
parent | 4bb17c08ae5d734894de0fcefe6a9645b443bf34 (diff) |
panfrost: Take into account a index_bias for glDrawElementsBaseVertex calls
Midgard does not accept a index_bias directly and relies instead on a
bias correction offset (offset_bias_correction) in order to calculate
the unbiased vertex index.
We need to make sure we adjust offset_start and vertex_count in order to
take into account the index_bias as required by a
glDrawElementsBaseVertex call and then supply a additional
offset_bias_correction to the hardware.
Signed-off-by: Rohan Garg <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/panfrost')
-rw-r--r-- | src/panfrost/include/panfrost-job.h | 21 | ||||
-rw-r--r-- | src/panfrost/pandecode/decode.c | 8 |
2 files changed, 22 insertions, 7 deletions
diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h index 9179ceff2ec..98d77e718fc 100644 --- a/src/panfrost/include/panfrost-job.h +++ b/src/panfrost/include/panfrost-job.h @@ -935,8 +935,23 @@ struct mali_vertex_tiler_prefix { u32 workgroups_x_shift_3 : 6; - /* Negative of draw_start for TILER jobs from what I've seen */ - int32_t negative_start; + /* Negative of min_index. This is used to compute + * the unbiased index in tiler/fragment shader runs. + * + * The hardware adds offset_bias_correction in each run, + * so that absent an index bias, the first vertex processed is + * genuinely the first vertex (0). But with an index bias, + * the first vertex process is numbered the same as the bias. + * + * To represent this more conviniently: + * unbiased_index = lower_bound_index + + * index_bias + + * offset_bias_correction + * + * This is done since the hardware doesn't accept a index_bias + * and this allows it to recover the unbiased index. + */ + int32_t offset_bias_correction; u32 zero1; /* Like many other strictly nonzero quantities, index_count is @@ -1080,7 +1095,7 @@ struct midgard_payload_vertex_tiler { u8 zero4; /* Offset for first vertex in buffer */ - u32 draw_start; + u32 offset_start; u64 zero5; diff --git a/src/panfrost/pandecode/decode.c b/src/panfrost/pandecode/decode.c index 080d650fc5a..78f6da6e56c 100644 --- a/src/panfrost/pandecode/decode.c +++ b/src/panfrost/pandecode/decode.c @@ -1334,8 +1334,8 @@ pandecode_vertex_tiler_prefix(struct mali_vertex_tiler_prefix *p, int job_no) if (p->index_count) pandecode_prop("index_count = MALI_POSITIVE(%" PRId32 ")", p->index_count + 1); - if (p->negative_start) - pandecode_prop("negative_start = %d", p->negative_start); + if (p->offset_bias_correction) + pandecode_prop("offset_bias_correction = %d", p->offset_bias_correction); DYN_MEMORY_PROP(p, job_no, indices); @@ -2181,8 +2181,8 @@ pandecode_vertex_or_tiler_job_mdg(const struct mali_job_descriptor_header *h, pandecode_padded_vertices(v->instance_shift, v->instance_odd); } - if (v->draw_start) - pandecode_prop("draw_start = %d", v->draw_start); + if (v->offset_start) + pandecode_prop("offset_start = %d", v->offset_start); if (v->zero5) { pandecode_msg("Zero tripped\n"); |