summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/panfrost/include/panfrost-job.h
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-06-27 14:13:10 -0700
committerAlyssa Rosenzweig <[email protected]>2019-07-01 07:50:57 -0700
commit8d74749f812e64968d37266061293e204fea252c (patch)
treedf6d072cef24746172e57214b5a06d1cb4689749 /src/gallium/drivers/panfrost/include/panfrost-job.h
parente9e22546ffd76c6d0738f12d702c54e7758d9e1f (diff)
panfrost: Implement instanced rendering
We implement GLES3.0 instanced rendering with full support for instanced arrays (via instance divisors). To do so, we use the new invocation helpers to invoke a triplet of (1, vertex_count, instance_count), rather than simply (1, vertex_count, 1). We rewrite the attribute handling code into a new pan_instancing.c file which handles both the simple LINEAR case for non-instanced as well as each of the new instancing cases: MODULO (for per-vertex attributes), POT and NPOT divisors. As a side effect, we rework how vertex buffers are handled, duplicating them to be 1:1 with vertex descriptors to simplify instancing code paths dramatically. This might be a performance regression, but this remains to be seen; if so, we can always deduplicate later with some added logic in pan_instancing.c Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost/include/panfrost-job.h')
-rw-r--r--src/gallium/drivers/panfrost/include/panfrost-job.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/gallium/drivers/panfrost/include/panfrost-job.h b/src/gallium/drivers/panfrost/include/panfrost-job.h
index 444e5ad9e69..5c93f319b65 100644
--- a/src/gallium/drivers/panfrost/include/panfrost-job.h
+++ b/src/gallium/drivers/panfrost/include/panfrost-job.h
@@ -834,8 +834,9 @@ struct mali_attr_meta {
/* Always observed to be zero at the moment */
unsigned unknown3 : 2;
- /* When packing multiple attributes in a buffer, offset addresses by this value */
- uint32_t src_offset;
+ /* When packing multiple attributes in a buffer, offset addresses by
+ * this value. Obscurely, this is signed. */
+ int32_t src_offset;
} __attribute__((packed));
enum mali_fbd_type {
@@ -1061,7 +1062,16 @@ struct midgard_payload_vertex_tiler {
u32 zero3;
#endif
- u32 gl_enables; // 0x5
+ u16 gl_enables; // 0x5
+
+ /* Both zero for non-instanced draws. For instanced draws, a
+ * decomposition of padded_num_vertices. See the comments about the
+ * corresponding fields in mali_attr for context. */
+
+ unsigned instance_shift : 5;
+ unsigned instance_odd : 3;
+
+ u8 zero4;
/* Offset for first vertex in buffer */
u32 draw_start;