shaderc: Fixed SPIR-V uniform array size reflection. Issue #2964.

This commit is contained in:
Бранимир Караџић 2022-10-27 19:43:17 -07:00
parent d5230bbbda
commit c4d4b90e32
2 changed files with 6 additions and 4 deletions

View File

@ -4868,7 +4868,7 @@ namespace bgfx
}
}
_num = bx::max<uint16_t>(1, _num);
_num = bx::max<uint16_t>(1, _num);
uint16_t idx = m_uniformHashMap.find(bx::hash<bx::HashMurmur2A>(_name) );
if (kInvalidHandle != idx)
@ -4890,6 +4890,8 @@ namespace bgfx
uniform.m_type = oldsize < newsize ? _type : uniform.m_type;
uniform.m_num = bx::max<uint16_t>(uniform.m_num, _num);
BX_TRACE(" Resize uniform (handle %3d) `%s`, num %d", handle.idx, _name, _num);
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateUniform);
cmdbuf.write(handle);
cmdbuf.write(uniform.m_type);
@ -4911,7 +4913,7 @@ namespace bgfx
return BGFX_INVALID_HANDLE;
}
BX_TRACE("Creating uniform (handle %3d) %s", handle.idx, _name);
BX_TRACE("Creating uniform (handle %3d) `%s`, num %d", handle.idx, _name, _num);
UniformRef& uniform = m_uniformRef[handle.idx];
uniform.m_name.set(_name);

View File

@ -652,10 +652,10 @@ namespace bgfx { namespace spirv
continue;
}
un.num = 0;
un.num = uint8_t(program->getUniformArraySize(ii) );
const uint32_t offset = program->getUniformBufferOffset(ii);
un.regIndex = uint16_t(offset);
un.regCount = uint16_t(program->getUniformArraySize(ii));
un.regCount = un.num;
switch (program->getUniformType(ii) )
{