cl_u32(&vc4->shader_rec, 0); /* UBO offset written by kernel */
cl_u16(&vc4->shader_rec, 0); /* vs num uniforms */
- cl_u8(&vc4->shader_rec, (1 << num_elements_emit) - 1); /* vs attribute array bitfield */
- cl_u8(&vc4->shader_rec, 16 * num_elements_emit); /* vs total attribute size */
+ cl_u8(&vc4->shader_rec, vc4->prog.vs->vattrs_live);
+ cl_u8(&vc4->shader_rec, vc4->prog.vs->vattr_offsets[8]);
cl_reloc(vc4, &vc4->shader_rec, vc4->prog.vs->bo, 0);
cl_u32(&vc4->shader_rec, 0); /* UBO offset written by kernel */
cl_u16(&vc4->shader_rec, 0); /* cs num uniforms */
- cl_u8(&vc4->shader_rec, (1 << num_elements_emit) - 1); /* cs attribute array bitfield */
- cl_u8(&vc4->shader_rec, 16 * num_elements_emit); /* cs total attribute size */
+ cl_u8(&vc4->shader_rec, vc4->prog.cs->vattrs_live);
+ cl_u8(&vc4->shader_rec, vc4->prog.cs->vattr_offsets[8]);
cl_reloc(vc4, &vc4->shader_rec, vc4->prog.cs->bo, 0);
cl_u32(&vc4->shader_rec, 0); /* UBO offset written by kernel */
cl_reloc(vc4, &vc4->shader_rec, rsc->bo, offset);
cl_u8(&vc4->shader_rec, elem_size - 1);
cl_u8(&vc4->shader_rec, vb->stride);
- cl_u8(&vc4->shader_rec, vpm_offset); /* VS VPM offset */
- cl_u8(&vc4->shader_rec, vpm_offset); /* CS VPM offset */
+ cl_u8(&vc4->shader_rec, vc4->prog.vs->vattr_offsets[i]);
+ cl_u8(&vc4->shader_rec, vc4->prog.cs->vattr_offsets[i]);
vpm_offset += align(elem_size, 4);
uint32_t attr_size = util_format_get_blocksize(format);
struct qreg vpm_reads[4];
+ c->vattr_sizes[attr] = align(attr_size, 4);
for (int i = 0; i < align(attr_size, 4) / 4; i++) {
struct qreg vpm = { QFILE_VPM, attr * 4 + i };
vpm_reads[i] = qir_MOV(c, vpm);
if (c->num_inputs)
return;
- for (int i = 0; i < 4; i++) {
- struct qreg vpm = { QFILE_VPM, 0 };
- (void)qir_MOV(c, vpm);
- c->num_inputs++;
- }
+ c->vattr_sizes[0] = 4;
+ struct qreg vpm = { QFILE_VPM, 0 };
+ (void)qir_MOV(c, vpm);
+ c->num_inputs++;
}
static void
}
} else {
shader->num_inputs = c->num_inputs;
+
+ shader->vattr_offsets[0] = 0;
+ for (int i = 0; i < 8; i++) {
+ shader->vattr_offsets[i + 1] =
+ shader->vattr_offsets[i] + c->vattr_sizes[i];
+
+ if (c->vattr_sizes[i])
+ shader->vattrs_live |= (1 << i);
+ }
}
copy_uniform_state_to_shader(shader, c);