mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-22 11:50:36 +02:00
svga: emit user-defined clip plane state
User-defined clip planes were a swtnl fallback before.
This commit is contained in:
parent
33afdf8356
commit
0be6ae74e9
3 changed files with 26 additions and 11 deletions
|
|
@ -474,9 +474,26 @@ static int emit_clip_planes( struct svga_context *svga,
|
|||
/* TODO: just emit directly from svga_set_clip_state()?
|
||||
*/
|
||||
for (i = 0; i < svga->curr.clip.nr; i++) {
|
||||
ret = SVGA3D_SetClipPlane( svga->swc,
|
||||
i,
|
||||
svga->curr.clip.ucp[i] );
|
||||
/* need to express the plane in D3D-style coordinate space.
|
||||
* GL coords get converted to D3D coords with the matrix:
|
||||
* [ 1 0 0 0 ]
|
||||
* [ 0 -1 0 0 ]
|
||||
* [ 0 0 2 0 ]
|
||||
* [ 0 0 -1 1 ]
|
||||
* Apply that matrix to our plane equation, and invert Y.
|
||||
*/
|
||||
float a = svga->curr.clip.ucp[i][0];
|
||||
float b = svga->curr.clip.ucp[i][1];
|
||||
float c = svga->curr.clip.ucp[i][2];
|
||||
float d = svga->curr.clip.ucp[i][3];
|
||||
float plane[4];
|
||||
|
||||
plane[0] = a;
|
||||
plane[1] = b;
|
||||
plane[2] = 2.0f * c;
|
||||
plane[3] = d - c;
|
||||
|
||||
ret = SVGA3D_SetClipPlane(svga->swc, i, plane);
|
||||
if(ret != PIPE_OK)
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,13 +139,6 @@ static int update_need_pipeline( struct svga_context *svga,
|
|||
need_pipeline = TRUE;
|
||||
}
|
||||
|
||||
/* SVGA_NEW_CLIP
|
||||
*/
|
||||
if (svga->curr.clip.nr) {
|
||||
SVGA_DBG(DEBUG_SWTNL, "%s: userclip\n", __FUNCTION__);
|
||||
need_pipeline = TRUE;
|
||||
}
|
||||
|
||||
if (need_pipeline != svga->state.sw.need_pipeline) {
|
||||
svga->state.sw.need_pipeline = need_pipeline;
|
||||
svga->dirty |= SVGA_NEW_NEED_PIPELINE;
|
||||
|
|
@ -163,7 +156,6 @@ struct svga_tracked_state svga_update_need_pipeline =
|
|||
{
|
||||
"need pipeline",
|
||||
(SVGA_NEW_RAST |
|
||||
SVGA_NEW_CLIP |
|
||||
SVGA_NEW_VS |
|
||||
SVGA_NEW_REDUCED_PRIMITIVE),
|
||||
update_need_pipeline
|
||||
|
|
|
|||
|
|
@ -240,6 +240,11 @@ static int emit_rss( struct svga_context *svga,
|
|||
EMIT_RS_FLOAT( svga, bias, DEPTHBIAS, fail );
|
||||
}
|
||||
|
||||
if (dirty & SVGA_NEW_CLIP) {
|
||||
/* the number of clip planes is how many planes to enable */
|
||||
unsigned enabled = (1 << svga->curr.clip.nr) - 1;
|
||||
EMIT_RS( svga, enabled, CLIPPLANEENABLE, fail );
|
||||
}
|
||||
|
||||
if (queue.rs_count) {
|
||||
SVGA3dRenderState *rs;
|
||||
|
|
@ -276,6 +281,7 @@ struct svga_tracked_state svga_hw_rss =
|
|||
|
||||
(SVGA_NEW_BLEND |
|
||||
SVGA_NEW_BLEND_COLOR |
|
||||
SVGA_NEW_CLIP |
|
||||
SVGA_NEW_DEPTH_STENCIL |
|
||||
SVGA_NEW_STENCIL_REF |
|
||||
SVGA_NEW_RAST |
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue