mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Fixed shader ref counting.
This commit is contained in:
16
src/bgfx_p.h
16
src/bgfx_p.h
@@ -3322,6 +3322,13 @@ namespace bgfx
|
||||
BGFX_CHECK_HANDLE("destroyProgram", m_programHandle, _handle);
|
||||
|
||||
ProgramRef& pr = m_programRef[_handle.idx];
|
||||
shaderDecRef(pr.m_vsh);
|
||||
|
||||
if (isValid(pr.m_fsh) )
|
||||
{
|
||||
shaderDecRef(pr.m_fsh);
|
||||
}
|
||||
|
||||
int32_t refs = --pr.m_refCount;
|
||||
if (0 == refs)
|
||||
{
|
||||
@@ -3331,15 +3338,6 @@ namespace bgfx
|
||||
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyProgram);
|
||||
cmdbuf.write(_handle);
|
||||
|
||||
shaderDecRef(pr.m_vsh);
|
||||
uint32_t hash = pr.m_vsh.idx;
|
||||
|
||||
if (isValid(pr.m_fsh) )
|
||||
{
|
||||
shaderDecRef(pr.m_fsh);
|
||||
hash |= pr.m_fsh.idx << 16;
|
||||
}
|
||||
|
||||
m_programHashMap.removeByHandle(_handle.idx);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user