Commit 79031cb5 by Geoff Lang

TextureStorage11::updateSubresourceLevel will now use the blitter if it is…

TextureStorage11::updateSubresourceLevel will now use the blitter if it is updating a depth stencil texture. TRAC #23531 Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods Author: Geoff Lang
parent de14d607
......@@ -117,20 +117,47 @@ bool TextureStorage11::updateSubresourceLevel(ID3D11Resource *srcTexture, unsign
{
GLuint clientVersion = mRenderer->getCurrentClientVersion();
D3D11_BOX srcBox;
srcBox.left = xoffset;
srcBox.top = yoffset;
srcBox.right = xoffset + roundUp((unsigned int)width, d3d11::GetBlockWidth(mTextureFormat, clientVersion));
srcBox.bottom = yoffset + roundUp((unsigned int)height, d3d11::GetBlockHeight(mTextureFormat, clientVersion));
srcBox.front = zoffset;
srcBox.back = zoffset + depth;
ID3D11DeviceContext *context = mRenderer->getDeviceContext();
ASSERT(getBaseTexture());
context->CopySubresourceRegion(getBaseTexture(), getSubresourceIndex(level + mLodOffset, layerTarget),
xoffset, yoffset, zoffset, srcTexture, sourceSubresource, &srcBox);
return true;
gl::Extents texSize(std::max(mTextureWidth >> level, 1U),
std::max(mTextureHeight >> level, 1U),
std::max(mTextureDepth >> level, 1U));
gl::Box copyArea(xoffset, yoffset, zoffset, width, height, depth);
bool fullCopy = copyArea.x == 0 &&
copyArea.y == 0 &&
copyArea.z == 0 &&
copyArea.width == texSize.width &&
copyArea.height == texSize.height &&
copyArea.depth == texSize.depth;
ID3D11Resource *dstTexture = getBaseTexture();
unsigned int dstSubresource = getSubresourceIndex(level + mLodOffset, layerTarget);
ASSERT(dstTexture);
if (!fullCopy && (d3d11::GetDepthBits(mTextureFormat) > 0 || d3d11::GetStencilBits(mTextureFormat) > 0))
{
// CopySubresourceRegion cannot copy partial depth stencils, use the blitter instead
Blit11 *blitter = mRenderer->getBlitter();
return blitter->copyDepthStencil(srcTexture, sourceSubresource, copyArea, texSize,
dstTexture, dstSubresource, copyArea, texSize);
}
else
{
D3D11_BOX srcBox;
srcBox.left = copyArea.x;
srcBox.top = copyArea.y;
srcBox.right = copyArea.x + roundUp((unsigned int)width, d3d11::GetBlockWidth(mTextureFormat, clientVersion));
srcBox.bottom = copyArea.y + roundUp((unsigned int)height, d3d11::GetBlockHeight(mTextureFormat, clientVersion));
srcBox.front = copyArea.z;
srcBox.back = copyArea.z + copyArea.depth;
ID3D11DeviceContext *context = mRenderer->getDeviceContext();
context->CopySubresourceRegion(dstTexture, dstSubresource, copyArea.x, copyArea.y, copyArea.z,
srcTexture, sourceSubresource, fullCopy ? NULL : &srcBox);
return true;
}
}
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment