diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-01-29 11:08:07 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-01-29 11:08:07 +0000 |
commit | 6b139c2063623e9310025247cd966490b9aa57ea (patch) | |
tree | 375acfd898ca3d721250aa17291bbb90a8d7250a /lib/mesa/src/gallium/auxiliary/draw | |
parent | cce99579dcfb1d54c54cff65573be3430e77f2c5 (diff) |
Import Mesa 18.3.2
Diffstat (limited to 'lib/mesa/src/gallium/auxiliary/draw')
5 files changed, 26 insertions, 4 deletions
diff --git a/lib/mesa/src/gallium/auxiliary/draw/draw_pipe_cull.c b/lib/mesa/src/gallium/auxiliary/draw/draw_pipe_cull.c index 3e8e45895..318d743db 100644 --- a/lib/mesa/src/gallium/auxiliary/draw/draw_pipe_cull.c +++ b/lib/mesa/src/gallium/auxiliary/draw/draw_pipe_cull.c @@ -181,6 +181,16 @@ static void cull_tri( struct draw_stage *stage, /* triangle is not culled, pass to next stage */ stage->next->tri( stage->next, header ); } + } else { + /* + * With zero area, this is back facing (because the spec says + * it's front facing if sign is positive?). + * Some apis apparently do not allow us to cull zero area tris + * here, in case of fill mode line (which is rather lame). + */ + if ((PIPE_FACE_BACK & cull_stage(stage)->cull_face) == 0) { + stage->next->tri( stage->next, header ); + } } } } diff --git a/lib/mesa/src/gallium/auxiliary/draw/draw_pipe_unfilled.c b/lib/mesa/src/gallium/auxiliary/draw/draw_pipe_unfilled.c index c465c7526..f39db0e6a 100644 --- a/lib/mesa/src/gallium/auxiliary/draw/draw_pipe_unfilled.c +++ b/lib/mesa/src/gallium/auxiliary/draw/draw_pipe_unfilled.c @@ -63,10 +63,9 @@ inject_front_face_info(struct draw_stage *stage, struct prim_header *header) { struct unfilled_stage *unfilled = unfilled_stage(stage); - unsigned ccw = header->det < 0.0; boolean is_front_face = ( - (stage->draw->rasterizer->front_ccw && ccw) || - (!stage->draw->rasterizer->front_ccw && !ccw)); + (stage->draw->rasterizer->front_ccw && header->det < 0.0f) || + (!stage->draw->rasterizer->front_ccw && header->det > 0.0f)); int slot = unfilled->face_slot; unsigned i; diff --git a/lib/mesa/src/gallium/auxiliary/draw/draw_pt_emit.c b/lib/mesa/src/gallium/auxiliary/draw/draw_pt_emit.c index 6fb630b54..984c76fdf 100644 --- a/lib/mesa/src/gallium/auxiliary/draw/draw_pt_emit.c +++ b/lib/mesa/src/gallium/auxiliary/draw/draw_pt_emit.c @@ -158,6 +158,7 @@ draw_pt_emit(struct pt_emit *emit, */ render->set_primitive(draw->render, prim_info->prim); + assert(vertex_count <= 65535); render->allocate_vertices(render, (ushort)translate->key.output_stride, (ushort)vertex_count); @@ -229,6 +230,7 @@ draw_pt_emit_linear(struct pt_emit *emit, */ render->set_primitive(draw->render, prim_info->prim); + assert(count <= 65535); if (!render->allocate_vertices(render, (ushort)translate->key.output_stride, (ushort)count)) diff --git a/lib/mesa/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/lib/mesa/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c index aa20b918f..f76e02299 100644 --- a/lib/mesa/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c +++ b/lib/mesa/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c @@ -299,6 +299,16 @@ fetch_pipeline_generic(struct draw_pt_middle_end *middle, FREE(vert_info->verts); vert_info = &gs_vert_info; prim_info = &gs_prim_info; + + /* + * pt emit can only handle ushort number of vertices (see + * render->allocate_vertices). + * vsplit guarantees there's never more than 4096, however GS can + * easily blow this up (by a factor of 256 (or even 1024) max). + */ + if (vert_info->count > 65535) { + opt |= PT_PIPELINE; + } } else { if (draw_prim_assembler_is_required(draw, prim_info, vert_info)) { draw_prim_assembler_run(draw, prim_info, vert_info, diff --git a/lib/mesa/src/gallium/auxiliary/draw/draw_vbuf.h b/lib/mesa/src/gallium/auxiliary/draw/draw_vbuf.h index 194796b04..8faccda55 100644 --- a/lib/mesa/src/gallium/auxiliary/draw/draw_vbuf.h +++ b/lib/mesa/src/gallium/auxiliary/draw/draw_vbuf.h @@ -38,6 +38,7 @@ #include "pipe/p_compiler.h" +#include "pipe/p_defines.h" struct pipe_rasterizer_state; @@ -96,7 +97,7 @@ struct vbuf_render { * the discretion of the driver, for the benefit of the passthrough * path. */ - void (*set_primitive)( struct vbuf_render *, unsigned prim ); + void (*set_primitive)( struct vbuf_render *, enum pipe_prim_type prim ); /** * Draw indexed primitives. Note that indices are ushort. The driver |