mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
Cleanup.
This commit is contained in:
parent
000c75539c
commit
f6d433f4ff
1 changed files with 20 additions and 8 deletions
|
@ -332,7 +332,6 @@ namespace bgfx { namespace mtl
|
||||||
, m_rtMsaa(false)
|
, m_rtMsaa(false)
|
||||||
, m_drawable(NULL)
|
, m_drawable(NULL)
|
||||||
{
|
{
|
||||||
m_fbh.idx = invalidHandle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~RendererContextMtl()
|
~RendererContextMtl()
|
||||||
|
@ -343,6 +342,10 @@ namespace bgfx { namespace mtl
|
||||||
{
|
{
|
||||||
BX_TRACE("Init.");
|
BX_TRACE("Init.");
|
||||||
|
|
||||||
|
m_fbh.idx = invalidHandle;
|
||||||
|
memset(m_uniforms, 0, sizeof(m_uniforms) );
|
||||||
|
memset(&m_resolution, 0, sizeof(m_resolution) );
|
||||||
|
|
||||||
if (NULL != NSClassFromString(@"CAMetalLayer") )
|
if (NULL != NSClassFromString(@"CAMetalLayer") )
|
||||||
{
|
{
|
||||||
//on iOS we need the layer as CAmetalLayer
|
//on iOS we need the layer as CAmetalLayer
|
||||||
|
@ -397,8 +400,6 @@ namespace bgfx { namespace mtl
|
||||||
m_uniformBufferVertexOffset = 0;
|
m_uniformBufferVertexOffset = 0;
|
||||||
m_uniformBufferFragmentOffset = 0;
|
m_uniformBufferFragmentOffset = 0;
|
||||||
|
|
||||||
memset(m_uniforms, 0, sizeof(m_uniforms) );
|
|
||||||
|
|
||||||
g_caps.supported |= (0
|
g_caps.supported |= (0
|
||||||
| BGFX_CAPS_TEXTURE_COMPARE_LEQUAL
|
| BGFX_CAPS_TEXTURE_COMPARE_LEQUAL
|
||||||
| BGFX_CAPS_TEXTURE_3D
|
| BGFX_CAPS_TEXTURE_3D
|
||||||
|
@ -886,10 +887,16 @@ namespace bgfx { namespace mtl
|
||||||
|
|
||||||
//TODO: there should be a way to specify if backbuffer needs stencil/depth.
|
//TODO: there should be a way to specify if backbuffer needs stencil/depth.
|
||||||
//TODO: support msaa
|
//TODO: support msaa
|
||||||
if (NULL == m_backBufferDepth
|
if (NULL == m_backBufferDepth
|
||||||
|| width != m_backBufferDepth.width()
|
|| width != m_backBufferDepth.width()
|
||||||
|| height != m_backBufferDepth.height() )
|
|| height != m_backBufferDepth.height()
|
||||||
|
|| m_resolution.m_width != _resolution.m_width
|
||||||
|
|| m_resolution.m_height != _resolution.m_height
|
||||||
|
|| m_resolution.m_flags != _resolution.m_flags)
|
||||||
{
|
{
|
||||||
|
m_resolution = _resolution;
|
||||||
|
m_resolution.m_flags &= ~BGFX_RESET_FORCE;
|
||||||
|
|
||||||
m_textureDescriptor.textureType = MTLTextureType2D;
|
m_textureDescriptor.textureType = MTLTextureType2D;
|
||||||
|
|
||||||
m_textureDescriptor.pixelFormat = MTLPixelFormatDepth32Float_Stencil8;
|
m_textureDescriptor.pixelFormat = MTLPixelFormatDepth32Float_Stencil8;
|
||||||
|
@ -1220,6 +1227,8 @@ namespace bgfx { namespace mtl
|
||||||
FrameBufferHandle m_fbh;
|
FrameBufferHandle m_fbh;
|
||||||
bool m_rtMsaa;
|
bool m_rtMsaa;
|
||||||
|
|
||||||
|
Resolution m_resolution;
|
||||||
|
|
||||||
// descriptors
|
// descriptors
|
||||||
RenderPipelineDescriptor m_renderPipelineDescriptor;
|
RenderPipelineDescriptor m_renderPipelineDescriptor;
|
||||||
DepthStencilDescriptor m_depthStencilDescriptor;
|
DepthStencilDescriptor m_depthStencilDescriptor;
|
||||||
|
@ -1857,14 +1866,17 @@ namespace bgfx { namespace mtl
|
||||||
MTLPixelFormat format = MTLPixelFormatInvalid;
|
MTLPixelFormat format = MTLPixelFormatInvalid;
|
||||||
if (srgb)
|
if (srgb)
|
||||||
{
|
{
|
||||||
format = s_textureFormat[m_textureFormat].m_fmtSrgb;
|
format = s_textureFormat[m_textureFormat].m_fmtSrgb;
|
||||||
BX_WARN(format != MTLPixelFormatInvalid, "sRGB not supported for texture format %d", m_textureFormat);
|
BX_WARN(format != MTLPixelFormatInvalid
|
||||||
|
, "sRGB not supported for texture format %d"
|
||||||
|
, m_textureFormat
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format == MTLPixelFormatInvalid)
|
if (format == MTLPixelFormatInvalid)
|
||||||
{
|
{
|
||||||
// not swizzled and not sRGB, or sRGB unsupported
|
// not swizzled and not sRGB, or sRGB unsupported
|
||||||
format = s_textureFormat[m_textureFormat].m_fmt;
|
format = s_textureFormat[m_textureFormat].m_fmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
desc.pixelFormat = format;
|
desc.pixelFormat = format;
|
||||||
|
|
Loading…
Reference in a new issue