[d3d11] Copy initial texture data to mapped buffer, if available

Otherwise, if an application maps the image right after creating it,
we might end up reading garbage data or overriding the image data.
This commit is contained in:
Philip Rebohle 2019-06-25 14:22:47 +02:00
parent 4d4db6c683
commit 5728d10587
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
1 changed files with 6 additions and 0 deletions

View File

@ -155,6 +155,12 @@ namespace dxvk {
pInitialData[id].SysMemSlicePitch,
packedFormat);
}
if (pTexture->GetMapMode() == D3D11_COMMON_TEXTURE_MAP_MODE_BUFFER) {
util::packImageData(pTexture->GetMappedBuffer(id)->mapPtr(0), pInitialData[id].pSysMem,
util::computeBlockCount(image->mipLevelExtent(level), formatInfo->blockSize),
formatInfo->elementSize, pInitialData[id].SysMemPitch, pInitialData[id].SysMemSlicePitch);
}
}
}
} else {