Vulkan: ignore unused storage buffers (#2460)

This commit is contained in:
pezcode 2021-04-09 05:26:17 +02:00 committed by GitHub
parent b298851bf0
commit 2240c591a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4342,9 +4342,7 @@ VK_IMPORT_DEVICE
const Binding& bind = renderBind.m_bind[stage];
const BindInfo& bindInfo = program.m_bindInfo[stage];
// bgfx does not seem to forbid setting a texture to a stage that a program does not use
if (bind.m_type == Binding::Texture
&& !isValid(bindInfo.uniformHandle) )
if (!isValid(bindInfo.uniformHandle) )
{
continue;
}
@ -5386,6 +5384,10 @@ VK_DESTROY
{
// regCount is used for descriptor type
const bool isBuffer = idToDescriptorType(regCount) == DescriptorType::StorageBuffer;
if (0 == regIndex)
{
continue;
}
const uint16_t stage = regIndex - (isBuffer ? 16 : 32) - (fragment ? 48 : 0); // regIndex is used for buffer binding index
m_bindInfo[stage].type = isBuffer ? BindType::Buffer : BindType::Image;