aboutsummaryrefslogtreecommitdiff
path: root/source/val/validate_extensions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/val/validate_extensions.cpp')
-rw-r--r--source/val/validate_extensions.cpp24
1 files changed, 7 insertions, 17 deletions
diff --git a/source/val/validate_extensions.cpp b/source/val/validate_extensions.cpp
index 17b04460..dc8c0243 100644
--- a/source/val/validate_extensions.cpp
+++ b/source/val/validate_extensions.cpp
@@ -27,6 +27,7 @@
#include "source/latest_version_glsl_std_450_header.h"
#include "source/latest_version_opencl_std_header.h"
#include "source/opcode.h"
+#include "source/spirv_constant.h"
#include "source/spirv_target_env.h"
#include "source/val/instruction.h"
#include "source/val/validate.h"
@@ -686,14 +687,13 @@ bool IsDebugVariableWithIntScalarType(ValidationState_t& _,
} // anonymous namespace
spv_result_t ValidateExtension(ValidationState_t& _, const Instruction* inst) {
- if (spvIsWebGPUEnv(_.context()->target_env)) {
+ if (_.version() < SPV_SPIRV_VERSION_WORD(1, 4)) {
std::string extension = GetExtensionString(&(inst->c_inst()));
-
- if (extension != ExtensionToString(kSPV_KHR_vulkan_memory_model)) {
- return _.diag(SPV_ERROR_INVALID_DATA, inst)
- << "For WebGPU, the only valid parameter to OpExtension is "
- << "\"" << ExtensionToString(kSPV_KHR_vulkan_memory_model)
- << "\".";
+ if (extension ==
+ ExtensionToString(kSPV_KHR_workgroup_memory_explicit_layout)) {
+ return _.diag(SPV_ERROR_WRONG_VERSION, inst)
+ << "SPV_KHR_workgroup_memory_explicit_layout extension "
+ "requires SPIR-V version 1.4 or later.";
}
}
@@ -703,16 +703,6 @@ spv_result_t ValidateExtension(ValidationState_t& _, const Instruction* inst) {
spv_result_t ValidateExtInstImport(ValidationState_t& _,
const Instruction* inst) {
const auto name_id = 1;
- if (spvIsWebGPUEnv(_.context()->target_env)) {
- const std::string name(reinterpret_cast<const char*>(
- inst->words().data() + inst->operands()[name_id].offset));
- if (name != "GLSL.std.450") {
- return _.diag(SPV_ERROR_INVALID_DATA, inst)
- << "For WebGPU, the only valid parameter to OpExtInstImport is "
- "\"GLSL.std.450\".";
- }
- }
-
if (!_.HasExtension(kSPV_KHR_non_semantic_info)) {
const std::string name(reinterpret_cast<const char*>(
inst->words().data() + inst->operands()[name_id].offset));