diff options
author | marha <marha@users.sourceforge.net> | 2012-12-05 09:16:39 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-12-05 09:16:39 +0100 |
commit | 52fc95bab22331376f6a7351fdc07f805bd67610 (patch) | |
tree | d93c6fce43dab496004a97a4dfc8bb38e5da6f5a /mesalib/src/gallium | |
parent | 6e1f3114a922dc8ac7c1ae0c20d64b8f7a0f5ef7 (diff) | |
parent | e82692e521240c5f8592f9ce56c9d5b3d68870ec (diff) | |
download | vcxsrv-52fc95bab22331376f6a7351fdc07f805bd67610.tar.gz vcxsrv-52fc95bab22331376f6a7351fdc07f805bd67610.tar.bz2 vcxsrv-52fc95bab22331376f6a7351fdc07f805bd67610.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
mesa git update 5 dec 2012
Diffstat (limited to 'mesalib/src/gallium')
-rw-r--r-- | mesalib/src/gallium/auxiliary/Makefile | 6 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_cache.c | 8 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_debug.c | 56 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_debug.h | 4 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_draw.c | 11 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_surface.c | 15 |
6 files changed, 53 insertions, 47 deletions
diff --git a/mesalib/src/gallium/auxiliary/Makefile b/mesalib/src/gallium/auxiliary/Makefile index dc2800337..72208f1a7 100644 --- a/mesalib/src/gallium/auxiliary/Makefile +++ b/mesalib/src/gallium/auxiliary/Makefile @@ -13,7 +13,11 @@ C_SOURCES += \ $(GALLIVM_SOURCES) CPP_SOURCES += \ $(GALLIVM_CPP_SOURCES) -CXXFLAGS += $(LLVM_CXXFLAGS) + +# LLVM >= 3.2 requires -fno-rtti +ifeq ($(shell expr `echo $(LLVM_VERSION) | sed -e 's/\([0-9]\)\.\([0-9]\)/\10\2/g'` \>= 302),1) +CXXFLAGS += -fno-rtti +endif endif diff --git a/mesalib/src/gallium/auxiliary/util/u_cache.c b/mesalib/src/gallium/auxiliary/util/u_cache.c index df08ec302..26aab2bf1 100644 --- a/mesalib/src/gallium/auxiliary/util/u_cache.c +++ b/mesalib/src/gallium/auxiliary/util/u_cache.c @@ -183,12 +183,12 @@ util_cache_set(struct util_cache *cache, void *value) { struct util_cache_entry *entry; - uint32_t hash = cache->hash(key); + uint32_t hash; assert(cache); if (!cache) return; - + hash = cache->hash(key); entry = util_cache_entry_get(cache, hash, key); if (!entry) entry = cache->lru.prev; @@ -218,12 +218,12 @@ util_cache_get(struct util_cache *cache, const void *key) { struct util_cache_entry *entry; - uint32_t hash = cache->hash(key); + uint32_t hash; assert(cache); if (!cache) return NULL; - + hash = cache->hash(key); entry = util_cache_entry_get(cache, hash, key); if (!entry) return NULL; diff --git a/mesalib/src/gallium/auxiliary/util/u_debug.c b/mesalib/src/gallium/auxiliary/util/u_debug.c index b26192a8b..ee97b7adb 100644 --- a/mesalib/src/gallium/auxiliary/util/u_debug.c +++ b/mesalib/src/gallium/auxiliary/util/u_debug.c @@ -436,7 +436,7 @@ void debug_funclog_enter_exit(const char* f, const int line, const char* file) #ifdef DEBUG /** - * Dump an image to a .raw or .ppm file (depends on OS). + * Dump an image to .ppm file. * \param format PIPE_FORMAT_x * \param cpp bytes per pixel * \param width width in pixels @@ -444,56 +444,48 @@ void debug_funclog_enter_exit(const char* f, const int line, const char* file) * \param stride row stride in bytes */ void debug_dump_image(const char *prefix, - unsigned format, unsigned cpp, + enum pipe_format format, unsigned cpp, unsigned width, unsigned height, unsigned stride, const void *data) { /* write a ppm file */ char filename[256]; + unsigned char *rgb8; FILE *f; util_snprintf(filename, sizeof(filename), "%s.ppm", prefix); - f = fopen(filename, "w"); - if (f) { - int i, x, y; - int r, g, b; - const uint8_t *ptr = (uint8_t *) data; - - /* XXX this is a hack */ - switch (format) { - case PIPE_FORMAT_B8G8R8A8_UNORM: - r = 2; - g = 1; - b = 0; - break; - default: - r = 0; - g = 1; - b = 1; - } + rgb8 = MALLOC(height * width * 3); + if (!rgb8) { + return; + } + + util_format_translate( + PIPE_FORMAT_R8G8B8_UNORM, + rgb8, width * 3, + 0, 0, + format, + data, stride, + 0, 0, width, height); + /* Must be opened in binary mode or DOS line ending causes data + * to be read with one byte offset. + */ + f = fopen(filename, "wb"); + if (f) { fprintf(f, "P6\n"); - fprintf(f, "# ppm-file created by osdemo.c\n"); + fprintf(f, "# ppm-file created by gallium\n"); fprintf(f, "%i %i\n", width, height); fprintf(f, "255\n"); - fclose(f); - - f = fopen(filename, "ab"); /* reopen in binary append mode */ - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - i = y * stride + x * cpp; - fputc(ptr[i + r], f); /* write red */ - fputc(ptr[i + g], f); /* write green */ - fputc(ptr[i + b], f); /* write blue */ - } - } + fwrite(rgb8, 1, height * width * 3, f); fclose(f); } else { fprintf(stderr, "Can't open %s for writing\n", filename); } + + FREE(rgb8); } /* FIXME: dump resources, not surfaces... */ diff --git a/mesalib/src/gallium/auxiliary/util/u_debug.h b/mesalib/src/gallium/auxiliary/util/u_debug.h index 3b42c2f07..0eb744333 100644 --- a/mesalib/src/gallium/auxiliary/util/u_debug.h +++ b/mesalib/src/gallium/auxiliary/util/u_debug.h @@ -41,6 +41,8 @@ #include "os/os_misc.h" +#include "pipe/p_format.h" + #ifdef __cplusplus extern "C" { @@ -418,7 +420,7 @@ struct pipe_transfer; struct pipe_resource; void debug_dump_image(const char *prefix, - unsigned format, unsigned cpp, + enum pipe_format format, unsigned cpp, unsigned width, unsigned height, unsigned stride, const void *data); diff --git a/mesalib/src/gallium/auxiliary/util/u_draw.c b/mesalib/src/gallium/auxiliary/util/u_draw.c index 5b3c41231..83d9284b8 100644 --- a/mesalib/src/gallium/auxiliary/util/u_draw.c +++ b/mesalib/src/gallium/auxiliary/util/u_draw.c @@ -108,8 +108,15 @@ util_draw_max_index( else { /* Per-instance data. Simply make sure the state tracker didn't * request more instances than those that fit in the buffer */ - assert((info->start_instance + info->instance_count)/element->instance_divisor - <= (buffer_max_index + 1)); + if ((info->start_instance + info->instance_count)/element->instance_divisor + > (buffer_max_index + 1)) { + /* FIXME: We really should stop thinking in terms of maximum + * indices/instances and simply start clamping against buffer + * size. */ + debug_printf("%s: too many instances for vertex buffer\n", + __FUNCTION__); + return 0; + } } } } diff --git a/mesalib/src/gallium/auxiliary/util/u_surface.c b/mesalib/src/gallium/auxiliary/util/u_surface.c index e99431ef8..5b42afd0d 100644 --- a/mesalib/src/gallium/auxiliary/util/u_surface.c +++ b/mesalib/src/gallium/auxiliary/util/u_surface.c @@ -266,13 +266,14 @@ util_clear_depth_stencil(struct pipe_context *pipe, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { + enum pipe_format format = dst->format; struct pipe_transfer *dst_trans; ubyte *dst_map; boolean need_rmw = FALSE; if ((clear_flags & PIPE_CLEAR_DEPTHSTENCIL) && ((clear_flags & PIPE_CLEAR_DEPTHSTENCIL) != PIPE_CLEAR_DEPTHSTENCIL) && - util_format_is_depth_and_stencil(dst->format)) + util_format_is_depth_and_stencil(format)) need_rmw = TRUE; assert(dst->texture); @@ -289,14 +290,14 @@ util_clear_depth_stencil(struct pipe_context *pipe, if (dst_map) { unsigned dst_stride = dst_trans->stride; - uint64_t zstencil = util_pack64_z_stencil(dst->texture->format, + uint64_t zstencil = util_pack64_z_stencil(format, depth, stencil); unsigned i, j; assert(dst_trans->stride > 0); - switch (util_format_get_blocksize(dst->format)) { + switch (util_format_get_blocksize(format)) { case 1: - assert(dst->format == PIPE_FORMAT_S8_UINT); + assert(format == PIPE_FORMAT_S8_UINT); if(dst_stride == width) memset(dst_map, (uint8_t) zstencil, height * width); else { @@ -307,7 +308,7 @@ util_clear_depth_stencil(struct pipe_context *pipe, } break; case 2: - assert(dst->format == PIPE_FORMAT_Z16_UNORM); + assert(format == PIPE_FORMAT_Z16_UNORM); for (i = 0; i < height; i++) { uint16_t *row = (uint16_t *)dst_map; for (j = 0; j < width; j++) @@ -326,10 +327,10 @@ util_clear_depth_stencil(struct pipe_context *pipe, } else { uint32_t dst_mask; - if (dst->format == PIPE_FORMAT_Z24_UNORM_S8_UINT) + if (format == PIPE_FORMAT_Z24_UNORM_S8_UINT) dst_mask = 0xffffff00; else { - assert(dst->format == PIPE_FORMAT_S8_UINT_Z24_UNORM); + assert(format == PIPE_FORMAT_S8_UINT_Z24_UNORM); dst_mask = 0xffffff; } if (clear_flags & PIPE_CLEAR_DEPTH) |