mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
Cleanup.
This commit is contained in:
parent
1fad44b477
commit
0e116113fb
2 changed files with 24 additions and 17 deletions
13
src/bgfx.cpp
13
src/bgfx.cpp
|
@ -1143,19 +1143,20 @@ namespace bgfx
|
||||||
|
|
||||||
for (uint32_t ii = 0; ii < BX_COUNTOF(s_emulatedFormats); ++ii)
|
for (uint32_t ii = 0; ii < BX_COUNTOF(s_emulatedFormats); ++ii)
|
||||||
{
|
{
|
||||||
if (0 == (g_caps.formats[s_emulatedFormats[ii] ] & BGFX_CAPS_FORMAT_TEXTURE_2D) )
|
const uint32_t fmt = s_emulatedFormats[ii];
|
||||||
|
if (0 == (g_caps.formats[fmt] & BGFX_CAPS_FORMAT_TEXTURE_2D) )
|
||||||
{
|
{
|
||||||
g_caps.formats[s_emulatedFormats[ii] ] |= BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED;
|
g_caps.formats[fmt] |= BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == (g_caps.formats[s_emulatedFormats[ii] ] & BGFX_CAPS_FORMAT_TEXTURE_3D) )
|
if (0 == (g_caps.formats[fmt] & BGFX_CAPS_FORMAT_TEXTURE_3D) )
|
||||||
{
|
{
|
||||||
g_caps.formats[s_emulatedFormats[ii] ] |= BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED;
|
g_caps.formats[fmt] |= BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == (g_caps.formats[s_emulatedFormats[ii] ] & BGFX_CAPS_FORMAT_TEXTURE_CUBE) )
|
if (0 == (g_caps.formats[fmt] & BGFX_CAPS_FORMAT_TEXTURE_CUBE) )
|
||||||
{
|
{
|
||||||
g_caps.formats[s_emulatedFormats[ii] ] |= BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED;
|
g_caps.formats[fmt] |= BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -434,11 +434,15 @@ namespace bgfx { namespace mtl
|
||||||
|
|
||||||
support |= MTLPixelFormatInvalid != s_textureFormat[ii].m_fmt
|
support |= MTLPixelFormatInvalid != s_textureFormat[ii].m_fmt
|
||||||
? BGFX_CAPS_FORMAT_TEXTURE_2D
|
? BGFX_CAPS_FORMAT_TEXTURE_2D
|
||||||
|
| BGFX_CAPS_FORMAT_TEXTURE_3D
|
||||||
|
| BGFX_CAPS_FORMAT_TEXTURE_CUBE
|
||||||
: BGFX_CAPS_FORMAT_TEXTURE_NONE
|
: BGFX_CAPS_FORMAT_TEXTURE_NONE
|
||||||
;
|
;
|
||||||
|
|
||||||
support |= MTLPixelFormatInvalid != s_textureFormat[ii].m_fmtSrgb
|
support |= MTLPixelFormatInvalid != s_textureFormat[ii].m_fmtSrgb
|
||||||
? BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB
|
? BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB
|
||||||
|
| BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB
|
||||||
|
| BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB
|
||||||
: BGFX_CAPS_FORMAT_TEXTURE_NONE
|
: BGFX_CAPS_FORMAT_TEXTURE_NONE
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -464,6 +468,15 @@ namespace bgfx { namespace mtl
|
||||||
g_caps.formats[TextureFormat::PTC24 ] = BGFX_CAPS_FORMAT_TEXTURE_NONE;
|
g_caps.formats[TextureFormat::PTC24 ] = BGFX_CAPS_FORMAT_TEXTURE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii)
|
||||||
|
{
|
||||||
|
if (BGFX_CAPS_FORMAT_TEXTURE_NONE == g_caps.formats[ii])
|
||||||
|
{
|
||||||
|
s_textureFormat[ii].m_fmt = MTLPixelFormatInvalid;
|
||||||
|
s_textureFormat[ii].m_fmtSrgb = MTLPixelFormatInvalid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Init reserved part of view name.
|
// Init reserved part of view name.
|
||||||
for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
|
for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
|
||||||
{
|
{
|
||||||
|
@ -1807,22 +1820,15 @@ namespace bgfx { namespace mtl
|
||||||
const uint32_t textureWidth = bx::uint32_max(blockInfo.blockWidth, imageContainer.m_width >>startLod);
|
const uint32_t textureWidth = bx::uint32_max(blockInfo.blockWidth, imageContainer.m_width >>startLod);
|
||||||
const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod);
|
const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod);
|
||||||
|
|
||||||
const uint16_t formatMask = imageContainer.m_cubeMap
|
|
||||||
? BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED
|
|
||||||
: imageContainer.m_depth > 1
|
|
||||||
? BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED
|
|
||||||
: BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED
|
|
||||||
;
|
|
||||||
|
|
||||||
const bool convert = 0 != (g_caps.formats[m_requestedFormat] & formatMask);
|
|
||||||
|
|
||||||
m_flags = _flags;
|
m_flags = _flags;
|
||||||
m_requestedFormat = (uint8_t)imageContainer.m_format;
|
m_requestedFormat = (uint8_t)imageContainer.m_format;
|
||||||
m_textureFormat = convert
|
m_textureFormat = MTLPixelFormatInvalid == s_textureFormat[m_requestedFormat].m_fmt
|
||||||
? uint8_t(TextureFormat::BGRA8)
|
? uint8_t(TextureFormat::BGRA8)
|
||||||
: m_requestedFormat
|
: m_requestedFormat
|
||||||
;
|
;
|
||||||
|
|
||||||
|
const bool convert = m_requestedFormat != m_textureFormat;
|
||||||
|
|
||||||
uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) );
|
uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) );
|
||||||
if (convert)
|
if (convert)
|
||||||
{
|
{
|
||||||
|
@ -1860,7 +1866,7 @@ namespace bgfx { namespace mtl
|
||||||
);
|
);
|
||||||
|
|
||||||
const bool bufferOnly = 0 != (_flags&BGFX_TEXTURE_RT_BUFFER_ONLY);
|
const bool bufferOnly = 0 != (_flags&BGFX_TEXTURE_RT_BUFFER_ONLY);
|
||||||
const bool computeWrite = 0 != (_flags&BGFX_TEXTURE_COMPUTE_WRITE);
|
// const bool computeWrite = 0 != (_flags&BGFX_TEXTURE_COMPUTE_WRITE);
|
||||||
// const bool renderTarget = 0 != (_flags&BGFX_TEXTURE_RT_MASK);
|
// const bool renderTarget = 0 != (_flags&BGFX_TEXTURE_RT_MASK);
|
||||||
const bool srgb = 0 != (_flags&BGFX_TEXTURE_SRGB) || imageContainer.m_srgb;
|
const bool srgb = 0 != (_flags&BGFX_TEXTURE_SRGB) || imageContainer.m_srgb;
|
||||||
// const uint32_t msaaQuality = bx::uint32_satsub( (_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT, 1);
|
// const uint32_t msaaQuality = bx::uint32_satsub( (_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT, 1);
|
||||||
|
|
Loading…
Reference in a new issue