Fix copying 4-byte 32-bit depth/stencil formats between buffers and textures.

This commit is contained in:
Bill Hollings 2018-06-05 17:24:05 -04:00
parent 8d9ee9b518
commit 67f659c064

View File

@ -658,9 +658,12 @@ void MVKCmdBufferImageCopy::encode(MVKCommandEncoder* cmdEncoder) {
bool wantStencil = mvkAreFlagsEnabled(imgFlags, VK_IMAGE_ASPECT_STENCIL_BIT); bool wantStencil = mvkAreFlagsEnabled(imgFlags, VK_IMAGE_ASPECT_STENCIL_BIT);
// The stencil component is always 1 byte per pixel. // The stencil component is always 1 byte per pixel.
// Don't reduce depths of 32-bit depth/stencil formats.
if (wantDepth && !wantStencil) { if (wantDepth && !wantStencil) {
bytesPerRow -= buffImgWd; if (mvkMTLPixelFormatBytesPerTexel(mtlPixFmt) != 4) {
bytesPerImg -= buffImgWd * buffImgHt; bytesPerRow -= buffImgWd;
bytesPerImg -= buffImgWd * buffImgHt;
}
blitOptions |= MTLBlitOptionDepthFromDepthStencil; blitOptions |= MTLBlitOptionDepthFromDepthStencil;
} else if (wantStencil && !wantDepth) { } else if (wantStencil && !wantDepth) {
bytesPerRow = buffImgWd; bytesPerRow = buffImgWd;