break;
case SpvCapabilityVariablePointers:
features_.variable_pointers = true;
- features_.variable_pointers_uniform_buffer_block = true;
+ features_.variable_pointers_storage_buffer = true;
break;
- case SpvCapabilityVariablePointersUniformBufferBlock:
- features_.variable_pointers_uniform_buffer_block = true;
+ case SpvCapabilityVariablePointersStorageBuffer:
+ features_.variable_pointers_storage_buffer = true;
break;
default:
break;
// Allow functionalities enabled by VariablePointers capability.
bool variable_pointers = false;
- // Allow functionalities enabled by VariablePointersUniformBufferBlock
+ // Allow functionalities enabled by VariablePointersStorageBuffer
// capability.
- bool variable_pointers_uniform_buffer_block = false;
+ bool variable_pointers_storage_buffer = false;
};
ValidationState_t(const spv_const_context context,
}
const bool uses_variable_pointer =
module_.features().variable_pointers ||
- module_.features().variable_pointers_uniform_buffer_block;
+ module_.features().variable_pointers_storage_buffer;
auto pointerIndex = 3;
auto pointer = module_.FindDef(inst->words[pointerIndex]);
if (!pointer ||
const spv_opcode_desc) {
const bool uses_variable_pointer =
module_.features().variable_pointers ||
- module_.features().variable_pointers_uniform_buffer_block;
+ module_.features().variable_pointers_storage_buffer;
const auto pointerIndex = 1;
auto pointer = module_.FindDef(inst->words[pointerIndex]);
if (!pointer ||
}
const bool uses_variable_pointer =
module_.features().variable_pointers ||
- module_.features().variable_pointers_uniform_buffer_block;
+ module_.features().variable_pointers_storage_buffer;
if (addressingModel == SpvAddressingModelLogical &&
SpvOpTypePointer == valueType->opcode() && !uses_variable_pointer) {
DIAG(valueIndex)
{SpvCapabilitySubgroupVoteKHR,
"SubgroupVoteKHR"},
{SpvCapabilityStorageUniformBufferBlock16,
- "StorageUniformBufferBlock16"},
+ "StorageBuffer16BitAccess"},
+ {SpvCapabilityStorageBuffer16BitAccess,
+ "StorageBuffer16BitAccess"},
{SpvCapabilityStorageUniform16,
- "StorageUniform16"},
+ "UniformAndStorageBuffer16BitAccess"},
+ {SpvCapabilityUniformAndStorageBuffer16BitAccess,
+ "UniformAndStorageBuffer16BitAccess"},
{SpvCapabilityStoragePushConstant16,
"StoragePushConstant16"},
{SpvCapabilityStorageInputOutput16,
Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1,
SPV_ENV_VULKAN_1_0),
ValuesIn(std::vector<AssemblyCase>{
- {"OpCapability StorageUniformBufferBlock16\n",
+ {"OpCapability StorageBuffer16BitAccess\n",
MakeInstruction(SpvOpCapability,
{SpvCapabilityStorageUniformBufferBlock16})},
- {"OpCapability StorageUniform16\n",
+ {"OpCapability StorageBuffer16BitAccess\n",
+ MakeInstruction(SpvOpCapability,
+ {SpvCapabilityStorageBuffer16BitAccess})},
+ {"OpCapability UniformAndStorageBuffer16BitAccess\n",
+ MakeInstruction(
+ SpvOpCapability,
+ {SpvCapabilityUniformAndStorageBuffer16BitAccess})},
+ {"OpCapability UniformAndStorageBuffer16BitAccess\n",
MakeInstruction(SpvOpCapability,
{SpvCapabilityStorageUniform16})},
{"OpCapability StoragePushConstant16\n",
{"OpCapability VariablePointers\n",
MakeInstruction(SpvOpCapability,
{SpvCapabilityVariablePointers})},
- {"OpCapability VariablePointersUniformBufferBlock\n",
+ {"OpCapability VariablePointersStorageBuffer\n",
MakeInstruction(
SpvOpCapability,
- {SpvCapabilityVariablePointersUniformBufferBlock})},
+ {SpvCapabilityVariablePointersStorageBuffer})},
})), );
} // anonymous namespace
CASE(PushConstant);
CASE(AtomicCounter);
CASE(Image);
+ CASE(StorageBuffer);
}
#undef CASE
EXPECT_EQ(SPV_SUCCESS, ValidateInstructions());
}
-// TODO: Add tests that exercise VariablePointersUniformBufferBlock instead of
+// TODO: Add tests that exercise VariablePointersStorageBuffer instead of
// VariablePointers.
void createVariablePointerSpirvProgram(std::ostringstream* spirv,
std::string result_strategy,
return sorted(set(extensions))
-def get_capability_list(operands):
- """Returns capabilities as a list of strings in the order of appearance."""
+def get_capabilities(operands):
+ """Returns capabilities as a list of JSON objects, in order of
+ appearance.
+ """
enumerants = sum([item.get('enumerants', []) for item in operands
if item.get('kind') in ['Capability']], [])
- return [item.get('enumerant') for item in enumerants]
+ return enumerants
def generate_extension_enum(operands):
def generate_capability_to_string_table(operands):
"""Returns capability to string mapping table."""
- capabilities = get_capability_list(operands)
+ capabilities = [item.get('enumerant')
+ for item in get_capabilities(operands)]
entry_template = ' {{SpvCapability{capability},\n "{capability}"}}'
table_entries = [entry_template.format(capability=capability)
for capability in capabilities]
def generate_capability_to_string_mapping(operands):
- """Returns mapping function from capabilities to corresponding strings."""
- capabilities = get_capability_list(operands)
+ """Returns mapping function from capabilities to corresponding strings.
+ We take care to avoid emitting duplicate values.
+ """
function = 'std::string CapabilityToString(SpvCapability capability) {\n'
function += ' switch (capability) {\n'
template = ' case SpvCapability{capability}:\n' \
' return "{capability}";\n'
- function += ''.join([template.format(capability=capability)
- for capability in capabilities])
+ emitted = set() # The values of capabilities we already have emitted
+ for capability in get_capabilities(operands):
+ value = capability.get('value')
+ if value not in emitted:
+ emitted.add(value)
+ function += template.format(capability=capability.get('enumerant'))
function += ' case SpvCapabilityMax:\n' \
' assert(0 && "Attempting to convert SpvCapabilityMax to string");\n' \
' return "";\n'