diff options
author | George Kyriazis <[email protected]> | 2017-04-19 13:55:26 -0500 |
---|---|---|
committer | George Kyriazis <[email protected]> | 2017-05-08 21:28:53 -0500 |
commit | 909f72e0a2178ede4497c352933c608e6e8dab00 (patch) | |
tree | e3e1d9c3ff16d1338a861e890d82df45523e61c7 /src/gallium/drivers | |
parent | 26a9ed6f0fee1ea0a01e99f42e0f9101d3c53ef0 (diff) |
swr: fix polygonmode for front==back
Rasterizer core only supports polygonmode front==back. Add logic for
populating fillMode for the rasterizer only for that case correctly.
Provide enum conversion between mesa enums and core enums.
The core renders lines/points as tris. Previously, code would enable
stipple for polygonmode != FILL. Modify stipple enable logic so that
this works correctly.
No regressions in vtk tests.
Fixes the following piglit tests:
pointsprite
gl-1.0-edgeflag-const
v2: remove cc stable, and remove "not implemented" assert
v3: modified commit message
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/swr/swr_state.cpp | 8 | ||||
-rw-r--r-- | src/gallium/drivers/swr/swr_state.h | 20 |
2 files changed, 27 insertions, 1 deletions
diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp index 56b13746d02..12b4e9d6398 100644 --- a/src/gallium/drivers/swr/swr_state.cpp +++ b/src/gallium/drivers/swr/swr_state.cpp @@ -1153,6 +1153,10 @@ swr_update_derived(struct pipe_context *pipe, rastState->slopeScaledDepthBias = 0; rastState->depthBiasClamp = 0; } + + /* translate polygon mode, at least for the front==back case */ + rastState->fillMode = swr_convert_fill_mode(rasterizer->fill_front); + struct pipe_surface *zb = fb->zsbuf; if (zb && swr_resource(zb->texture)->has_depth) rastState->depthFormat = swr_resource(zb->texture)->swr.format; @@ -1423,7 +1427,9 @@ swr_update_derived(struct pipe_context *pipe, /* and points, since we rasterize them as triangles, too */ /* Has to be before fragment shader, since it sets SWR_NEW_FS */ if (p_draw_info) { - bool new_prim_is_poly = (u_reduced_prim(p_draw_info->mode) == PIPE_PRIM_TRIANGLES); + bool new_prim_is_poly = + (u_reduced_prim(p_draw_info->mode) == PIPE_PRIM_TRIANGLES) && + (ctx->derived.rastState.fillMode == SWR_FILLMODE_SOLID); if (new_prim_is_poly != ctx->poly_stipple.prim_is_poly) { ctx->dirty |= SWR_NEW_FS; ctx->poly_stipple.prim_is_poly = new_prim_is_poly; diff --git a/src/gallium/drivers/swr/swr_state.h b/src/gallium/drivers/swr/swr_state.h index 9a8c4e1311c..7940a960d93 100644 --- a/src/gallium/drivers/swr/swr_state.h +++ b/src/gallium/drivers/swr/swr_state.h @@ -376,4 +376,24 @@ swr_convert_prim_topology(const unsigned mode) return TOP_UNKNOWN; } }; + +/* + * convert mesa PIPE_POLYGON_MODE_X to SWR enum SWR_FILLMODE + */ +static INLINE enum SWR_FILLMODE +swr_convert_fill_mode(const unsigned mode) +{ + switch(mode) { + case PIPE_POLYGON_MODE_FILL: + return SWR_FILLMODE_SOLID; + case PIPE_POLYGON_MODE_LINE: + return SWR_FILLMODE_WIREFRAME; + case PIPE_POLYGON_MODE_POINT: + return SWR_FILLMODE_POINT; + default: + assert(0 && "Unknown fillmode"); + return SWR_FILLMODE_SOLID; // at least do something sensible + } +} + #endif |