On Thu, May 3, 2018 at 3:12 PM, Alyssa Rosenzweig <aly...@rosenzweig.io> wrote: > 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. >
maybe look at the user_clip_plane lowering as an example, ie. nir_intrinsic_load_user_clip_plane there are a few other examples of sysval's that lower to driver_params (ie. things driver stuffs in special uniforms, basically) BR, -R > I can send the Midgard code as an RFC if there's interest. > > Thanks, > > -Alyssa > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev