Alyssa Rosenzweig <aly...@rosenzweig.io> writes: > Hi all, > > Certain embedded GPUs do not implement coordinate transformation in > hardware. Instead, section 12.5 "Coordinate Transformation" of the ES > 3.2 specification is implemented in the vertex shader itself. Relevant > examples include Midgard and vc4. > > To handle this, a lowering pass is needed to convert gl_Position writes > to screen space writes. The vc4 driver lowers this in the backend IR; > however, I don't think the pass needs to be specialised to the backend. > For Midgard, I have written a NIR lowering pass to implement the same, > which enables the lowered instructions themselves to be optimised. > > At the moment, this pass lives inside the (downstream) Midgard compiler. > In the future, it will be necessary for the Bifrost compiler as well, > should that use NIR. That said, Bifrost will share the same Gallium > driver, so the pass could still live in the driver > (src/gallium/drivers/panfrost). > > Should this pass be moved into common code (src/compiler/nir)? If so, > what would the driver agnostic way of passing viewport parameters be? > Both vc4 and Midgard currently use/will use special uniforms for this > purpose. Similarly, is there a driver agnostic way of representing the > transformed write? The Midgard pass emits `nir_instrinic_store_output` > for the final value, but I'm not sure if this is generalisable.
I don't think I can really use a generic lowering on vc4 and v3d, FWIW. I need to store both the scaled and unscaled vertex coordinates in my coordinate shader. What might be nice for me would be the ability to lower output stores to a store intrinsic with a totally custom offset (unrelated to any VARYING_SLOT), and which doesn't get reordered relative to other store intrinsics. Right now I have to emit my stores in order in an epilogue and then try to coalesce an ALU op into the store, rather than having something in NIR that would be easier to coalesce.
signature.asc
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev