Hash :
223cd0ac
Author :
Date :
2021-06-15T18:46:07
Capture/Replay: Refactor shared context handling
This is the initial CL to enable capture/replay of multi-context
applications.
This CL refactors FrameCapture and FrameCaptureShared to move much of
the functionality into FrameCaptureShared, since most everything is
shared by Contexts in the share group. For example, the setup of the
majority of the GL objects is done in the new SetupReplayContextShared()
function in the new $LABEL_capture_context_shared_frame001.cpp file. The
setup is performed by (for example):
void SetupReplay()
{
$LABEL::InitReplay();
$LABEL::SetupReplayContextShared();
SetupReplayContext2();
}
This performs the shared setup first, followed by the context-specific
setup, which may reference shared objects careated by
LABEL::SetupReplayContextShared().
No re-capturing is required with this change, since the external APIs
(i.e., SetupReplay()) are still the same.
Bug: angleproject:5878
Test: Manual MEC and replay of Magic Tiles 3, Candy Crush Soda Saga, Temple Run 2
Change-Id: Iab7bfe651437e9be1dee83514cd97acc20c61d1d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2965780
Commit-Queue: Tim Van Patten <timvp@google.com>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
# Copyright 2020 The ANGLE Project 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("../../../gni/angle.gni")
declare_args() {
# Determines if we build the capture_replay_tests. Off by default.
angle_build_capture_replay_tests = false
# Set the trace directory. Default is traces
angle_capture_replay_test_trace_dir = "traces"
angle_capture_replay_composite_file_id = 1
}
if (angle_build_capture_replay_tests) {
assert(angle_with_capture_by_default, "Must build with capture by default.")
angle_trace_fixture("angle_capture_replay_tests_fixture") {
gl_header = "angle_trace_gl.h"
public_deps = [
"$angle_root:libEGL",
"$angle_root/util:angle_util",
]
}
# TODO (nguyenmh): http://anglebug.com/4758:
# turn angle_executable into angle_test when adding android support
import(
"${angle_capture_replay_test_trace_dir}/traces${angle_capture_replay_composite_file_id}.gni")
# Build each trace into a module. Use a short name to work around file path limits on Windows.
_trace_counter = 1
_traces = []
foreach(_trace_data, trace_data) {
_trace = _trace_data[0]
_target = "cr_trace_" + _trace_counter
_trace_counter += 1
angle_trace(_target) {
trace_name = _trace
trace_dir = angle_capture_replay_test_trace_dir
trace_ctx = _trace_data[1]
sources = _trace_data[2]
angledata = _trace_data[3]
fixture = ":angle_capture_replay_tests_fixture"
output_name = _trace
}
_traces += [ ":${_target}" ]
}
angle_executable("capture_replay_tests") {
testonly = true
sources = [
"${angle_capture_replay_test_trace_dir}/CompositeTests${angle_capture_replay_composite_file_id}.cpp",
"${angle_capture_replay_test_trace_dir}/CompositeTests${angle_capture_replay_composite_file_id}.h",
"CaptureReplayTests.cpp",
]
deps = [
":angle_capture_replay_tests_fixture",
"$angle_root:angle_common",
"$angle_root:angle_compression",
] + _traces
configs += [
"$angle_root:library_name_config",
"$angle_root:libANGLE_config",
]
defines = []
if ((is_linux || is_chromeos) && !is_component_build) {
# Set rpath to find shared libs in a non-component build.
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
}
suppressed_configs += [ "$angle_root:constructor_and_destructor_warnings" ]
# Disable optimization to avoid optimizing huge files.
_trace_folder_relative_path = "./" + angle_capture_replay_test_trace_dir
_data_path = rebase_path(_trace_folder_relative_path, root_out_dir)
defines = [
"ANGLE_CAPTURE_REPLAY_TEST_DATA_DIR=\"${_data_path}\"",
"ANGLE_CAPTURE_REPLAY_COMPOSITE_TESTS_HEADER=" +
angle_capture_replay_test_trace_dir +
"/CompositeTests${angle_capture_replay_composite_file_id}.h",
"ANGLE_REPLAY_EXPORT=",
]
include_dirs = [ "." ]
}
} else {
group("capture_replay_tests") {
}
}