diff options
author | dan sinclair <dj2@everburning.com> | 2018-07-31 18:44:35 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-31 18:44:35 -0400 |
commit | 111933537be7f7c46953813fc2aac03807df61b2 (patch) | |
tree | 5f0d2641885e381a92f0a4dcd6035037f3fb82e9 /source | |
parent | 32ccf0d04c73d31d4e6c30d54c2c3792b203bf03 (diff) |
Update diag() in validate_barriers (#1754)
This CL updates validate_barriers to provide an explicit instruction
when calling diag().
Diffstat (limited to 'source')
-rw-r--r-- | source/val/validate_barriers.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/source/val/validate_barriers.cpp b/source/val/validate_barriers.cpp index 7a3a853a..dfeb9937 100644 --- a/source/val/validate_barriers.cpp +++ b/source/val/validate_barriers.cpp @@ -37,7 +37,7 @@ spv_result_t ValidateExecutionScope(ValidationState_t& _, std::tie(is_int32, is_const_int32, value) = _.EvalInt32IfConst(id); if (!is_int32) { - return _.diag(SPV_ERROR_INVALID_DATA) + return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": expected Execution Scope to be a 32-bit int"; } @@ -48,7 +48,7 @@ spv_result_t ValidateExecutionScope(ValidationState_t& _, if (spvIsVulkanEnv(_.context()->target_env)) { if (value != SpvScopeWorkgroup && value != SpvScopeSubgroup) { - return _.diag(SPV_ERROR_INVALID_DATA) + return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": in Vulkan environment Execution Scope is limited to " "Workgroup and Subgroup"; @@ -89,7 +89,7 @@ spv_result_t ValidateMemoryScope(ValidationState_t& _, const Instruction* inst, std::tie(is_int32, is_const_int32, value) = _.EvalInt32IfConst(id); if (!is_int32) { - return _.diag(SPV_ERROR_INVALID_DATA) + return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": expected Memory Scope to be a 32-bit int"; } @@ -100,14 +100,14 @@ spv_result_t ValidateMemoryScope(ValidationState_t& _, const Instruction* inst, if (spvIsVulkanEnv(_.context()->target_env)) { if (value == SpvScopeCrossDevice) { - return _.diag(SPV_ERROR_INVALID_DATA) + return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": in Vulkan environment, Memory Scope cannot be CrossDevice"; } if (_.context()->target_env == SPV_ENV_VULKAN_1_0 && value != SpvScopeDevice && value != SpvScopeWorkgroup && value != SpvScopeInvocation) { - return _.diag(SPV_ERROR_INVALID_DATA) + return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": in Vulkan 1.0 environment Memory Scope is limited to " "Device, " @@ -129,7 +129,7 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, std::tie(is_int32, is_const_int32, value) = _.EvalInt32IfConst(id); if (!is_int32) { - return _.diag(SPV_ERROR_INVALID_DATA) + return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": expected Memory Semantics to be a 32-bit int"; } @@ -144,7 +144,7 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, SpvMemorySemanticsSequentiallyConsistentMask)); if (num_memory_order_set_bits > 1) { - return _.diag(SPV_ERROR_INVALID_DATA) + return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": Memory Semantics can have at most one of the following bits " "set: Acquire, Release, AcquireRelease or SequentiallyConsistent"; @@ -157,7 +157,7 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, SpvMemorySemanticsImageMemoryMask); if (opcode == SpvOpMemoryBarrier && !num_memory_order_set_bits) { - return _.diag(SPV_ERROR_INVALID_DATA) + return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": Vulkan specification requires Memory Semantics to have one " "of the following bits set: Acquire, Release, AcquireRelease " @@ -165,7 +165,7 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, } if (opcode == SpvOpMemoryBarrier && !includes_storage_class) { - return _.diag(SPV_ERROR_INVALID_DATA) + return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": expected Memory Semantics to include a Vulkan-supported " "storage class"; @@ -174,7 +174,7 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, #if 0 // TODO(atgoo@github.com): this check fails Vulkan CTS, reenable once fixed. if (opcode == SpvOpControlBarrier && value && !includes_storage_class) { - return _.diag(SPV_ERROR_INVALID_DATA) + return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": expected Memory Semantics to include a Vulkan-supported " "storage class if Memory Semantics is not None"; @@ -249,7 +249,7 @@ spv_result_t BarriersPass(ValidationState_t& _, const Instruction* inst) { case SpvOpNamedBarrierInitialize: { if (_.GetIdOpcode(result_type) != SpvOpTypeNamedBarrier) { - return _.diag(SPV_ERROR_INVALID_DATA) + return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": expected Result Type to be OpTypeNamedBarrier"; } @@ -257,7 +257,7 @@ spv_result_t BarriersPass(ValidationState_t& _, const Instruction* inst) { const uint32_t subgroup_count_type = _.GetOperandTypeId(inst, 2); if (!_.IsIntScalarType(subgroup_count_type) || _.GetBitWidth(subgroup_count_type) != 32) { - return _.diag(SPV_ERROR_INVALID_DATA) + return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": expected Subgroup Count to be a 32-bit int"; } @@ -267,7 +267,7 @@ spv_result_t BarriersPass(ValidationState_t& _, const Instruction* inst) { case SpvOpMemoryNamedBarrier: { const uint32_t named_barrier_type = _.GetOperandTypeId(inst, 0); if (_.GetIdOpcode(named_barrier_type) != SpvOpTypeNamedBarrier) { - return _.diag(SPV_ERROR_INVALID_DATA) + return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": expected Named Barrier to be of type OpTypeNamedBarrier"; } |