| # Copyright 2016 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/components.gni") |
| import("//build/testing/environments.gni") |
| import("//src/graphics/lib/magma/gnbuild/magma.gni") |
| import("//src/ui/lib/escher/build_args.gni") |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":escher_tests" ] |
| } |
| config("use_runtime_glsl_config") { |
| defines = [ "ESCHER_USE_RUNTIME_GLSL=1" ] |
| } |
| |
| config("test_for_glsl_spirv_mismatch_config") { |
| defines = [ "ESCHER_TEST_FOR_GLSL_SPIRV_MISMATCH=1" ] |
| } |
| |
| fuchsia_test_component("escher_unittests") { |
| manifest = "meta/escher_unittests.cml" |
| deps = [ "test:escher_unittests" ] |
| } |
| |
| fuchsia_test_component("escher_unittests_expected_failure") { |
| manifest = "meta/escher_unittests_expected_failure.cml" |
| deps = [ "test:escher_unittests_expected_failure" ] |
| } |
| |
| fuchsia_test_component("escher_renderer_tests") { |
| manifest = "meta/escher_renderer_tests.cml" |
| deps = [ "test:escher_renderer_tests" ] |
| } |
| |
| fuchsia_test_component("escher_examples_test") { |
| manifest = "meta/escher_examples_test.cml" |
| deps = [ "//src/ui/examples/escher/test:escher_examples_test" ] |
| } |
| |
| fuchsia_test_package("escher_tests") { |
| test_components = [ |
| ":escher_renderer_tests", |
| ":escher_examples_test", |
| ":escher_unittests", |
| ] |
| deps = [ |
| "shaders:escher_shaders_resources", |
| "shaders:escher_shaders_spirv_resources", |
| "shaders:escher_test_shaders_spirv_resources", |
| "//src/lib/vulkan:vulkan_validation_layers", |
| "//src/ui/examples/escher/common/assets:escher_examples_assets", |
| ] |
| |
| test_specs = { |
| environments = basic_envs + magma_libvulkan_hardware_envs |
| } |
| } |
| |
| fuchsia_test_package("escher_tests_expected_failure") { |
| test_components = [ ":escher_unittests_expected_failure" ] |
| deps = [ |
| "shaders:escher_shaders_resources", |
| "shaders:escher_shaders_spirv_resources", |
| "//src/lib/vulkan:vulkan_validation_layers", |
| ] |
| |
| test_specs = { |
| log_settings = { |
| max_severity = "FATAL" |
| } |
| } |
| } |
| |
| config("thread_safety_warning") { |
| cflags = [ |
| "-Wthread-safety", |
| "-fcolor-diagnostics", |
| ] |
| } |
| |
| config("vk_mem_alloc_small_heap_max_size") { |
| # Set maximum small heap size to 256MB, which works for AEMU (which has 512MB |
| # memory heaps) and possibly other devices with limited memory size. |
| defines = [ "VMA_SMALL_HEAP_MAX_SIZE=(256ull*1024*1024)" ] |
| } |
| |
| config("vk_mem_alloc_error_suppression") { |
| cflags = [ |
| "-Wno-deprecated-copy", |
| "-Wno-missing-field-initializers", |
| "-Wno-unused-variable", |
| ] |
| |
| if (is_mac) { |
| # TODO(fxbug.dev/62261): Current vk_mem_alloc.h has a possible naming |
| # conflict for aligned_alloc() method which is implemented natively on |
| # macOS 10.15 SDK and above. We should update vk_mem_alloc.h to upstream |
| # to fix this. |
| cflags += [ "-Wno-unguarded-availability-new" ] |
| } |
| } |
| |
| source_set("vk_mem_alloc") { |
| public_deps = [ |
| "//src/lib/fxl", |
| "//src/lib/vulkan", |
| ] |
| |
| sources = [ |
| "third_party/VulkanMemoryAllocator/vk_mem_alloc.h", |
| "vk/vk_mem_alloc.cc", |
| ] |
| |
| public_configs = [ |
| ":vk_mem_alloc_error_suppression", |
| ":vk_mem_alloc_small_heap_max_size", |
| ] |
| } |
| |
| # Allows variants of Escher library to be built, e.g. to toggle |
| # between runtime GLSL compilation vs using precompiled SPIR-V. |
| template("escher_library") { |
| source_set(target_name) { |
| forward_variables_from(invoker, "*") |
| |
| defines = [ |
| # Currently necessary on Fuchsia, but not Linux. |
| "ESCHER_DISABLE_BACKGROUND_GLSL_COMPILATION", |
| ] |
| |
| deps = [ |
| "//third_party/spirv-cross/gn:spirv_cross_sources", |
| "//third_party/spirv-tools:spvtools_opt", |
| ] |
| |
| if (use_runtime_glsl) { |
| deps += [ |
| "//third_party/glslang:glslang_default_resource_limits_sources", |
| "//third_party/glslang:glslang_sources", |
| "//third_party/shaderc:libshaderc", |
| ] |
| } |
| |
| public_deps = [ |
| ":vk_mem_alloc", |
| "//src/lib/fxl", |
| "//src/lib/vulkan", |
| "//src/ui/lib/escher/base:escher_base", |
| "//src/ui/lib/escher/geometry:escher_geometry", |
| "//src/ui/lib/escher/types:escher_types", |
| ] |
| |
| sources = [ |
| "debug/debug_font.cc", |
| "debug/debug_font.h", |
| "debug/debug_rects.cc", |
| "debug/debug_rects.h", |
| "defaults/default_shader_program_factory.cc", |
| "defaults/default_shader_program_factory.h", |
| "escher.cc", |
| "escher.h", |
| "escher_process_init.cc", |
| "escher_process_init.h", |
| "flatland/flatland_static_config.cc", |
| "flatland/flatland_static_config.h", |
| "flatland/rectangle_compositor.cc", |
| "flatland/rectangle_compositor.h", |
| "forward_declarations.h", |
| "fs/hack_filesystem.cc", |
| "fs/hack_filesystem.h", |
| "hmd/pose_buffer_latching_shader.cc", |
| "hmd/pose_buffer_latching_shader.h", |
| "impl/command_buffer.cc", |
| "impl/command_buffer.h", |
| "impl/command_buffer_pool.cc", |
| "impl/command_buffer_pool.h", |
| "impl/command_buffer_sequencer.cc", |
| "impl/command_buffer_sequencer.h", |
| "impl/debug_print.cc", |
| "impl/descriptor_set_pool.cc", |
| "impl/descriptor_set_pool.h", |
| "impl/frame_manager.cc", |
| "impl/frame_manager.h", |
| "impl/gpu_mem_slab.cc", |
| "impl/gpu_mem_slab.h", |
| "impl/gpu_mem_suballocation.cc", |
| "impl/gpu_mem_suballocation.h", |
| "impl/image_cache.cc", |
| "impl/image_cache.h", |
| "impl/mesh_manager.cc", |
| "impl/mesh_manager.h", |
| "impl/mesh_shader_binding.cc", |
| "impl/mesh_shader_binding.h", |
| "impl/naive_buffer.cc", |
| "impl/naive_buffer.h", |
| "impl/naive_image.cc", |
| "impl/naive_image.h", |
| "impl/uniform_buffer_pool.cc", |
| "impl/uniform_buffer_pool.h", |
| "impl/vulkan_utils.cc", |
| "impl/vulkan_utils.h", |
| "impl/z_sort.cc", |
| "impl/z_sort.h", |
| "material/material.cc", |
| "material/material.h", |
| "math/lerp.h", |
| "math/rotations.cc", |
| "math/rotations.h", |
| "mesh/indexed_triangle_mesh.h", |
| "mesh/indexed_triangle_mesh_clip.h", |
| "mesh/indexed_triangle_mesh_upload.h", |
| "mesh/tessellation.cc", |
| "mesh/tessellation.h", |
| "paper/paper_draw_call.h", |
| "paper/paper_draw_call_factory.cc", |
| "paper/paper_draw_call_factory.h", |
| "paper/paper_drawable.h", |
| "paper/paper_drawable_flags.h", |
| "paper/paper_light.h", |
| "paper/paper_material.h", |
| "paper/paper_readme.h", |
| "paper/paper_render_funcs.cc", |
| "paper/paper_render_funcs.h", |
| "paper/paper_render_queue.cc", |
| "paper/paper_render_queue.h", |
| "paper/paper_render_queue_context.cc", |
| "paper/paper_render_queue_context.h", |
| "paper/paper_render_queue_flags.h", |
| "paper/paper_renderer.cc", |
| "paper/paper_renderer.h", |
| "paper/paper_renderer_config.h", |
| "paper/paper_renderer_static_config.cc", |
| "paper/paper_renderer_static_config.h", |
| "paper/paper_scene.h", |
| "paper/paper_shader_list.h", |
| "paper/paper_shader_structs.h", |
| "paper/paper_shape_cache.cc", |
| "paper/paper_shape_cache.h", |
| "paper/paper_timestamp_graph.cc", |
| "paper/paper_timestamp_graph.h", |
| "paper/paper_transform_stack.cc", |
| "paper/paper_transform_stack.h", |
| "profiling/timestamp_profiler.cc", |
| "profiling/timestamp_profiler.h", |
| "renderer/batch_gpu_downloader.cc", |
| "renderer/batch_gpu_downloader.h", |
| "renderer/batch_gpu_uploader.cc", |
| "renderer/batch_gpu_uploader.h", |
| "renderer/buffer_cache.cc", |
| "renderer/buffer_cache.h", |
| "renderer/frame.cc", |
| "renderer/frame.h", |
| "renderer/render_funcs.cc", |
| "renderer/render_funcs.h", |
| "renderer/render_queue.cc", |
| "renderer/render_queue.h", |
| "renderer/render_queue_context.h", |
| "renderer/render_queue_item.h", |
| "renderer/sampler_cache.cc", |
| "renderer/sampler_cache.h", |
| "renderer/semaphore.cc", |
| "renderer/semaphore.h", |
| "renderer/uniform_allocation.h", |
| "renderer/uniform_binding.h", |
| "renderer/uniform_block_allocator.cc", |
| "renderer/uniform_block_allocator.h", |
| "resources/resource.cc", |
| "resources/resource.h", |
| "resources/resource_manager.cc", |
| "resources/resource_manager.h", |
| "resources/resource_recycler.cc", |
| "resources/resource_recycler.h", |
| "resources/resource_type_info.h", |
| "scene/ambient_light.cc", |
| "scene/ambient_light.h", |
| "scene/binding.h", |
| "scene/camera.cc", |
| "scene/camera.h", |
| "scene/directional_light.cc", |
| "scene/directional_light.h", |
| "scene/model.cc", |
| "scene/model.h", |
| "scene/object.cc", |
| "scene/object.h", |
| "scene/shape.cc", |
| "scene/shape.h", |
| "scene/viewing_volume.cc", |
| "scene/viewing_volume.h", |
| "shaders/util/spirv_file_util.cc", |
| "shaders/util/spirv_file_util.h", |
| "shape/mesh.cc", |
| "shape/mesh.h", |
| "shape/mesh_builder.cc", |
| "shape/mesh_builder.h", |
| "shape/mesh_builder_factory.h", |
| "shape/mesh_spec.cc", |
| "shape/mesh_spec.h", |
| "shape/rounded_rect.cc", |
| "shape/rounded_rect.h", |
| "status.h", |
| "third_party/enum_utils/enum_utils.h", |
| "third_party/granite/vk/command_buffer.cc", |
| "third_party/granite/vk/command_buffer.h", |
| "third_party/granite/vk/command_buffer_pipeline_state.cc", |
| "third_party/granite/vk/command_buffer_pipeline_state.h", |
| "third_party/granite/vk/descriptor_set_layout.cc", |
| "third_party/granite/vk/descriptor_set_layout.h", |
| "third_party/granite/vk/pipeline_layout.cc", |
| "third_party/granite/vk/pipeline_layout.h", |
| "third_party/granite/vk/render_pass.cc", |
| "third_party/granite/vk/render_pass.h", |
| "third_party/granite/vk/render_pass_info.cc", |
| "third_party/granite/vk/render_pass_info.h", |
| "third_party/granite/vk/shader_utils.cc", |
| "third_party/granite/vk/shader_utils.h", |
| "util/align.h", |
| "util/alloca.h", |
| "util/bit_ops.h", |
| "util/bitmap.h", |
| "util/block_allocator.cc", |
| "util/block_allocator.h", |
| "util/debug_print.h", |
| "util/enum_cast.h", |
| "util/enum_count.h", |
| "util/enum_flags.h", |
| "util/enum_utils.h", |
| "util/epsilon_compare.cc", |
| "util/epsilon_compare.h", |
| "util/hash.h", |
| "util/hash_cache.h", |
| "util/hash_fnv_1a.h", |
| "util/hash_map.h", |
| "util/hashable.h", |
| "util/hasher.h", |
| "util/image_utils.cc", |
| "util/image_utils.h", |
| "util/intrusive_list.h", |
| "util/object_pool.h", |
| "util/pair_hasher.h", |
| "util/stack_allocator.h", |
| "util/stopwatch.h", |
| "util/string_utils.h", |
| "util/trace_macros.h", |
| "util/tracer.cc", |
| "util/tracer.h", |
| "vk/buffer.cc", |
| "vk/buffer.h", |
| "vk/buffer_factory.h", |
| "vk/chained_semaphore_generator.cc", |
| "vk/chained_semaphore_generator.h", |
| "vk/color_space.cc", |
| "vk/color_space.h", |
| "vk/command_buffer.h", |
| "vk/framebuffer.cc", |
| "vk/framebuffer.h", |
| "vk/gpu_allocator.h", |
| "vk/gpu_mem.cc", |
| "vk/gpu_mem.h", |
| "vk/image.cc", |
| "vk/image.h", |
| "vk/image_layout_updater.cc", |
| "vk/image_layout_updater.h", |
| "vk/image_view.cc", |
| "vk/image_view.h", |
| "vk/impl/descriptor_set_allocator.cc", |
| "vk/impl/descriptor_set_allocator.h", |
| "vk/impl/descriptor_set_allocator_cache.cc", |
| "vk/impl/descriptor_set_allocator_cache.h", |
| "vk/impl/framebuffer.cc", |
| "vk/impl/framebuffer.h", |
| "vk/impl/framebuffer_allocator.cc", |
| "vk/impl/framebuffer_allocator.h", |
| "vk/impl/pipeline_layout_cache.cc", |
| "vk/impl/pipeline_layout_cache.h", |
| "vk/impl/render_pass_cache.cc", |
| "vk/impl/render_pass_cache.h", |
| "vk/naive_gpu_allocator.cc", |
| "vk/naive_gpu_allocator.h", |
| "vk/pipeline_builder.cc", |
| "vk/pipeline_builder.h", |
| "vk/render_pass.cc", |
| "vk/render_pass.h", |
| "vk/render_pass_info.h", |
| "vk/sampler.cc", |
| "vk/sampler.h", |
| "vk/shader_module.cc", |
| "vk/shader_module.h", |
| "vk/shader_module_template.cc", |
| "vk/shader_module_template.h", |
| "vk/shader_program.cc", |
| "vk/shader_program.h", |
| "vk/shader_program_factory.cc", |
| "vk/shader_program_factory.h", |
| "vk/shader_variant_args.cc", |
| "vk/shader_variant_args.h", |
| "vk/texture.cc", |
| "vk/texture.h", |
| "vk/vma_gpu_allocator.cc", |
| "vk/vma_gpu_allocator.h", |
| "vk/vulkan_context.h", |
| "vk/vulkan_device_queues.cc", |
| "vk/vulkan_device_queues.h", |
| "vk/vulkan_instance.cc", |
| "vk/vulkan_instance.h", |
| "vk/vulkan_limits.h", |
| "vk/vulkan_swapchain.cc", |
| "vk/vulkan_swapchain.h", |
| "vk/vulkan_swapchain_helper.cc", |
| "vk/vulkan_swapchain_helper.h", |
| ] |
| |
| if (is_fuchsia) { |
| sources += [ |
| "flib/fence.h", |
| "flib/fence_listener.cc", |
| "flib/fence_listener.h", |
| "flib/fence_queue.cc", |
| "flib/fence_queue.h", |
| "flib/fence_set_listener.cc", |
| "flib/fence_set_listener.h", |
| "fs/fuchsia_data_source.cc", |
| "fs/fuchsia_data_source.h", |
| "util/fuchsia_utils.cc", |
| "util/fuchsia_utils.h", |
| ] |
| public_deps += [ |
| "//sdk/fidl/fuchsia.images:fuchsia.images_hlcpp", |
| "//sdk/fidl/fuchsia.sysmem:fuchsia.sysmem_hlcpp", |
| "//sdk/lib/fidl/cpp", |
| "//sdk/lib/fit", |
| "//sdk/lib/vfs/cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/trace-vthread", |
| ] |
| deps += [ "//zircon/system/ulib/trace" ] |
| } |
| |
| if (is_linux) { |
| sources += [ |
| "fs/linux_data_source.cc", |
| "fs/linux_data_source.h", |
| "util/impl/trace_macros_impl.cc", |
| "util/impl/trace_macros_impl.h", |
| ] |
| } |
| |
| if (is_mac) { |
| sources += [ |
| "fs/macos_data_source.cc", |
| "fs/macos_data_source.h", |
| "util/impl/trace_macros_impl.cc", |
| "util/impl/trace_macros_impl.h", |
| ] |
| } |
| |
| public_configs = [ ":thread_safety_warning" ] |
| if (use_runtime_glsl) { |
| public_configs += [ ":use_runtime_glsl_config" ] |
| } |
| } |
| } |
| |
| set_defaults("escher_library") { |
| configs = default_common_binary_configs |
| } |
| |
| escher_library("escher_with_glslang") { |
| use_runtime_glsl = true |
| } |
| |
| escher_library("escher_no_glslang") { |
| use_runtime_glsl = false |
| } |
| |
| source_set("escher") { |
| if (escher_use_runtime_glsl) { |
| public_deps = [ "//src/ui/lib/escher:escher_with_glslang" ] |
| } else { |
| public_deps = [ "//src/ui/lib/escher:escher_no_glslang" ] |
| } |
| if (escher_test_for_glsl_spirv_mismatch) { |
| public_configs += [ ":test_for_glsl_spirv_mismatch_config" ] |
| } |
| } |
| |
| group("unittests") { |
| testonly = true |
| deps = [ |
| "//src/ui/lib/escher/test:escher_renderer_tests", |
| "//src/ui/lib/escher/test:escher_unittests", |
| ] |
| } |