aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-11-19 11:21:45 +0100
committermarha <marha@users.sourceforge.net>2012-11-19 11:21:45 +0100
commit57b3e446b9b4017ccfdd3227be481df590740426 (patch)
tree0e4899f530f75d343c090202fc7123c78f9b4866 /mesalib/src/gallium/auxiliary/util
parent24635abae6008bef13e30d798b3f33abab412770 (diff)
parentb3e1e62c45f525cdd332073aaa34d8452cb23374 (diff)
downloadvcxsrv-57b3e446b9b4017ccfdd3227be481df590740426.tar.gz
vcxsrv-57b3e446b9b4017ccfdd3227be481df590740426.tar.bz2
vcxsrv-57b3e446b9b4017ccfdd3227be481df590740426.zip
Merge remote-tracking branch 'origin/released'
* origin/released: git update 19 nov 2012 Added bash script to update released branch Conflicts: mesalib/src/mapi/glapi/gen/gl_API.xml mesalib/src/mesa/program/.gitignore pixman/pixman/pixman-mmx.c xorg-server/Xi/xiquerypointer.c xorg-server/xkb/xkb.c
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.c8
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_debug.h2
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format.c26
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_prim.h2
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_rect.h15
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_snprintf.c2
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_string.h4
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_surface.c88
8 files changed, 79 insertions, 68 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c
index 0c1430e23..e788b6594 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c
@@ -900,7 +900,7 @@ void util_blitter_cache_all_shaders(struct blitter_context *blitter)
target == PIPE_TEXTURE_2D_ARRAY)) {
continue;
}
- if (!has_arraytex &&
+ if (!has_cubearraytex &&
(target == PIPE_TEXTURE_CUBE_ARRAY))
continue;
@@ -1891,6 +1891,12 @@ static boolean is_box_inside_resource(const struct pipe_resource *res,
height = u_minify(res->height0, level);
depth = res->array_size;
break;
+ case PIPE_TEXTURE_CUBE_ARRAY:
+ width = u_minify(res->width0, level);
+ height = u_minify(res->height0, level);
+ depth = res->array_size;
+ assert(res->array_size % 6 == 0);
+ break;
case PIPE_MAX_TEXTURE_TYPES:;
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_debug.h b/mesalib/src/gallium/auxiliary/util/u_debug.h
index 14d319c2c..3b42c2f07 100644
--- a/mesalib/src/gallium/auxiliary/util/u_debug.h
+++ b/mesalib/src/gallium/auxiliary/util/u_debug.h
@@ -275,7 +275,7 @@ struct debug_named_value
* ...
* @endcode
*/
-#define DEBUG_NAMED_VALUE(__symbol) DEBUG_NAMED_VALUE_WITH_DESCRIPTION(__symbol, NULL)
+#define DEBUG_NAMED_VALUE(__symbol) {#__symbol, (unsigned long)__symbol, NULL}
#define DEBUG_NAMED_VALUE_WITH_DESCRIPTION(__symbol, __desc) {#__symbol, (unsigned long)__symbol, __desc}
#define DEBUG_NAMED_VALUE_END {NULL, 0, NULL}
diff --git a/mesalib/src/gallium/auxiliary/util/u_format.c b/mesalib/src/gallium/auxiliary/util/u_format.c
index a41c468a9..f572a612e 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format.c
+++ b/mesalib/src/gallium/auxiliary/util/u_format.c
@@ -61,30 +61,6 @@ util_format_is_float(enum pipe_format format)
}
-/**
- * Return the number of logical channels in the given format by
- * examining swizzles.
- * XXX this could be made into a public function if useful elsewhere.
- */
-static unsigned
-nr_logical_channels(const struct util_format_description *desc)
-{
- boolean swizzle_used[UTIL_FORMAT_SWIZZLE_MAX];
-
- memset(swizzle_used, 0, sizeof(swizzle_used));
-
- swizzle_used[desc->swizzle[0]] = TRUE;
- swizzle_used[desc->swizzle[1]] = TRUE;
- swizzle_used[desc->swizzle[2]] = TRUE;
- swizzle_used[desc->swizzle[3]] = TRUE;
-
- return (swizzle_used[UTIL_FORMAT_SWIZZLE_X] +
- swizzle_used[UTIL_FORMAT_SWIZZLE_Y] +
- swizzle_used[UTIL_FORMAT_SWIZZLE_Z] +
- swizzle_used[UTIL_FORMAT_SWIZZLE_W]);
-}
-
-
/** Test if the format contains RGB, but not alpha */
boolean
util_format_is_rgb_no_alpha(enum pipe_format format)
@@ -94,7 +70,7 @@ util_format_is_rgb_no_alpha(enum pipe_format format)
if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
- nr_logical_channels(desc) == 3) {
+ desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_1) {
return TRUE;
}
return FALSE;
diff --git a/mesalib/src/gallium/auxiliary/util/u_prim.h b/mesalib/src/gallium/auxiliary/util/u_prim.h
index 070df643d..d62c636f2 100644
--- a/mesalib/src/gallium/auxiliary/util/u_prim.h
+++ b/mesalib/src/gallium/auxiliary/util/u_prim.h
@@ -118,7 +118,9 @@ static INLINE unsigned u_reduced_prim( unsigned pipe_prim )
return PIPE_PRIM_POINTS;
case PIPE_PRIM_LINES:
+ case PIPE_PRIM_LINES_ADJACENCY:
case PIPE_PRIM_LINE_STRIP:
+ case PIPE_PRIM_LINE_STRIP_ADJACENCY:
case PIPE_PRIM_LINE_LOOP:
return PIPE_PRIM_LINES;
diff --git a/mesalib/src/gallium/auxiliary/util/u_rect.h b/mesalib/src/gallium/auxiliary/util/u_rect.h
index 4cb90d3c3..8fccae8c4 100644
--- a/mesalib/src/gallium/auxiliary/util/u_rect.h
+++ b/mesalib/src/gallium/auxiliary/util/u_rect.h
@@ -31,6 +31,10 @@
#include "pipe/p_compiler.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct u_rect {
int x0, x1;
int y0, y1;
@@ -75,6 +79,10 @@ u_rect_possible_intersection(const struct u_rect *a,
}
}
+#ifdef __cplusplus
+}
+#endif
+
#include "pipe/p_format.h"
#include "util/u_pack_color.h"
@@ -88,6 +96,10 @@ u_rect_possible_intersection(const struct u_rect *a,
*/
#include "pipe/p_format.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern void
util_copy_rect(ubyte * dst, enum pipe_format format,
unsigned dst_stride, unsigned dst_x, unsigned dst_y,
@@ -99,5 +111,8 @@ util_fill_rect(ubyte * dst, enum pipe_format format,
unsigned dst_stride, unsigned dst_x, unsigned dst_y,
unsigned width, unsigned height, union util_color *uc);
+#ifdef __cplusplus
+}
+#endif
#endif /* U_RECT_H */
diff --git a/mesalib/src/gallium/auxiliary/util/u_snprintf.c b/mesalib/src/gallium/auxiliary/util/u_snprintf.c
index e16f103e3..a24b6ff38 100644
--- a/mesalib/src/gallium/auxiliary/util/u_snprintf.c
+++ b/mesalib/src/gallium/auxiliary/util/u_snprintf.c
@@ -167,7 +167,7 @@
#if HAVE_CONFIG_H
#include <config.h>
#else
-#ifdef _WIN32
+#ifdef _MSC_VER
#define vsnprintf util_vsnprintf
#define snprintf util_snprintf
#define HAVE_VSNPRINTF 0
diff --git a/mesalib/src/gallium/auxiliary/util/u_string.h b/mesalib/src/gallium/auxiliary/util/u_string.h
index 15630ad07..fca73ffc7 100644
--- a/mesalib/src/gallium/auxiliary/util/u_string.h
+++ b/mesalib/src/gallium/auxiliary/util/u_string.h
@@ -35,7 +35,7 @@
#ifndef U_STRING_H_
#define U_STRING_H_
-#if !defined(_WIN32) && !defined(XF86_LIBC_H)
+#if !defined(_MSC_VER) && !defined(XF86_LIBC_H)
#include <stdio.h>
#endif
#include <stddef.h>
@@ -64,7 +64,7 @@ util_strchrnul(const char *s, char c)
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
int util_vsnprintf(char *, size_t, const char *, va_list);
int util_snprintf(char *str, size_t size, const char *format, ...);
diff --git a/mesalib/src/gallium/auxiliary/util/u_surface.c b/mesalib/src/gallium/auxiliary/util/u_surface.c
index 304da9070..e99431ef8 100644
--- a/mesalib/src/gallium/auxiliary/util/u_surface.c
+++ b/mesalib/src/gallium/auxiliary/util/u_surface.c
@@ -129,11 +129,11 @@ util_resource_copy_region(struct pipe_context *pipe,
const struct pipe_box *src_box)
{
struct pipe_transfer *src_trans, *dst_trans;
- void *dst_map;
- const void *src_map;
+ uint8_t *dst_map;
+ const uint8_t *src_map;
enum pipe_format src_format, dst_format;
- unsigned w = src_box->width;
- unsigned h = src_box->height;
+ struct pipe_box dst_box;
+ int z;
assert(src && dst);
if (!src || !dst)
@@ -145,44 +145,62 @@ util_resource_copy_region(struct pipe_context *pipe,
src_format = src->format;
dst_format = dst->format;
- src_map = pipe_transfer_map(pipe,
- src,
- src_level,
- src_box->z,
- PIPE_TRANSFER_READ,
- src_box->x, src_box->y, w, h, &src_trans);
-
- dst_map = pipe_transfer_map(pipe,
- dst,
- dst_level,
- dst_z,
- PIPE_TRANSFER_WRITE,
- dst_x, dst_y, w, h, &dst_trans);
-
assert(util_format_get_blocksize(dst_format) == util_format_get_blocksize(src_format));
assert(util_format_get_blockwidth(dst_format) == util_format_get_blockwidth(src_format));
assert(util_format_get_blockheight(dst_format) == util_format_get_blockheight(src_format));
+
+ src_map = pipe->transfer_map(pipe,
+ src,
+ src_level,
+ PIPE_TRANSFER_READ,
+ src_box, &src_trans);
assert(src_map);
+ if (!src_map) {
+ goto no_src_map;
+ }
+
+ dst_box.x = dst_x;
+ dst_box.y = dst_y;
+ dst_box.z = dst_z;
+ dst_box.width = src_box->width;
+ dst_box.height = src_box->height;
+ dst_box.depth = src_box->depth;
+
+ dst_map = pipe->transfer_map(pipe,
+ dst,
+ dst_level,
+ PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE,
+ &dst_box, &dst_trans);
assert(dst_map);
+ if (!dst_map) {
+ goto no_dst_map;
+ }
- if (src_map && dst_map) {
- if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
- memcpy(dst_map, src_map, w);
- } else {
+ if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
+ assert(src_box->height == 1);
+ assert(src_box->depth == 1);
+ memcpy(dst_map, src_map, src_box->width);
+ } else {
+ for (z = 0; z < src_box->depth; ++z) {
util_copy_rect(dst_map,
dst_format,
dst_trans->stride,
0, 0,
- w, h,
+ src_box->width, src_box->height,
src_map,
src_trans->stride,
- 0,
- 0);
+ 0, 0);
+
+ dst_map += dst_trans->layer_stride;
+ src_map += src_trans->layer_stride;
}
}
- pipe->transfer_unmap(pipe, src_trans);
pipe->transfer_unmap(pipe, dst_trans);
+no_dst_map:
+ pipe->transfer_unmap(pipe, src_trans);
+no_src_map:
+ ;
}
@@ -271,7 +289,8 @@ util_clear_depth_stencil(struct pipe_context *pipe,
if (dst_map) {
unsigned dst_stride = dst_trans->stride;
- unsigned zstencil = util_pack_z_stencil(dst->texture->format, depth, stencil);
+ uint64_t zstencil = util_pack64_z_stencil(dst->texture->format,
+ depth, stencil);
unsigned i, j;
assert(dst_trans->stride > 0);
@@ -279,10 +298,10 @@ util_clear_depth_stencil(struct pipe_context *pipe,
case 1:
assert(dst->format == PIPE_FORMAT_S8_UINT);
if(dst_stride == width)
- memset(dst_map, (ubyte) zstencil, height * width);
+ memset(dst_map, (uint8_t) zstencil, height * width);
else {
for (i = 0; i < height; i++) {
- memset(dst_map, (ubyte) zstencil, width);
+ memset(dst_map, (uint8_t) zstencil, width);
dst_map += dst_stride;
}
}
@@ -301,7 +320,7 @@ util_clear_depth_stencil(struct pipe_context *pipe,
for (i = 0; i < height; i++) {
uint32_t *row = (uint32_t *)dst_map;
for (j = 0; j < width; j++)
- *row++ = zstencil;
+ *row++ = (uint32_t) zstencil;
dst_map += dst_stride;
}
}
@@ -319,19 +338,13 @@ util_clear_depth_stencil(struct pipe_context *pipe,
uint32_t *row = (uint32_t *)dst_map;
for (j = 0; j < width; j++) {
uint32_t tmp = *row & dst_mask;
- *row++ = tmp | (zstencil & ~dst_mask);
+ *row++ = tmp | ((uint32_t) zstencil & ~dst_mask);
}
dst_map += dst_stride;
}
}
break;
case 8:
- {
- uint64_t zstencil = util_pack64_z_stencil(dst->texture->format,
- depth, stencil);
-
- assert(dst->format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT);
-
if (!need_rmw) {
for (i = 0; i < height; i++) {
uint64_t *row = (uint64_t *)dst_map;
@@ -358,7 +371,6 @@ util_clear_depth_stencil(struct pipe_context *pipe,
}
}
break;
- }
default:
assert(0);
break;