Image11 and TextureStorage11 make sure sizes are aligned properly.

TRAC #22422 Signed-off-by: Jamie Madill Signed-off-by: Nicolas Capens Author: Geoff Lang git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1915 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 53b0ecb8
...@@ -371,9 +371,14 @@ void Image11::createStagingTexture() ...@@ -371,9 +371,14 @@ void Image11::createStagingTexture()
{ {
ID3D11Device *device = mRenderer->getDevice(); ID3D11Device *device = mRenderer->getDevice();
// Round up the width and height to the nearest multiple of dimension alignment
unsigned int dimensionAlignment = d3d11::GetTextureFormatDimensionAlignment(dxgiFormat);
unsigned int width = mWidth + dimensionAlignment - 1 - (mWidth - 1) % dimensionAlignment;
unsigned int height = mHeight + dimensionAlignment - 1 - (mHeight - 1) % dimensionAlignment;
D3D11_TEXTURE2D_DESC desc; D3D11_TEXTURE2D_DESC desc;
desc.Width = mWidth; desc.Width = width;
desc.Height = mHeight; desc.Height = height;
desc.MipLevels = desc.ArraySize = 1; desc.MipLevels = desc.ArraySize = 1;
desc.Format = dxgiFormat; desc.Format = dxgiFormat;
desc.SampleDesc.Count = 1; desc.SampleDesc.Count = 1;
......
...@@ -133,6 +133,11 @@ bool TextureStorage11::updateSubresourceLevel(ID3D11Texture2D *srcTexture, int l ...@@ -133,6 +133,11 @@ bool TextureStorage11::updateSubresourceLevel(ID3D11Texture2D *srcTexture, int l
{ {
if (srcTexture) if (srcTexture)
{ {
// Round up the width and height to the nearest multiple of dimension alignment
unsigned int dimensionAlignment = d3d11::GetTextureFormatDimensionAlignment(mTextureFormat);
width = width + dimensionAlignment - 1 - (width - 1) % dimensionAlignment;
height = height + dimensionAlignment - 1 - (height - 1) % dimensionAlignment;
D3D11_BOX srcBox; D3D11_BOX srcBox;
srcBox.left = xoffset; srcBox.left = xoffset;
srcBox.top = yoffset; srcBox.top = yoffset;
......
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