Skip to content

mesa/st: implement hardware accelerated GL_SELECT

Qiang Yu requested to merge yuq825/mesa:topic/hw-gl-select into main

Use an internal geometry shader to handle input primitives. Do full accurate culling and clipping in the shader and output hit result and min/max depth to a SSBO for final being written to select buffer.

With multiple result slots in SSBO we can left multiple draws on the fly and wait them done when buffer is full or exit GL_SELECT mode.

This provides quicker selection response compared to software based solution. Tested on Discovery Studio 2020: some complex model needs 1~2s selection response time originally, now it's almost selected immidiately.

Also tested with piglit select test case.

The problem of this implementation is using too many registers (on AMD GPU it costs 144 VGPR) because it needs an array to store clipped vertices which is scaled by clip plane number. But it's still much faster than software implementation. One way to improve the current implementation is using shader core local storage like LDS of AMD GPU.

Need to set MESA_HW_ACCEL_SELECT to enabled this path.

Only target supporting OpenGL < 3.0, so user geometry/tessellation shader, gl_CullDistance/gl_ClipDistance, multi viewport, glClipControl and new primitive types like GL_LINES_ADJACENCY/GL_LINE_STRIP_ADJACENCY/GL_TRIANGLES_ADJACENCY/GL_TRIANGLE_STRIP_ADJACENCY won't work and get error message.

Edited by Qiang Yu

Merge request reports