chromium/third_party/blink/renderer/modules/webgpu/BUILD.gn

# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//third_party/blink/renderer/modules/modules.gni")
import("//ui/gl/features.gni")

blink_modules_sources("webgpu") {
  sources = [
    "dawn_conversions.cc",
    "dawn_conversions.h",
    "dawn_enum_conversions.cc",
    "dawn_enum_conversions.h",
    "dawn_object.cc",
    "dawn_object.h",
    "external_texture_helper.cc",
    "external_texture_helper.h",
    "gpu.cc",
    "gpu.h",
    "gpu_adapter.cc",
    "gpu_adapter.h",
    "gpu_adapter_info.cc",
    "gpu_adapter_info.h",
    "gpu_bind_group.cc",
    "gpu_bind_group.h",
    "gpu_bind_group_layout.cc",
    "gpu_bind_group_layout.h",
    "gpu_buffer.cc",
    "gpu_buffer.h",
    "gpu_buffer_usage.h",
    "gpu_canvas_context.cc",
    "gpu_canvas_context.h",
    "gpu_color_write.h",
    "gpu_command_buffer.cc",
    "gpu_command_buffer.h",
    "gpu_command_encoder.cc",
    "gpu_command_encoder.h",
    "gpu_compilation_info.cc",
    "gpu_compilation_info.h",
    "gpu_compilation_message.cc",
    "gpu_compilation_message.h",
    "gpu_compute_pass_encoder.cc",
    "gpu_compute_pass_encoder.h",
    "gpu_compute_pipeline.cc",
    "gpu_compute_pipeline.h",
    "gpu_device.cc",
    "gpu_device.h",
    "gpu_device_lost_info.cc",
    "gpu_device_lost_info.h",
    "gpu_error.cc",
    "gpu_error.h",
    "gpu_external_texture.cc",
    "gpu_external_texture.h",
    "gpu_internal_error.cc",
    "gpu_internal_error.h",
    "gpu_map_mode.h",
    "gpu_memory_heap_info.cc",
    "gpu_memory_heap_info.h",
    "gpu_out_of_memory_error.cc",
    "gpu_out_of_memory_error.h",
    "gpu_pipeline_error.cc",
    "gpu_pipeline_error.h",
    "gpu_pipeline_layout.cc",
    "gpu_pipeline_layout.h",
    "gpu_programmable_pass_encoder.cc",
    "gpu_programmable_pass_encoder.h",
    "gpu_programmable_stage.cc",
    "gpu_programmable_stage.h",
    "gpu_query_set.cc",
    "gpu_query_set.h",
    "gpu_queue.cc",
    "gpu_queue.h",
    "gpu_render_bundle.cc",
    "gpu_render_bundle.h",
    "gpu_render_bundle_encoder.cc",
    "gpu_render_bundle_encoder.h",
    "gpu_render_pass_encoder.cc",
    "gpu_render_pass_encoder.h",
    "gpu_render_pipeline.cc",
    "gpu_render_pipeline.h",
    "gpu_sampler.cc",
    "gpu_sampler.h",
    "gpu_shader_module.cc",
    "gpu_shader_module.h",
    "gpu_shader_stage.h",
    "gpu_supported_features.cc",
    "gpu_supported_features.h",
    "gpu_supported_limits.cc",
    "gpu_supported_limits.h",
    "gpu_texture.cc",
    "gpu_texture.h",
    "gpu_texture_usage.h",
    "gpu_texture_view.cc",
    "gpu_texture_view.h",
    "gpu_uncaptured_error_event.cc",
    "gpu_uncaptured_error_event.h",
    "gpu_validation_error.cc",
    "gpu_validation_error.h",
    "string_utils.cc",
    "string_utils.h",
    "texture_utils.cc",
    "texture_utils.h",
    "wgsl_language_features.cc",
    "wgsl_language_features.h",
  ]
  deps = [
    "//gpu/command_buffer/client:webgpu_interface",
    "//services/metrics/public/cpp:ukm_builders",
    "//skia",
    "//skia:skcms",
    "//third_party/blink/renderer/modules/webcodecs:webcodecs",
  ]

  if (use_dawn) {
    deps += [ "//third_party/dawn/src/dawn/wire" ]
  } else {
    # If Dawn is not used, use the proc table. This gives the WebGPU implementation
    # something to link to, though WebGPU won't be supported.
    deps += [ "//third_party/dawn/src/dawn:proc" ]
  }
}

source_set("unit_tests") {
  testonly = true
  sources = [ "gpu_context_lost_test.cc" ]

  deps = [
    "//base/test:test_support",
    "//third_party/blink/renderer/controller:blink_bindings_test_sources",
    "//third_party/blink/renderer/core",
    "//third_party/blink/renderer/core:testing",
    "//third_party/blink/renderer/modules",
    "//third_party/blink/renderer/platform:test_support",
  ]
}