diff options
author | Paul Berry <[email protected]> | 2011-09-26 13:15:57 -0700 |
---|---|---|
committer | Paul Berry <[email protected]> | 2011-10-05 11:50:21 -0700 |
commit | 7d68c639ddb0f9df45cf698b8e8227bf1860b5fe (patch) | |
tree | 5d4323977f2e7e514f6c29818cea375f09cb9905 /src/mesa | |
parent | e2072a1046039403d814613553e7b3b563d43dfc (diff) |
mesa: Add a gl_vert_result for gl_ClipVertex.
Before this patch, clip planes didn't work properly in Mesa when using
vertex shaders, because Mesa assigned both gl_ClipVertex and
gl_Position to the same gl_vert_result (VERT_RESULT_HPOS). As a
result, backends couldn't distinguish between the two variables, so
any shader that wrote different values to them would fail to work
properly.
This patch paves the way for proper support of gl_ClipVertex by
creating a new enumerated value in gl_vert_result for it
(VERT_RESULT_CLIP_VERTEX). After this patch, a back-end may add
support for gl_ClipVertex using the following algorithm:
- If using a user-supplied GLSL vertex shader:
- If the bit corresponding to VERT_RESULT_CLIP_VERTEX is set in
gl_program::OutputsWritten:
- Clip using the vertex shader output VERT_RESULT_CLIP_VERTEX and
the clip planes defined in gl_context::Transform.EyeUserPlane.
- Else:
- Clip using the vertex shader output VERT_RESULT_HPOS and the
clip planes defined in gl_context::Transform.EyeUserPlane.
- Else (either using fixed function or an ARB vertex program):
- Clip using the vertex shader output VERT_RESULT_HPOS and the clip
planes defined in gl_context::Transform._ClipUserPlane (*)
where (*) represents the normal Mesa behavior before this patch.
An example of implementing the above algorithm can be found in the
patch that follows this one, which implements gl_ClipVertex in i965
Gen6.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/mtypes.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 67db4df8f79..71cbe0443d9 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -214,9 +214,10 @@ typedef enum VERT_RESULT_BFC0 = 13, VERT_RESULT_BFC1 = 14, VERT_RESULT_EDGE = 15, - VERT_RESULT_CLIP_DIST0 = 16, - VERT_RESULT_CLIP_DIST1 = 17, - VERT_RESULT_VAR0 = 18, /**< shader varying */ + VERT_RESULT_CLIP_VERTEX = 16, + VERT_RESULT_CLIP_DIST0 = 17, + VERT_RESULT_CLIP_DIST1 = 18, + VERT_RESULT_VAR0 = 19, /**< shader varying */ VERT_RESULT_MAX = (VERT_RESULT_VAR0 + MAX_VARYING) } gl_vert_result; |