}
break;
case PIPE_FORMAT_S8Z24_UNORM:
+ {
+ uint *pDest = (uint *) (map + y * pt->stride + x*4);
+ assert(pt->usage == PIPE_TRANSFER_READ_WRITE);
+ for (i = 0; i < h; i++) {
+ for (j = 0; j < w; j++) {
+ /* convert 32-bit Z to 24-bit Z, preserve stencil */
+ pDest[j] = (pDest[j] & 0xff000000) | ptrc[j] >> 8;
+ }
+ pDest += pt->stride/4;
+ ptrc += srcStride;
+ }
+ }
+ break;
case PIPE_FORMAT_X8Z24_UNORM:
{
uint *pDest = (uint *) (map + y * pt->stride + x*4);
}
break;
case PIPE_FORMAT_Z24S8_UNORM:
+ {
+ uint *pDest = (uint *) (map + y * pt->stride + x*4);
+ assert(pt->usage == PIPE_TRANSFER_READ_WRITE);
+ for (i = 0; i < h; i++) {
+ for (j = 0; j < w; j++) {
+ /* convert 32-bit Z to 24-bit Z, preserve stencil */
+ pDest[j] = (pDest[j] & 0xff) | (ptrc[j] & 0xffffff00);
+ }
+ pDest += pt->stride/4;
+ ptrc += srcStride;
+ }
+ }
+ break;
case PIPE_FORMAT_Z24X8_UNORM:
{
uint *pDest = (uint *) (map + y * pt->stride + x*4);
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
/* convert 32-bit Z to 24-bit Z (0 stencil) */
- pDest[j] = ptrc[j] << 8;
+ pDest[j] = ptrc[j] & 0xffffff00;
}
pDest += pt->stride/4;
ptrc += srcStride;
st_cond_flush_get_tex_transfer(st, rbRead->texture, 0, 0, 0,
PIPE_TRANSFER_READ, srcx, srcy, width,
height);
+ struct pipe_transfer *ptTex;
+ enum pipe_transfer_usage transfer_usage;
- struct pipe_transfer *ptTex =
- st_cond_flush_get_tex_transfer(st, pt, 0, 0, 0, PIPE_TRANSFER_WRITE,
- 0, 0, width, height);
+ if (type == GL_DEPTH && pf_is_depth_and_stencil(pt->format))
+ transfer_usage = PIPE_TRANSFER_READ_WRITE;
+ else
+ transfer_usage = PIPE_TRANSFER_WRITE;
+
+ ptTex = st_cond_flush_get_tex_transfer(st, pt, 0, 0, 0, transfer_usage,
+ 0, 0, width, height);
if (type == GL_COLOR) {
/* alternate path using get/put_tile() */
GLint texelBytes, sizeInBytes;
GLuint dstRowStride;
struct gl_pixelstore_attrib unpackNB;
+ enum pipe_transfer_usage transfer_usage;
DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(target), level, width, height, depth, border);
}
if (stImage->pt) {
+ if (format == GL_DEPTH_COMPONENT &&
+ pf_is_depth_and_stencil(stImage->pt->format))
+ transfer_usage = PIPE_TRANSFER_READ_WRITE;
+ else
+ transfer_usage = PIPE_TRANSFER_WRITE;
+
texImage->Data = st_texture_image_map(ctx->st, stImage, 0,
- PIPE_TRANSFER_WRITE, 0, 0,
+ transfer_usage, 0, 0,
stImage->base.Width,
stImage->base.Height);
if(stImage->transfer)
st_texture_image_unmap(ctx->st, stImage);
/* map next slice of 3D texture */
texImage->Data = st_texture_image_map(ctx->st, stImage, i + 1,
- PIPE_TRANSFER_WRITE, 0, 0,
+ transfer_usage, 0, 0,
stImage->base.Width,
stImage->base.Height);
src += srcImageStride;
_mesa_image_image_stride(packing, width, height, format, type);
GLint i;
const GLubyte *src;
+ enum pipe_transfer_usage transfer_usage;
DBG("%s target %s level %d offset %d,%d %dx%d\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(target),
* from uploading the buffer under us.
*/
if (stImage->pt) {
+ if (format == GL_DEPTH_COMPONENT &&
+ pf_is_depth_and_stencil(stImage->pt->format))
+ transfer_usage = PIPE_TRANSFER_READ_WRITE;
+ else
+ transfer_usage = PIPE_TRANSFER_WRITE;
+
st_teximage_flush_before_map(ctx->st, stImage->pt, 0, level,
- PIPE_TRANSFER_WRITE);
+ transfer_usage);
texImage->Data = st_texture_image_map(ctx->st, stImage, zoffset,
- PIPE_TRANSFER_WRITE,
+ transfer_usage,
xoffset, yoffset,
width, height);
}
/* map next slice of 3D texture */
texImage->Data = st_texture_image_map(ctx->st, stImage,
zoffset + i + 1,
- PIPE_TRANSFER_WRITE,
+ transfer_usage,
xoffset, yoffset,
width, height);
src += srcImageStride;
struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *src_trans;
GLvoid *texDest;
+ enum pipe_transfer_usage transfer_usage;
assert(width <= MAX_WIDTH);
srcX, srcY,
width, height);
+ if (baseFormat == GL_DEPTH_COMPONENT &&
+ pf_is_depth_and_stencil(stImage->pt->format))
+ transfer_usage = PIPE_TRANSFER_READ_WRITE;
+ else
+ transfer_usage = PIPE_TRANSFER_WRITE;
+
st_teximage_flush_before_map(ctx->st, stImage->pt, 0, 0,
- PIPE_TRANSFER_WRITE);
+ transfer_usage);
- texDest = st_texture_image_map(ctx->st, stImage, 0, PIPE_TRANSFER_WRITE,
+ texDest = st_texture_image_map(ctx->st, stImage, 0, transfer_usage,
destX, destY, width, height);
if (baseFormat == GL_DEPTH_COMPONENT ||