diff --git a/src/image.cpp b/src/image.cpp index d93338f90..6df97efa7 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -1069,7 +1069,7 @@ namespace bgfx } bpp = getBitsPerPixel(format); - blockSize = format < TextureFormat::Unknown ? 4*4 : 1; + blockSize = isCompressed(format) ? 4*4 : 1; blockSize = blockSize*bpp/8; _imageContainer.m_data = NULL; @@ -1221,7 +1221,7 @@ namespace bgfx } bpp = getBitsPerPixel(format); - blockSize = format < TextureFormat::Unknown ? 4*4 : 1; + blockSize = isCompressed(format) ? 4*4 : 1; blockSize = blockSize*bpp/8; _imageContainer.m_data = NULL; @@ -1346,7 +1346,7 @@ namespace bgfx } bpp = getBitsPerPixel(format); - blockSize = format < TextureFormat::Unknown ? 4*4 : 1; + blockSize = isCompressed(format) ? 4*4 : 1; blockSize = blockSize*bpp/8; _imageContainer.m_data = NULL; @@ -1389,7 +1389,7 @@ namespace bgfx bx::read(_reader, tc); 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; _imageContainer.m_format = tc.m_format; @@ -1638,7 +1638,7 @@ namespace bgfx depth = bx::uint32_max(1, depth); uint32_t size = width*height*depth*blockSize; - if (TextureFormat::Unknown > type) + if (isCompressed(type) ) { width = bx::uint32_max(1, (width + 3)>>2); height = bx::uint32_max(1, (height + 3)>>2); diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index babc0a6bb..0c1a9a7aa 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -1766,7 +1766,7 @@ namespace bgfx srd[kk].pSysMem = temp; 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].SysMemSlicePitch = (mip.m_height/4)*srd[kk].SysMemPitch; diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index d321eb51b..bd33869db 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -1686,7 +1686,7 @@ namespace bgfx && 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; for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side) diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 2fd4cea98..3dee459dd 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -1454,7 +1454,7 @@ namespace bgfx m_fmt = tfi.m_fmt; 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; if (decompress) @@ -1567,7 +1567,7 @@ namespace bgfx && !s_renderCtx->m_textureSwizzleSupport ; 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; 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 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 height = _rect.m_height;