D3D1x: Fixed update surface size when texture is transcoded.

This commit is contained in:
Branimir Karadžić
2021-11-11 15:46:29 -08:00
parent 17bb4dce49
commit 67d1cce8f8
2 changed files with 16 additions and 10 deletions

View File

@@ -4751,9 +4751,10 @@ namespace bgfx { namespace d3d11
uint32_t rectpitch = _rect.m_width*bpp/8;
if (bimg::isCompressed(bimg::TextureFormat::Enum(m_textureFormat)))
{
const bimg::ImageBlockInfo& blockInfo = bimg::getBlockInfo(bimg::TextureFormat::Enum(m_textureFormat));
const bimg::ImageBlockInfo& blockInfo = bimg::getBlockInfo(bimg::TextureFormat::Enum(m_textureFormat) );
rectpitch = (_rect.m_width / blockInfo.blockWidth)*blockInfo.blockSize;
}
const uint32_t srcpitch = UINT16_MAX == _pitch ? rectpitch : _pitch;
const uint32_t slicepitch = rectpitch*_rect.m_height;
@@ -4767,6 +4768,9 @@ namespace bgfx { namespace d3d11
temp = (uint8_t*)BX_ALLOC(g_allocator, slicepitch);
bimg::imageDecodeToBgra8(g_allocator, temp, data, _rect.m_width, _rect.m_height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) );
data = temp;
box.right = bx::max(1u, m_width >> _mip);
box.bottom = bx::max(1u, m_height >> _mip);
}
deviceCtx->UpdateSubresource(