• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2017 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("../gni/angle.gni")
6
7declare_args() {
8  # Determines if we build the capture_replay sample. Off by default.
9  angle_build_capture_replay_sample = false
10
11  # Decide which context to replay, starting with desktop default
12  angle_capture_replay_sample_context_id = 1
13}
14
15config("sample_util_config") {
16  include_dirs = [ "sample_util" ]
17}
18
19angle_source_set("sample_util") {
20  testonly = true
21  sources = [
22    "sample_util/SampleApplication.cpp",
23    "sample_util/SampleApplication.h",
24    "sample_util/texture_utils.cpp",
25    "sample_util/texture_utils.h",
26    "sample_util/tga_utils.cpp",
27    "sample_util/tga_utils.h",
28  ]
29  data_deps = [
30    "../:libEGL",
31    "../:libGLESv1_CM",
32    "../:libGLESv2",
33  ]
34  public_deps = [
35    "../:angle_common",
36    "../util:angle_test_utils",
37    "../util:angle_util",
38    "../util:angle_util_loader_headers",
39  ]
40  configs += [ "../:library_name_config" ]
41  public_configs = [
42    ":sample_util_config",
43    "../:no_gl_prototypes",
44  ]
45}
46
47template("angle_sample") {
48  if (defined(invoker.data)) {
49    copy(target_name + "_data") {
50      sources = invoker.data
51      outputs = [ "$root_out_dir/{{source_file_part}}" ]
52    }
53  }
54
55  angle_executable(target_name) {
56    testonly = true
57    forward_variables_from(invoker,
58                           [
59                             "cflags",
60                             "defines",
61                             "deps",
62                             "sources",
63                           ])
64    deps += [ ":sample_util" ]
65    if (defined(invoker.data)) {
66      deps += [ ":${target_name}_data" ]
67    }
68
69    if (defined(invoker.suppressed_configs)) {
70      suppressed_configs += invoker.suppressed_configs
71    }
72  }
73}
74
75set_defaults("angle_sample") {
76  deps = []
77}
78
79angle_sample("hello_triangle") {
80  sources = [ "hello_triangle/HelloTriangle.cpp" ]
81}
82
83angle_sample("mip_map_2d") {
84  sources = [ "mip_map_2d/MipMap2D.cpp" ]
85}
86
87angle_sample("multi_texture") {
88  sources = [ "multi_texture/MultiTexture.cpp" ]
89  data = [
90    "multi_texture/basemap.tga",
91    "multi_texture/lightmap.tga",
92  ]
93}
94
95angle_sample("multi_window") {
96  sources = [ "multi_window/MultiWindow.cpp" ]
97}
98
99angle_sample("multiple_draw_buffers") {
100  sources = [ "multiple_draw_buffers/MultipleDrawBuffers.cpp" ]
101  data = [
102    "multiple_draw_buffers/multiple_draw_buffers_copy_fs.glsl",
103    "multiple_draw_buffers/multiple_draw_buffers_fs.glsl",
104    "multiple_draw_buffers/multiple_draw_buffers_vs.glsl",
105  ]
106}
107
108angle_sample("multiview") {
109  sources = [ "multiview/Multiview.cpp" ]
110}
111
112angle_sample("particle_system") {
113  sources = [ "particle_system/ParticleSystem.cpp" ]
114  data = [ "particle_system/smoke.tga" ]
115}
116
117angle_sample("post_sub_buffer") {
118  sources = [ "post_sub_buffer/PostSubBuffer.cpp" ]
119}
120
121angle_sample("simple_instancing") {
122  sources = [ "simple_instancing/SimpleInstancing.cpp" ]
123}
124
125angle_sample("simple_texture_2d") {
126  sources = [ "simple_texture_2d/SimpleTexture2D.cpp" ]
127}
128
129angle_sample("simple_texture_cubemap") {
130  sources = [ "simple_texture_cubemap/SimpleTextureCubemap.cpp" ]
131}
132
133angle_sample("simple_vertex_shader") {
134  sources = [ "simple_vertex_shader/SimpleVertexShader.cpp" ]
135}
136
137angle_sample("stencil_operations") {
138  sources = [ "stencil_operations/StencilOperations.cpp" ]
139}
140
141angle_sample("tex_redef_microbench") {
142  sources = [ "tex_redef_microbench/TexRedefMicroBench.cpp" ]
143}
144
145angle_sample("texture_wrap") {
146  sources = [ "texture_wrap/TextureWrap.cpp" ]
147}
148
149angle_sample("tri_fan_microbench") {
150  sources = [ "tri_fan_microbench/TriFanMicroBench.cpp" ]
151}
152
153angle_sample("window_test") {
154  sources = [ "WindowTest/WindowTest.cpp" ]
155}
156
157angle_sample("gles1_hello_triangle") {
158  sources = [ "gles1/HelloTriangle.cpp" ]
159}
160
161angle_sample("gles1_simple_texture_2d") {
162  sources = [ "gles1/SimpleTexture2D.cpp" ]
163}
164
165angle_sample("gles1_simple_lighting") {
166  sources = [ "gles1/SimpleLighting.cpp" ]
167}
168
169angle_sample("gles1_flat_shading") {
170  sources = [ "gles1/FlatShading.cpp" ]
171}
172
173angle_sample("gles1_draw_texture") {
174  sources = [ "gles1/DrawTexture.cpp" ]
175}
176
177if (angle_build_capture_replay_sample) {
178  # The capture_replay sample is set up to work with a single Context.
179  # To use the capture replay sample first move your capture sources into
180  # the capture_replay folder and enable the gn arg above.
181  angle_sample("capture_replay_sample") {
182    _contextid = angle_capture_replay_sample_context_id
183    sources =
184        rebase_path(
185            read_file(
186                "capture_replay/angle_capture_context${_contextid}_files.txt",
187                "list lines"),
188            ".",
189            "capture_replay") +
190        [
191          "capture_replay/CaptureReplay.cpp",
192          "capture_replay/angle_capture_context${_contextid}.cpp",
193          "capture_replay/angle_capture_context${_contextid}.h",
194        ]
195
196    deps = [ "$angle_root:angle_compression" ]
197
198    _data_path = rebase_path("capture_replay", root_out_dir)
199    defines = [
200      "ANGLE_CAPTURE_REPLAY_SAMPLE_DATA_DIR=\"${_data_path}\"",
201      "ANGLE_CAPTURE_REPLAY_SAMPLE_CONTEXT_ID=${_contextid}",
202      "ANGLE_CAPTURE_REPLAY_SAMPLE_HEADER=angle_capture_context${_contextid}.h",
203    ]
204
205    suppressed_configs = [ "$angle_root:constructor_and_destructor_warnings" ]
206
207    # Disable optimization to avoid optimizing huge files.
208    if (!is_debug) {
209      suppressed_configs += [ "//build/config/compiler:default_optimization" ]
210      configs += [ "//build/config/compiler:no_optimize" ]
211    }
212  }
213}
214
215group("angle_samples") {
216  testonly = true
217  deps = [
218    ":gles1_draw_texture",
219    ":gles1_flat_shading",
220    ":gles1_hello_triangle",
221    ":gles1_simple_lighting",
222    ":gles1_simple_texture_2d",
223    ":hello_triangle",
224    ":mip_map_2d",
225    ":multi_texture",
226    ":multi_window",
227    ":multiple_draw_buffers",
228    ":multiview",
229    ":particle_system",
230    ":post_sub_buffer",
231    ":sample_util",
232    ":simple_instancing",
233    ":simple_texture_2d",
234    ":simple_texture_cubemap",
235    ":simple_vertex_shader",
236    ":stencil_operations",
237    ":tex_redef_microbench",
238    ":texture_wrap",
239    ":tri_fan_microbench",
240    ":window_test",
241  ]
242}
243