diff options
author | marha <marha@users.sourceforge.net> | 2013-01-28 07:55:57 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-01-28 07:55:57 +0100 |
commit | 69c8cec54b01ed522bf10baf20da70304bac701a (patch) | |
tree | f37ea158a90ecb99d0780dfdaca14d05394fed3f /mesalib/src/gallium/auxiliary/util | |
parent | 06872e284da1c00ce03b234ca24aefeac64990d2 (diff) | |
download | vcxsrv-69c8cec54b01ed522bf10baf20da70304bac701a.tar.gz vcxsrv-69c8cec54b01ed522bf10baf20da70304bac701a.tar.bz2 vcxsrv-69c8cec54b01ed522bf10baf20da70304bac701a.zip |
mesa mkfontscale pixman git update 28 jan 2013
mesa: 87592cff57feef29565150b9203e220b50623f30
mkfontscale: b3af8de8d25128f565c2ed2f7c63b6e4099eb84e
pixman: 65fc1adb6545737058e938105ae948a3607c277c
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util')
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_debug.c | 2 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_tile.c | 4 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_tile.h | 8 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_upload_mgr.c | 9 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_vbuf.c | 76 |
5 files changed, 63 insertions, 36 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_debug.c b/mesalib/src/gallium/auxiliary/util/u_debug.c index 6e8c5b993..f4670f28c 100644 --- a/mesalib/src/gallium/auxiliary/util/u_debug.c +++ b/mesalib/src/gallium/auxiliary/util/u_debug.c @@ -232,7 +232,7 @@ debug_get_flags_option(const char *name, unsigned long result; const char *str; const struct debug_named_value *orig = flags; - int namealign = 0; + unsigned namealign = 0; str = os_get_option(name); if(!str) diff --git a/mesalib/src/gallium/auxiliary/util/u_tile.c b/mesalib/src/gallium/auxiliary/util/u_tile.c index 6c618a674..62298cdab 100644 --- a/mesalib/src/gallium/auxiliary/util/u_tile.c +++ b/mesalib/src/gallium/auxiliary/util/u_tile.c @@ -806,7 +806,7 @@ pipe_put_tile_z(struct pipe_transfer *pt, for (j = 0; j < w; j++) { /* convert 32-bit integer Z to float Z */ const double scale = 1.0 / 0xffffffffU; - pDest[j] = ptrc[j] * scale; + pDest[j] = (float) (ptrc[j] * scale); } pDest += pt->stride/4; ptrc += srcStride; @@ -820,7 +820,7 @@ pipe_put_tile_z(struct pipe_transfer *pt, for (j = 0; j < w; j++) { /* convert 32-bit integer Z to float Z */ const double scale = 1.0 / 0xffffffffU; - pDest[j*2] = ptrc[j] * scale; + pDest[j*2] = (float) (ptrc[j] * scale); } pDest += pt->stride/4; ptrc += srcStride; diff --git a/mesalib/src/gallium/auxiliary/util/u_tile.h b/mesalib/src/gallium/auxiliary/util/u_tile.h index abcd402c8..9e8194459 100644 --- a/mesalib/src/gallium/auxiliary/util/u_tile.h +++ b/mesalib/src/gallium/auxiliary/util/u_tile.h @@ -45,13 +45,13 @@ struct pipe_transfer; static INLINE boolean u_clip_tile(uint x, uint y, uint *w, uint *h, const struct pipe_box *box) { - if (x >= box->width) + if ((int) x >= box->width) return TRUE; - if (y >= box->height) + if ((int) y >= box->height) return TRUE; - if (x + *w > box->width) + if ((int) (x + *w) > box->width) *w = box->width - x; - if (y + *h > box->height) + if ((int) (y + *h) > box->height) *h = box->height - y; return FALSE; } diff --git a/mesalib/src/gallium/auxiliary/util/u_upload_mgr.c b/mesalib/src/gallium/auxiliary/util/u_upload_mgr.c index ee1c6881e..6859751c5 100644 --- a/mesalib/src/gallium/auxiliary/util/u_upload_mgr.c +++ b/mesalib/src/gallium/auxiliary/util/u_upload_mgr.c @@ -163,6 +163,13 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr *upload, unsigned alloc_offset = align(min_out_offset, upload->alignment); unsigned offset; + /* Init these return values here in case we fail below to make + * sure the caller doesn't get garbage values. + */ + *out_offset = ~0; + pipe_resource_reference(outbuf, NULL); + *ptr = NULL; + /* Make sure we have enough space in the upload buffer * for the sub-allocation. */ if (MAX2(upload->offset, alloc_offset) + alloc_size > upload->size) { @@ -182,8 +189,6 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr *upload, PIPE_TRANSFER_UNSYNCHRONIZED, &upload->transfer); if (!upload->map) { - pipe_resource_reference(outbuf, NULL); - *ptr = NULL; upload->transfer = NULL; return PIPE_ERROR_OUT_OF_MEMORY; } diff --git a/mesalib/src/gallium/auxiliary/util/u_vbuf.c b/mesalib/src/gallium/auxiliary/util/u_vbuf.c index b712b52de..244b04d2a 100644 --- a/mesalib/src/gallium/auxiliary/util/u_vbuf.c +++ b/mesalib/src/gallium/auxiliary/util/u_vbuf.c @@ -323,7 +323,7 @@ void u_vbuf_destroy(struct u_vbuf *mgr) FREE(mgr); } -static void +static enum pipe_error u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key, unsigned vb_mask, unsigned out_vb, int start_vertex, unsigned num_vertices, @@ -335,6 +335,7 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key, struct pipe_resource *out_buffer = NULL; uint8_t *out_map; unsigned out_offset, mask; + enum pipe_error err; /* Get a translate object. */ tr = translate_cache_find(mgr->translate_cache, key); @@ -381,6 +382,14 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key, assert((ib->buffer || ib->user_buffer) && ib->index_size); + /* Create and map the output buffer. */ + err = u_upload_alloc(mgr->uploader, 0, + key->output_stride * num_indices, + &out_offset, &out_buffer, + (void**)&out_map); + if (err != PIPE_OK) + return err; + if (ib->user_buffer) { map = (uint8_t*)ib->user_buffer + offset; } else { @@ -389,12 +398,6 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key, PIPE_TRANSFER_READ, &transfer); } - /* Create and map the output buffer. */ - u_upload_alloc(mgr->uploader, 0, - key->output_stride * num_indices, - &out_offset, &out_buffer, - (void**)&out_map); - switch (ib->index_size) { case 4: tr->run_elts(tr, (unsigned*)map, num_indices, 0, out_map); @@ -412,11 +415,13 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key, } } else { /* Create and map the output buffer. */ - u_upload_alloc(mgr->uploader, - key->output_stride * start_vertex, - key->output_stride * num_vertices, - &out_offset, &out_buffer, - (void**)&out_map); + err = u_upload_alloc(mgr->uploader, + key->output_stride * start_vertex, + key->output_stride * num_vertices, + &out_offset, &out_buffer, + (void**)&out_map); + if (err != PIPE_OK) + return err; out_offset -= key->output_stride * start_vertex; @@ -441,6 +446,8 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key, pipe_resource_reference( &mgr->real_vertex_buffer[out_vb].buffer, NULL); mgr->real_vertex_buffer[out_vb].buffer = out_buffer; + + return PIPE_OK; } static boolean @@ -588,11 +595,14 @@ u_vbuf_translate_begin(struct u_vbuf *mgr, /* Translate buffers. */ for (type = 0; type < VB_NUM; type++) { if (key[type].nr_elements) { - u_vbuf_translate_buffers(mgr, &key[type], mask[type], - mgr->fallback_vbs[type], - start[type], num[type], - start_index, num_indices, min_index, - unroll_indices && type == VB_VERTEX); + enum pipe_error err; + err = u_vbuf_translate_buffers(mgr, &key[type], mask[type], + mgr->fallback_vbs[type], + start[type], num[type], + start_index, num_indices, min_index, + unroll_indices && type == VB_VERTEX); + if (err != PIPE_OK) + return FALSE; /* Fixup the stride for constant attribs. */ if (type == VB_CONST) { @@ -884,7 +894,7 @@ void u_vbuf_set_index_buffer(struct u_vbuf *mgr, pipe->set_index_buffer(pipe, ib); } -static void +static enum pipe_error u_vbuf_upload_buffers(struct u_vbuf *mgr, int start_vertex, unsigned num_vertices, int start_instance, unsigned num_instances) @@ -953,6 +963,7 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr, unsigned start, end; struct pipe_vertex_buffer *real_vb; const uint8_t *ptr; + enum pipe_error err; i = u_bit_scan(&buffer_mask); @@ -963,11 +974,15 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr, real_vb = &mgr->real_vertex_buffer[i]; ptr = mgr->vertex_buffer[i].user_buffer; - u_upload_data(mgr->uploader, start, end - start, ptr + start, - &real_vb->buffer_offset, &real_vb->buffer); + err = u_upload_data(mgr->uploader, start, end - start, ptr + start, + &real_vb->buffer_offset, &real_vb->buffer); + if (err != PIPE_OK) + return err; real_vb->buffer_offset -= start; } + + return PIPE_OK; } static boolean u_vbuf_need_minmax_index(struct u_vbuf *mgr) @@ -1176,11 +1191,13 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info) if (unroll_indices || incompatible_vb_mask || mgr->ve->incompatible_elem_mask) { - /* XXX check the return value */ - u_vbuf_translate_begin(mgr, start_vertex, num_vertices, - info->start_instance, info->instance_count, - info->start, info->count, min_index, - unroll_indices); + if (!u_vbuf_translate_begin(mgr, start_vertex, num_vertices, + info->start_instance, info->instance_count, + info->start, info->count, min_index, + unroll_indices)) { + debug_warn_once("u_vbuf_translate_begin() failed"); + return; + } user_vb_mask &= ~(incompatible_vb_mask | mgr->ve->incompatible_vb_mask_all); @@ -1188,8 +1205,13 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info) /* Upload user buffers. */ if (user_vb_mask) { - u_vbuf_upload_buffers(mgr, start_vertex, num_vertices, - info->start_instance, info->instance_count); + if (u_vbuf_upload_buffers(mgr, start_vertex, num_vertices, + info->start_instance, + info->instance_count) != PIPE_OK) { + debug_warn_once("u_vbuf_upload_buffers() failed"); + return; + } + mgr->dirty_real_vb_mask |= user_vb_mask; } |