Skip to content

asahi: Rework system value lowering + support compute kernels!

Alyssa Rosenzweig requested to merge alyssa/mesa:agx/compute into main

The previous lowering was insufficient in two areas:

  • No support for indirection. This is required for dynamically indexing into UBOs, SSBOS, etc in OpenGL ES 3.2

  • Only a single table supported. Multiple tables are required to implement indirect dispatch/draws efficiently, in order to bind the indirect buffer as uniforms.

The first problem is addressed here by reworking the lowering of system values to happen in NIR, decoupled from the uniform register assignment details, such that we can handle 1:n lowerings in a straightforward way. Namely, indirect sysvals are lowered to indirect memory loads relative to the base address of the sysval table, where the table address is itself pushed as a (direct) sysval.

The second problem is addressed in this patch by generalizing to multiple uniform tables.

After that rework, implementing compute kernels is straightforward.

Merge request reports