mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-20 13:53:14 +01:00
Added bimg dependency.
This commit is contained in:
@@ -1153,10 +1153,10 @@ namespace bgfx { namespace gl
|
||||
: tfi.m_internalFmt
|
||||
;
|
||||
|
||||
GLsizei size = (16*16*getBitsPerPixel(_format) )/8;
|
||||
GLsizei size = (16*16*bimg::getBitsPerPixel(bimg::TextureFormat::Enum(_format) ) )/8;
|
||||
void* data = NULL;
|
||||
|
||||
if (isDepth(_format) )
|
||||
if (bimg::isDepth(bimg::TextureFormat::Enum(_format) ) )
|
||||
{
|
||||
_srgb = false;
|
||||
_mipmaps = false;
|
||||
@@ -1169,7 +1169,7 @@ namespace bgfx { namespace gl
|
||||
flushGlError();
|
||||
GLenum err = 0;
|
||||
|
||||
if (isCompressed(_format) )
|
||||
if (bimg::isCompressed(bimg::TextureFormat::Enum(_format) ) )
|
||||
{
|
||||
glCompressedTexImage2D(GL_TEXTURE_2D, 0, internalFmt, 16, 16, 0, size, data);
|
||||
err |= glGetError();
|
||||
@@ -1294,9 +1294,9 @@ namespace bgfx { namespace gl
|
||||
GLenum err = initTestTexture(_format, _srgb, false);
|
||||
|
||||
GLenum attachment;
|
||||
if (isDepth(_format) )
|
||||
if (bimg::isDepth(bimg::TextureFormat::Enum(_format) ) )
|
||||
{
|
||||
const ImageBlockInfo& info = getBlockInfo(_format);
|
||||
const bimg::ImageBlockInfo& info = bimg::getBlockInfo(bimg::TextureFormat::Enum(_format) );
|
||||
if (0 == info.depthBits)
|
||||
{
|
||||
attachment = GL_STENCIL_ATTACHMENT;
|
||||
@@ -2413,7 +2413,7 @@ namespace bgfx { namespace gl
|
||||
if (m_readBackSupported)
|
||||
{
|
||||
const TextureGL& texture = m_textures[_handle.idx];
|
||||
const bool compressed = isCompressed(TextureFormat::Enum(texture.m_textureFormat) );
|
||||
const bool compressed = bimg::isCompressed(bimg::TextureFormat::Enum(texture.m_textureFormat) );
|
||||
|
||||
GL_CHECK(glBindTexture(texture.m_target, texture.m_id) );
|
||||
|
||||
@@ -2558,7 +2558,7 @@ namespace bgfx { namespace gl
|
||||
|
||||
if (GL_RGBA == m_readPixelsFmt)
|
||||
{
|
||||
imageSwizzleBgra8(data, width, height, width*4, data);
|
||||
bimg::imageSwizzleBgra8(data, width, height, width*4, data);
|
||||
}
|
||||
|
||||
g_callback->screenShot(_filePath
|
||||
@@ -3127,7 +3127,7 @@ namespace bgfx { namespace gl
|
||||
|
||||
if (GL_RGBA == m_readPixelsFmt)
|
||||
{
|
||||
imageSwizzleBgra8(m_capture, m_resolution.m_width, m_resolution.m_height, m_resolution.m_width*4, m_capture);
|
||||
bimg::imageSwizzleBgra8(m_capture, m_resolution.m_width, m_resolution.m_height, m_resolution.m_width*4, m_capture);
|
||||
}
|
||||
|
||||
g_callback->captureFrame(m_capture, m_captureSize);
|
||||
@@ -4810,9 +4810,9 @@ namespace bgfx { namespace gl
|
||||
|
||||
void TextureGL::create(const Memory* _mem, uint32_t _flags, uint8_t _skip)
|
||||
{
|
||||
ImageContainer imageContainer;
|
||||
bimg::ImageContainer imageContainer;
|
||||
|
||||
if (imageParse(imageContainer, _mem->data, _mem->size) )
|
||||
if (bimg::imageParse(imageContainer, _mem->data, _mem->size) )
|
||||
{
|
||||
uint8_t numMips = imageContainer.m_numMips;
|
||||
const uint8_t startLod = uint8_t(bx::uint32_min(_skip, numMips-1) );
|
||||
@@ -4822,7 +4822,7 @@ namespace bgfx { namespace gl
|
||||
uint32_t textureHeight;
|
||||
uint32_t textureDepth;
|
||||
{
|
||||
const ImageBlockInfo& ibi = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) );
|
||||
const bimg::ImageBlockInfo& ibi = bimg::getBlockInfo(bimg::TextureFormat::Enum(imageContainer.m_format) );
|
||||
textureWidth = bx::uint32_max(ibi.blockWidth, imageContainer.m_width >>startLod);
|
||||
textureHeight = bx::uint32_max(ibi.blockHeight, imageContainer.m_height>>startLod);
|
||||
textureDepth = 1 < imageContainer.m_depth
|
||||
@@ -4888,7 +4888,7 @@ namespace bgfx { namespace gl
|
||||
&& !s_textureFormat[m_requestedFormat].m_supported
|
||||
&& !s_renderGL->m_textureSwizzleSupport
|
||||
;
|
||||
const bool compressed = isCompressed(TextureFormat::Enum(m_requestedFormat) );
|
||||
const bool compressed = bimg::isCompressed(bimg::TextureFormat::Enum(m_requestedFormat) );
|
||||
const bool convert = false
|
||||
|| m_textureFormat != m_requestedFormat
|
||||
|| swizzle
|
||||
@@ -4941,8 +4941,8 @@ namespace bgfx { namespace gl
|
||||
: side
|
||||
;
|
||||
|
||||
ImageMip mip;
|
||||
if (imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) )
|
||||
bimg::ImageMip mip;
|
||||
if (bimg::imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) )
|
||||
{
|
||||
if (compressed
|
||||
&& !convert)
|
||||
@@ -4994,7 +4994,7 @@ namespace bgfx { namespace gl
|
||||
{
|
||||
uint32_t size = bx::uint32_max(1, (width + 3)>>2)
|
||||
* bx::uint32_max(1, (height + 3)>>2)
|
||||
* 4*4*getBitsPerPixel(TextureFormat::Enum(m_textureFormat) )/8
|
||||
* 4*4* bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) )/8
|
||||
;
|
||||
|
||||
compressedTexImage(imageTarget
|
||||
@@ -5066,7 +5066,7 @@ namespace bgfx { namespace gl
|
||||
|
||||
void TextureGL::update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem)
|
||||
{
|
||||
const uint32_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) );
|
||||
const uint32_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) );
|
||||
const uint32_t rectpitch = _rect.m_width*bpp/8;
|
||||
uint32_t srcpitch = UINT16_MAX == _pitch ? rectpitch : _pitch;
|
||||
|
||||
@@ -5084,7 +5084,7 @@ namespace bgfx { namespace gl
|
||||
&& !s_renderGL->m_textureSwizzleSupport
|
||||
;
|
||||
const bool unpackRowLength = BX_IGNORE_C4127(!!BGFX_CONFIG_RENDERER_OPENGL || s_extension[Extension::EXT_unpack_subimage].m_supported);
|
||||
const bool compressed = isCompressed(TextureFormat::Enum(m_requestedFormat) );
|
||||
const bool compressed = bimg::isCompressed(bimg::TextureFormat::Enum(m_requestedFormat) );
|
||||
const bool convert = false
|
||||
|| (compressed && m_textureFormat != m_requestedFormat)
|
||||
|| swizzle
|
||||
@@ -5110,7 +5110,7 @@ namespace bgfx { namespace gl
|
||||
|
||||
if (!unpackRowLength)
|
||||
{
|
||||
imageCopy(temp, width, height, bpp, srcpitch, data);
|
||||
bimg::imageCopy(temp, width, height, bpp, srcpitch, data);
|
||||
data = temp;
|
||||
}
|
||||
|
||||
@@ -5133,7 +5133,7 @@ namespace bgfx { namespace gl
|
||||
|
||||
if (convert)
|
||||
{
|
||||
imageDecodeToRgba8(temp, data, width, height, srcpitch, TextureFormat::Enum(m_requestedFormat) );
|
||||
bimg::imageDecodeToRgba8(temp, data, width, height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) );
|
||||
data = temp;
|
||||
srcpitch = rectpitch;
|
||||
}
|
||||
@@ -5141,7 +5141,7 @@ namespace bgfx { namespace gl
|
||||
if (!unpackRowLength
|
||||
&& !convert)
|
||||
{
|
||||
imageCopy(temp, width, height, bpp, srcpitch, data);
|
||||
bimg::imageCopy(temp, width, height, bpp, srcpitch, data);
|
||||
data = temp;
|
||||
}
|
||||
|
||||
@@ -5883,10 +5883,10 @@ namespace bgfx { namespace gl
|
||||
}
|
||||
|
||||
GLenum attachment = GL_COLOR_ATTACHMENT0 + colorIdx;
|
||||
TextureFormat::Enum format = (TextureFormat::Enum)texture.m_textureFormat;
|
||||
if (isDepth(format) )
|
||||
bimg::TextureFormat::Enum format = bimg::TextureFormat::Enum(texture.m_textureFormat);
|
||||
if (bimg::isDepth(format) )
|
||||
{
|
||||
const ImageBlockInfo& info = getBlockInfo(format);
|
||||
const bimg::ImageBlockInfo& info = bimg::getBlockInfo(format);
|
||||
if (0 < info.stencilBits)
|
||||
{
|
||||
attachment = GL_DEPTH_STENCIL_ATTACHMENT;
|
||||
@@ -5973,7 +5973,7 @@ namespace bgfx { namespace gl
|
||||
if (0 != texture.m_id)
|
||||
{
|
||||
GLenum attachment = GL_COLOR_ATTACHMENT0 + colorIdx;
|
||||
if (!isDepth( (TextureFormat::Enum)texture.m_textureFormat) )
|
||||
if (!bimg::isDepth(bimg::TextureFormat::Enum(texture.m_textureFormat) ) )
|
||||
{
|
||||
++colorIdx;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user