[Mesa-dev] GLSL clipping
brianp at vmware.com
Thu Jun 3 07:42:15 PDT 2010
tom fogal wrote:
> I'm using the classic (OS)Mesa driver w/ GLSL.
> I see from:
> that gl_ClipVertex is unsupported, which probably explains why I'm
> getting such strange results when I use it :)
> I might be interested in taking a stab at this, or perhaps just skip
> ClipVertex entirely and jump right to ClipDistance. The machinery
> is basically all there, right? It seems like the compiler already
> parses this (or ignores unknown tokens?); would I just need to add some
> semantic analysis && then glue to call the existing clipping code, or
> am I opening up a large can of worms here?
We don't have any infrastructure in place for gl_ClipVertex or
gl_ClipDistance yet. The former is used in GLSL 1.10 and 1.20 but
deprecated in favor of the later in GLSL 1.30 and later.
We should support both to be complete, but I'd probably start with
gl_ClipDistance first since it's the way forward.
Among the tasks:
- Add new VERT_RESULT_* entries for at least 6 clip distances.
- Add gl_ClipDistance to the vertOutputs list in slang_builtin.c and
- The old Mesa TNL pipeline's clipping code should probably be
refactored into several sub-steps:
1. for fixed-function: compute clip distances and save them.
2. Set the VB->ClipMask flags to TRUE for vertices whose clip
distance is negative.
3. do clipping/interpolation using clip distances.
- For Gallium we'll probably need TGSI semantic tags for clip
distances, plus a refactoring of the clip code as for TNL. But I'd
have to study things a bit to be sure what's needed.
I know you're using OSMesa but I'd probably opt to implement this in
gallium first. Someday I want to write a new version of the OSMesa
interface based on gallium...
More information about the mesa-dev