aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util/u_surface.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-11-19 10:47:23 +0100
committermarha <marha@users.sourceforge.net>2012-11-19 10:47:23 +0100
commitb3e1e62c45f525cdd332073aaa34d8452cb23374 (patch)
tree221ee6420074033279921fadc971d30d63d6847b /mesalib/src/gallium/auxiliary/util/u_surface.c
parentb142593315b909b9e202f0f4585b96bf2e74b9db (diff)
downloadvcxsrv-b3e1e62c45f525cdd332073aaa34d8452cb23374.tar.gz
vcxsrv-b3e1e62c45f525cdd332073aaa34d8452cb23374.tar.bz2
vcxsrv-b3e1e62c45f525cdd332073aaa34d8452cb23374.zip
git update 19 nov 2012
fontconfig: c20ac78b01df3f0919352bba16b5b48b3b5d4d6d libxcb: 76a2166de9c80b35f987fdc3f3a228bafa0de94e mesa: ddb901fbf4489ffcd85d3320f23913eb1d4fbdfe pixman: 44dd746bb68625b2f6be77c3f80292b45defe9d7 xserver: 6a6c3afe71ac82a93d9fd0034dd5bbdcf0eae1ea xkeyboard-config: 709e05c069428236ca2567e784c9971eecc8ca50
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_surface.c')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_surface.c88
1 files changed, 50 insertions, 38 deletions
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;