[Mesa-dev] [PATCH v2 0/2] Implement gl_ClipVertex on i965 Gen6+

Paul Berry stereotype441 at gmail.com
Mon Oct 3 14:17:55 PDT 2011


This is a minor rework of a patch series I submitted on 9/27 to
implement gl_ClipVertex on i965 Gen6 and above.  They key subtlety
here is that due to differences in coordinate system conventions used
by GLSL vs fixed function shaders, we need to use the "eye coordinate"
clip planes when compiling a GLSL vertex shader, and the "clip
coordinate" clip planes when compiling the fixed function vertex
program or an ARB vertex program (for a 700-word essay on why I
believe this is correct, see
http://lists.freedesktop.org/archives/mesa-dev/2011-September/012785.html).

In the previous version of this patch series, I lazily took advantage
of the fact that i965 uses its new vertex shader back-end for
compiling GLSL vertex shaders, and its old vertex shader back-end for
compiling fixed function and ARB vertex programs.  That wasn't future
proof because eventually we hope to use the new vertex shader back-end
for all programs.  In the revised patch series, I have created a
function brw_select_clip_planes() that chooses the correct set of clip
planes based on the state of ctx->Shader.CurrentVertexProgram, which
should be future proof.

Note: to make the type signature of brw_select_clip_planes()
comprehensible I created the typedef:

    typedef GLfloat GLclipplane[4];

I'm not really certain that this is the best name for this typedef (or
that I put it in a terribly good place) so if anyone feels the urge to
bike-shed about it, now is your chance.

[PATCH v2 1/2] mesa: Add a gl_vert_result for gl_ClipVertex.
[PATCH v2 2/2] i965 Gen6: Implement gl_ClipVertex.


More information about the mesa-dev mailing list