SPV: Fix #1374: For an SSBO 16-bit access, only emit StorageUniformBufferBlock16 capability.

This commit is contained in:
John Kessenich 2018-05-14 22:08:53 -06:00
parent 2fb966aad2
commit 1831087e48
2 changed files with 16 additions and 5 deletions

View File

@ -2479,17 +2479,29 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol*
node->getType().containsBasicType(glslang::EbtInt16) ||
node->getType().containsBasicType(glslang::EbtUint16);
if (contains16BitType) {
if (storageClass == spv::StorageClassInput || storageClass == spv::StorageClassOutput) {
switch (storageClass) {
case spv::StorageClassInput:
case spv::StorageClassOutput:
addPre13Extension(spv::E_SPV_KHR_16bit_storage);
builder.addCapability(spv::CapabilityStorageInputOutput16);
} else if (storageClass == spv::StorageClassPushConstant) {
break;
case spv::StorageClassPushConstant:
addPre13Extension(spv::E_SPV_KHR_16bit_storage);
builder.addCapability(spv::CapabilityStoragePushConstant16);
} else if (storageClass == spv::StorageClassUniform) {
break;
case spv::StorageClassUniform:
addPre13Extension(spv::E_SPV_KHR_16bit_storage);
builder.addCapability(spv::CapabilityStorageUniform16);
if (node->getType().getQualifier().storage == glslang::EvqBuffer)
builder.addCapability(spv::CapabilityStorageUniformBufferBlock16);
else
builder.addCapability(spv::CapabilityStorageUniform16);
break;
case spv::StorageClassStorageBuffer:
addPre13Extension(spv::E_SPV_KHR_16bit_storage);
builder.addCapability(spv::CapabilityStorageUniformBufferBlock16);
break;
default:
break;
}
}

View File

@ -10,7 +10,6 @@ spv.shaderBallotAMD.comp
Capability Groups
Capability Int16
Capability StorageUniformBufferBlock16
Capability StorageUniform16
Extension "SPV_AMD_gpu_shader_half_float"
Extension "SPV_AMD_gpu_shader_int16"
Extension "SPV_AMD_shader_ballot"