mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 21:40:20 +01:00
svga: use SVGA3D_RS_FILLMODE for vgpu9
I'm not sure why we didn't support this in the past, but fillmode is supported by all renderers nowadays. Also fix the logic in svga_create_rasterizer_state() to avoid a few swtnl case. No piglit regressions Reviewed-by: Neha Bhende <bhenden@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
This commit is contained in:
parent
a45b495700
commit
92e5dc94ac
3 changed files with 37 additions and 26 deletions
|
|
@ -191,31 +191,23 @@ static inline boolean
|
|||
svga_need_unfilled_fallback(const struct svga_hwtnl *hwtnl,
|
||||
enum pipe_prim_type prim)
|
||||
{
|
||||
const struct svga_context *svga = hwtnl->svga;
|
||||
|
||||
if (u_reduced_prim(prim) != PIPE_PRIM_TRIANGLES) {
|
||||
/* if we're drawing points or lines, no fallback needed */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (svga_have_vgpu10(svga)) {
|
||||
/* vgpu10 supports polygon fill and line modes */
|
||||
if ((prim == PIPE_PRIM_QUADS ||
|
||||
prim == PIPE_PRIM_QUAD_STRIP ||
|
||||
prim == PIPE_PRIM_POLYGON) &&
|
||||
hwtnl->api_fillmode == PIPE_POLYGON_MODE_LINE) {
|
||||
/* VGPU10 doesn't directly render quads or polygons. They're
|
||||
* converted to triangles. If we let the device draw the triangle
|
||||
* outlines we'll get an extra, stray lines in the interiors.
|
||||
* So, to draw unfilled quads correctly, we need the fallback.
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
return hwtnl->api_fillmode == PIPE_POLYGON_MODE_POINT;
|
||||
} else {
|
||||
/* vgpu9 doesn't support line or point fill modes */
|
||||
return hwtnl->api_fillmode != PIPE_POLYGON_MODE_FILL;
|
||||
if ((prim == PIPE_PRIM_QUADS ||
|
||||
prim == PIPE_PRIM_QUAD_STRIP ||
|
||||
prim == PIPE_PRIM_POLYGON) &&
|
||||
hwtnl->api_fillmode == PIPE_POLYGON_MODE_LINE) {
|
||||
/* We can't directly render quads or polygons. They're
|
||||
* converted to triangles. If we let the device draw the triangle
|
||||
* outlines we'll get an extra, stray lines in the interiors.
|
||||
* So, to draw unfilled quads correctly, we need the fallback.
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ svga_create_rasterizer_state(struct pipe_context *pipe,
|
|||
{
|
||||
int fill_front = templ->fill_front;
|
||||
int fill_back = templ->fill_back;
|
||||
int fill = PIPE_POLYGON_MODE_FILL;
|
||||
int fill;
|
||||
boolean offset_front = util_get_offset(templ, fill_front);
|
||||
boolean offset_back = util_get_offset(templ, fill_back);
|
||||
boolean offset = FALSE;
|
||||
|
|
@ -267,13 +267,13 @@ svga_create_rasterizer_state(struct pipe_context *pipe,
|
|||
break;
|
||||
|
||||
case PIPE_FACE_FRONT:
|
||||
offset = offset_front;
|
||||
fill = fill_front;
|
||||
offset = offset_back;
|
||||
fill = fill_back;
|
||||
break;
|
||||
|
||||
case PIPE_FACE_BACK:
|
||||
offset = offset_back;
|
||||
fill = fill_back;
|
||||
offset = offset_front;
|
||||
fill = fill_front;
|
||||
break;
|
||||
|
||||
case PIPE_FACE_NONE:
|
||||
|
|
@ -283,6 +283,7 @@ svga_create_rasterizer_state(struct pipe_context *pipe,
|
|||
*/
|
||||
rast->need_pipeline |= SVGA_PIPELINE_FLAG_TRIS;
|
||||
rast->need_pipeline_tris_str = "different front/back fillmodes";
|
||||
fill = PIPE_POLYGON_MODE_FILL;
|
||||
}
|
||||
else {
|
||||
offset = offset_front;
|
||||
|
|
@ -302,8 +303,7 @@ svga_create_rasterizer_state(struct pipe_context *pipe,
|
|||
if (fill != PIPE_POLYGON_MODE_FILL &&
|
||||
(templ->flatshade ||
|
||||
templ->light_twoside ||
|
||||
offset ||
|
||||
templ->cull_face != PIPE_FACE_NONE)) {
|
||||
offset)) {
|
||||
fill = PIPE_POLYGON_MODE_FILL;
|
||||
rast->need_pipeline |= SVGA_PIPELINE_FLAG_TRIS;
|
||||
rast->need_pipeline_tris_str = "unfilled primitives with no index manipulation";
|
||||
|
|
|
|||
|
|
@ -75,6 +75,23 @@ svga_queue_rs(struct rs_queue *q, unsigned rss, unsigned value)
|
|||
}
|
||||
|
||||
|
||||
static unsigned
|
||||
translate_fill_mode(unsigned fill)
|
||||
{
|
||||
switch (fill) {
|
||||
case PIPE_POLYGON_MODE_POINT:
|
||||
return SVGA3D_FILLMODE_POINT;
|
||||
case PIPE_POLYGON_MODE_LINE:
|
||||
return SVGA3D_FILLMODE_LINE;
|
||||
case PIPE_POLYGON_MODE_FILL:
|
||||
return SVGA3D_FILLMODE_FILL;
|
||||
default:
|
||||
assert(!"Bad fill mode");
|
||||
return SVGA3D_FILLMODE_FILL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Compare old and new render states and emit differences between them
|
||||
* to hardware. Simplest implementation would be to emit the whole of
|
||||
* the "to" state.
|
||||
|
|
@ -207,6 +224,8 @@ emit_rss_vgpu9(struct svga_context *svga, unsigned dirty)
|
|||
*/
|
||||
EMIT_RS(svga, curr->shademode, SHADEMODE);
|
||||
|
||||
EMIT_RS(svga, translate_fill_mode(curr->hw_fillmode), FILLMODE);
|
||||
|
||||
/* Don't do culling while the software pipeline is active. It
|
||||
* does it for us, and additionally introduces potentially
|
||||
* back-facing triangles.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue