This commit is contained in:
Branimir Karadžić 2014-02-20 22:05:50 -08:00
parent 0e81c0b2aa
commit 3bc15318fd
4 changed files with 10 additions and 10 deletions

View file

@ -1069,7 +1069,7 @@ namespace bgfx
} }
bpp = getBitsPerPixel(format); bpp = getBitsPerPixel(format);
blockSize = format < TextureFormat::Unknown ? 4*4 : 1; blockSize = isCompressed(format) ? 4*4 : 1;
blockSize = blockSize*bpp/8; blockSize = blockSize*bpp/8;
_imageContainer.m_data = NULL; _imageContainer.m_data = NULL;
@ -1221,7 +1221,7 @@ namespace bgfx
} }
bpp = getBitsPerPixel(format); bpp = getBitsPerPixel(format);
blockSize = format < TextureFormat::Unknown ? 4*4 : 1; blockSize = isCompressed(format) ? 4*4 : 1;
blockSize = blockSize*bpp/8; blockSize = blockSize*bpp/8;
_imageContainer.m_data = NULL; _imageContainer.m_data = NULL;
@ -1346,7 +1346,7 @@ namespace bgfx
} }
bpp = getBitsPerPixel(format); bpp = getBitsPerPixel(format);
blockSize = format < TextureFormat::Unknown ? 4*4 : 1; blockSize = isCompressed(format) ? 4*4 : 1;
blockSize = blockSize*bpp/8; blockSize = blockSize*bpp/8;
_imageContainer.m_data = NULL; _imageContainer.m_data = NULL;
@ -1389,7 +1389,7 @@ namespace bgfx
bx::read(_reader, tc); bx::read(_reader, tc);
uint32_t bpp = getBitsPerPixel(TextureFormat::Enum(tc.m_format) ); uint32_t bpp = getBitsPerPixel(TextureFormat::Enum(tc.m_format) );
uint32_t blockSize = tc.m_format < TextureFormat::Unknown ? 4*4 : 1; uint32_t blockSize = isCompressed(TextureFormat::Enum(tc.m_format) ) ? 4*4 : 1;
blockSize = blockSize*bpp/8; blockSize = blockSize*bpp/8;
_imageContainer.m_format = tc.m_format; _imageContainer.m_format = tc.m_format;
@ -1638,7 +1638,7 @@ namespace bgfx
depth = bx::uint32_max(1, depth); depth = bx::uint32_max(1, depth);
uint32_t size = width*height*depth*blockSize; uint32_t size = width*height*depth*blockSize;
if (TextureFormat::Unknown > type) if (isCompressed(type) )
{ {
width = bx::uint32_max(1, (width + 3)>>2); width = bx::uint32_max(1, (width + 3)>>2);
height = bx::uint32_max(1, (height + 3)>>2); height = bx::uint32_max(1, (height + 3)>>2);

View file

@ -1766,7 +1766,7 @@ namespace bgfx
srd[kk].pSysMem = temp; srd[kk].pSysMem = temp;
srd[kk].SysMemPitch = srcpitch; srd[kk].SysMemPitch = srcpitch;
} }
else if (TextureFormat::Unknown > m_textureFormat) else if (isCompressed(TextureFormat::Enum(m_textureFormat) ) )
{ {
srd[kk].SysMemPitch = (mip.m_width/4)*mip.m_blockSize; srd[kk].SysMemPitch = (mip.m_width/4)*mip.m_blockSize;
srd[kk].SysMemSlicePitch = (mip.m_height/4)*srd[kk].SysMemPitch; srd[kk].SysMemSlicePitch = (mip.m_height/4)*srd[kk].SysMemPitch;

View file

@ -1686,7 +1686,7 @@ namespace bgfx
&& imageContainer.m_format != TextureFormat::BC5 && imageContainer.m_format != TextureFormat::BC5
; ;
const bool compressed = TextureFormat::Unknown > m_requestedFormat; const bool compressed = isCompressed(TextureFormat::Enum(m_requestedFormat) );
const uint32_t min = compressed ? 4 : 1; const uint32_t min = compressed ? 4 : 1;
for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side) for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)

View file

@ -1454,7 +1454,7 @@ namespace bgfx
m_fmt = tfi.m_fmt; m_fmt = tfi.m_fmt;
m_type = tfi.m_type; m_type = tfi.m_type;
const bool compressed = TextureFormat::Unknown > _format; const bool compressed = isCompressed(TextureFormat::Enum(_format) );
const bool decompress = !tfi.m_supported && compressed; const bool decompress = !tfi.m_supported && compressed;
if (decompress) if (decompress)
@ -1567,7 +1567,7 @@ namespace bgfx
&& !s_renderCtx->m_textureSwizzleSupport && !s_renderCtx->m_textureSwizzleSupport
; ;
const bool convert = m_textureFormat != m_requestedFormat; const bool convert = m_textureFormat != m_requestedFormat;
const bool compressed = TextureFormat::Unknown > m_textureFormat; const bool compressed = isCompressed(TextureFormat::Enum(m_textureFormat) );
const uint32_t min = convert && compressed ? 4 : 1; const uint32_t min = convert && compressed ? 4 : 1;
BX_WARN(!swizzle && !convert, "Texture %s%s%s from %s to %s." BX_WARN(!swizzle && !convert, "Texture %s%s%s from %s to %s."
@ -1728,7 +1728,7 @@ namespace bgfx
; ;
const bool unpackRowLength = !!BGFX_CONFIG_RENDERER_OPENGL || s_extension[Extension::EXT_unpack_subimage].m_supported; const bool unpackRowLength = !!BGFX_CONFIG_RENDERER_OPENGL || s_extension[Extension::EXT_unpack_subimage].m_supported;
const bool convert = m_textureFormat != m_requestedFormat; const bool convert = m_textureFormat != m_requestedFormat;
const bool compressed = TextureFormat::Unknown > m_textureFormat; const bool compressed = isCompressed(TextureFormat::Enum(m_textureFormat) );
const uint32_t width = _rect.m_width; const uint32_t width = _rect.m_width;
const uint32_t height = _rect.m_height; const uint32_t height = _rect.m_height;