diff options
author | Jason Ekstrand <jason.ekstrand@intel.com> | 2017-03-01 11:53:41 -0800 |
---|---|---|
committer | Jason Ekstrand <jason.ekstrand@intel.com> | 2017-03-01 16:14:03 -0800 |
commit | a2195e561a1ef2be1398c05fe83299638220f5ff (patch) | |
tree | 17b358148f8e3e67ece7039e0f325b805a579816 /src/mesa/drivers/dri/i965/brw_vs.c | |
parent | 818bfdfa1569d271639548b94816d7e749e77bde (diff) |
i965: Move select_clip_planes to brw_vs.c
Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_vs.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 3f11a76506e..a9c474ac06a 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -43,6 +43,32 @@ #include "util/ralloc.h" +/** + * Decide which set of clip planes should be used when clipping via + * gl_Position or gl_ClipVertex. + */ +gl_clip_plane * +brw_select_clip_planes(struct gl_context *ctx) +{ + if (ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]) { + /* There is currently a GLSL vertex shader, so clip according to GLSL + * rules, which means compare gl_ClipVertex (or gl_Position, if + * gl_ClipVertex wasn't assigned) against the eye-coordinate clip planes + * that were stored in EyeUserPlane at the time the clip planes were + * specified. + */ + return ctx->Transform.EyeUserPlane; + } else { + /* Either we are using fixed function or an ARB vertex program. In + * either case the clip planes are going to be compared against + * gl_Position (which is in clip coordinates) so we have to clip using + * _ClipUserPlane, which was transformed into clip coordinates by Mesa + * core. + */ + return ctx->Transform._ClipUserPlane; + } +} + GLbitfield64 brw_vs_outputs_written(struct brw_context *brw, struct brw_vs_prog_key *key, GLbitfield64 user_varyings) |