зеркало из https://github.com/AvaloniaUI/angle.git
Trace Tests: Remove auto-generated code.
Bug: angleproject:5133 Change-Id: I71a82071b1c667475f7fefcd6c8766a9de71141d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3144215 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
76d420826f
Коммит
1c0bb44862
|
@ -536,17 +536,12 @@ template("angle_trace_fixture") {
|
|||
}
|
||||
|
||||
template("angle_trace") {
|
||||
_trace_prefix = invoker.trace_prefix
|
||||
angle_shared_library(target_name) {
|
||||
testonly = true
|
||||
|
||||
# Similar to capture replay sample, use the file index for sources
|
||||
sources = [
|
||||
"${_trace_prefix}.cpp",
|
||||
"${_trace_prefix}.h",
|
||||
] + invoker.sources
|
||||
sources = invoker.sources
|
||||
|
||||
# TODO(http://anglebug.com/5133): Revert back to non-autogen'ed data.
|
||||
data = invoker.data
|
||||
defines = [ "ANGLE_REPLAY_IMPLEMENTATION" ]
|
||||
suppressed_configs += [ "$angle_root:constructor_and_destructor_warnings" ]
|
||||
|
@ -577,8 +572,4 @@ template("angle_trace") {
|
|||
output_name = invoker.output_name
|
||||
}
|
||||
}
|
||||
|
||||
angle_source_set(target_name + "_headers") {
|
||||
sources = [ "${_trace_prefix}.h" ]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
{
|
||||
"src/tests/restricted_traces/.gitignore":
|
||||
"e1e43b4e19ea9204910e8e121900cf7a",
|
||||
"371f3b4bd514af95e67a73f82116d4b6",
|
||||
"src/tests/restricted_traces/gen_restricted_traces.py":
|
||||
"241d7eb3d8322ff67f44b84f8a06a4cf",
|
||||
"7780405f8e0d92fa87a772dd64c62efb",
|
||||
"src/tests/restricted_traces/restricted_traces.json":
|
||||
"7429fc866e8460aeaaf8e555fd71c5cb",
|
||||
"src/tests/restricted_traces/restricted_traces_autogen.cpp":
|
||||
"629bbb70a63b171e728a661f584b1b61",
|
||||
"src/tests/restricted_traces/restricted_traces_autogen.gni":
|
||||
"cdef35f52e828db179768259a35b02b5",
|
||||
"src/tests/restricted_traces/restricted_traces_autogen.h":
|
||||
"77a97c4bb042e28be314bf45e915e013"
|
||||
"7429fc866e8460aeaaf8e555fd71c5cb"
|
||||
}
|
|
@ -39,15 +39,15 @@ if (angle_build_capture_replay_tests) {
|
|||
_trace_json_path = "$_dir/$_trace.json"
|
||||
|
||||
# This extra empty step is needed to prevent GN from warning on reassignment.
|
||||
_trace_data = {
|
||||
}
|
||||
_trace_data = []
|
||||
_trace_data = read_file(_trace_json_path, "json")
|
||||
_ctx = _trace_data.WindowSurfaceContextID
|
||||
_target = "cr_trace_${_trace_counter}"
|
||||
_trace_counter += 1
|
||||
_trace_extra_cpp =
|
||||
"$_dir/${_trace}_context${_trace_data.WindowSurfaceContextID}.cpp"
|
||||
angle_trace(_target) {
|
||||
trace_prefix = "$_dir/${_trace}_context${_ctx}"
|
||||
sources = rebase_path(_trace_data.TraceFiles, ".", _dir)
|
||||
sources =
|
||||
rebase_path(_trace_data.TraceFiles, ".", _dir) + [ _trace_extra_cpp ]
|
||||
data = []
|
||||
fixture = ":angle_capture_replay_tests_fixture"
|
||||
output_name = _trace
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "common/PackedEnums.h"
|
||||
#include "common/string_utils.h"
|
||||
#include "common/system_utils.h"
|
||||
#include "restricted_traces/restricted_traces_export.h"
|
||||
#include "tests/perf_tests/ANGLEPerfTest.h"
|
||||
#include "tests/perf_tests/ANGLEPerfTestArgs.h"
|
||||
#include "tests/perf_tests/DrawCallPerfParams.h"
|
||||
|
@ -19,8 +20,6 @@
|
|||
#include "util/png_utils.h"
|
||||
#include "util/test_utils.h"
|
||||
|
||||
#include "restricted_traces/restricted_traces_autogen.h"
|
||||
|
||||
#include <rapidjson/document.h>
|
||||
#include <rapidjson/istreamwrapper.h>
|
||||
|
||||
|
@ -1931,15 +1930,17 @@ void RegisterTraceTests()
|
|||
}
|
||||
|
||||
// Load JSON data.
|
||||
std::stringstream tracesJsonStream;
|
||||
tracesJsonStream << rootTracePath << GetPathSeparator() << "restricted_traces.json";
|
||||
std::string tracesJsonPath = tracesJsonStream.str();
|
||||
|
||||
std::vector<std::string> traces;
|
||||
if (!LoadTraceNamesFromJSON(tracesJsonPath, &traces))
|
||||
{
|
||||
ERR() << "Unable to load traces from JSON file: " << tracesJsonPath;
|
||||
return;
|
||||
std::stringstream tracesJsonStream;
|
||||
tracesJsonStream << rootTracePath << GetPathSeparator() << "restricted_traces.json";
|
||||
std::string tracesJsonPath = tracesJsonStream.str();
|
||||
|
||||
if (!LoadTraceNamesFromJSON(tracesJsonPath, &traces))
|
||||
{
|
||||
ERR() << "Unable to load traces from JSON file: " << tracesJsonPath;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<TraceInfo> traceInfos;
|
||||
|
@ -1953,9 +1954,8 @@ void RegisterTraceTests()
|
|||
TraceInfo traceInfo = {};
|
||||
if (!LoadTraceInfoFromJSON(trace, traceJsonPath, &traceInfo))
|
||||
{
|
||||
static_assert(sizeof(TraceInfo) == sizeof(trace_angle::TraceInfo), "Size mismatch");
|
||||
trace_angle::TraceInfo autogenFormatInfo = trace_angle::GetTraceInfo(trace.c_str());
|
||||
memcpy(&traceInfo, &autogenFormatInfo, sizeof(TraceInfo));
|
||||
ERR() << "Unable to load traced data from JSON file: " << traceJsonPath;
|
||||
return;
|
||||
}
|
||||
|
||||
traceInfos.push_back(traceInfo);
|
||||
|
|
|
@ -1,109 +1 @@
|
|||
aliexpress/
|
||||
among_us/
|
||||
angry_birds_2_1500/
|
||||
arena_of_valor/
|
||||
asphalt_8/
|
||||
avakin_life/
|
||||
aztec_ruins/
|
||||
badland/
|
||||
beach_buggy_racing/
|
||||
blockman_go/
|
||||
brawl_stars/
|
||||
bricks_breaker_quest/
|
||||
bubble_shooter/
|
||||
bus_simulator_indonesia/
|
||||
call_break_offline_card_game/
|
||||
candy_crush_500/
|
||||
candy_crush_soda_saga/
|
||||
car_parking_multiplayer/
|
||||
clash_of_clans/
|
||||
clash_royale/
|
||||
cod_mobile/
|
||||
coin_master/
|
||||
command_and_conquer_rivals/
|
||||
cookie_run_kingdom/
|
||||
disney_tsum_tsum/
|
||||
dr_driving/
|
||||
dragon_ball_legends/
|
||||
dragon_raja/
|
||||
efootball_pes_2021/
|
||||
egypt_1500/
|
||||
eight_ball_pool/
|
||||
extreme_car_driving_simulator/
|
||||
fallout_shelter_online/
|
||||
farm_heroes_saga/
|
||||
fate_grand_order/
|
||||
fifa_mobile/
|
||||
final_fantasy/
|
||||
free_fire/
|
||||
gardenscapes/
|
||||
genshin_impact/
|
||||
google_maps/
|
||||
happy_color/
|
||||
hay_day/
|
||||
hearthstone/
|
||||
higgs_domino_island/
|
||||
hill_climb_racing/
|
||||
homescapes/
|
||||
idle_heroes/
|
||||
junes_journey/
|
||||
kartrider_rush/
|
||||
klondike_adventures/
|
||||
league_of_legends_wild_rift/
|
||||
lego_legacy/
|
||||
lineage_m/
|
||||
ludo_king/
|
||||
magic_tiles_3/
|
||||
manhattan_10/
|
||||
manhattan_31/
|
||||
mario_kart_tour/
|
||||
marvel_contest_of_champions/
|
||||
messenger_lite/
|
||||
minecraft/
|
||||
mini_world/
|
||||
mobile_legends/
|
||||
nba2k20_800/
|
||||
nier_reincarnation/
|
||||
one_punch_man/
|
||||
plants_vs_zombies_2/
|
||||
pokemon_go/
|
||||
pokemon_unite/
|
||||
professional_baseball_spirits/
|
||||
pubg_mobile_battle_royale/
|
||||
pubg_mobile_lite/
|
||||
pubg_mobile_skydive/
|
||||
ragnarok_m_eternal_love/
|
||||
raid_shadow_legends/
|
||||
real_commando_secret_mission/
|
||||
real_cricket_20/
|
||||
real_gangster_crime/
|
||||
rise_of_kingdoms/
|
||||
romancing_saga/
|
||||
rope_hero_vice_town/
|
||||
saint_seiya_awakening/
|
||||
sakura_school_simulator/
|
||||
scrabble_go/
|
||||
shadow_fight_2/
|
||||
slingshot_test1/
|
||||
slingshot_test2/
|
||||
sniper_3d/
|
||||
sonic_the_hedgehog/
|
||||
standoff_2/
|
||||
subway_princess_runner/
|
||||
subway_surfers/
|
||||
summoners_war/
|
||||
talking_tom_hero_dash/
|
||||
temple_run_2/
|
||||
temple_run_300/
|
||||
toon_blast/
|
||||
township/
|
||||
trex_200/
|
||||
whatsapp/
|
||||
words_with_friends_2/
|
||||
wordscapes/
|
||||
world_cricket_championship_2/
|
||||
world_of_kings/
|
||||
world_of_tanks_blitz/
|
||||
world_war_doh/
|
||||
worms_zone_io/
|
||||
zillow/
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,6 @@ import("../../../gni/angle.gni")
|
|||
|
||||
angle_shared_library("angle_restricted_trace_loader") {
|
||||
sources = [
|
||||
"restricted_traces_autogen.h",
|
||||
"restricted_traces_export.h",
|
||||
"trace_egl_loader_autogen.cpp",
|
||||
"trace_egl_loader_autogen.h",
|
||||
|
@ -28,45 +27,49 @@ angle_trace_fixture("angle_restricted_trace_fixture") {
|
|||
public_configs = [ "$angle_root:no_gl_prototypes" ]
|
||||
}
|
||||
|
||||
# Imports "angle_restricted_traces"
|
||||
import("restricted_traces_autogen.gni")
|
||||
_traces = []
|
||||
_trace_headers = []
|
||||
_trace_json = read_file("restricted_traces.json", "json")
|
||||
_trace_targets = []
|
||||
|
||||
foreach(_trace_data, angle_restricted_traces) {
|
||||
_trace = _trace_data[0]
|
||||
_trace_ctx = _trace_data[1]
|
||||
_target = "angle_restricted_trace_${_trace}"
|
||||
foreach(_trace_and_version, _trace_json.traces) {
|
||||
_trace_and_version_arr = []
|
||||
_trace_and_version_arr = string_split(_trace_and_version)
|
||||
_trace = _trace_and_version_arr[0]
|
||||
_trace_json_path = "$_trace/$_trace.json"
|
||||
_trace_data = []
|
||||
_trace_data = read_file(_trace_json_path, "json")
|
||||
_target = "angle_restricted_trace_$_trace"
|
||||
_trace_extra_cpp =
|
||||
"${_trace}/${_trace}_context${_trace_data.WindowSurfaceContextID}.cpp"
|
||||
|
||||
angle_trace(_target) {
|
||||
sources = _trace_data[2]
|
||||
data = _trace_data[3]
|
||||
trace_prefix = _trace_data[4]
|
||||
# TODO(jmadill): Include context file in TraceFiles. http://anglebug.com/5133
|
||||
sources =
|
||||
rebase_path(_trace_data.TraceFiles, ".", _trace) + [ _trace_extra_cpp ]
|
||||
|
||||
data = [
|
||||
"$_trace/$_trace.json",
|
||||
"$_trace/$_trace.angledata.gz",
|
||||
]
|
||||
fixture = ":angle_restricted_trace_fixture"
|
||||
}
|
||||
|
||||
_traces += [ ":${_target}" ]
|
||||
_trace_headers += [ ":${_target}_headers" ]
|
||||
_trace_targets += [ ":$_target" ]
|
||||
}
|
||||
|
||||
angle_shared_library("angle_restricted_traces") {
|
||||
testonly = true
|
||||
|
||||
sources = [
|
||||
"restricted_traces_autogen.cpp",
|
||||
"restricted_traces_autogen.h",
|
||||
"restricted_traces_export.h",
|
||||
]
|
||||
sources = [ "restricted_traces_export.h" ]
|
||||
|
||||
data = [ "restricted_traces.json" ]
|
||||
|
||||
data_deps = _traces
|
||||
data_deps = _trace_targets
|
||||
defines = [ "ANGLE_TRACE_IMPLEMENTATION" ]
|
||||
|
||||
deps = [
|
||||
"$angle_root:angle_common",
|
||||
"$angle_root/util:angle_util",
|
||||
] + _trace_headers
|
||||
"$angle_root:angle_common",
|
||||
"$angle_root/util:angle_util",
|
||||
]
|
||||
|
||||
public_deps = [ ":angle_restricted_trace_loader" ]
|
||||
}
|
||||
|
|
|
@ -15,134 +15,6 @@ import json
|
|||
import os
|
||||
import sys
|
||||
|
||||
GNI_TEMPLATE = """\
|
||||
# GENERATED FILE - DO NOT EDIT.
|
||||
# Generated by {script_name} using data from {data_source_name}
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# A list of all restricted trace tests, paired with their context.
|
||||
# Can be consumed by tests/BUILD.gn.
|
||||
|
||||
angle_restricted_traces = [
|
||||
{test_list}
|
||||
]
|
||||
"""
|
||||
|
||||
HEADER_TEMPLATE = """\
|
||||
// GENERATED FILE - DO NOT EDIT.
|
||||
// Generated by {script_name} using data from {data_source_name}
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// {filename}: Types and enumerations for trace tests.
|
||||
|
||||
#ifndef ANGLE_RESTRICTED_TRACES_AUTOGEN_H_
|
||||
#define ANGLE_RESTRICTED_TRACES_AUTOGEN_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <KHR/khrplatform.h>
|
||||
#include <EGL/egl.h>
|
||||
|
||||
#include "restricted_traces_export.h"
|
||||
|
||||
namespace trace_angle
|
||||
{{
|
||||
using GenericProc = void (*)();
|
||||
using LoadProc = GenericProc(KHRONOS_APIENTRY *)(const char *);
|
||||
ANGLE_TRACE_LOADER_EXPORT void LoadEGL(LoadProc loadProc);
|
||||
ANGLE_TRACE_LOADER_EXPORT void LoadGLES(LoadProc loadProc);
|
||||
|
||||
static constexpr size_t kTraceInfoMaxNameLen = 128;
|
||||
|
||||
static constexpr uint32_t kDefaultReplayContextClientMajorVersion = 3;
|
||||
static constexpr uint32_t kDefaultReplayContextClientMinorVersion = 1;
|
||||
static constexpr uint32_t kDefaultReplayDrawSurfaceColorSpace = EGL_COLORSPACE_LINEAR;
|
||||
|
||||
struct TraceInfo
|
||||
{{
|
||||
char name[kTraceInfoMaxNameLen];
|
||||
uint32_t contextClientMajorVersion;
|
||||
uint32_t contextClientMinorVersion;
|
||||
uint32_t frameEnd;
|
||||
uint32_t frameStart;
|
||||
uint32_t drawSurfaceWidth;
|
||||
uint32_t drawSurfaceHeight;
|
||||
uint32_t drawSurfaceColorSpace;
|
||||
uint32_t displayPlatformType;
|
||||
uint32_t displayDeviceType;
|
||||
int configRedBits;
|
||||
int configBlueBits;
|
||||
int configGreenBits;
|
||||
int configAlphaBits;
|
||||
int configDepthBits;
|
||||
int configStencilBits;
|
||||
bool isBinaryDataCompressed;
|
||||
bool areClientArraysEnabled;
|
||||
bool isBindGeneratesResourcesEnabled;
|
||||
bool isWebGLCompatibilityEnabled;
|
||||
bool isRobustResourceInitEnabled;
|
||||
}};
|
||||
|
||||
ANGLE_TRACE_EXPORT const TraceInfo &GetTraceInfo(const char *traceName);
|
||||
}} // namespace trace_angle
|
||||
|
||||
#endif // ANGLE_RESTRICTED_TRACES_AUTOGEN_H_
|
||||
"""
|
||||
|
||||
SOURCE_TEMPLATE = """\
|
||||
// GENERATED FILE - DO NOT EDIT.
|
||||
// Generated by {script_name} using data from {data_source_name}
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// {filename}: Types and enumerations for trace tests.
|
||||
|
||||
#include "{filename}.h"
|
||||
|
||||
#include "common/PackedEnums.h"
|
||||
#include "common/system_utils.h"
|
||||
|
||||
{trace_includes}
|
||||
|
||||
namespace trace_angle
|
||||
{{
|
||||
namespace
|
||||
{{
|
||||
constexpr size_t kNumTraces = {num_traces};
|
||||
struct TracePair
|
||||
{{
|
||||
const char name[kTraceInfoMaxNameLen];
|
||||
TraceInfo info;
|
||||
}};
|
||||
constexpr TracePair kTraceInfos[kNumTraces] = {{
|
||||
{trace_infos}
|
||||
}};
|
||||
}}
|
||||
|
||||
const TraceInfo &GetTraceInfo(const char *traceName)
|
||||
{{
|
||||
// Could be improved using std::lower_bound.
|
||||
for (const TracePair &tracePair : kTraceInfos)
|
||||
{{
|
||||
if (strncmp(tracePair.name, traceName, kTraceInfoMaxNameLen) == 0)
|
||||
{{
|
||||
return tracePair.info;
|
||||
}}
|
||||
}}
|
||||
UNREACHABLE();
|
||||
return kTraceInfos[0].info;
|
||||
}}
|
||||
}} // namespace trace_angle
|
||||
"""
|
||||
|
||||
CIPD_TRACE_PREFIX = 'angle/traces'
|
||||
EXPERIMENTAL_CIPD_PREFIX = 'experimental/google.com/%s/angle/traces'
|
||||
DEPS_PATH = '../../../DEPS'
|
||||
|
@ -172,176 +44,6 @@ def reject_duplicate_keys(pairs):
|
|||
return found_keys
|
||||
|
||||
|
||||
def load_json_metadata(trace):
|
||||
json_file_name = '%s/%s.json' % (trace, trace)
|
||||
with open(json_file_name) as f:
|
||||
return json.loads(f.read())
|
||||
|
||||
|
||||
# TODO(http://anglebug.com/5878): Revert back to non-autogen'ed file names for the angledata.gz.
|
||||
def get_angledata_filename(trace):
|
||||
angledata_files = glob.glob('%s/%s*angledata.gz' % (trace, trace))
|
||||
assert len(angledata_files) == 1, "Trace '%s' has %d angledata.gz files" % (
|
||||
trace, len(angledata_files))
|
||||
return angledata_files[0].replace('\\', '/')
|
||||
|
||||
|
||||
# TODO(jmadill): Remove the GNI generation. http://anglebug.com/5133
|
||||
def gen_gni(traces, gni_file, format_args):
|
||||
test_list = []
|
||||
for trace in traces:
|
||||
context = get_context(trace)
|
||||
angledata_file = get_angledata_filename(trace)
|
||||
txt_file = '%s/%s_capture_context%s_files.txt' % (trace, trace, context)
|
||||
if os.path.exists(txt_file):
|
||||
with open(txt_file) as f:
|
||||
files = f.readlines()
|
||||
f.close()
|
||||
source_files = ['"%s/%s"' % (trace, file.strip()) for file in files]
|
||||
else:
|
||||
json_data = load_json_metadata(trace)
|
||||
files = json_data["TraceFiles"]
|
||||
|
||||
source_files = ['"%s/%s"' % (trace, file.strip()) for file in files]
|
||||
data_files = ['"%s"' % angledata_file]
|
||||
json_file_name = '%s/%s.json' % (trace, trace)
|
||||
if os.path.exists(json_file_name):
|
||||
data_files.append('"%s"' % json_file_name)
|
||||
|
||||
for prefix_expr in ['%s/%s_capture_context%s', '%s/%s_context%s']:
|
||||
prefix = prefix_expr % (trace, trace, context)
|
||||
prefix_cpp = '%s.cpp' % prefix
|
||||
if os.path.exists(prefix_cpp):
|
||||
break
|
||||
|
||||
assert os.path.exists(prefix_cpp), '%s does not exist' % prefix_cpp
|
||||
|
||||
test_list += [
|
||||
'["%s", %s, [%s], [%s], "%s"]' %
|
||||
(trace, context, ','.join(source_files), ','.join(data_files), prefix)
|
||||
]
|
||||
|
||||
format_args['test_list'] = ',\n'.join(test_list)
|
||||
gni_data = GNI_TEMPLATE.format(**format_args)
|
||||
with open(gni_file, "w") as out_file:
|
||||
out_file.write(gni_data)
|
||||
return True
|
||||
|
||||
|
||||
def contains_string(trace, string):
|
||||
"""Determines if the trace contains a string"""
|
||||
for file in os.listdir(trace):
|
||||
if fnmatch.fnmatch(file, '*.h'):
|
||||
with open(os.path.join(trace, file)) as f:
|
||||
if string in f.read():
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def contains_context_version(trace):
|
||||
"""Determines if the trace contains the major/minor context version"""
|
||||
return contains_string(trace, 'kReplayContextClientMajorVersion')
|
||||
|
||||
|
||||
def contains_colorspace(trace):
|
||||
"""Determines if the trace contains an EGL surface color space"""
|
||||
return contains_string(trace, 'kReplayDrawSurfaceColorSpace')
|
||||
|
||||
|
||||
# TODO(jmadill): Remove after retrace. http://anglebug.com/5133
|
||||
def json_metadata_exists(trace):
|
||||
return os.path.isfile('%s/%s.json' % (trace, trace))
|
||||
|
||||
|
||||
def get_trace_info(trace):
|
||||
# Skip getting trace info if we're using JSON metadata.
|
||||
# TODO: Remove generated code. http://anglebug.com/5133
|
||||
if json_metadata_exists(trace):
|
||||
return ''
|
||||
|
||||
# Some traces don't contain major/minor version, so use defaults
|
||||
info = [f'"{trace}"']
|
||||
if contains_context_version(trace):
|
||||
info += [
|
||||
f'{trace}::kReplayContextClientMajorVersion',
|
||||
f'{trace}::kReplayContextClientMinorVersion'
|
||||
]
|
||||
else:
|
||||
info += [
|
||||
'kDefaultReplayContextClientMajorVersion', 'kDefaultReplayContextClientMinorVersion'
|
||||
]
|
||||
|
||||
info += [
|
||||
f'{trace}::kReplayFrameStart', f'{trace}::kReplayFrameEnd',
|
||||
f'{trace}::kReplayDrawSurfaceWidth', f'{trace}::kReplayDrawSurfaceHeight'
|
||||
]
|
||||
|
||||
if contains_colorspace(trace):
|
||||
info += [f'{trace}::kReplayDrawSurfaceColorSpace']
|
||||
else:
|
||||
info += ['kDefaultReplayDrawSurfaceColorSpace']
|
||||
|
||||
# Add placeholder fields to fix an MSVC warning.
|
||||
info += ['0'] * 8
|
||||
info += ['false'] * 5
|
||||
|
||||
return ", ".join(info)
|
||||
|
||||
|
||||
def get_context(trace):
|
||||
"""Returns the trace context number."""
|
||||
# TODO(jmadill): Remove the txt scan once migrated. http://anglebug.com/5133
|
||||
# Load up the only header present for each trace
|
||||
for file in os.listdir(trace):
|
||||
if fnmatch.fnmatch(file, '*.txt'):
|
||||
# Strip the extension to isolate the context by scanning
|
||||
# for numbers leading up to the last one, i.e.:
|
||||
# app_capture_context123_files.txt
|
||||
# ^^
|
||||
# start---||---end
|
||||
start = len(file) - 11
|
||||
end = start + 1
|
||||
while file[start - 1].isdigit():
|
||||
start -= 1
|
||||
context = file[start:end]
|
||||
assert context.isnumeric(), 'Trace context number is not numeric: %s' % context
|
||||
return context
|
||||
|
||||
expr = re.compile(r'.*_context(\d+).cpp')
|
||||
for file in os.listdir(trace):
|
||||
m = expr.match(file)
|
||||
if m:
|
||||
context = m.group(1)
|
||||
assert context.isnumeric(), 'Trace context number is not numeric: %s' % context
|
||||
return context
|
||||
assert False, 'Failed to find context number for %s' % trace
|
||||
|
||||
|
||||
def get_header_name(trace):
|
||||
return '%s/%s_capture_context%s.h' % (trace, trace, get_context(trace))
|
||||
|
||||
|
||||
def gen_header(header_file, format_args):
|
||||
header_data = HEADER_TEMPLATE.format(**format_args)
|
||||
with open(header_file, "w") as out_file:
|
||||
out_file.write(header_data)
|
||||
return True
|
||||
|
||||
|
||||
def gen_source(source_file, format_args):
|
||||
source_data = SOURCE_TEMPLATE.format(**format_args)
|
||||
with open(source_file, "w") as out_file:
|
||||
out_file.write(source_data)
|
||||
return True
|
||||
|
||||
|
||||
def gen_git_ignore(traces):
|
||||
ignores = ['%s/' % trace for trace in traces]
|
||||
with open('.gitignore', 'w') as out_file:
|
||||
out_file.write('\n'.join(sorted(ignores)))
|
||||
return True
|
||||
|
||||
|
||||
def read_json(json_file):
|
||||
with open(json_file) as map_file:
|
||||
return json.loads(map_file.read(), object_pairs_hook=reject_duplicate_keys)
|
||||
|
@ -386,9 +88,6 @@ def update_deps(trace_pairs):
|
|||
|
||||
def main():
|
||||
json_file = 'restricted_traces.json'
|
||||
gni_file = 'restricted_traces_autogen.gni'
|
||||
header_file = 'restricted_traces_autogen.h'
|
||||
source_file = 'restricted_traces_autogen.cpp'
|
||||
|
||||
json_data = read_json(json_file)
|
||||
if 'traces' not in json_data:
|
||||
|
@ -402,8 +101,9 @@ def main():
|
|||
inputs = [json_file]
|
||||
|
||||
# Note: we do not include DEPS in the list of outputs to simplify the integration.
|
||||
# Otherwise we'd continually need to regenerate on any roll.
|
||||
outputs = [gni_file, header_file, source_file, '.gitignore']
|
||||
# Otherwise we'd continually need to regenerate on any roll. We include .gitignore
|
||||
# in the outputs so we have a placeholder value.
|
||||
outputs = ['.gitignore']
|
||||
|
||||
if sys.argv[1] == 'inputs':
|
||||
print(','.join(inputs))
|
||||
|
@ -414,36 +114,6 @@ def main():
|
|||
return 1
|
||||
return 0
|
||||
|
||||
format_args = {
|
||||
'script_name': os.path.basename(__file__),
|
||||
'data_source_name': json_file,
|
||||
}
|
||||
|
||||
if not gen_gni(traces, gni_file, format_args):
|
||||
print('.gni file generation failed.')
|
||||
return 1
|
||||
|
||||
trace_infos = ['{"%s", {%s}}' % (trace, get_trace_info(trace)) for trace in traces]
|
||||
|
||||
no_json_traces = filter(lambda trace: not json_metadata_exists(trace), traces)
|
||||
includes = ['#include "%s"' % get_header_name(trace) for trace in no_json_traces]
|
||||
|
||||
format_args['filename'] = 'restricted_traces_autogen'
|
||||
format_args['num_traces'] = len(trace_infos)
|
||||
format_args['trace_includes'] = '\n'.join(includes)
|
||||
format_args['trace_infos'] = ',\n'.join(trace_infos)
|
||||
if not gen_header(header_file, format_args):
|
||||
print('.h file generation failed.')
|
||||
return 1
|
||||
|
||||
if not gen_source(source_file, format_args):
|
||||
print('.cpp file generation failed.')
|
||||
return 1
|
||||
|
||||
if not gen_git_ignore(traces):
|
||||
print('.gitignore file generation failed')
|
||||
return 1
|
||||
|
||||
if not update_deps(trace_pairs):
|
||||
print('DEPS file update failed')
|
||||
return 1
|
||||
|
|
|
@ -1,149 +0,0 @@
|
|||
// GENERATED FILE - DO NOT EDIT.
|
||||
// Generated by gen_restricted_traces.py using data from restricted_traces.json
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// restricted_traces_autogen: Types and enumerations for trace tests.
|
||||
|
||||
#include "restricted_traces_autogen.h"
|
||||
|
||||
#include "common/PackedEnums.h"
|
||||
#include "common/system_utils.h"
|
||||
|
||||
namespace trace_angle
|
||||
{
|
||||
namespace
|
||||
{
|
||||
constexpr size_t kNumTraces = 109;
|
||||
struct TracePair
|
||||
{
|
||||
const char name[kTraceInfoMaxNameLen];
|
||||
TraceInfo info;
|
||||
};
|
||||
constexpr TracePair kTraceInfos[kNumTraces] = {{"aliexpress", {}},
|
||||
{"among_us", {}},
|
||||
{"angry_birds_2_1500", {}},
|
||||
{"arena_of_valor", {}},
|
||||
{"asphalt_8", {}},
|
||||
{"avakin_life", {}},
|
||||
{"aztec_ruins", {}},
|
||||
{"badland", {}},
|
||||
{"beach_buggy_racing", {}},
|
||||
{"blockman_go", {}},
|
||||
{"brawl_stars", {}},
|
||||
{"bricks_breaker_quest", {}},
|
||||
{"bubble_shooter", {}},
|
||||
{"bus_simulator_indonesia", {}},
|
||||
{"call_break_offline_card_game", {}},
|
||||
{"candy_crush_500", {}},
|
||||
{"candy_crush_soda_saga", {}},
|
||||
{"car_parking_multiplayer", {}},
|
||||
{"clash_of_clans", {}},
|
||||
{"clash_royale", {}},
|
||||
{"cod_mobile", {}},
|
||||
{"coin_master", {}},
|
||||
{"command_and_conquer_rivals", {}},
|
||||
{"cookie_run_kingdom", {}},
|
||||
{"disney_tsum_tsum", {}},
|
||||
{"dr_driving", {}},
|
||||
{"dragon_ball_legends", {}},
|
||||
{"dragon_raja", {}},
|
||||
{"efootball_pes_2021", {}},
|
||||
{"egypt_1500", {}},
|
||||
{"eight_ball_pool", {}},
|
||||
{"extreme_car_driving_simulator", {}},
|
||||
{"fallout_shelter_online", {}},
|
||||
{"farm_heroes_saga", {}},
|
||||
{"fate_grand_order", {}},
|
||||
{"fifa_mobile", {}},
|
||||
{"final_fantasy", {}},
|
||||
{"free_fire", {}},
|
||||
{"gardenscapes", {}},
|
||||
{"genshin_impact", {}},
|
||||
{"google_maps", {}},
|
||||
{"happy_color", {}},
|
||||
{"hay_day", {}},
|
||||
{"hearthstone", {}},
|
||||
{"higgs_domino_island", {}},
|
||||
{"hill_climb_racing", {}},
|
||||
{"homescapes", {}},
|
||||
{"idle_heroes", {}},
|
||||
{"junes_journey", {}},
|
||||
{"kartrider_rush", {}},
|
||||
{"klondike_adventures", {}},
|
||||
{"league_of_legends_wild_rift", {}},
|
||||
{"lego_legacy", {}},
|
||||
{"lineage_m", {}},
|
||||
{"ludo_king", {}},
|
||||
{"magic_tiles_3", {}},
|
||||
{"manhattan_10", {}},
|
||||
{"manhattan_31", {}},
|
||||
{"mario_kart_tour", {}},
|
||||
{"marvel_contest_of_champions", {}},
|
||||
{"messenger_lite", {}},
|
||||
{"minecraft", {}},
|
||||
{"mini_world", {}},
|
||||
{"mobile_legends", {}},
|
||||
{"nba2k20_800", {}},
|
||||
{"nier_reincarnation", {}},
|
||||
{"one_punch_man", {}},
|
||||
{"plants_vs_zombies_2", {}},
|
||||
{"pokemon_go", {}},
|
||||
{"pokemon_unite", {}},
|
||||
{"professional_baseball_spirits", {}},
|
||||
{"pubg_mobile_battle_royale", {}},
|
||||
{"pubg_mobile_lite", {}},
|
||||
{"pubg_mobile_skydive", {}},
|
||||
{"ragnarok_m_eternal_love", {}},
|
||||
{"raid_shadow_legends", {}},
|
||||
{"real_commando_secret_mission", {}},
|
||||
{"real_cricket_20", {}},
|
||||
{"real_gangster_crime", {}},
|
||||
{"rise_of_kingdoms", {}},
|
||||
{"romancing_saga", {}},
|
||||
{"rope_hero_vice_town", {}},
|
||||
{"saint_seiya_awakening", {}},
|
||||
{"sakura_school_simulator", {}},
|
||||
{"scrabble_go", {}},
|
||||
{"shadow_fight_2", {}},
|
||||
{"slingshot_test1", {}},
|
||||
{"slingshot_test2", {}},
|
||||
{"sniper_3d", {}},
|
||||
{"sonic_the_hedgehog", {}},
|
||||
{"standoff_2", {}},
|
||||
{"subway_princess_runner", {}},
|
||||
{"subway_surfers", {}},
|
||||
{"summoners_war", {}},
|
||||
{"talking_tom_hero_dash", {}},
|
||||
{"temple_run_2", {}},
|
||||
{"temple_run_300", {}},
|
||||
{"toon_blast", {}},
|
||||
{"township", {}},
|
||||
{"trex_200", {}},
|
||||
{"whatsapp", {}},
|
||||
{"words_with_friends_2", {}},
|
||||
{"wordscapes", {}},
|
||||
{"world_cricket_championship_2", {}},
|
||||
{"world_of_kings", {}},
|
||||
{"world_of_tanks_blitz", {}},
|
||||
{"world_war_doh", {}},
|
||||
{"worms_zone_io", {}},
|
||||
{"zillow", {}}};
|
||||
} // namespace
|
||||
|
||||
const TraceInfo &GetTraceInfo(const char *traceName)
|
||||
{
|
||||
// Could be improved using std::lower_bound.
|
||||
for (const TracePair &tracePair : kTraceInfos)
|
||||
{
|
||||
if (strncmp(tracePair.name, traceName, kTraceInfoMaxNameLen) == 0)
|
||||
{
|
||||
return tracePair.info;
|
||||
}
|
||||
}
|
||||
UNREACHABLE();
|
||||
return kTraceInfos[0].info;
|
||||
}
|
||||
} // namespace trace_angle
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,61 +0,0 @@
|
|||
// GENERATED FILE - DO NOT EDIT.
|
||||
// Generated by gen_restricted_traces.py using data from restricted_traces.json
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// restricted_traces_autogen: Types and enumerations for trace tests.
|
||||
|
||||
#ifndef ANGLE_RESTRICTED_TRACES_AUTOGEN_H_
|
||||
#define ANGLE_RESTRICTED_TRACES_AUTOGEN_H_
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <KHR/khrplatform.h>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include "restricted_traces_export.h"
|
||||
|
||||
namespace trace_angle
|
||||
{
|
||||
using GenericProc = void (*)();
|
||||
using LoadProc = GenericProc(KHRONOS_APIENTRY *)(const char *);
|
||||
ANGLE_TRACE_LOADER_EXPORT void LoadEGL(LoadProc loadProc);
|
||||
ANGLE_TRACE_LOADER_EXPORT void LoadGLES(LoadProc loadProc);
|
||||
|
||||
static constexpr size_t kTraceInfoMaxNameLen = 128;
|
||||
|
||||
static constexpr uint32_t kDefaultReplayContextClientMajorVersion = 3;
|
||||
static constexpr uint32_t kDefaultReplayContextClientMinorVersion = 1;
|
||||
static constexpr uint32_t kDefaultReplayDrawSurfaceColorSpace = EGL_COLORSPACE_LINEAR;
|
||||
|
||||
struct TraceInfo
|
||||
{
|
||||
char name[kTraceInfoMaxNameLen];
|
||||
uint32_t contextClientMajorVersion;
|
||||
uint32_t contextClientMinorVersion;
|
||||
uint32_t frameEnd;
|
||||
uint32_t frameStart;
|
||||
uint32_t drawSurfaceWidth;
|
||||
uint32_t drawSurfaceHeight;
|
||||
uint32_t drawSurfaceColorSpace;
|
||||
uint32_t displayPlatformType;
|
||||
uint32_t displayDeviceType;
|
||||
int configRedBits;
|
||||
int configBlueBits;
|
||||
int configGreenBits;
|
||||
int configAlphaBits;
|
||||
int configDepthBits;
|
||||
int configStencilBits;
|
||||
bool isBinaryDataCompressed;
|
||||
bool areClientArraysEnabled;
|
||||
bool isBindGeneratesResourcesEnabled;
|
||||
bool isWebGLCompatibilityEnabled;
|
||||
bool isRobustResourceInitEnabled;
|
||||
};
|
||||
|
||||
ANGLE_TRACE_EXPORT const TraceInfo &GetTraceInfo(const char *traceName);
|
||||
} // namespace trace_angle
|
||||
|
||||
#endif // ANGLE_RESTRICTED_TRACES_AUTOGEN_H_
|
|
@ -37,4 +37,12 @@
|
|||
# endif
|
||||
#endif // !defined(ANGLE_TRACE_LOADER_EXPORT)
|
||||
|
||||
namespace trace_angle
|
||||
{
|
||||
using GenericProc = void (*)();
|
||||
using LoadProc = GenericProc(KHRONOS_APIENTRY *)(const char *);
|
||||
ANGLE_TRACE_LOADER_EXPORT void LoadEGL(LoadProc loadProc);
|
||||
ANGLE_TRACE_LOADER_EXPORT void LoadGLES(LoadProc loadProc);
|
||||
} // namespace trace_angle
|
||||
|
||||
#endif // ANGLE_RESTRICTED_TRACES_EXPORT_H_
|
||||
|
|
|
@ -20,29 +20,36 @@ import stat
|
|||
import subprocess
|
||||
import sys
|
||||
|
||||
from gen_restricted_traces import get_context as get_context
|
||||
from gen_restricted_traces import read_json as read_json
|
||||
|
||||
DEFAULT_TEST_SUITE = 'angle_perftests'
|
||||
DEFAULT_TEST_JSON = 'restricted_traces.json'
|
||||
DEFAULT_LOG_LEVEL = 'info'
|
||||
DEFAULT_BACKUP_FOLDER = 'retrace-backups'
|
||||
|
||||
# We preserve select metadata in the trace header that can't be re-captured properly.
|
||||
# Currently this is just the set of default framebuffer surface config bits.
|
||||
METADATA_KEYWORDS = ['kDefaultFramebuffer']
|
||||
|
||||
EXIT_SUCCESS = 0
|
||||
EXIT_FAILURE = 1
|
||||
|
||||
|
||||
def load_trace_json(trace):
|
||||
json_file_name = '%s/%s.json' % (trace, trace)
|
||||
return read_json(json_file_name)
|
||||
|
||||
|
||||
def get_context(trace, trace_path):
|
||||
"""Returns the trace context number."""
|
||||
json_data = load_trace_json(trace)
|
||||
return str(json_data['WindowSurfaceContextID'])
|
||||
|
||||
|
||||
def get_script_dir():
|
||||
return os.path.dirname(sys.argv[0])
|
||||
|
||||
|
||||
# TODO(jmadill): Remove after retrace. http://anglebug.com/5133
|
||||
def json_metadata_exists(trace):
|
||||
json_file_name = os.path.join(get_script_dir(), '%s/%s.json') % (trace, trace)
|
||||
return os.path.isfile(json_file_name)
|
||||
def context_header(trace, trace_path):
|
||||
context_id = get_context(trace, trace_path)
|
||||
header = '%s_context%s.h' % (trace, context_id)
|
||||
return os.path.join(trace_path, header)
|
||||
|
||||
|
||||
def load_json_metadata(trace):
|
||||
|
@ -55,41 +62,6 @@ def src_trace_path(trace):
|
|||
return os.path.join(get_script_dir(), trace)
|
||||
|
||||
|
||||
def context_header(trace, trace_path):
|
||||
context_id = get_context(trace_path)
|
||||
# TODO(jmadill): Remove after retrace. http://anglebug.com/5133
|
||||
for try_path_expr in ['%s_capture_context%s.h', '%s_context%s.h']:
|
||||
header = try_path_expr % (trace, context_id)
|
||||
try_path = os.path.join(trace_path, header)
|
||||
if os.path.isfile(try_path):
|
||||
return try_path
|
||||
logging.fatal('Could not find context header for %s' % trace)
|
||||
return None
|
||||
|
||||
|
||||
def get_num_frames(trace):
|
||||
if json_metadata_exists(trace):
|
||||
json_metadata = load_json_metadata(trace)
|
||||
if 'FrameEnd' in json_metadata:
|
||||
return int(json_metadata['FrameEnd'])
|
||||
|
||||
trace_path = src_trace_path(trace)
|
||||
|
||||
lo = 99999999
|
||||
hi = 0
|
||||
|
||||
for file in os.listdir(trace_path):
|
||||
match = re.match(r'.+_context\d_frame(\d+)\.cpp', file)
|
||||
if match:
|
||||
frame = int(match.group(1))
|
||||
if frame < lo:
|
||||
lo = frame
|
||||
if frame > hi:
|
||||
hi = frame
|
||||
|
||||
return hi - lo + 1
|
||||
|
||||
|
||||
def get_trace_metadata(trace):
|
||||
trace_path = src_trace_path(trace)
|
||||
header_file = context_header(trace, trace_path)
|
||||
|
@ -124,6 +96,11 @@ def replace_metadata(header_file, metadata):
|
|||
f.writelines(lines)
|
||||
|
||||
|
||||
def get_num_frames(json_data):
|
||||
metadata = json_data['TraceMetadata']
|
||||
return metadata['FrameEnd'] - metadata['FrameStart'] + 1
|
||||
|
||||
|
||||
def path_contains_header(path):
|
||||
for file in os.listdir(path):
|
||||
if fnmatch.fnmatch(file, '*.h'):
|
||||
|
@ -157,14 +134,6 @@ def backup_traces(args, traces):
|
|||
copy_trace_folder(trace_path, trace_backup_path)
|
||||
|
||||
|
||||
# TODO(jmadill): Remove this once migrated. http://anglebug.com/5133
|
||||
def run_code_generation():
|
||||
python_binary = 'py.exe' if os.name == 'nt' else 'python3'
|
||||
angle_dir = os.path.join(get_script_dir(), '..', '..', '..')
|
||||
gen_path = os.path.join(angle_dir, 'scripts', 'run_code_generation.py')
|
||||
subprocess.check_call([python_binary, gen_path])
|
||||
|
||||
|
||||
def restore_traces(args, traces):
|
||||
for trace in fnmatch.filter(traces, args.traces):
|
||||
trace_path = src_trace_path(trace)
|
||||
|
@ -173,13 +142,6 @@ def restore_traces(args, traces):
|
|||
logging.error('Trace folder not found at %s' % trace_backup_path)
|
||||
else:
|
||||
copy_trace_folder(trace_backup_path, trace_path)
|
||||
# TODO(jmadill): Remove this once migrated. http://anglebug.com/5133
|
||||
angle_dir = os.path.join(get_script_dir(), '..', '..', '..')
|
||||
json_path = os.path.join(angle_dir, 'scripts', 'code_generation_hashes',
|
||||
'restricted_traces.json')
|
||||
if os.path.exists(json_path):
|
||||
os.unlink(json_path)
|
||||
run_code_generation()
|
||||
|
||||
|
||||
def run_autoninja(args):
|
||||
|
@ -232,16 +194,12 @@ def upgrade_traces(args, traces):
|
|||
logging.info('Skipping "%s" because the out folder already exists' % trace)
|
||||
continue
|
||||
|
||||
num_frames = get_num_frames(trace)
|
||||
metadata = get_trace_metadata(trace)
|
||||
json_data = load_trace_json(trace)
|
||||
num_frames = get_num_frames(json_data)
|
||||
|
||||
metadata = json_data['TraceMetadata']
|
||||
logging.debug('Read metadata: %s' % str(metadata))
|
||||
|
||||
if json_metadata_exists(trace):
|
||||
json_metadata = load_json_metadata(trace)
|
||||
else:
|
||||
json_metadata = {}
|
||||
|
||||
max_steps = min(args.limit, num_frames) if args.limit else num_frames
|
||||
|
||||
# We start tracing from frame 2. --retrace-mode issues a Swap() after Setup() so we can
|
||||
|
@ -276,8 +234,6 @@ def upgrade_traces(args, traces):
|
|||
logging.error('There was a problem tracing "%s", could not find header file: %s' %
|
||||
(trace, header_file))
|
||||
failures += [trace]
|
||||
else:
|
||||
replace_metadata(header_file, metadata)
|
||||
except:
|
||||
logging.exception('There was an exception running "%s":' % trace)
|
||||
failures += [trace]
|
||||
|
@ -302,7 +258,8 @@ def validate_traces(args, traces):
|
|||
failures = []
|
||||
|
||||
for trace in fnmatch.filter(traces, args.traces):
|
||||
num_frames = get_num_frames(trace)
|
||||
json_data = load_trace_json(trace)
|
||||
num_frames = get_num_frames(json_data)
|
||||
max_steps = min(args.limit, num_frames) if args.limit else num_frames
|
||||
try:
|
||||
run_test_suite(args, trace, max_steps, additional_args, additional_env)
|
||||
|
|
Загрузка…
Ссылка в новой задаче