summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2012-11-07 12:57:15 +0000
committerAndreas Boll <andreas.boll.dev@gmail.com>2013-04-17 13:30:13 +0200
commitf3baee53cf2f499e39163680b4234140febaa4c1 (patch)
tree14efa8744d6a526b99eedaada34cf8be66bd7737
parent831124de09c4f975bccfb09eecf68d42a069915b (diff)
util/u_surface: Fix util_clear_depth_stencil for Z32_FLOAT_S8X24_UINT.
util_pack_z_stencil was being unconditionally invoked for all formats, causing an assertion failure for Z32_FLOAT_S8X24_UINT. NOTE: Candidate for the stable branches. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com> (cherry picked from commit bbb48a4a55f7588d678e14e7166e8dac3f2007bc)
-rw-r--r--src/gallium/auxiliary/util/u_surface.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c
index fcfff148fe..f1409c23cd 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -308,7 +308,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);
@@ -316,10 +317,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;
}
}
@@ -338,7 +339,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;
}
}
@@ -356,19 +357,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;
@@ -395,7 +390,6 @@ util_clear_depth_stencil(struct pipe_context *pipe,
}
}
break;
- }
default:
assert(0);
break;