Implement GL_EXT_shader_16bit_storage and GL_EXT_shader_8bit_storage extensions.

These introduce limited support for 8/16-bit types such that they can only be accessed in buffer memory and converted to/from 32-bit types.

Contributed from Khronos-internal work.
This commit is contained in:
John Kessenich
2018-07-03 13:19:51 -06:00
parent eefab240f7
commit 312dcfb070
43 changed files with 6179 additions and 2765 deletions

View File

@@ -2507,6 +2507,20 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol*
}
}
const bool contains8BitType = node->getType().containsBasicType(glslang::EbtInt8) ||
node->getType().containsBasicType(glslang::EbtUint8);
if (contains8BitType) {
if (storageClass == spv::StorageClassPushConstant) {
builder.addExtension(spv::E_SPV_KHR_8bit_storage);
builder.addCapability(spv::CapabilityStoragePushConstant8);
} else if (storageClass == spv::StorageClassUniform) {
builder.addExtension(spv::E_SPV_KHR_8bit_storage);
builder.addCapability(spv::CapabilityUniformAndStorageBuffer8BitAccess);
if (node->getType().getQualifier().storage == glslang::EvqBuffer)
builder.addCapability(spv::CapabilityStorageBuffer8BitAccess);
}
}
const char* name = node->getName().c_str();
if (glslang::IsAnonymous(name))
name = "";