From 3bc15318fd95498c42b6e757ba95cb22dd338339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Thu, 20 Feb 2014 22:05:50 -0800 Subject: [PATCH] Cleanup. --- src/image.cpp | 10 +++++----- src/renderer_d3d11.cpp | 2 +- src/renderer_d3d9.cpp | 2 +- src/renderer_gl.cpp | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/image.cpp b/src/image.cpp index d93338f9..6df97efa 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 babc0a6b..0c1a9a7a 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 d321eb51..bd33869d 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 2fd4cea9..3dee459d 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;