|
@@ -142,15 +142,28 @@ typedef enum VUIDError_ {
|
|
|
VUIDErrorMax,
|
|
VUIDErrorMax,
|
|
|
} VUIDError;
|
|
} VUIDError;
|
|
|
|
|
|
|
|
-const static uint32_t NumRtBuiltins = 16;
|
|
|
|
|
|
|
+const static uint32_t NumVUIDBuiltins = 29;
|
|
|
|
|
|
|
|
typedef struct {
|
|
typedef struct {
|
|
|
SpvBuiltIn builtIn;
|
|
SpvBuiltIn builtIn;
|
|
|
uint32_t vuid[VUIDErrorMax]; // execution mode, storage class, type VUIDs
|
|
uint32_t vuid[VUIDErrorMax]; // execution mode, storage class, type VUIDs
|
|
|
-} RtBuiltinVUIDMapping;
|
|
|
|
|
|
|
+} BuiltinVUIDMapping;
|
|
|
|
|
|
|
|
-std::array<RtBuiltinVUIDMapping, NumRtBuiltins> rtBuiltinInfo = {{
|
|
|
|
|
|
|
+std::array<BuiltinVUIDMapping, NumVUIDBuiltins> builtinVUIDInfo = {{
|
|
|
// clang-format off
|
|
// clang-format off
|
|
|
|
|
+ {SpvBuiltInSubgroupEqMask, {0, 4370, 4371}},
|
|
|
|
|
+ {SpvBuiltInSubgroupGeMask, {0, 4372, 4373}},
|
|
|
|
|
+ {SpvBuiltInSubgroupGtMask, {0, 4374, 4375}},
|
|
|
|
|
+ {SpvBuiltInSubgroupLeMask, {0, 4376, 4377}},
|
|
|
|
|
+ {SpvBuiltInSubgroupLtMask, {0, 4378, 4379}},
|
|
|
|
|
+ {SpvBuiltInSubgroupLocalInvocationId, {0, 4380, 4381}},
|
|
|
|
|
+ {SpvBuiltInSubgroupSize, {0, 4382, 4383}},
|
|
|
|
|
+ {SpvBuiltInGlobalInvocationId, {4236, 4237, 4238}},
|
|
|
|
|
+ {SpvBuiltInLocalInvocationId, {4281, 4282, 4283}},
|
|
|
|
|
+ {SpvBuiltInNumWorkgroups, {4296, 4297, 4298}},
|
|
|
|
|
+ {SpvBuiltInNumSubgroups, {4293, 4294, 4295}},
|
|
|
|
|
+ {SpvBuiltInSubgroupId, {4367, 4368, 4369}},
|
|
|
|
|
+ {SpvBuiltInWorkgroupId, {4422, 4423, 4424}},
|
|
|
{SpvBuiltInHitKindKHR, {4242, 4243, 4244}},
|
|
{SpvBuiltInHitKindKHR, {4242, 4243, 4244}},
|
|
|
{SpvBuiltInHitTNV, {4245, 4246, 4247}},
|
|
{SpvBuiltInHitTNV, {4245, 4246, 4247}},
|
|
|
{SpvBuiltInInstanceCustomIndexKHR, {4251, 4252, 4253}},
|
|
{SpvBuiltInInstanceCustomIndexKHR, {4251, 4252, 4253}},
|
|
@@ -170,9 +183,9 @@ std::array<RtBuiltinVUIDMapping, NumRtBuiltins> rtBuiltinInfo = {{
|
|
|
// clang-format off
|
|
// clang-format off
|
|
|
} };
|
|
} };
|
|
|
|
|
|
|
|
-uint32_t GetVUIDForRTBuiltin(SpvBuiltIn builtIn, VUIDError type) {
|
|
|
|
|
|
|
+uint32_t GetVUIDForBuiltin(SpvBuiltIn builtIn, VUIDError type) {
|
|
|
uint32_t vuid = 0;
|
|
uint32_t vuid = 0;
|
|
|
- for (const auto& iter: rtBuiltinInfo) {
|
|
|
|
|
|
|
+ for (const auto& iter: builtinVUIDInfo) {
|
|
|
if (iter.builtIn == builtIn) {
|
|
if (iter.builtIn == builtIn) {
|
|
|
assert(type < VUIDErrorMax);
|
|
assert(type < VUIDErrorMax);
|
|
|
vuid = iter.vuid[type];
|
|
vuid = iter.vuid[type];
|
|
@@ -2826,32 +2839,17 @@ spv_result_t BuiltInsValidator::ValidateLayerOrViewportIndexAtReference(
|
|
|
spv_result_t BuiltInsValidator::ValidateComputeShaderI32Vec3InputAtDefinition(
|
|
spv_result_t BuiltInsValidator::ValidateComputeShaderI32Vec3InputAtDefinition(
|
|
|
const Decoration& decoration, const Instruction& inst) {
|
|
const Decoration& decoration, const Instruction& inst) {
|
|
|
if (spvIsVulkanOrWebGPUEnv(_.context()->target_env)) {
|
|
if (spvIsVulkanOrWebGPUEnv(_.context()->target_env)) {
|
|
|
|
|
+ const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]);
|
|
|
if (spv_result_t error = ValidateI32Vec(
|
|
if (spv_result_t error = ValidateI32Vec(
|
|
|
decoration, inst, 3,
|
|
decoration, inst, 3,
|
|
|
- [this, &decoration,
|
|
|
|
|
- &inst](const std::string& message) -> spv_result_t {
|
|
|
|
|
- uint32_t operand = decoration.params()[0];
|
|
|
|
|
- uint32_t vuid = 0;
|
|
|
|
|
- switch (operand) {
|
|
|
|
|
- case SpvBuiltInGlobalInvocationId:
|
|
|
|
|
- vuid = 4238;
|
|
|
|
|
- break;
|
|
|
|
|
- case SpvBuiltInLocalInvocationId:
|
|
|
|
|
- vuid = 4283;
|
|
|
|
|
- break;
|
|
|
|
|
- case SpvBuiltInNumWorkgroups:
|
|
|
|
|
- vuid = 4298;
|
|
|
|
|
- break;
|
|
|
|
|
- case SpvBuiltInWorkgroupId:
|
|
|
|
|
- vuid = 4424;
|
|
|
|
|
- break;
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ [this, &inst, builtin](const std::string& message) -> spv_result_t {
|
|
|
|
|
+ uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorType);
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
|
<< _.VkErrorID(vuid) << "According to the "
|
|
<< _.VkErrorID(vuid) << "According to the "
|
|
|
<< spvLogStringForEnv(_.context()->target_env)
|
|
<< spvLogStringForEnv(_.context()->target_env)
|
|
|
<< " spec BuiltIn "
|
|
<< " spec BuiltIn "
|
|
|
<< _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN,
|
|
<< _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN,
|
|
|
- operand)
|
|
|
|
|
|
|
+ builtin)
|
|
|
<< " variable needs to be a 3-component 32-bit int "
|
|
<< " variable needs to be a 3-component 32-bit int "
|
|
|
"vector. "
|
|
"vector. "
|
|
|
<< message;
|
|
<< message;
|
|
@@ -2869,31 +2867,16 @@ spv_result_t BuiltInsValidator::ValidateComputeShaderI32Vec3InputAtReference(
|
|
|
const Decoration& decoration, const Instruction& built_in_inst,
|
|
const Decoration& decoration, const Instruction& built_in_inst,
|
|
|
const Instruction& referenced_inst,
|
|
const Instruction& referenced_inst,
|
|
|
const Instruction& referenced_from_inst) {
|
|
const Instruction& referenced_from_inst) {
|
|
|
- uint32_t operand = decoration.params()[0];
|
|
|
|
|
if (spvIsVulkanOrWebGPUEnv(_.context()->target_env)) {
|
|
if (spvIsVulkanOrWebGPUEnv(_.context()->target_env)) {
|
|
|
|
|
+ const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]);
|
|
|
const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst);
|
|
const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst);
|
|
|
if (storage_class != SpvStorageClassMax &&
|
|
if (storage_class != SpvStorageClassMax &&
|
|
|
storage_class != SpvStorageClassInput) {
|
|
storage_class != SpvStorageClassInput) {
|
|
|
- uint32_t vuid = 0;
|
|
|
|
|
- switch (operand) {
|
|
|
|
|
- case SpvBuiltInGlobalInvocationId:
|
|
|
|
|
- vuid = 4237;
|
|
|
|
|
- break;
|
|
|
|
|
- case SpvBuiltInLocalInvocationId:
|
|
|
|
|
- vuid = 4282;
|
|
|
|
|
- break;
|
|
|
|
|
- case SpvBuiltInNumWorkgroups:
|
|
|
|
|
- vuid = 4297;
|
|
|
|
|
- break;
|
|
|
|
|
- case SpvBuiltInWorkgroupId:
|
|
|
|
|
- vuid = 4423;
|
|
|
|
|
- break;
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorStorageClass);
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst)
|
|
|
<< _.VkErrorID(vuid) << spvLogStringForEnv(_.context()->target_env)
|
|
<< _.VkErrorID(vuid) << spvLogStringForEnv(_.context()->target_env)
|
|
|
<< " spec allows BuiltIn "
|
|
<< " spec allows BuiltIn "
|
|
|
- << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN,
|
|
|
|
|
- decoration.params()[0])
|
|
|
|
|
|
|
+ << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin)
|
|
|
<< " to be only used for variables with Input storage class. "
|
|
<< " to be only used for variables with Input storage class. "
|
|
|
<< GetReferenceDesc(decoration, built_in_inst, referenced_inst,
|
|
<< GetReferenceDesc(decoration, built_in_inst, referenced_inst,
|
|
|
referenced_from_inst)
|
|
referenced_from_inst)
|
|
@@ -2907,27 +2890,12 @@ spv_result_t BuiltInsValidator::ValidateComputeShaderI32Vec3InputAtReference(
|
|
|
bool has_webgpu_model = execution_model == SpvExecutionModelGLCompute;
|
|
bool has_webgpu_model = execution_model == SpvExecutionModelGLCompute;
|
|
|
if ((spvIsVulkanEnv(_.context()->target_env) && !has_vulkan_model) ||
|
|
if ((spvIsVulkanEnv(_.context()->target_env) && !has_vulkan_model) ||
|
|
|
(spvIsWebGPUEnv(_.context()->target_env) && !has_webgpu_model)) {
|
|
(spvIsWebGPUEnv(_.context()->target_env) && !has_webgpu_model)) {
|
|
|
- uint32_t vuid = 0;
|
|
|
|
|
- switch (operand) {
|
|
|
|
|
- case SpvBuiltInGlobalInvocationId:
|
|
|
|
|
- vuid = 4236;
|
|
|
|
|
- break;
|
|
|
|
|
- case SpvBuiltInLocalInvocationId:
|
|
|
|
|
- vuid = 4281;
|
|
|
|
|
- break;
|
|
|
|
|
- case SpvBuiltInNumWorkgroups:
|
|
|
|
|
- vuid = 4296;
|
|
|
|
|
- break;
|
|
|
|
|
- case SpvBuiltInWorkgroupId:
|
|
|
|
|
- vuid = 4422;
|
|
|
|
|
- break;
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorExecutionModel);
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst)
|
|
|
<< _.VkErrorID(vuid)
|
|
<< _.VkErrorID(vuid)
|
|
|
<< spvLogStringForEnv(_.context()->target_env)
|
|
<< spvLogStringForEnv(_.context()->target_env)
|
|
|
<< " spec allows BuiltIn "
|
|
<< " spec allows BuiltIn "
|
|
|
- << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN,
|
|
|
|
|
- decoration.params()[0])
|
|
|
|
|
|
|
+ << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin)
|
|
|
<< " to be used only with GLCompute execution model. "
|
|
<< " to be used only with GLCompute execution model. "
|
|
|
<< GetReferenceDesc(decoration, built_in_inst, referenced_inst,
|
|
<< GetReferenceDesc(decoration, built_in_inst, referenced_inst,
|
|
|
referenced_from_inst, execution_model);
|
|
referenced_from_inst, execution_model);
|
|
@@ -2949,23 +2917,23 @@ spv_result_t BuiltInsValidator::ValidateComputeShaderI32Vec3InputAtReference(
|
|
|
spv_result_t BuiltInsValidator::ValidateComputeI32InputAtDefinition(
|
|
spv_result_t BuiltInsValidator::ValidateComputeI32InputAtDefinition(
|
|
|
const Decoration& decoration, const Instruction& inst) {
|
|
const Decoration& decoration, const Instruction& inst) {
|
|
|
if (spvIsVulkanEnv(_.context()->target_env)) {
|
|
if (spvIsVulkanEnv(_.context()->target_env)) {
|
|
|
|
|
+ const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]);
|
|
|
if (decoration.struct_member_index() != Decoration::kInvalidMember) {
|
|
if (decoration.struct_member_index() != Decoration::kInvalidMember) {
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
|
<< "BuiltIn "
|
|
<< "BuiltIn "
|
|
|
- << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN,
|
|
|
|
|
- decoration.params()[0])
|
|
|
|
|
|
|
+ << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin)
|
|
|
<< " cannot be used as a member decoration ";
|
|
<< " cannot be used as a member decoration ";
|
|
|
}
|
|
}
|
|
|
if (spv_result_t error = ValidateI32(
|
|
if (spv_result_t error = ValidateI32(
|
|
|
decoration, inst,
|
|
decoration, inst,
|
|
|
- [this, &decoration,
|
|
|
|
|
- &inst](const std::string& message) -> spv_result_t {
|
|
|
|
|
|
|
+ [this, &inst, builtin](const std::string& message) -> spv_result_t {
|
|
|
|
|
+ uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorType);
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
|
|
|
+ << _.VkErrorID(vuid)
|
|
|
<< "According to the "
|
|
<< "According to the "
|
|
|
<< spvLogStringForEnv(_.context()->target_env)
|
|
<< spvLogStringForEnv(_.context()->target_env)
|
|
|
<< " spec BuiltIn "
|
|
<< " spec BuiltIn "
|
|
|
- << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN,
|
|
|
|
|
- decoration.params()[0])
|
|
|
|
|
|
|
+ << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin)
|
|
|
<< " variable needs to be a 32-bit int "
|
|
<< " variable needs to be a 32-bit int "
|
|
|
"vector. "
|
|
"vector. "
|
|
|
<< message;
|
|
<< message;
|
|
@@ -2983,14 +2951,16 @@ spv_result_t BuiltInsValidator::ValidateComputeI32InputAtReference(
|
|
|
const Instruction& referenced_inst,
|
|
const Instruction& referenced_inst,
|
|
|
const Instruction& referenced_from_inst) {
|
|
const Instruction& referenced_from_inst) {
|
|
|
if (spvIsVulkanEnv(_.context()->target_env)) {
|
|
if (spvIsVulkanEnv(_.context()->target_env)) {
|
|
|
|
|
+ const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]);
|
|
|
const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst);
|
|
const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst);
|
|
|
if (storage_class != SpvStorageClassMax &&
|
|
if (storage_class != SpvStorageClassMax &&
|
|
|
storage_class != SpvStorageClassInput) {
|
|
storage_class != SpvStorageClassInput) {
|
|
|
|
|
+ uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorStorageClass);
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst)
|
|
|
|
|
+ << _.VkErrorID(vuid)
|
|
|
<< spvLogStringForEnv(_.context()->target_env)
|
|
<< spvLogStringForEnv(_.context()->target_env)
|
|
|
<< " spec allows BuiltIn "
|
|
<< " spec allows BuiltIn "
|
|
|
- << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN,
|
|
|
|
|
- decoration.params()[0])
|
|
|
|
|
|
|
+ << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin)
|
|
|
<< " to be only used for variables with Input storage class. "
|
|
<< " to be only used for variables with Input storage class. "
|
|
|
<< GetReferenceDesc(decoration, built_in_inst, referenced_inst,
|
|
<< GetReferenceDesc(decoration, built_in_inst, referenced_inst,
|
|
|
referenced_from_inst)
|
|
referenced_from_inst)
|
|
@@ -3002,11 +2972,12 @@ spv_result_t BuiltInsValidator::ValidateComputeI32InputAtReference(
|
|
|
execution_model == SpvExecutionModelTaskNV ||
|
|
execution_model == SpvExecutionModelTaskNV ||
|
|
|
execution_model == SpvExecutionModelMeshNV;
|
|
execution_model == SpvExecutionModelMeshNV;
|
|
|
if (spvIsVulkanEnv(_.context()->target_env) && !has_vulkan_model) {
|
|
if (spvIsVulkanEnv(_.context()->target_env) && !has_vulkan_model) {
|
|
|
|
|
+ uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorExecutionModel);
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst)
|
|
|
|
|
+ << _.VkErrorID(vuid)
|
|
|
<< spvLogStringForEnv(_.context()->target_env)
|
|
<< spvLogStringForEnv(_.context()->target_env)
|
|
|
<< " spec allows BuiltIn "
|
|
<< " spec allows BuiltIn "
|
|
|
- << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN,
|
|
|
|
|
- decoration.params()[0])
|
|
|
|
|
|
|
+ << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin)
|
|
|
<< " to be used only with GLCompute execution model. "
|
|
<< " to be used only with GLCompute execution model. "
|
|
|
<< GetReferenceDesc(decoration, built_in_inst, referenced_inst,
|
|
<< GetReferenceDesc(decoration, built_in_inst, referenced_inst,
|
|
|
referenced_from_inst, execution_model);
|
|
referenced_from_inst, execution_model);
|
|
@@ -3028,23 +2999,23 @@ spv_result_t BuiltInsValidator::ValidateComputeI32InputAtReference(
|
|
|
spv_result_t BuiltInsValidator::ValidateI32InputAtDefinition(
|
|
spv_result_t BuiltInsValidator::ValidateI32InputAtDefinition(
|
|
|
const Decoration& decoration, const Instruction& inst) {
|
|
const Decoration& decoration, const Instruction& inst) {
|
|
|
if (spvIsVulkanEnv(_.context()->target_env)) {
|
|
if (spvIsVulkanEnv(_.context()->target_env)) {
|
|
|
|
|
+ const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]);
|
|
|
if (decoration.struct_member_index() != Decoration::kInvalidMember) {
|
|
if (decoration.struct_member_index() != Decoration::kInvalidMember) {
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
|
<< "BuiltIn "
|
|
<< "BuiltIn "
|
|
|
- << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN,
|
|
|
|
|
- decoration.params()[0])
|
|
|
|
|
|
|
+ << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin)
|
|
|
<< " cannot be used as a member decoration ";
|
|
<< " cannot be used as a member decoration ";
|
|
|
}
|
|
}
|
|
|
if (spv_result_t error = ValidateI32(
|
|
if (spv_result_t error = ValidateI32(
|
|
|
decoration, inst,
|
|
decoration, inst,
|
|
|
- [this, &decoration,
|
|
|
|
|
- &inst](const std::string& message) -> spv_result_t {
|
|
|
|
|
|
|
+ [this, &inst, builtin](const std::string& message) -> spv_result_t {
|
|
|
|
|
+ uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorType);
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
|
|
|
+ << _.VkErrorID(vuid)
|
|
|
<< "According to the "
|
|
<< "According to the "
|
|
|
<< spvLogStringForEnv(_.context()->target_env)
|
|
<< spvLogStringForEnv(_.context()->target_env)
|
|
|
<< " spec BuiltIn "
|
|
<< " spec BuiltIn "
|
|
|
- << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN,
|
|
|
|
|
- decoration.params()[0])
|
|
|
|
|
|
|
+ << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin)
|
|
|
<< " variable needs to be a 32-bit int. " << message;
|
|
<< " variable needs to be a 32-bit int. " << message;
|
|
|
})) {
|
|
})) {
|
|
|
return error;
|
|
return error;
|
|
@@ -3053,11 +3024,12 @@ spv_result_t BuiltInsValidator::ValidateI32InputAtDefinition(
|
|
|
const SpvStorageClass storage_class = GetStorageClass(inst);
|
|
const SpvStorageClass storage_class = GetStorageClass(inst);
|
|
|
if (storage_class != SpvStorageClassMax &&
|
|
if (storage_class != SpvStorageClassMax &&
|
|
|
storage_class != SpvStorageClassInput) {
|
|
storage_class != SpvStorageClassInput) {
|
|
|
|
|
+ uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorStorageClass);
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
|
|
|
+ << _.VkErrorID(vuid)
|
|
|
<< spvLogStringForEnv(_.context()->target_env)
|
|
<< spvLogStringForEnv(_.context()->target_env)
|
|
|
<< " spec allows BuiltIn "
|
|
<< " spec allows BuiltIn "
|
|
|
- << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN,
|
|
|
|
|
- decoration.params()[0])
|
|
|
|
|
|
|
+ << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin)
|
|
|
<< " to be only used for variables with Input storage class. "
|
|
<< " to be only used for variables with Input storage class. "
|
|
|
<< GetReferenceDesc(decoration, inst, inst, inst) << " "
|
|
<< GetReferenceDesc(decoration, inst, inst, inst) << " "
|
|
|
<< GetStorageClassDesc(inst);
|
|
<< GetStorageClassDesc(inst);
|
|
@@ -3070,23 +3042,23 @@ spv_result_t BuiltInsValidator::ValidateI32InputAtDefinition(
|
|
|
spv_result_t BuiltInsValidator::ValidateI32Vec4InputAtDefinition(
|
|
spv_result_t BuiltInsValidator::ValidateI32Vec4InputAtDefinition(
|
|
|
const Decoration& decoration, const Instruction& inst) {
|
|
const Decoration& decoration, const Instruction& inst) {
|
|
|
if (spvIsVulkanEnv(_.context()->target_env)) {
|
|
if (spvIsVulkanEnv(_.context()->target_env)) {
|
|
|
|
|
+ const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]);
|
|
|
if (decoration.struct_member_index() != Decoration::kInvalidMember) {
|
|
if (decoration.struct_member_index() != Decoration::kInvalidMember) {
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
|
<< "BuiltIn "
|
|
<< "BuiltIn "
|
|
|
- << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN,
|
|
|
|
|
- decoration.params()[0])
|
|
|
|
|
|
|
+ << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin)
|
|
|
<< " cannot be used as a member decoration ";
|
|
<< " cannot be used as a member decoration ";
|
|
|
}
|
|
}
|
|
|
if (spv_result_t error = ValidateI32Vec(
|
|
if (spv_result_t error = ValidateI32Vec(
|
|
|
decoration, inst, 4,
|
|
decoration, inst, 4,
|
|
|
- [this, &decoration,
|
|
|
|
|
- &inst](const std::string& message) -> spv_result_t {
|
|
|
|
|
|
|
+ [this, &inst, builtin](const std::string& message) -> spv_result_t {
|
|
|
|
|
+ uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorType);
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
|
|
|
+ << _.VkErrorID(vuid)
|
|
|
<< "According to the "
|
|
<< "According to the "
|
|
|
<< spvLogStringForEnv(_.context()->target_env)
|
|
<< spvLogStringForEnv(_.context()->target_env)
|
|
|
<< " spec BuiltIn "
|
|
<< " spec BuiltIn "
|
|
|
- << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN,
|
|
|
|
|
- decoration.params()[0])
|
|
|
|
|
|
|
+ << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin)
|
|
|
<< " variable needs to be a 4-component 32-bit int "
|
|
<< " variable needs to be a 4-component 32-bit int "
|
|
|
"vector. "
|
|
"vector. "
|
|
|
<< message;
|
|
<< message;
|
|
@@ -3097,11 +3069,12 @@ spv_result_t BuiltInsValidator::ValidateI32Vec4InputAtDefinition(
|
|
|
const SpvStorageClass storage_class = GetStorageClass(inst);
|
|
const SpvStorageClass storage_class = GetStorageClass(inst);
|
|
|
if (storage_class != SpvStorageClassMax &&
|
|
if (storage_class != SpvStorageClassMax &&
|
|
|
storage_class != SpvStorageClassInput) {
|
|
storage_class != SpvStorageClassInput) {
|
|
|
|
|
+ uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorStorageClass);
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
|
|
|
+ << _.VkErrorID(vuid)
|
|
|
<< spvLogStringForEnv(_.context()->target_env)
|
|
<< spvLogStringForEnv(_.context()->target_env)
|
|
|
<< " spec allows BuiltIn "
|
|
<< " spec allows BuiltIn "
|
|
|
- << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN,
|
|
|
|
|
- decoration.params()[0])
|
|
|
|
|
|
|
+ << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin)
|
|
|
<< " to be only used for variables with Input storage class. "
|
|
<< " to be only used for variables with Input storage class. "
|
|
|
<< GetReferenceDesc(decoration, inst, inst, inst) << " "
|
|
<< GetReferenceDesc(decoration, inst, inst, inst) << " "
|
|
|
<< GetStorageClassDesc(inst);
|
|
<< GetStorageClassDesc(inst);
|
|
@@ -3628,7 +3601,7 @@ spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtDefinition(
|
|
|
decoration, inst,
|
|
decoration, inst,
|
|
|
[this, &inst,
|
|
[this, &inst,
|
|
|
builtin](const std::string& message) -> spv_result_t {
|
|
builtin](const std::string& message) -> spv_result_t {
|
|
|
- uint32_t vuid = GetVUIDForRTBuiltin(builtin, VUIDErrorType);
|
|
|
|
|
|
|
+ uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorType);
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
|
<< _.VkErrorID(vuid)
|
|
<< _.VkErrorID(vuid)
|
|
|
<< "According to the Vulkan spec BuiltIn "
|
|
<< "According to the Vulkan spec BuiltIn "
|
|
@@ -3650,7 +3623,7 @@ spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtDefinition(
|
|
|
decoration, inst,
|
|
decoration, inst,
|
|
|
[this, &inst,
|
|
[this, &inst,
|
|
|
builtin](const std::string& message) -> spv_result_t {
|
|
builtin](const std::string& message) -> spv_result_t {
|
|
|
- uint32_t vuid = GetVUIDForRTBuiltin(builtin, VUIDErrorType);
|
|
|
|
|
|
|
+ uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorType);
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
|
<< _.VkErrorID(vuid)
|
|
<< _.VkErrorID(vuid)
|
|
|
<< "According to the Vulkan spec BuiltIn "
|
|
<< "According to the Vulkan spec BuiltIn "
|
|
@@ -3671,7 +3644,7 @@ spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtDefinition(
|
|
|
decoration, inst, 3,
|
|
decoration, inst, 3,
|
|
|
[this, &inst,
|
|
[this, &inst,
|
|
|
builtin](const std::string& message) -> spv_result_t {
|
|
builtin](const std::string& message) -> spv_result_t {
|
|
|
- uint32_t vuid = GetVUIDForRTBuiltin(builtin, VUIDErrorType);
|
|
|
|
|
|
|
+ uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorType);
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
|
<< _.VkErrorID(vuid)
|
|
<< _.VkErrorID(vuid)
|
|
|
<< "According to the Vulkan spec BuiltIn "
|
|
<< "According to the Vulkan spec BuiltIn "
|
|
@@ -3691,7 +3664,7 @@ spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtDefinition(
|
|
|
decoration, inst, 3,
|
|
decoration, inst, 3,
|
|
|
[this, &inst,
|
|
[this, &inst,
|
|
|
builtin](const std::string& message) -> spv_result_t {
|
|
builtin](const std::string& message) -> spv_result_t {
|
|
|
- uint32_t vuid = GetVUIDForRTBuiltin(builtin, VUIDErrorType);
|
|
|
|
|
|
|
+ uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorType);
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
|
<< _.VkErrorID(vuid)
|
|
<< _.VkErrorID(vuid)
|
|
|
<< "According to the Vulkan spec BuiltIn "
|
|
<< "According to the Vulkan spec BuiltIn "
|
|
@@ -3711,7 +3684,7 @@ spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtDefinition(
|
|
|
decoration, inst, 3, 4,
|
|
decoration, inst, 3, 4,
|
|
|
[this, &inst,
|
|
[this, &inst,
|
|
|
builtin](const std::string& message) -> spv_result_t {
|
|
builtin](const std::string& message) -> spv_result_t {
|
|
|
- uint32_t vuid = GetVUIDForRTBuiltin(builtin, VUIDErrorType);
|
|
|
|
|
|
|
+ uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorType);
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
|
|
|
<< _.VkErrorID(vuid)
|
|
<< _.VkErrorID(vuid)
|
|
|
<< "According to the Vulkan spec BuiltIn "
|
|
<< "According to the Vulkan spec BuiltIn "
|
|
@@ -3744,7 +3717,7 @@ spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtReference(
|
|
|
const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst);
|
|
const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst);
|
|
|
if (storage_class != SpvStorageClassMax &&
|
|
if (storage_class != SpvStorageClassMax &&
|
|
|
storage_class != SpvStorageClassInput) {
|
|
storage_class != SpvStorageClassInput) {
|
|
|
- uint32_t vuid = GetVUIDForRTBuiltin(builtin, VUIDErrorStorageClass);
|
|
|
|
|
|
|
+ uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorStorageClass);
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst)
|
|
|
<< _.VkErrorID(vuid) << "Vulkan spec allows BuiltIn "
|
|
<< _.VkErrorID(vuid) << "Vulkan spec allows BuiltIn "
|
|
|
<< _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN,
|
|
<< _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN,
|
|
@@ -3757,7 +3730,7 @@ spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtReference(
|
|
|
|
|
|
|
|
for (const SpvExecutionModel execution_model : execution_models_) {
|
|
for (const SpvExecutionModel execution_model : execution_models_) {
|
|
|
if (!IsExecutionModelValidForRtBuiltIn(builtin, execution_model)) {
|
|
if (!IsExecutionModelValidForRtBuiltIn(builtin, execution_model)) {
|
|
|
- uint32_t vuid = GetVUIDForRTBuiltin(builtin, VUIDErrorExecutionModel);
|
|
|
|
|
|
|
+ uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorExecutionModel);
|
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst)
|
|
return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst)
|
|
|
<< _.VkErrorID(vuid) << "Vulkan spec does not allow BuiltIn "
|
|
<< _.VkErrorID(vuid) << "Vulkan spec does not allow BuiltIn "
|
|
|
<< _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN,
|
|
<< _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN,
|