Hello, This series adds support for clip/cull distances in the Intel Vulkan driver. It works a little differently than how we did it in OpenGL.
In GL, we have a pass that combines both float[] arrays into a single vec4[2] variable. Drivers see a vec4[2] with swizzles and writemasks. The pass is a bit complicated, but works. This series retains float[] arrays. It introduces a new "compact array" concept. A nir_variable with the "compact" flag set will be tightly packed into vec4 slots, with one scalar per component, rather than the usual sparse packing (one scalar per slot). In other words, a float[8] compact array will occupy 2 slots, rather than 8 slots. nir_lower_io uses the location field for the array index / 4, and the "component" field (from ARB_enhanced_layouts) for the array index % 4. We still need a pass to pack clip/cull distances together into a single array, rather than two arrays. It's pretty straightforward. I'm not sure whether this is a better approach than just converting to vec4[2] and swizzles/writemasks. It's pretty simple, and will likely be reusable for gl_TessLevelInner/Outer[] as well. The last patch uses the new approach in OpenGL, mostly for testing purposes. I ran shader-db statistics for programs using ClipDistance, and the instruction counts were identical via either method. --Ken _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev