diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-05-23 05:33:34 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-05-23 05:33:34 +0000 |
commit | 9886815a25d84be79f51e65ebd8e458bb5d26ca8 (patch) | |
tree | a65edf018dd992543337433f7303fb29a6c8e8cf /lib/mesa/src/gallium/auxiliary/draw | |
parent | e2a3acb64af2657b1181806818eacad061103c23 (diff) |
Merge Mesa 19.0.5
Diffstat (limited to 'lib/mesa/src/gallium/auxiliary/draw')
-rw-r--r-- | lib/mesa/src/gallium/auxiliary/draw/draw_context.c | 2 | ||||
-rw-r--r-- | lib/mesa/src/gallium/auxiliary/draw/draw_pipe_stipple.c | 26 |
2 files changed, 17 insertions, 11 deletions
diff --git a/lib/mesa/src/gallium/auxiliary/draw/draw_context.c b/lib/mesa/src/gallium/auxiliary/draw/draw_context.c index 3fc096789..f8c69585e 100644 --- a/lib/mesa/src/gallium/auxiliary/draw/draw_context.c +++ b/lib/mesa/src/gallium/auxiliary/draw/draw_context.c @@ -950,6 +950,8 @@ draw_set_mapped_so_targets(struct draw_context *draw, { int i; + draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); + for (i = 0; i < num_targets; i++) draw->so.targets[i] = targets[i]; for (i = num_targets; i < PIPE_MAX_SO_BUFFERS; i++) diff --git a/lib/mesa/src/gallium/auxiliary/draw/draw_pipe_stipple.c b/lib/mesa/src/gallium/auxiliary/draw/draw_pipe_stipple.c index d30572cc6..386b7649e 100644 --- a/lib/mesa/src/gallium/auxiliary/draw/draw_pipe_stipple.c +++ b/lib/mesa/src/gallium/auxiliary/draw/draw_pipe_stipple.c @@ -48,8 +48,8 @@ struct stipple_stage { struct draw_stage stage; float counter; - uint pattern; - uint factor; + ushort pattern; + ushort factor; bool smooth; }; @@ -110,7 +110,7 @@ emit_segment(struct draw_stage *stage, struct prim_header *header, static inline bool -stipple_test(int counter, ushort pattern, int factor) +stipple_test(int counter, ushort pattern, ushort factor) { int b = (counter / factor) & 0xf; return !!((1 << b) & pattern); @@ -136,6 +136,10 @@ stipple_line(struct draw_stage *stage, struct prim_header *header) float length; int i; + int intlength; + + if (header->flags & DRAW_PIPE_RESET_STIPPLE) + stipple->counter = 0; if (stipple->smooth) { float dx = x1 - x0; @@ -147,21 +151,21 @@ stipple_line(struct draw_stage *stage, struct prim_header *header) length = MAX2(dx, dy); } - if (header->flags & DRAW_PIPE_RESET_STIPPLE) - stipple->counter = 0; + if (util_is_inf_or_nan(length)) + intlength = 0; + else + intlength = ceilf(length); /* XXX ToDo: instead of iterating pixel-by-pixel, use a look-up table. */ - for (i = 0; i < length; i++) { + for (i = 0; i < intlength; i++) { bool result = stipple_test((int)stipple->counter + i, - (ushort)stipple->pattern, stipple->factor); + stipple->pattern, stipple->factor); if (result != state) { /* changing from "off" to "on" or vice versa */ if (state) { - if (start != i) { - /* finishing an "on" segment */ - emit_segment(stage, header, start / length, i / length); - } + /* finishing an "on" segment */ + emit_segment(stage, header, start / length, i / length); } else { /* starting an "on" segment */ |