Commit fb1b68b3 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Special attributes

parent 236cddb9
......@@ -263,6 +263,11 @@ struct mali_payload_set_value {
u64 unknown;
} __attribute__((packed));
/* Special attributes have a fixed index */
#define MALI_SPECIAL_ATTRIBUTE_BASE 16
#define MALI_VERTEX_ID (MALI_SPECIAL_ATTRIBUTE_BASE + 0)
#define MALI_INSTANCE_ID (MALI_SPECIAL_ATTRIBUTE_BASE + 1)
struct mali_attr {
mali_ptr elements;
u32 stride;
......
......@@ -349,11 +349,13 @@ void panwrap_replay_attributes(const struct panwrap_mapped_memory *mem,
size_t vertex_count;
size_t component_count;
if (!varying) {
/* gl_VertexID and gl_InstanceID do not have elements to
* decode; we would crash if we tried */
if (!varying && i < MALI_SPECIAL_ATTRIBUTE_BASE) {
/* TODO: Attributes are not necessarily float32 vectors in general;
* decoding like this without snarfing types from the shader is unsafe all things considered */
return;
float *buffer = panwrap_fetch_gpu_mem(mem, raw_elements, attr[i].size);
vertex_count = attr[i].size / attr[i].stride;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment