summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/swr_state.cpp
diff options
context:
space:
mode:
authorTim Rowley <[email protected]>2016-05-25 18:49:34 -0500
committerTim Rowley <[email protected]>2016-06-09 13:28:35 -0500
commit2c85128e015a401550046f47ce3e2dc0c0049540 (patch)
treeb21cb0ab258192b5375ddf067d4ee7553c18562d /src/gallium/drivers/swr/swr_state.cpp
parentcf804b4455fac9e585b3600a8318caaced9c23de (diff)
swr: implement clipPlanes/clipVertex/clipDistance/cullDistance
v2: only load the clip vertex once v3: fix clip enable logic, add cullDistance v4: remove duplicate fields in vs jit key, fix test of clip fixup needed v5: fix clipdistance linkage for slot!=0,4 v6: support clip+cull; passes most piglit clip (failures understood) Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/swr_state.cpp')
-rw-r--r--src/gallium/drivers/swr/swr_state.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp
index f50537f3a61..3eeb98d0261 100644
--- a/src/gallium/drivers/swr/swr_state.cpp
+++ b/src/gallium/drivers/swr/swr_state.cpp
@@ -849,7 +849,9 @@ swr_update_derived(struct pipe_context *pipe,
}
/* Raster state */
- if (ctx->dirty & (SWR_NEW_RASTERIZER | SWR_NEW_FRAMEBUFFER)) {
+ if (ctx->dirty & (SWR_NEW_RASTERIZER |
+ SWR_NEW_VS | // clipping
+ SWR_NEW_FRAMEBUFFER)) {
pipe_rasterizer_state *rasterizer = ctx->rasterizer;
pipe_framebuffer_state *fb = &ctx->framebuffer;
@@ -906,6 +908,14 @@ swr_update_derived(struct pipe_context *pipe,
rastState->depthClipEnable = rasterizer->depth_clip;
+ rastState->clipDistanceMask =
+ ctx->vs->info.base.num_written_clipdistance ?
+ ctx->vs->info.base.clipdist_writemask & rasterizer->clip_plane_enable :
+ rasterizer->clip_plane_enable;
+
+ rastState->cullDistanceMask =
+ ctx->vs->info.base.culldist_writemask << ctx->vs->info.base.num_written_clipdistance;
+
SwrSetRastState(ctx->swrContext, rastState);
}
@@ -1067,6 +1077,7 @@ swr_update_derived(struct pipe_context *pipe,
/* VertexShader */
if (ctx->dirty & (SWR_NEW_VS |
+ SWR_NEW_RASTERIZER | // for clip planes
SWR_NEW_SAMPLER |
SWR_NEW_SAMPLER_VIEW |
SWR_NEW_FRAMEBUFFER)) {
@@ -1341,6 +1352,18 @@ swr_update_derived(struct pipe_context *pipe,
}
}
+ if (ctx->dirty & SWR_NEW_CLIP) {
+ // shader exporting clip distances overrides all user clip planes
+ if (ctx->rasterizer->clip_plane_enable &&
+ !ctx->vs->info.base.num_written_clipdistance)
+ {
+ swr_draw_context *pDC = &ctx->swrDC;
+ memcpy(pDC->userClipPlanes,
+ ctx->clip.ucp,
+ sizeof(pDC->userClipPlanes));
+ }
+ }
+
uint32_t linkage = ctx->vs->linkageMask;
if (ctx->rasterizer->sprite_coord_enable)
linkage |= (1 << ctx->vs->info.base.num_outputs);