MCPcopy Create free account
hub / github.com/crownengine/crown / getViableTextureFormat

Function getViableTextureFormat

3rdparty/bgfx/src/bgfx.cpp:1757–1787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1755 }
1756
1757 TextureFormat::Enum getViableTextureFormat(const bimg::ImageContainer& _imageContainer)
1758 {
1759 const uint32_t formatCaps = g_caps.formats[_imageContainer.m_format];
1760 bool convert = 0 == formatCaps;
1761
1762 if (_imageContainer.m_cubeMap)
1763 {
1764 convert |= 0 == (formatCaps & BGFX_CAPS_FORMAT_TEXTURE_CUBE)
1765 && 0 != (formatCaps & BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED)
1766 ;
1767 }
1768 else if (_imageContainer.m_depth > 1)
1769 {
1770 convert |= 0 == (formatCaps & BGFX_CAPS_FORMAT_TEXTURE_3D)
1771 && 0 != (formatCaps & BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED)
1772 ;
1773 }
1774 else
1775 {
1776 convert |= 0 == (formatCaps & BGFX_CAPS_FORMAT_TEXTURE_2D)
1777 && 0 != (formatCaps & BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED)
1778 ;
1779 }
1780
1781 if (convert)
1782 {
1783 return TextureFormat::BGRA8;
1784 }
1785
1786 return TextureFormat::Enum(_imageContainer.m_format);
1787 }
1788
1789 const char* getName(TextureFormat::Enum _fmt)
1790 {

Callers 4

createMethod · 0.85
createMethod · 0.85
createMethod · 0.85
createMethod · 0.85

Calls 1

EnumEnum · 0.70

Tested by

no test coverage detected