diff options
Diffstat (limited to 'mesalib/src/gallium/auxiliary')
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_debug.h | 19 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_format_r11g11b10f.h | 10 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_vbuf.c | 36 |
3 files changed, 59 insertions, 6 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_debug.h b/mesalib/src/gallium/auxiliary/util/u_debug.h index cbea35830..ed19cda05 100644 --- a/mesalib/src/gallium/auxiliary/util/u_debug.h +++ b/mesalib/src/gallium/auxiliary/util/u_debug.h @@ -215,6 +215,25 @@ void _debug_assert_fail(const char *expr, /** + * Emit a warning message, but only once. + */ +#ifdef DEBUG +#define debug_warn_once(__msg) \ + do { \ + static bool warned = FALSE; \ + if (!warned) { \ + _debug_printf("%s:%u:%s: one time warning: %s\n", \ + __FILE__, __LINE__, __FUNCTION__, __msg); \ + warned = TRUE; \ + } \ + } while (0) +#else +#define debug_warn_once(__msg) \ + ((void)0) +#endif + + +/** * Output an error message. Not muted on release version. */ #ifdef DEBUG diff --git a/mesalib/src/gallium/auxiliary/util/u_format_r11g11b10f.h b/mesalib/src/gallium/auxiliary/util/u_format_r11g11b10f.h index 6bb430296..bd64b2896 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_r11g11b10f.h +++ b/mesalib/src/gallium/auxiliary/util/u_format_r11g11b10f.h @@ -119,12 +119,12 @@ static INLINE float uf11_to_f32(uint16_t val) float scale, decimal; exponent -= 15; if (exponent < 0) { - scale = 1.0 / (1 << -exponent); + scale = 1.0f / (1 << -exponent); } else { - scale = 1 << exponent; + scale = (float) (1 << exponent); } - decimal = 1.0 + (float) mantissa / 64; + decimal = 1.0f + (float) mantissa / 64; f32.f = scale * decimal; } @@ -208,9 +208,9 @@ static INLINE float uf10_to_f32(uint16_t val) scale = 1.0 / (1 << -exponent); } else { - scale = 1 << exponent; + scale = (float) (1 << exponent); } - decimal = 1.0 + (float) mantissa / 32; + decimal = 1.0f + (float) mantissa / 32; f32.f = scale * decimal; } diff --git a/mesalib/src/gallium/auxiliary/util/u_vbuf.c b/mesalib/src/gallium/auxiliary/util/u_vbuf.c index 711ad10e8..50c35afd5 100644 --- a/mesalib/src/gallium/auxiliary/util/u_vbuf.c +++ b/mesalib/src/gallium/auxiliary/util/u_vbuf.c @@ -912,6 +912,39 @@ static boolean u_vbuf_need_minmax_index(struct u_vbuf_priv *mgr) return FALSE; } +static boolean u_vbuf_mapping_vertex_buffer_blocks(struct u_vbuf_priv *mgr) +{ + unsigned i, nr = mgr->ve->count; + + for (i = 0; i < nr; i++) { + struct pipe_vertex_buffer *vb; + unsigned index; + + /* Per-instance attribs are not per-vertex data. */ + if (mgr->ve->ve[i].instance_divisor) { + continue; + } + + index = mgr->ve->ve[i].vertex_buffer_index; + vb = &mgr->b.vertex_buffer[index]; + + /* Constant attribs are not per-vertex data. */ + if (!vb->stride) { + continue; + } + + /* Return true for the hw buffers which don't need to be translated. */ + /* XXX we could use some kind of a is-busy query. */ + if (!u_vbuf_resource(vb->buffer)->user_ptr && + !mgr->ve->incompatible_layout_elem[i] && + !mgr->incompatible_vb[index]) { + return TRUE; + } + } + + return FALSE; +} + static void u_vbuf_get_minmax_index(struct pipe_context *pipe, struct pipe_index_buffer *ib, const struct pipe_draw_info *info, @@ -1054,7 +1087,8 @@ u_vbuf_draw_begin(struct u_vbuf *mgrb, * performance. */ if (!info->primitive_restart && num_vertices > info->count*2 && - num_vertices-info->count > 32) { + num_vertices-info->count > 32 && + !u_vbuf_mapping_vertex_buffer_blocks(mgr)) { /*printf("num_vertices=%i count=%i\n", num_vertices, info->count);*/ unroll_indices = true; } |