metal fixes: memleaks and out of bounds index
This commit is contained in:
parent
8196612195
commit
a722db896a
@ -450,16 +450,17 @@ namespace bgfx { namespace mtl
|
||||
if (NULL != lib)
|
||||
{
|
||||
m_screenshotBlitProgramVsh.m_function = lib.newFunctionWithName(SHADER_FUNCTION_NAME);
|
||||
release(lib);
|
||||
}
|
||||
|
||||
lib = m_device.newLibraryWithSource(fshSource);
|
||||
if (NULL != lib)
|
||||
{
|
||||
m_screenshotBlitProgramFsh.m_function = lib.newFunctionWithName(SHADER_FUNCTION_NAME);
|
||||
release(lib);
|
||||
}
|
||||
|
||||
m_screenshotBlitProgram.create(&m_screenshotBlitProgramVsh, &m_screenshotBlitProgramFsh);
|
||||
release(lib);
|
||||
|
||||
reset(m_renderPipelineDescriptor);
|
||||
m_renderPipelineDescriptor.colorAttachments[0].pixelFormat = m_mainFrameBuffer.m_swapChain->m_metalLayer.pixelFormat;
|
||||
@ -665,6 +666,9 @@ namespace bgfx { namespace mtl
|
||||
m_pipelineStateCache.invalidate();
|
||||
m_pipelineProgram.clear();
|
||||
|
||||
m_depthStencilStateCache.invalidate();
|
||||
m_samplerStateCache.invalidate();
|
||||
|
||||
for (uint32_t ii = 0; ii < BX_COUNTOF(m_shaders); ++ii)
|
||||
{
|
||||
m_shaders[ii].destroy();
|
||||
@ -784,7 +788,7 @@ namespace bgfx { namespace mtl
|
||||
|
||||
void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) override
|
||||
{
|
||||
m_program[_handle.idx].create(&m_shaders[_vsh.idx], &m_shaders[_fsh.idx]);
|
||||
m_program[_handle.idx].create(&m_shaders[_vsh.idx], isValid(_fsh) ? &m_shaders[_fsh.idx] : NULL);
|
||||
}
|
||||
|
||||
void destroyProgram(ProgramHandle _handle) override
|
||||
@ -4611,6 +4615,8 @@ namespace bgfx { namespace mtl
|
||||
|
||||
rce = m_commandBuffer.renderCommandEncoderWithDescriptor(renderPassDescriptor);
|
||||
|
||||
MTL_RELEASE(renderPassDescriptor);
|
||||
|
||||
rce.setCullMode(MTLCullModeNone);
|
||||
|
||||
rce.setRenderPipelineState(m_screenshotBlitRenderPipelineState);
|
||||
|
Loading…
Reference in New Issue
Block a user