WebGPU: Add GPUShaderModuleDescriptor.sourceMap/hints
These aren't used by Blink at all, but are necessary to add so that the
WebIDL validation for GPUShaderModuleDescriptor is correct.
Warnings are added when these members are used that explain they will
have no effect.
Also removes a TODO that SPIR-V support should be removed. We're keeping
it available when --enable-unsafe-webgpu is used.
Fixed: 1177491
Change-Id: I48dd160e4d703067fa51c09a98e8aa01a270795b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3676974
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1009574}
diff --git a/third_party/blink/renderer/bindings/generated_in_modules.gni b/third_party/blink/renderer/bindings/generated_in_modules.gni
index 70dac509..d521eae 100644
--- a/third_party/blink/renderer/bindings/generated_in_modules.gni
+++ b/third_party/blink/renderer/bindings/generated_in_modules.gni
@@ -477,6 +477,8 @@
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_sampler_binding_layout.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_sampler_descriptor.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_sampler_descriptor.h",
+ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_shader_module_compilation_hint.cc",
+ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_shader_module_compilation_hint.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_shader_module_descriptor.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_shader_module_descriptor.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_stencil_face_state.cc",
diff --git a/third_party/blink/renderer/bindings/idl_in_modules.gni b/third_party/blink/renderer/bindings/idl_in_modules.gni
index 13b68b8..5319c3e9 100644
--- a/third_party/blink/renderer/bindings/idl_in_modules.gni
+++ b/third_party/blink/renderer/bindings/idl_in_modules.gni
@@ -1028,6 +1028,7 @@
"//third_party/blink/renderer/modules/webgpu/gpu_sampler_binding_layout.idl",
"//third_party/blink/renderer/modules/webgpu/gpu_sampler_descriptor.idl",
"//third_party/blink/renderer/modules/webgpu/gpu_shader_module.idl",
+ "//third_party/blink/renderer/modules/webgpu/gpu_shader_module_compilation_hint.idl",
"//third_party/blink/renderer/modules/webgpu/gpu_shader_module_descriptor.idl",
"//third_party/blink/renderer/modules/webgpu/gpu_shader_stage.idl",
"//third_party/blink/renderer/modules/webgpu/gpu_stencil_face_state.idl",
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_shader_module_compilation_hint.idl b/third_party/blink/renderer/modules/webgpu/gpu_shader_module_compilation_hint.idl
new file mode 100644
index 0000000..e81e158
--- /dev/null
+++ b/third_party/blink/renderer/modules/webgpu/gpu_shader_module_compilation_hint.idl
@@ -0,0 +1,9 @@
+// Copyright 2022 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// https://gpuweb.github.io/gpuweb/
+
+dictionary GPUShaderModuleCompilationHint {
+ (GPUPipelineLayout or GPUAutoLayoutMode) layout;
+};
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_shader_module_descriptor.idl b/third_party/blink/renderer/modules/webgpu/gpu_shader_module_descriptor.idl
index a14bd389..a81d75b 100644
--- a/third_party/blink/renderer/modules/webgpu/gpu_shader_module_descriptor.idl
+++ b/third_party/blink/renderer/modules/webgpu/gpu_shader_module_descriptor.idl
@@ -5,6 +5,7 @@
// https://gpuweb.github.io/gpuweb/
dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase {
- // TODO(crbug.com/1069302): Remove SPIR-V support, change this to USVString.
required (USVString or Uint32Array) code;
+ object sourceMap;
+ record<USVString, GPUShaderModuleCompilationHint> hints;
};