diff options
Diffstat (limited to '3rdparty/bgfx/src/image.cpp')
-rw-r--r-- | 3rdparty/bgfx/src/image.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/3rdparty/bgfx/src/image.cpp b/3rdparty/bgfx/src/image.cpp index f7aa4404b71..37537a11cb3 100644 --- a/3rdparty/bgfx/src/image.cpp +++ b/3rdparty/bgfx/src/image.cpp @@ -2122,6 +2122,14 @@ namespace bgfx imageCheckerboard(_width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffffffff), _dst); break; + case TextureFormat::RGBA8: + imageSwizzleBgra8(_width, _height, _pitch, _src, _dst); + break; + + case TextureFormat::BGRA8: + memcpy(_dst, _src, _pitch*_height); + break; + default: // Decompression not implemented... Make ugly red-yellow checkerboard texture. imageCheckerboard(_width, _height, 16, UINT32_C(0xffff0000), UINT32_C(0xffffff00), _dst); @@ -2129,6 +2137,25 @@ namespace bgfx } } + void imageDecodeToRgba8(uint8_t* _dst, const uint8_t* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, uint8_t _type) + { + switch (_type) + { + case TextureFormat::RGBA8: + memcpy(_dst, _src, _pitch*_height); + break; + + case TextureFormat::BGRA8: + imageSwizzleBgra8(_width, _height, _pitch, _src, _dst); + break; + + default: + imageDecodeToBgra8(_dst, _src, _width, _height, _pitch, _type); + imageSwizzleBgra8(_width, _height, _pitch, _dst, _dst); + break; + } + } + bool imageGetRawData(const ImageContainer& _imageContainer, uint8_t _side, uint8_t _lod, const void* _data, uint32_t _size, ImageMip& _mip) { uint32_t offset = _imageContainer.m_offset; |