Updated spirv-tools.

This commit is contained in:
Бранимир Караџић
2019-10-05 09:53:49 -07:00
parent 35abd01cfb
commit fc16266e51
39 changed files with 2527 additions and 252 deletions

View File

@@ -461,6 +461,28 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) {
}
}
if (!_.IsValidStorageClass(storage_class)) {
return _.diag(SPV_ERROR_INVALID_BINARY, inst)
<< "Invalid storage class for target environment";
}
if (storage_class == SpvStorageClassGeneric) {
return _.diag(SPV_ERROR_INVALID_BINARY, inst)
<< "OpVariable storage class cannot be Generic";
}
if (inst->function() && storage_class != SpvStorageClassFunction) {
return _.diag(SPV_ERROR_INVALID_LAYOUT, inst)
<< "Variables must have a function[7] storage class inside"
" of a function";
}
if (!inst->function() && storage_class == SpvStorageClassFunction) {
return _.diag(SPV_ERROR_INVALID_LAYOUT, inst)
<< "Variables can not have a function[7] storage class "
"outside of a function";
}
// SPIR-V 3.32.8: Check that pointer type and variable type have the same
// storage class.
const auto result_storage_class_index = 1;
@@ -1568,8 +1590,8 @@ spv_result_t ValidatePtrComparison(ValidationState_t& _,
<< "Operand type must be a pointer";
}
SpvStorageClass sc = op1_type->GetOperandAs<SpvStorageClass>(1u);
if (_.addressing_model() == SpvAddressingModelLogical) {
SpvStorageClass sc = op1_type->GetOperandAs<SpvStorageClass>(1u);
if (sc != SpvStorageClassWorkgroup && sc != SpvStorageClassStorageBuffer) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
<< "Invalid pointer storage class";
@@ -1580,6 +1602,9 @@ spv_result_t ValidatePtrComparison(ValidationState_t& _,
<< "Workgroup storage class pointer requires VariablePointers "
"capability to be specified";
}
} else if (sc == SpvStorageClassPhysicalStorageBuffer) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
<< "Cannot use a pointer in the PhysicalStorageBuffer storage class";
}
return SPV_SUCCESS;