# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/ui.gni")
import("//gpu/vulkan/features.gni")
import("//skia/features.gni")
import("//third_party/dawn/scripts/dawn_features.gni")
import("//third_party/protobuf/proto_library.gni")
import("//ui/gl/features.gni")
group("service") {
if (is_component_build) {
public_deps = [ "//gpu" ]
} else {
public_deps = [ ":service_sources" ]
}
}
group("gles2") {
if (is_component_build) {
public_deps = [ "//gpu:gles2" ]
} else {
public_deps = [ ":gles2_sources" ]
}
}
if (is_component_build) {
link_target_type = "source_set"
} else {
link_target_type = "static_library"
}
target(link_target_type, "service_sources") {
# External code should depend on this via //gpu/command_buffer/service above
# rather than depending on this directly or the component build will break.
visibility = [ "//gpu/*" ]
sources = [
"async_api_interface.h",
"command_buffer_direct.cc",
"command_buffer_direct.h",
"command_buffer_service.cc",
"command_buffer_service.h",
"common_decoder.cc",
"common_decoder.h",
"decoder_client.h",
"gpu_switches.cc",
"gpu_switches.h",
"memory_tracking.cc",
"memory_tracking.h",
"retaining_one_shot_timer_holder.cc",
"retaining_one_shot_timer_holder.h",
"scheduler.cc",
"scheduler.h",
"scheduler_dfs.cc",
"scheduler_dfs.h",
"scheduler_task_runner.cc",
"scheduler_task_runner.h",
"sequence_id.h",
"sync_point_manager.cc",
"sync_point_manager.h",
"task_graph.cc",
"task_graph.h",
"texture_base.cc",
"texture_base.h",
"transfer_buffer_manager.cc",
"transfer_buffer_manager.h",
]
configs += [
"//build/config:precompiled_headers",
"//gpu:gpu_implementation",
"//third_party/khronos:khronos_headers",
]
public_deps = [
"//base",
"//gpu/command_buffer/common:common_sources",
"//url:url",
]
deps = [
"//base",
"//gpu/command_buffer/client:client_sources",
"//gpu/config:config_sources",
"//gpu/ipc/common:ipc_common_sources",
"//gpu/ipc/common:surface_handle_type",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/gfx/ipc/color",
"//ui/gl",
]
if (is_android && !is_debug) {
# On Android optimize more since this component can be a bottleneck.
configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
}
if (is_win) {
config("service_win_linker_flags") {
# This is in a separate config so the flags can be applied to dependents.
# ldflags in GN aren't automatically inherited.
ldflags = [
# Linking with OneCore.lib causes the following dlls to load.
"/DELAYLOAD:api-ms-win-core-handle-l1-1-0.dll",
]
}
}
target(link_target_type, "gles2_sources") {
# External code should depend on this via //gpu/command_buffer/service:gles2
# above rather than depending on this directly or the component build will
# break.
visibility = [ "//gpu/*" ]
deps = []
defines = []
sources = [
"buffer_manager.cc",
"buffer_manager.h",
"client_service_map.h",
"command_buffer_task_executor.cc",
"command_buffer_task_executor.h",
"context_group.cc",
"context_group.h",
"context_state.cc",
"context_state.h",
"context_state_autogen.h",
"context_state_impl_autogen.h",
"copy_shared_image_helper.cc",
"copy_shared_image_helper.h",
"decoder_context.h",
"display_compositor_memory_and_task_controller_on_gpu.cc",
"display_compositor_memory_and_task_controller_on_gpu.h",
"error_state.cc",
"error_state.h",
"feature_info.cc",
"feature_info.h",
"framebuffer_completeness_cache.cc",
"framebuffer_completeness_cache.h",
"framebuffer_manager.cc",
"framebuffer_manager.h",
"gl_context_virtual.cc",
"gl_context_virtual.h",
"gl_context_virtual_delegate.h",
"gl_state_restorer_impl.cc",
"gl_state_restorer_impl.h",
"gl_utils.cc",
"gl_utils.h",
"gles2_cmd_clear_framebuffer.cc",
"gles2_cmd_clear_framebuffer.h",
"gles2_cmd_copy_tex_image.cc",
"gles2_cmd_copy_tex_image.h",
"gles2_cmd_copy_texture_chromium.cc",
"gles2_cmd_copy_texture_chromium.h",
"gles2_cmd_decoder.cc",
"gles2_cmd_decoder.h",
"gles2_cmd_decoder_autogen.h",
"gles2_cmd_decoder_passthrough.cc",
"gles2_cmd_decoder_passthrough.h",
"gles2_cmd_decoder_passthrough_doer_prototypes.h",
"gles2_cmd_decoder_passthrough_doers.cc",
"gles2_cmd_decoder_passthrough_handlers.cc",
"gles2_cmd_decoder_passthrough_handlers_autogen.cc",
"gles2_cmd_validation.cc",
"gles2_cmd_validation.h",
"gles2_cmd_validation_autogen.h",
"gles2_cmd_validation_implementation_autogen.h",
"gles2_external_framebuffer.cc",
"gles2_external_framebuffer.h",
"gles2_query_manager.cc",
"gles2_query_manager.h",
"gpu_command_buffer_memory_tracker.cc",
"gpu_command_buffer_memory_tracker.h",
"gpu_fence_manager.cc",
"gpu_fence_manager.h",
"gpu_state_tracer.cc",
"gpu_state_tracer.h",
"gpu_task_scheduler_helper.cc",
"gpu_task_scheduler_helper.h",
"gpu_tracer.cc",
"gpu_tracer.h",
"gr_cache_controller.cc",
"gr_cache_controller.h",
"gr_shader_cache.cc",
"gr_shader_cache.h",
"graphite_cache_controller.cc",
"graphite_cache_controller.h",
"graphite_image_provider.cc",
"graphite_image_provider.h",
"graphite_utils.cc",
"graphite_utils.h",
"id_manager.cc",
"id_manager.h",
"indexed_buffer_binding_host.cc",
"indexed_buffer_binding_host.h",
"isolation_key_provider.h",
"logger.cc",
"logger.h",
"memory_program_cache.cc",
"memory_program_cache.h",
"multi_draw_manager.cc",
"multi_draw_manager.h",
"passthrough_discardable_manager.cc",
"passthrough_discardable_manager.h",
"passthrough_program_cache.cc",
"passthrough_program_cache.h",
"program_cache.cc",
"program_cache.h",
"program_manager.cc",
"program_manager.h",
"query_manager.cc",
"query_manager.h",
"raster_cmd_validation.cc",
"raster_cmd_validation.h",
"raster_cmd_validation_autogen.h",
"raster_cmd_validation_implementation_autogen.h",
"raster_decoder.cc",
"raster_decoder.h",
"renderbuffer_manager.cc",
"renderbuffer_manager.h",
"sampler_manager.cc",
"sampler_manager.h",
"scheduler_sequence.cc",
"scheduler_sequence.h",
"service_discardable_manager.cc",
"service_discardable_manager.h",
"service_font_manager.cc",
"service_font_manager.h",
"service_transfer_cache.cc",
"service_transfer_cache.h",
"service_utils.cc",
"service_utils.h",
"shader_manager.cc",
"shader_manager.h",
"shader_translator.cc",
"shader_translator.h",
"shader_translator_cache.cc",
"shader_translator_cache.h",
"shared_context_state.cc",
"shared_context_state.h",
"shared_image/compound_image_backing.cc",
"shared_image/compound_image_backing.h",
"shared_image/copy_image_plane.cc",
"shared_image/copy_image_plane.h",
"shared_image/egl_image_backing.cc",
"shared_image/egl_image_backing.h",
"shared_image/egl_image_backing_factory.cc",
"shared_image/egl_image_backing_factory.h",
"shared_image/gl_common_image_backing_factory.cc",
"shared_image/gl_common_image_backing_factory.h",
"shared_image/gl_repack_utils.cc",
"shared_image/gl_repack_utils.h",
"shared_image/gl_texture_holder.cc",
"shared_image/gl_texture_holder.h",
"shared_image/gl_texture_image_backing.cc",
"shared_image/gl_texture_image_backing.h",
"shared_image/gl_texture_image_backing_factory.cc",
"shared_image/gl_texture_image_backing_factory.h",
"shared_image/gl_texture_passthrough_fallback_image_representation.cc",
"shared_image/gl_texture_passthrough_fallback_image_representation.h",
"shared_image/raw_draw_image_backing.cc",
"shared_image/raw_draw_image_backing.h",
"shared_image/raw_draw_image_backing_factory.cc",
"shared_image/raw_draw_image_backing_factory.h",
"shared_image/shared_image_backing.cc",
"shared_image/shared_image_backing.h",
"shared_image/shared_image_backing_factory.cc",
"shared_image/shared_image_backing_factory.h",
"shared_image/shared_image_factory.cc",
"shared_image/shared_image_factory.h",
"shared_image/shared_image_format_service_utils.cc",
"shared_image/shared_image_format_service_utils.h",
"shared_image/shared_image_gl_utils.cc",
"shared_image/shared_image_gl_utils.h",
"shared_image/shared_image_manager.cc",
"shared_image/shared_image_manager.h",
"shared_image/shared_image_representation.cc",
"shared_image/shared_image_representation.h",
"shared_image/shared_memory_image_backing.cc",
"shared_image/shared_memory_image_backing.h",
"shared_image/shared_memory_image_backing_factory.cc",
"shared_image/shared_memory_image_backing_factory.h",
"shared_image/skia_gl_image_representation.cc",
"shared_image/skia_gl_image_representation.h",
"shared_image/wrapped_graphite_texture_backing.cc",
"shared_image/wrapped_graphite_texture_backing.h",
"shared_image/wrapped_graphite_texture_holder.cc",
"shared_image/wrapped_graphite_texture_holder.h",
"shared_image/wrapped_sk_image_backing.cc",
"shared_image/wrapped_sk_image_backing.h",
"shared_image/wrapped_sk_image_backing_factory.cc",
"shared_image/wrapped_sk_image_backing_factory.h",
"shared_image_interface_in_process.cc",
"shared_image_interface_in_process.h",
"shared_memory_region_wrapper.cc",
"shared_memory_region_wrapper.h",
"single_task_sequence.h",
"skia_utils.cc",
"skia_utils.h",
"texture_manager.cc",
"texture_manager.h",
"transform_feedback_manager.cc",
"transform_feedback_manager.h",
"value_validator.h",
"vertex_array_manager.cc",
"vertex_array_manager.h",
"vertex_attrib_manager.cc",
"vertex_attrib_manager.h",
"webgpu_cmd_validation.cc",
"webgpu_cmd_validation.h",
"webgpu_cmd_validation_autogen.h",
"webgpu_cmd_validation_implementation_autogen.h",
"webgpu_decoder.cc",
"webgpu_decoder.h",
]
if (is_android) {
sources += [
"abstract_texture_android.cc",
"abstract_texture_android.h",
]
}
if (use_dawn) {
deps += [ "//gpu/webgpu:common" ]
sources += [
"dawn_caching_interface.cc",
"dawn_caching_interface.h",
"dawn_instance.cc",
"dawn_instance.h",
"dawn_platform.cc",
"dawn_platform.h",
"dawn_service_memory_transfer_service.cc",
"dawn_service_memory_transfer_service.h",
"dawn_service_serializer.cc",
"dawn_service_serializer.h",
"shared_image/dawn_fallback_image_representation.cc",
"shared_image/dawn_fallback_image_representation.h",
"webgpu_decoder_impl.cc",
"webgpu_decoder_impl.h",
]
}
configs += [
"//build/config:precompiled_headers",
"//gpu:gpu_gles2_implementation",
"//gpu:raster_implementation",
"//gpu:webgpu_implementation",
"//third_party/khronos:khronos_headers",
]
# Prefer mesa GL headers to system headers, which cause problems on Win.
include_dirs = [ "//third_party/mesa_headers" ]
public_deps = [
"//base",
"//cc/paint",
"//gpu/command_buffer/common",
"//gpu/command_buffer/common:gles2_sources",
"//gpu/command_buffer/common:raster_sources",
"//gpu/command_buffer/common:webgpu_sources",
"//skia",
"//third_party/blink/public/common/tokens:tokens_headers",
"//third_party/dawn/include/dawn:cpp_headers",
]
deps += [
":disk_cache_proto",
":service",
"//base",
"//build:chromecast_buildflags",
"//build:chromeos_buildflags",
"//components/crash/core/common",
"//components/viz/common:shared_image_format",
"//gpu/command_buffer/client",
"//gpu/command_buffer/common:gles2_utils",
"//gpu/config",
"//gpu/ipc/common",
"//gpu/vulkan:buildflags",
"//skia:buildflags",
"//third_party/angle:angle_image_util",
"//third_party/angle:angle_version_info",
"//third_party/dawn/include/dawn:cpp_headers",
"//third_party/dawn/src/dawn:proc",
"//third_party/libyuv",
"//third_party/protobuf:protobuf_lite",
"//third_party/re2",
"//third_party/zlib",
"//ui/base:features",
"//ui/base:ozone_buildflags",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/gl",
"//ui/gl:buildflags",
"//ui/gl/init",
]
# If statically linked against ANGLE, link against angle:translator which is already included with ANGLE.
if (use_static_angle) {
deps += [ "//third_party/angle:translator" ]
} else {
deps += [ "//third_party/angle:translator_gl_d3d_only" ]
}
if (use_ozone) {
sources += [
"shared_image/gl_ozone_image_representation.cc",
"shared_image/gl_ozone_image_representation.h",
"shared_image/ozone_image_backing.cc",
"shared_image/ozone_image_backing.h",
"shared_image/ozone_image_backing_factory.cc",
"shared_image/ozone_image_backing_factory.h",
"shared_image/ozone_image_gl_textures_holder.cc",
"shared_image/ozone_image_gl_textures_holder.h",
]
deps += [
"//ui/base:features",
"//ui/ozone",
]
}
if (enable_vulkan) {
deps += [
"//components/viz/common:vulkan_context_provider",
"//gpu/vulkan",
]
sources += [
"shared_image/angle_vulkan_image_backing.cc",
"shared_image/angle_vulkan_image_backing.h",
"shared_image/angle_vulkan_image_backing_factory.cc",
"shared_image/angle_vulkan_image_backing_factory.h",
"shared_image/texture_holder_vk.cc",
"shared_image/texture_holder_vk.h",
]
if (is_linux || is_fuchsia || is_win) {
sources += [
"external_semaphore.cc",
"external_semaphore.h",
"external_semaphore_pool.cc",
"external_semaphore_pool.h",
"shared_image/external_vk_image_backing.cc",
"shared_image/external_vk_image_backing.h",
"shared_image/external_vk_image_backing_factory.cc",
"shared_image/external_vk_image_backing_factory.h",
"shared_image/external_vk_image_gl_representation.cc",
"shared_image/external_vk_image_gl_representation.h",
"shared_image/external_vk_image_overlay_representation.cc",
"shared_image/external_vk_image_overlay_representation.h",
"shared_image/external_vk_image_skia_representation.cc",
"shared_image/external_vk_image_skia_representation.h",
]
}
if (use_ozone) {
sources += [
"shared_image/skia_vk_ozone_image_representation.cc",
"shared_image/skia_vk_ozone_image_representation.h",
"shared_image/vulkan_ozone_image_representation.cc",
"shared_image/vulkan_ozone_image_representation.h",
]
}
if (is_linux && use_dawn) {
sources += [
"shared_image/external_vk_image_dawn_representation.cc",
"shared_image/external_vk_image_dawn_representation.h",
]
}
}
if (use_dawn) {
deps += [
"//net",
"//third_party/dawn/src/dawn:proc",
"//third_party/dawn/src/dawn/native",
"//third_party/dawn/src/dawn/platform",
]
if (dawn_enable_opengles) {
sources += [
"shared_image/dawn_egl_image_representation.cc",
"shared_image/dawn_egl_image_representation.h",
"shared_image/dawn_gl_texture_representation.cc",
"shared_image/dawn_gl_texture_representation.h",
]
}
if (use_ozone) {
sources += [
"shared_image/dawn_ozone_image_representation.cc",
"shared_image/dawn_ozone_image_representation.h",
]
}
}
if (is_apple) {
sources += [
"shared_image/iosurface_image_backing.h",
"shared_image/iosurface_image_backing.mm",
"shared_image/iosurface_image_backing_factory.h",
"shared_image/iosurface_image_backing_factory.mm",
"shared_image/shared_image_format_service_utils_mac.mm",
]
# Do not compile with ARC because Dawn is not (yet) compatible with being
# called from code compiled with ARC.
configs -= [ "//build/config/compiler:enable_arc" ]
if (skia_use_metal) {
deps += [ "//components/viz/common:metal_context_provider" ]
}
# Required by gles2_cmd_decoder.cc on Apple.
frameworks = [
"CoreVideo.framework",
"IOSurface.framework",
"Metal.framework",
]
if (is_mac) {
frameworks += [
"Cocoa.framework",
"OpenGL.framework",
]
}
}
if (skia_use_dawn) {
sources += [
"dawn_context_provider.cc",
"dawn_context_provider.h",
"shared_image/dawn_shared_texture_holder.cc",
"shared_image/dawn_shared_texture_holder.h",
"shared_image/skia_graphite_dawn_image_representation.cc",
"shared_image/skia_graphite_dawn_image_representation.h",
]
deps += [ "//third_party/dawn/src/dawn:cpp" ]
if (is_chromeos) {
sources += [
"drm_modifiers_filter_dawn.cc",
"drm_modifiers_filter_dawn.h",
]
deps += [ "//ui/gfx/linux:drm" ]
}
}
if (is_android) {
if (!is_debug) {
# On Android optimize more since this component can be a bottleneck.
configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
sources += [
"ahardwarebuffer_utils.cc",
"ahardwarebuffer_utils.h",
"image_reader_gl_owner.cc",
"image_reader_gl_owner.h",
"ref_counted_lock.cc",
"ref_counted_lock.h",
"shared_image/ahardwarebuffer_image_backing_factory.cc",
"shared_image/ahardwarebuffer_image_backing_factory.h",
"shared_image/android_image_backing.cc",
"shared_image/android_image_backing.h",
"shared_image/android_video_image_backing.cc",
"shared_image/android_video_image_backing.h",
"shared_image/gl_texture_android_image_representation.cc",
"shared_image/gl_texture_android_image_representation.h",
"shared_image/gl_texture_passthrough_android_image_representation.cc",
"shared_image/gl_texture_passthrough_android_image_representation.h",
"shared_image/skia_vk_android_image_representation.cc",
"shared_image/skia_vk_android_image_representation.h",
"shared_image/video_image_reader_image_backing.cc",
"shared_image/video_image_reader_image_backing.h",
"shared_image/video_surface_texture_image_backing.cc",
"shared_image/video_surface_texture_image_backing.h",
"stream_texture_shared_image_interface.h",
"surface_texture_gl_owner.cc",
"surface_texture_gl_owner.h",
"texture_owner.cc",
"texture_owner.h",
]
# For AImageReader.
libs = [ "mediandk" ]
if (use_dawn) {
sources += [
"shared_image/dawn_ahardwarebuffer_image_representation.cc",
"shared_image/dawn_ahardwarebuffer_image_representation.h",
]
}
deps += [
"//base",
"//third_party/jni_zero",
]
# TODO(cblume): http://crbug.com/911313
# Abstract out the platform specific defines. Right now we need the android
# platform specific define here to be able to include android specific
# functions.
defines += [ "VK_USE_PLATFORM_ANDROID_KHR" ]
deps += [ "//third_party/libsync" ]
if (enable_vulkan) {
deps += [ "//gpu/vulkan" ]
}
}
if (is_win) {
sources += [
"dxgi_shared_handle_manager.cc",
"dxgi_shared_handle_manager.h",
"shared_image/d3d_image_backing.cc",
"shared_image/d3d_image_backing.h",
"shared_image/d3d_image_backing_factory.cc",
"shared_image/d3d_image_backing_factory.h",
"shared_image/d3d_image_representation.cc",
"shared_image/d3d_image_representation.h",
"shared_image/d3d_image_utils.cc",
"shared_image/d3d_image_utils.h",
"shared_image/dcomp_image_backing_factory.cc",
"shared_image/dcomp_image_backing_factory.h",
"shared_image/dcomp_surface_image_backing.cc",
"shared_image/dcomp_surface_image_backing.h",
"shared_image/dcomp_surface_image_representation.cc",
"shared_image/dcomp_surface_image_representation.h",
"shared_image/dxgi_swap_chain_image_backing.cc",
"shared_image/dxgi_swap_chain_image_backing.h",
"shared_image/dxgi_swap_chain_image_representation.cc",
"shared_image/dxgi_swap_chain_image_representation.h",
]
libs = [
"dxguid.lib",
"onecore.lib",
]
all_dependent_configs = [ ":service_win_linker_flags" ]
}
}
proto_library("disk_cache_proto") {
sources = [ "disk_cache_proto.proto" ]
}
if (is_android) {
static_library("android_texture_owner_test_support") {
testonly = true
sources = [
"mock_texture_owner.cc",
"mock_texture_owner.h",
"ref_counted_lock_for_test.cc",
"ref_counted_lock_for_test.h",
]
deps = [
":gles2",
"//base/test:test_support",
"//gpu:test_support",
"//testing/gmock",
"//testing/gtest",
"//ui/gl",
"//ui/gl/init",
]
}
}
if (is_android) {
source_set("android_texture_owner_unittests") {
testonly = true
sources = [
"image_reader_gl_owner_unittest.cc",
"surface_texture_gl_owner_unittest.cc",
"surface_texture_transform_unittest.cc",
]
# For AImageReader_getFormat()
libs = [ "mediandk" ]
deps = [
":android_texture_owner_test_support",
":gles2",
"//base/test:test_support",
"//gpu:test_support",
"//testing/gmock",
"//testing/gtest",
"//ui/gl",
"//ui/gl/init",
]
}
}