diff options
author | Marek Olšák <marek.olsak@amd.com> | 2016-04-13 17:28:30 +0200 |
---|---|---|
committer | Marek Olšák <marek.olsak@amd.com> | 2016-04-16 00:21:15 +0200 |
commit | c1a2fe7fd1ce7e58517a00c3031d786e8b9849f8 (patch) | |
tree | abcec60a868fd90ca116f09ade27d417bd39e6ec | |
parent | 696d8ff5a1f477aa0d7a9b9a2c6d6959e0d101df (diff) |
gallium/radeon: handle vertex shaders that disable clipping & viewport
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_viewport.c | 20 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index a6abe09d438..b23a780f803 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -455,6 +455,7 @@ struct r600_common_context { struct r600_viewports viewports; bool scissor_enabled; bool vs_writes_viewport_index; + bool vs_disables_clipping_viewport; /* Additional context states. */ unsigned flags; /* flush flags */ diff --git a/src/gallium/drivers/radeon/r600_viewport.c b/src/gallium/drivers/radeon/r600_viewport.c index ea558cd22de..980c5ef17e6 100644 --- a/src/gallium/drivers/radeon/r600_viewport.c +++ b/src/gallium/drivers/radeon/r600_viewport.c @@ -130,7 +130,12 @@ static void r600_emit_one_scissor(struct r600_common_context *rctx, { struct pipe_scissor_state final; - r600_clamp_scissor(rctx, &final, vp_scissor); + if (rctx->vs_disables_clipping_viewport) { + final.minx = final.miny = 0; + final.maxx = final.maxy = GET_MAX_SCISSOR(rctx); + } else { + r600_clamp_scissor(rctx, &final, vp_scissor); + } if (scissor) r600_clip_scissor(&final, scissor); @@ -324,9 +329,22 @@ void r600_set_scissor_enable(struct r600_common_context *rctx, bool enable) void r600_update_vs_writes_viewport_index(struct r600_common_context *rctx, struct tgsi_shader_info *info) { + bool vs_window_space; + if (!info) return; + /* When the VS disables clipping and viewport transformation. */ + vs_window_space = + info->properties[TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION]; + + if (rctx->vs_disables_clipping_viewport != vs_window_space) { + rctx->vs_disables_clipping_viewport = vs_window_space; + rctx->scissors.dirty_mask = (1 << R600_MAX_VIEWPORTS) - 1; + rctx->set_atom_dirty(rctx, &rctx->scissors.atom, true); + } + + /* Viewport index handling. */ rctx->vs_writes_viewport_index = info->writes_viewport_index; if (!rctx->vs_writes_viewport_index) return; |