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 ...@@ -117,20 +117,47 @@ bool TextureStorage11::updateSubresourceLevel(ID3D11Resource *srcTexture, unsign
{ {
GLuint clientVersion = mRenderer->getCurrentClientVersion(); GLuint clientVersion = mRenderer->getCurrentClientVersion();
D3D11_BOX srcBox; gl::Extents texSize(std::max(mTextureWidth >> level, 1U),
srcBox.left = xoffset; std::max(mTextureHeight >> level, 1U),
srcBox.top = yoffset; std::max(mTextureDepth >> level, 1U));
srcBox.right = xoffset + roundUp((unsigned int)width, d3d11::GetBlockWidth(mTextureFormat, clientVersion)); gl::Box copyArea(xoffset, yoffset, zoffset, width, height, depth);
srcBox.bottom = yoffset + roundUp((unsigned int)height, d3d11::GetBlockHeight(mTextureFormat, clientVersion));
srcBox.front = zoffset; bool fullCopy = copyArea.x == 0 &&
srcBox.back = zoffset + depth; copyArea.y == 0 &&
copyArea.z == 0 &&
ID3D11DeviceContext *context = mRenderer->getDeviceContext(); copyArea.width == texSize.width &&
copyArea.height == texSize.height &&
ASSERT(getBaseTexture()); copyArea.depth == texSize.depth;
context->CopySubresourceRegion(getBaseTexture(), getSubresourceIndex(level + mLodOffset, layerTarget),
xoffset, yoffset, zoffset, srcTexture, sourceSubresource, &srcBox); ID3D11Resource *dstTexture = getBaseTexture();
return true; 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; 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