Skip to content

lima: implement clip plane lowering

Erico Nunes requested to merge enunes/mesa:lima-clip-planes into main

This is a followup to !7088 (merged). I had started an investigation about this using OpenGL ES 1 in comments !7088 (comment 650663) and below.

It is based on the vc4 clip plane lowering implementation, and follows the same method as the mali driver.

Mesa does have some built-in partial handling for clip planes in st_program, but to correctly handle enabling and disabling clip planes during runtime, clip plane lowering must be implemented in the backend too.

For the vertex shader in lima, the load_user_clip_plane intrinsic must be created before nir_lower_viewport_transform. Otherwise, it uses the transformed position which is not what is expected while calculating clip plane coordinates. This is what took me longer to figure out.

Merge request reports