diff options
author | Kenneth Graunke <[email protected]> | 2015-06-26 15:05:13 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2015-06-28 19:44:34 -0700 |
commit | 19a0ba130fd0d0f3b86181a8d05cf5391420360d (patch) | |
tree | 79c8500386cfb47307342cd4251492890e640b7a /src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | |
parent | 17e8fca626c908dcbedabf57ce175113840e65c2 (diff) |
i965/vs: Move compute_clip_distance() out of emit_urb_writes().
Legacy user clipping (using gl_Position or gl_ClipVertex) is handled by
turning those into the modern gl_ClipDistance equivalents.
This is unnecessary in Core Profile: if user clipping is enabled, but
the shader doesn't write the corresponding gl_ClipDistance entry,
results are undefined. Hence, it is also unnecessary for geometry
shaders.
This patch moves the call up to run_vs(). This is equivalent for VS,
but removes the need to pass clip distances into emit_urb_writes().
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Reviewed-by: Chris Forbes <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs_visitor.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 0cbaf17f1e4..34bf32d7ab3 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -1731,6 +1731,12 @@ fs_visitor::setup_uniform_clipplane_values(gl_clip_plane *clip_planes) } } +/** + * Lower legacy fixed-function and gl_ClipVertex clipping to clip distances. + * + * This does nothing if the shader uses gl_ClipDistance or user clipping is + * disabled altogether. + */ void fs_visitor::compute_clip_distance(gl_clip_plane *clip_planes) { struct brw_vue_prog_data *vue_prog_data = @@ -1738,6 +1744,10 @@ void fs_visitor::compute_clip_distance(gl_clip_plane *clip_planes) const struct brw_vue_prog_key *key = (const struct brw_vue_prog_key *) this->key; + /* Bail unless some sort of legacy clipping is enabled */ + if (!key->userclip_active || prog->UsesClipDistanceOut) + return; + /* From the GLSL 1.30 spec, section 7.1 (Vertex Shader Special Variables): * * "If a linked set of shaders forming the vertex stage contains no @@ -1781,7 +1791,7 @@ void fs_visitor::compute_clip_distance(gl_clip_plane *clip_planes) } void -fs_visitor::emit_urb_writes(gl_clip_plane *clip_planes) +fs_visitor::emit_urb_writes() { int slot, urb_offset, length; struct brw_vs_prog_data *vs_prog_data = @@ -1794,10 +1804,6 @@ fs_visitor::emit_urb_writes(gl_clip_plane *clip_planes) bool flush; fs_reg sources[8]; - /* Lower legacy ff and ClipVertex clipping to clip distances */ - if (key->base.userclip_active && !prog->UsesClipDistanceOut) - compute_clip_distance(clip_planes); - /* If we don't have any valid slots to write, just do a minimal urb write * send to terminate the shader. This includes 1 slot of undefined data, * because it's invalid to write 0 data: |