Commit 78dde332 by Jamie Madill Committed by Commit Bot

Move restricted traces to CIPD.

All traces are now stored as DEPS entries in CIPD. The auto-generation script generates the DEPS entries. Note that we don't include DEPS in the list of generated outputs to simplify other rollers. Also we update auto-generation to include full sources list to allow 'gn analyze' to work successfully. Usees a trace fixture for common code. This will enable a more compact trace without as much repeated code. We must land a set of re-trace traces to avoid breakage. Also includes a python script for uploading new traces to CIPD. The script first checks if traces are already present in the cloud, and if so it skips the upload. It will take a while to complete as the number of traces grows larger as it takes a few seconds per trace. The traces in this patch are also re-traced to use the common fixture code instead of including duplicated code in each trace. They now form a simple common interface and the autogenerated cpp is now simply a list of properties. I've also updated the capture/replay tests to use the simpler common entry point integration. There is less auto-generated glue code now. We now use a new serialized string query extension instead of calling directly into ANGLE's internals. Also includes a docs update. The capture/replay sample is broken and we'll need to update it in a follow-up CL. Also includes a few necessary fixes to the retracing script. Bug: angleproject:5811 Change-Id: I977bc6dc56843c8966377fc445ae97e91e17319a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2797833 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarTim Van Patten <timvp@google.com>
parent f7019e45
......@@ -26,10 +26,6 @@ declare_args() {
# Link in system libGL, to work with apitrace. See doc/DebuggingTips.md.
angle_link_glx = false
# Defaults to capture building to $root_out_dir/angle_libs/with_capture.
# Switch on to build capture to $root_out_dir.
angle_with_capture_by_default = false
# Don't build extra (test, samples etc) for Windows UWP. We don't have
# infrastructure (e.g. windowing helper functions) in place to run them.
angle_build_all = !build_with_chromium && !angle_is_winuwp && angle_has_build
......@@ -1096,14 +1092,6 @@ angle_static_library("libGLESv2_static") {
public_deps = [ ":libANGLE" ]
}
angle_static_library("libGLESv2_with_capture_static") {
sources = libglesv2_sources
configs += [ ":debug_annotations_config" ]
public_configs += [ ":angle_static" ]
deps = [ ":includes" ]
public_deps = [ ":libANGLE_with_capture" ]
}
angle_shared_library("libGLESv1_CM") {
sources = libglesv1_cm_sources
output_name = "libGLESv1_CM${angle_libs_suffix}"
......@@ -1198,22 +1186,6 @@ angle_static_library("libEGL_static") {
]
}
angle_static_library("libEGL_with_capture_static") {
sources = libegl_sources
configs += [
":debug_annotations_config",
":library_name_config",
]
public_configs += [ ":angle_static" ]
deps = [
":includes",
":libGLESv2_with_capture_static",
]
}
# Convenience targets for some of the samples so they can be built
# with Chromium's toolchain.
angle_executable("angle_shader_translator") {
......
......@@ -12,6 +12,10 @@ declare_args() {
# Display mode for ANGLE vulkan display, could be 'simple' or 'headless', default is 'simple'.
angle_vulkan_display_mode = "simple"
# Defaults to capture building to $root_out_dir/angle_libs/with_capture.
# Switch on to build capture to $root_out_dir.
angle_with_capture_by_default = false
}
if (angle_has_build) {
......@@ -433,3 +437,80 @@ if (angle_standalone || build_with_chromium) {
}
}
}
# Used by a few targets that compile traces.
template("angle_trace_fixture") {
_config_name = target_name + "_config"
config(_config_name) {
include_dirs = [ "$angle_root/src/libANGLE/capture" ]
}
angle_source_set(target_name) {
testonly = true
defines = [ "ANGLE_REPLAY_IMPLEMENTATION" ]
suppressed_configs += [ "$angle_root:constructor_and_destructor_warnings" ]
sources = [
"$angle_root/src/libANGLE/capture/trace_fixture.cpp",
"$angle_root/src/libANGLE/capture/trace_fixture.h",
invoker.gl_header,
]
public_deps = [ "$angle_root:includes" ]
if (defined(invoker.public_deps)) {
public_deps += invoker.public_deps
}
include_dirs = [ "." ]
public_configs = [ ":${_config_name}" ]
if (defined(invoker.public_configs)) {
public_configs += invoker.public_configs
}
}
}
template("angle_trace") {
_trace_name = invoker.trace_name
_trace_dir = invoker.trace_dir
_trace_ctx = invoker.trace_ctx
_trace_prefix = "${_trace_dir}/${_trace_name}_capture_context${_trace_ctx}"
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
data = [ "${_trace_prefix}.angledata.gz" ]
defines = [ "ANGLE_REPLAY_IMPLEMENTATION" ]
suppressed_configs += [ "$angle_root:constructor_and_destructor_warnings" ]
deps = [
"$angle_root:includes",
invoker.fixture,
]
if (is_android) {
libs = [ "log" ]
}
# Disable optimization in the trace perf tests to avoid optimizing huge files.
if (!is_debug) {
suppressed_configs += [
"//build/config/compiler:afdo",
"//build/config/compiler:afdo_optimize_size",
"//build/config/compiler:default_optimization",
"//build/config/compiler/pgo:default_pgo_flags",
]
configs += [ "//build/config/compiler:no_optimize" ]
}
include_dirs = [ "." ]
if (defined(invoker.output_name)) {
output_name = invoker.output_name
}
}
angle_source_set(target_name + "_headers") {
sources = [ "${_trace_prefix}.h" ]
}
}
{
"src/tests/restricted_traces/.gitignore":
"4fbdf9f45b9a615c42005c39c14dd5a1",
"src/tests/restricted_traces/aliexpress.tar.gz.sha1":
"12f48ff0c4ca7980ea879c81b0c9518b",
"src/tests/restricted_traces/among_us.tar.gz.sha1":
"6fcc4409e6f23a59680c99bcdeb75889",
"src/tests/restricted_traces/angry_birds_2_1500.tar.gz.sha1":
"2b5d6505d6a8b6f3bbfbad2c8405a89d",
"src/tests/restricted_traces/arena_of_valor.tar.gz.sha1":
"b775f6c42b1a09065c9c19660fb82113",
"src/tests/restricted_traces/asphalt_8.tar.gz.sha1":
"83e8aa4663fa6130db0bff09fb915f36",
"src/tests/restricted_traces/avakin_life.tar.gz.sha1":
"371845cdb84fddc484fed2c857d3b9db",
"src/tests/restricted_traces/aztec_ruins.tar.gz.sha1":
"9d8fd6e9d0b31ab57241802466201de5",
"src/tests/restricted_traces/brawl_stars.tar.gz.sha1":
"8b1cf8ebd8a1099b4d298bb3b446e8bd",
"src/tests/restricted_traces/bus_simulator_indonesia.tar.gz.sha1":
"0d9c9de640f997cec3aee06f6a38de89",
"src/tests/restricted_traces/candy_crush_500.tar.gz.sha1":
"b0772c8cf2d3d49e49fea9fe7cff0446",
"src/tests/restricted_traces/car_parking_multiplayer.tar.gz.sha1":
"99f13305fcca8315a941f6c2efeeddf0",
"src/tests/restricted_traces/clash_of_clans.tar.gz.sha1":
"4e3190f8b3cdded405172d6ef1fa7fa3",
"src/tests/restricted_traces/clash_royale.tar.gz.sha1":
"5a2d06f461a43b7ca69ce8bbf1079aad",
"src/tests/restricted_traces/cod_mobile.tar.gz.sha1":
"80a697dd447e4aae4fefd3627f663c4f",
"src/tests/restricted_traces/coin_master.tar.gz.sha1":
"c40fb4ab22955e4713d52616cbe4975f",
"src/tests/restricted_traces/dragon_ball_legends.tar.gz.sha1":
"baabf75c08e7417bd2194e6d69bfce71",
"src/tests/restricted_traces/dragon_raja.tar.gz.sha1":
"3c111fe0d8a1ac4e121114c14f3cf581",
"src/tests/restricted_traces/efootball_pes_2021.tar.gz.sha1":
"3cea8bb2d5d9e3516e5e261f5cb96fa7",
"src/tests/restricted_traces/egypt_1500.tar.gz.sha1":
"0d569cbab0adf4df1027f671c65f7bff",
"src/tests/restricted_traces/eight_ball_pool.tar.gz.sha1":
"5826ab8ccdef774fbec4106ddef76720",
"src/tests/restricted_traces/extreme_car_driving_simulator.tar.gz.sha1":
"935f2d28778428e1c608d785f9a3664e",
"src/tests/restricted_traces/fallout_shelter_online.tar.gz.sha1":
"6f2784d375489b6d6f44092de1a859e0",
"src/tests/restricted_traces/fate_grand_order.tar.gz.sha1":
"091d008d6d38d2cc8a6d31e3be417063",
"src/tests/restricted_traces/fifa_mobile.tar.gz.sha1":
"18ceeeff6dab6ee56a5e110afaad9ecb",
"src/tests/restricted_traces/free_fire.tar.gz.sha1":
"a4e7aba54fb48524bb4f3022623bc7cd",
"fcc293bb10f2079d7b6844ed36e52973",
"src/tests/restricted_traces/gen_restricted_traces.py":
"e16f270a02d11ad334cdd43bdff8b068",
"src/tests/restricted_traces/google_maps.tar.gz.sha1":
"5d7001969619570e80e5a39b1ab8b0c4",
"src/tests/restricted_traces/happy_color.tar.gz.sha1":
"8d5a1a5a7814a7a5f4361c9d84379f96",
"src/tests/restricted_traces/hay_day.tar.gz.sha1":
"88f1d78502cf64f64e1c73228f9d5bd4",
"src/tests/restricted_traces/hearthstone.tar.gz.sha1":
"73fa97c4ab9be39017725c219666e908",
"src/tests/restricted_traces/hill_climb_racing.tar.gz.sha1":
"3026eeb93388fe35fa3e5e4eed95ef96",
"src/tests/restricted_traces/junes_journey.tar.gz.sha1":
"a7bd336ada3bf24c79b3e9529906fd60",
"src/tests/restricted_traces/kartrider_rush.tar.gz.sha1":
"c11aab56dcaba570a1993c1f8ebe4668",
"src/tests/restricted_traces/klondike_adventures.tar.gz.sha1":
"8f467e30dd52312c0a1c257d76db9589",
"src/tests/restricted_traces/league_of_legends_wild_rift.tar.gz.sha1":
"47a9b75ac925f68a51e51642f92c8a48",
"src/tests/restricted_traces/lego_legacy.tar.gz.sha1":
"543b6beed660d7206c2839c6811aa9f4",
"src/tests/restricted_traces/lineage_m.tar.gz.sha1":
"dff18018a646039b905aa1fc18900778",
"src/tests/restricted_traces/magic_tiles_3.tar.gz.sha1":
"e31a9dcfc1734a407d3f54183941f965",
"src/tests/restricted_traces/manhattan_10.tar.gz.sha1":
"f24ffb3d8150ea69b71df0e391af2fed",
"src/tests/restricted_traces/manhattan_31.tar.gz.sha1":
"12256b955ea6f318e99c8bcd8ab97d2d",
"src/tests/restricted_traces/marvel_contest_of_champions.tar.gz.sha1":
"80cf00c9a348c2ea95d538e9257375dd",
"src/tests/restricted_traces/messenger_lite.tar.gz.sha1":
"8972e27c2d12ff8d3ac8f5b8104d6b4c",
"src/tests/restricted_traces/minecraft.tar.gz.sha1":
"f9f4e3d480c83b03a1de55d63a04a207",
"src/tests/restricted_traces/mobile_legends.tar.gz.sha1":
"5da0b64ab06225a7e85b8a0bb8275b52",
"src/tests/restricted_traces/nba2k20_800.tar.gz.sha1":
"9a97bffd4c6c156a14308bb1c6f50a7e",
"src/tests/restricted_traces/one_punch_man.tar.gz.sha1":
"d7af01fd688a3cbbb9b7d58ed31620fb",
"src/tests/restricted_traces/plants_vs_zombies_2.tar.gz.sha1":
"fe1d7c220de5c5942195c0bc56267149",
"src/tests/restricted_traces/pubg_mobile_lite.tar.gz.sha1":
"6a77372489ee4b43639b684a39ab8d71",
"src/tests/restricted_traces/ragnarok_m_eternal_love.tar.gz.sha1":
"370d7d960100a8244fe0e811af65006b",
"src/tests/restricted_traces/raid_shadow_legends.tar.gz.sha1":
"18b0f7f021bd65340f25a70b79dd4789",
"src/tests/restricted_traces/real_commando_secret_mission.tar.gz.sha1":
"4b484dd9c53a79100ec13b6f1c86040d",
"src/tests/restricted_traces/real_cricket_20.tar.gz.sha1":
"c03e3ca87a7a992e39d664f7b16a22ca",
"src/tests/restricted_traces/real_gangster_crime.tar.gz.sha1":
"c85be329035a760edad673eb2ca7c3f1",
"754de0f59746bfa03aed9b48a6e7f022",
"src/tests/restricted_traces/restricted_traces.json":
"fe4b0321246ef9ac4243c0d5ed9553d0",
"4ab4ea5b9481598e22b784c3dbcbcf8f",
"src/tests/restricted_traces/restricted_traces_autogen.cpp":
"46620754f74076ee16756075fa16c9ca",
"4034774f7000737316706bc59dcc4b22",
"src/tests/restricted_traces/restricted_traces_autogen.gni":
"eff15c7c32bbab20ad5e211c99236bff",
"499249ac260a0e48555103770dbc86f4",
"src/tests/restricted_traces/restricted_traces_autogen.h":
"cfab65aadcb9090a90099538b5083bc5",
"src/tests/restricted_traces/rise_of_kingdoms.tar.gz.sha1":
"d4618f857c44f0dfa642ae3af8f161d9",
"src/tests/restricted_traces/romancing_saga.tar.gz.sha1":
"a46c4faab1651f5d87374c231c8dcea6",
"src/tests/restricted_traces/rope_hero_vice_town.tar.gz.sha1":
"ce79b6ef759e66cd3f08a54d4691eebd",
"src/tests/restricted_traces/saint_seiya_awakening.tar.gz.sha1":
"c9cde6bdfd9096a44d5f03d905a45a4f",
"src/tests/restricted_traces/shadow_fight_2.tar.gz.sha1":
"f8490221b74d0186b86a3d9e2b37b97d",
"src/tests/restricted_traces/sniper_3d.tar.gz.sha1":
"1901148bf50860b68778ffb077c72406",
"src/tests/restricted_traces/standoff_2.tar.gz.sha1":
"5ebf645e4ea83fc7da1baf6616742eeb",
"src/tests/restricted_traces/subway_surfers.tar.gz.sha1":
"647775e4cd6bc9969b69463c2ad99a39",
"src/tests/restricted_traces/talking_tom_hero_dash.tar.gz.sha1":
"e72092832f4642e7a2711820dcbc78e4",
"src/tests/restricted_traces/temple_run_2.tar.gz.sha1":
"6ba951f53dccc520995fc7cc17f86288",
"src/tests/restricted_traces/temple_run_300.tar.gz.sha1":
"0a08ce3df88cb358ccac3ac63ba04955",
"src/tests/restricted_traces/trex_200.tar.gz.sha1":
"c57dc6e28b1eaa1b3bb5dae54847966a",
"src/tests/restricted_traces/whatsapp.tar.gz.sha1":
"7d36415d9cb26cef1107f33eebb4726a",
"src/tests/restricted_traces/world_of_tanks_blitz.tar.gz.sha1":
"6cba9bb8542b71443f107952faddbe64",
"src/tests/restricted_traces/world_war_doh.tar.gz.sha1":
"ac16fcec4e9514e8b4cc952f91f37f60",
"src/tests/restricted_traces/worms_zone_io.tar.gz.sha1":
"d2a7f98823d8d9f6581fba94f041a9cc"
"9959abff09ddfebf648a3242f1a5e781"
}
\ No newline at end of file
......@@ -65,6 +65,7 @@ class Win32Library : public Library
{
if (!mModule)
{
fprintf(stderr, "Module was not loaded\n");
return nullptr;
}
......
//
// Copyright 2021 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.
//
// trace_fixture.cpp:
// Common code for the ANGLE trace replays.
//
#include "trace_fixture.h"
#include "angle_trace_gl.h"
namespace
{
void UpdateResourceMap(ResourceMap *resourceMap, GLuint id, GLsizei readBufferOffset)
{
GLuint returnedID;
memcpy(&returnedID, &gReadBuffer[readBufferOffset], sizeof(GLuint));
(*resourceMap)[id] = returnedID;
}
DecompressCallback gDecompressCallback;
const char *gBinaryDataDir = ".";
void LoadBinaryData(const char *fileName)
{
// TODO(b/179188489): Fix cross-module deallocation.
if (gBinaryData != nullptr)
{
delete[] gBinaryData;
}
char pathBuffer[1000] = {};
sprintf(pathBuffer, "%s/%s", gBinaryDataDir, fileName);
FILE *fp = fopen(pathBuffer, "rb");
if (fp == 0)
{
fprintf(stderr, "Error loading binary data file: %s\n", fileName);
return;
}
fseek(fp, 0, SEEK_END);
long size = ftell(fp);
fseek(fp, 0, SEEK_SET);
if (gDecompressCallback)
{
if (!strstr(fileName, ".gz"))
{
fprintf(stderr, "Filename does not end in .gz");
exit(1);
}
std::vector<uint8_t> compressedData(size);
(void)fread(compressedData.data(), 1, size, fp);
gBinaryData = gDecompressCallback(compressedData);
}
else
{
if (!strstr(fileName, ".angledata"))
{
fprintf(stderr, "Filename does not end in .angledata");
exit(1);
}
gBinaryData = new uint8_t[size];
(void)fread(gBinaryData, 1, size, fp);
}
fclose(fp);
}
} // namespace
LocationsMap gUniformLocations;
BlockIndexesMap gUniformBlockIndexes;
GLuint gCurrentProgram = 0;
void UpdateUniformLocation(GLuint program, const char *name, GLint location)
{
gUniformLocations[program][location] = glGetUniformLocation(program, name);
}
void DeleteUniformLocations(GLuint program)
{
gUniformLocations.erase(program);
}
void UpdateUniformBlockIndex(GLuint program, const char *name, GLuint index)
{
gUniformBlockIndexes[program][index] = glGetUniformBlockIndex(program, name);
}
void UpdateCurrentProgram(GLuint program)
{
gCurrentProgram = program;
}
uint8_t *gBinaryData;
uint8_t *gReadBuffer;
uint8_t *gClientArrays[kMaxClientArrays];
ResourceMap gBufferMap;
ResourceMap gFenceNVMap;
ResourceMap gFramebufferMap;
ResourceMap gMemoryObjectMap;
ResourceMap gProgramPipelineMap;
ResourceMap gQueryMap;
ResourceMap gRenderbufferMap;
ResourceMap gSamplerMap;
ResourceMap gSemaphoreMap;
ResourceMap gShaderProgramMap;
ResourceMap gTextureMap;
ResourceMap gTransformFeedbackMap;
ResourceMap gVertexArrayMap;
SyncResourceMap gSyncMap;
void SetBinaryDataDecompressCallback(DecompressCallback callback)
{
gDecompressCallback = callback;
}
void SetBinaryDataDir(const char *dataDir)
{
gBinaryDataDir = dataDir;
}
void InitializeReplay(const char *binaryDataFileName,
size_t maxClientArraySize,
size_t readBufferSize)
{
LoadBinaryData(binaryDataFileName);
for (uint8_t *&clientArray : gClientArrays)
{
clientArray = new uint8_t[maxClientArraySize];
}
gReadBuffer = new uint8_t[readBufferSize];
}
void FinishReplay()
{
for (uint8_t *&clientArray : gClientArrays)
{
delete[] clientArray;
}
delete[] gReadBuffer;
}
void UpdateClientArrayPointer(int arrayIndex, const void *data, uint64_t size)
{
memcpy(gClientArrays[arrayIndex], data, static_cast<size_t>(size));
}
BufferHandleMap gMappedBufferData;
void UpdateClientBufferData(GLuint bufferID, const void *source, GLsizei size)
{
memcpy(gMappedBufferData[gBufferMap[bufferID]], source, size);
}
void UpdateBufferID(GLuint id, GLsizei readBufferOffset)
{
UpdateResourceMap(&gBufferMap, id, readBufferOffset);
}
void UpdateFenceNVID(GLuint id, GLsizei readBufferOffset)
{
UpdateResourceMap(&gFenceNVMap, id, readBufferOffset);
}
void UpdateFramebufferID(GLuint id, GLsizei readBufferOffset)
{
UpdateResourceMap(&gFramebufferMap, id, readBufferOffset);
}
void UpdateMemoryObjectID(GLuint id, GLsizei readBufferOffset)
{
UpdateResourceMap(&gMemoryObjectMap, id, readBufferOffset);
}
void UpdateProgramPipelineID(GLuint id, GLsizei readBufferOffset)
{
UpdateResourceMap(&gProgramPipelineMap, id, readBufferOffset);
}
void UpdateQueryID(GLuint id, GLsizei readBufferOffset)
{
UpdateResourceMap(&gQueryMap, id, readBufferOffset);
}
void UpdateRenderbufferID(GLuint id, GLsizei readBufferOffset)
{
UpdateResourceMap(&gRenderbufferMap, id, readBufferOffset);
}
void UpdateSamplerID(GLuint id, GLsizei readBufferOffset)
{
UpdateResourceMap(&gSamplerMap, id, readBufferOffset);
}
void UpdateSemaphoreID(GLuint id, GLsizei readBufferOffset)
{
UpdateResourceMap(&gSemaphoreMap, id, readBufferOffset);
}
void UpdateShaderProgramID(GLuint id, GLsizei readBufferOffset)
{
UpdateResourceMap(&gShaderProgramMap, id, readBufferOffset);
}
void UpdateTextureID(GLuint id, GLsizei readBufferOffset)
{
UpdateResourceMap(&gTextureMap, id, readBufferOffset);
}
void UpdateTransformFeedbackID(GLuint id, GLsizei readBufferOffset)
{
UpdateResourceMap(&gTransformFeedbackMap, id, readBufferOffset);
}
void UpdateVertexArrayID(GLuint id, GLsizei readBufferOffset)
{
UpdateResourceMap(&gVertexArrayMap, id, readBufferOffset);
}
//
// Copyright 2021 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.
//
// trace_fixture.h:
// Common code for the ANGLE trace replays.
//
#ifndef ANGLE_TRACE_FIXTURE_H_
#define ANGLE_TRACE_FIXTURE_H_
#include <EGL/egl.h>
#include "angle_gl.h"
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <limits>
#include <unordered_map>
#include <vector>
#if !defined(ANGLE_REPLAY_EXPORT)
# if defined(_WIN32)
# if defined(ANGLE_REPLAY_IMPLEMENTATION)
# define ANGLE_REPLAY_EXPORT __declspec(dllexport)
# else
# define ANGLE_REPLAY_EXPORT __declspec(dllimport)
# endif
# elif defined(__GNUC__)
# define ANGLE_REPLAY_EXPORT __attribute__((visibility("default")))
# else
# define ANGLE_REPLAY_EXPORT
# endif
#endif // !defined(ANGLE_REPLAY_EXPORT)
using DecompressCallback = uint8_t *(*)(const std::vector<uint8_t> &);
extern "C" {
ANGLE_REPLAY_EXPORT void SetBinaryDataDecompressCallback(DecompressCallback callback);
ANGLE_REPLAY_EXPORT void SetBinaryDataDir(const char *dataDir);
ANGLE_REPLAY_EXPORT void SetupReplay();
ANGLE_REPLAY_EXPORT void ReplayFrame(uint32_t frameIndex);
ANGLE_REPLAY_EXPORT void ResetReplay();
ANGLE_REPLAY_EXPORT void FinishReplay();
// Only defined if serialization is enabled.
ANGLE_REPLAY_EXPORT const char *GetSerializedContextState(uint32_t frameIndex);
} // extern "C"
// Maps from <captured Program ID, captured location> to run-time location.
using LocationsMap = std::unordered_map<GLuint, std::unordered_map<GLint, GLint>>;
extern LocationsMap gUniformLocations;
using BlockIndexesMap = std::unordered_map<GLuint, std::unordered_map<GLuint, GLuint>>;
extern BlockIndexesMap gUniformBlockIndexes;
extern GLuint gCurrentProgram;
void UpdateUniformLocation(GLuint program, const char *name, GLint location);
void DeleteUniformLocations(GLuint program);
void UpdateUniformBlockIndex(GLuint program, const char *name, GLuint index);
void UpdateCurrentProgram(GLuint program);
// Maps from captured Resource ID to run-time Resource ID.
class ResourceMap
{
public:
ResourceMap() {}
GLuint &operator[](GLuint index)
{
if (mIDs.size() <= static_cast<size_t>(index))
mIDs.resize(index + 1, 0);
return mIDs[index];
}
private:
std::vector<GLuint> mIDs;
};
void InitializeReplay(const char *binaryDataFileName,
size_t maxClientArraySize,
size_t readBufferSize);
// Global state
constexpr size_t kMaxClientArrays = 16;
extern uint8_t *gBinaryData;
extern uint8_t *gReadBuffer;
extern uint8_t *gClientArrays[kMaxClientArrays];
extern ResourceMap gBufferMap;
extern ResourceMap gFenceNVMap;
extern ResourceMap gFramebufferMap;
extern ResourceMap gMemoryObjectMap;
extern ResourceMap gProgramPipelineMap;
extern ResourceMap gQueryMap;
extern ResourceMap gRenderbufferMap;
extern ResourceMap gSamplerMap;
extern ResourceMap gSemaphoreMap;
extern ResourceMap gShaderProgramMap;
extern ResourceMap gTextureMap;
extern ResourceMap gTransformFeedbackMap;
extern ResourceMap gVertexArrayMap;
using SyncResourceMap = std::unordered_map<uintptr_t, GLsync>;
extern SyncResourceMap gSyncMap;
void UpdateClientArrayPointer(int arrayIndex, const void *data, uint64_t size);
using BufferHandleMap = std::unordered_map<GLuint, void *>;
extern BufferHandleMap gMappedBufferData;
void UpdateClientBufferData(GLuint bufferID, const void *source, GLsizei size);
void UpdateBufferID(GLuint id, GLsizei readBufferOffset);
void UpdateFenceNVID(GLuint id, GLsizei readBufferOffset);
void UpdateFramebufferID(GLuint id, GLsizei readBufferOffset);
void UpdateMemoryObjectID(GLuint id, GLsizei readBufferOffset);
void UpdateProgramPipelineID(GLuint id, GLsizei readBufferOffset);
void UpdateQueryID(GLuint id, GLsizei readBufferOffset);
void UpdateRenderbufferID(GLuint id, GLsizei readBufferOffset);
void UpdateSamplerID(GLuint id, GLsizei readBufferOffset);
void UpdateSemaphoreID(GLuint id, GLsizei readBufferOffset);
void UpdateShaderProgramID(GLuint id, GLsizei readBufferOffset);
void UpdateTextureID(GLuint id, GLsizei readBufferOffset);
void UpdateTransformFeedbackID(GLuint id, GLsizei readBufferOffset);
void UpdateVertexArrayID(GLuint id, GLsizei readBufferOffset);
#endif // ANGLE_TRACE_FIXTURE_H_
trace*/
angle_trace_gl.h
results.txt
\ No newline at end of file
......@@ -15,38 +15,62 @@ declare_args() {
}
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]
fixture = ":angle_capture_replay_tests_fixture"
output_name = _trace
}
_traces += [ ":${_target}" ]
}
angle_executable("capture_replay_tests") {
testonly = true
_trace_folder_relative_path = "./" + angle_capture_replay_test_trace_dir
_trace_sources =
generated_sources + [
"CompositeTests${angle_capture_replay_composite_file_id}.h",
"CompositeTests${angle_capture_replay_composite_file_id}.cpp",
]
sources = rebase_path(_trace_sources, ".", _trace_folder_relative_path) +
[ "CaptureReplayTests.cpp" ]
deps = [
"$angle_root:angle_common",
"$angle_root:angle_compression",
"$angle_root:libEGL_with_capture_static",
"$angle_root/util:angle_util_static",
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 = []
suppressed_configs += [ "$angle_root:constructor_and_destructor_warnings" ]
# Disable optimization to avoid optimizing huge files.
if (!is_debug) {
suppressed_configs += [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:no_optimize" ]
}
_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}\"",
......
......@@ -7,9 +7,8 @@
// Application that runs replay for testing of capture replay
//
#include "common/debug.h"
#include "common/system_utils.h"
#include "libANGLE/Context.h"
#include "libANGLE/capture/frame_capture_utils.h"
#include "util/EGLPlatformParameters.h"
#include "util/EGLWindow.h"
#include "util/OSWindow.h"
......@@ -93,6 +92,10 @@ class CaptureReplayTests
cleanupTest();
return false;
}
// Load trace
mTraceLibrary.reset(new angle::TraceLibrary(testTraceInfo.testName.c_str()));
// Set CWD to executable directory.
std::string exeDir = angle::GetExecutableDirectory();
if (!angle::SetCWD(exeDir.c_str()))
......@@ -102,16 +105,17 @@ class CaptureReplayTests
}
if (testTraceInfo.isBinaryDataCompressed)
{
SetBinaryDataDecompressCallback(testIndex, angle::DecompressBinaryData);
mTraceLibrary->setBinaryDataDecompressCallback(angle::DecompressBinaryData);
}
SetBinaryDataDir(testIndex, ANGLE_CAPTURE_REPLAY_TEST_DATA_DIR);
mTraceLibrary->setBinaryDataDir(ANGLE_CAPTURE_REPLAY_TEST_DATA_DIR);
SetupContextReplay(testIndex);
mTraceLibrary->setupReplay();
return true;
}
void cleanupTest()
{
mTraceLibrary.reset(nullptr);
mEGLWindow->destroyGL();
mOSWindow->destroy();
}
......@@ -128,17 +132,11 @@ class CaptureReplayTests
for (uint32_t frame = testTraceInfo.replayFrameStart; frame <= testTraceInfo.replayFrameEnd;
frame++)
{
ReplayContextFrame(testIndex, frame);
gl::Context *context = static_cast<gl::Context *>(mEGLWindow->getContext());
std::string serializedContextString;
if (angle::SerializeContextToString(context, &serializedContextString) !=
angle::Result::Continue)
{
cleanupTest();
return -1;
}
mTraceLibrary->replayFrame(frame);
const GLubyte *bytes = glGetString(GL_SERIALIZED_CONTEXT_STRING_ANGLE);
bool isEqual =
compareSerializedContexts(testIndex, frame, serializedContextString.c_str());
compareSerializedContexts(testIndex, frame, reinterpret_cast<const char *>(bytes));
// Swap always to allow RenderDoc/other tools to capture frames.
swap();
if (!isEqual)
......@@ -167,7 +165,8 @@ class CaptureReplayTests
const char *replaySerializedContextState)
{
return !strcmp(replaySerializedContextState, GetSerializedContextState(testIndex, frame));
return !strcmp(replaySerializedContextState,
mTraceLibrary->getSerializedContextState(frame));
}
OSWindow *mOSWindow = nullptr;
......@@ -175,6 +174,7 @@ class CaptureReplayTests
EGLPlatformParameters mPlatformParams;
// Handle to the entry point binding library.
std::unique_ptr<angle::Library> mEntryPointsLib;
std::unique_ptr<angle::TraceLibrary> mTraceLibrary;
};
int main(int argc, char **argv)
......
#ifndef ANGLE_TRACE_GL_H_
#define ANGLE_TRACE_GL_H_
#include "trace_fixture.h"
#include "util/util_gl.h"
#endif // ANGLE_TRACE_GL_H_
......@@ -848,7 +848,10 @@ void ANGLERenderTest::step()
mOSWindow->messageLoop();
#if defined(ANGLE_ENABLE_ASSERTS)
EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
if (!gRetraceMode)
{
EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
}
#endif // defined(ANGLE_ENABLE_ASSERTS)
}
......@@ -899,7 +902,7 @@ void ANGLERenderTest::startTest() {}
void ANGLERenderTest::finishTest()
{
if (mTestParams.eglParameters.deviceType != EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE &&
!gNoFinish)
!gNoFinish && !gRetraceMode)
{
glFinish();
}
......
......@@ -25,7 +25,7 @@ double gTestTimeSeconds = 10.0;
int gTestTrials = 3;
bool gNoFinish = false;
bool gEnableAllTraceTests = false;
bool gStartTraceAfterSetup = false;
bool gRetraceMode = false;
// Default to three warmup loops. There's no science to this. More than two loops was experimentally
// helpful on a Windows NVIDIA setup when testing with Vulkan and native trace tests.
......@@ -141,9 +141,9 @@ void ANGLEProcessPerfTestArgs(int *argc, char **argv)
{
gEnableAllTraceTests = true;
}
else if (strcmp("--start-trace-after-setup", argv[argIndex]) == 0)
else if (strcmp("--retrace-mode", argv[argIndex]) == 0)
{
gStartTraceAfterSetup = true;
gRetraceMode = true;
}
else
{
......
......@@ -27,7 +27,7 @@ extern double gTestTimeSeconds;
extern int gTestTrials;
extern bool gNoFinish;
extern bool gEnableAllTraceTests;
extern bool gStartTraceAfterSetup;
extern bool gRetraceMode;
inline bool OneFrame()
{
......
......@@ -129,6 +129,7 @@ class TracePerfTest : public ANGLERenderTest, public ::testing::WithParamInterfa
uint32_t mCurrentFrame = 0;
uint32_t mOffscreenFrameCount = 0;
bool mScreenshotSaved = false;
std::unique_ptr<TraceLibrary> mTraceLibrary;
};
class TracePerfTest;
......@@ -502,10 +503,16 @@ TracePerfTest::TracePerfTest()
void TracePerfTest::initializeBenchmark()
{
const auto &params = GetParam();
const auto &params = GetParam();
const TraceInfo &traceInfo = GetTraceInfo(params.testID);
mStartingDirectory = angle::GetCWD().value();
std::stringstream traceNameStr;
traceNameStr << "angle_restricted_trace_" << traceInfo.name;
std::string traceName = traceNameStr.str();
mTraceLibrary.reset(new TraceLibrary(traceName.c_str()));
// To load the trace data path correctly we set the CWD to the executable dir.
if (!IsAndroid())
{
......@@ -515,10 +522,16 @@ void TracePerfTest::initializeBenchmark()
trace_angle::LoadGLES(TraceLoadProc);
const TraceInfo &traceInfo = GetTraceInfo(params.testID);
mStartFrame = traceInfo.startFrame;
mEndFrame = traceInfo.endFrame;
SetBinaryDataDecompressCallback(params.testID, DecompressBinaryData);
if (!mTraceLibrary->valid())
{
ERR() << "Could not load trace library.";
mSkipTest = true;
return;
}
mStartFrame = traceInfo.startFrame;
mEndFrame = traceInfo.endFrame;
mTraceLibrary->setBinaryDataDecompressCallback(DecompressBinaryData);
std::string relativeTestDataDir = std::string("src/tests/restricted_traces/") + traceInfo.name;
......@@ -528,9 +541,10 @@ void TracePerfTest::initializeBenchmark()
{
ERR() << "Could not find test data folder.";
mSkipTest = true;
return;
}
SetBinaryDataDir(params.testID, testDataDir);
mTraceLibrary->setBinaryDataDir(testDataDir);
mWindowWidth = mTestParams.windowWidth;
mWindowHeight = mTestParams.windowHeight;
......@@ -575,7 +589,7 @@ void TracePerfTest::initializeBenchmark()
}
// Potentially slow. Can load a lot of resources.
SetupReplay(params.testID);
mTraceLibrary->setupReplay();
glFinish();
......@@ -586,7 +600,7 @@ void TracePerfTest::initializeBenchmark()
// If we're re-tracing, trigger capture start after setup. This ensures the Setup function gets
// recaptured into another Setup function and not merged with the first frame.
if (angle::gStartTraceAfterSetup)
if (angle::gRetraceMode)
{
angle::SetEnvironmentVar("ANGLE_CAPTURE_TRIGGER", "0");
getGLWindow()->swap();
......@@ -615,6 +629,9 @@ void TracePerfTest::destroyBenchmark()
mOffscreenFramebuffer = 0;
}
mTraceLibrary->finishReplay();
mTraceLibrary.reset(nullptr);
// In order for the next test to load, restore the working directory
angle::SetCWD(mStartingDirectory.c_str());
}
......@@ -669,7 +686,7 @@ void TracePerfTest::drawBenchmark()
beginInternalTraceEvent(frameName);
startGpuTimer();
ReplayFrame(params.testID, mCurrentFrame);
mTraceLibrary->replayFrame(mCurrentFrame);
stopGpuTimer();
if (params.surfaceType == SurfaceType::Offscreen)
......@@ -732,7 +749,7 @@ void TracePerfTest::drawBenchmark()
if (mCurrentFrame == mEndFrame)
{
ResetReplay(params.testID);
mTraceLibrary->resetReplay();
mCurrentFrame = mStartFrame;
}
else
......
aliexpress.tar.gz
aliexpress/
among_us.tar.gz
among_us/
angry_birds_2_1500.tar.gz
angry_birds_2_1500/
arena_of_valor.tar.gz
arena_of_valor/
asphalt_8.tar.gz
asphalt_8/
avakin_life.tar.gz
avakin_life/
aztec_ruins.tar.gz
aztec_ruins/
brawl_stars.tar.gz
brawl_stars/
bus_simulator_indonesia.tar.gz
bus_simulator_indonesia/
candy_crush_500.tar.gz
candy_crush_500/
car_parking_multiplayer.tar.gz
car_parking_multiplayer/
clash_of_clans.tar.gz
clash_of_clans/
clash_royale.tar.gz
clash_royale/
cod_mobile.tar.gz
cod_mobile/
coin_master.tar.gz
coin_master/
dragon_ball_legends.tar.gz
dragon_ball_legends/
dragon_raja.tar.gz
dragon_raja/
efootball_pes_2021.tar.gz
efootball_pes_2021/
egypt_1500.tar.gz
egypt_1500/
eight_ball_pool.tar.gz
eight_ball_pool/
extreme_car_driving_simulator.tar.gz
extreme_car_driving_simulator/
fallout_shelter_online.tar.gz
fallout_shelter_online/
fate_grand_order.tar.gz
fate_grand_order/
fifa_mobile.tar.gz
fifa_mobile/
free_fire.tar.gz
free_fire/
google_maps.tar.gz
google_maps/
happy_color.tar.gz
happy_color/
hay_day.tar.gz
hay_day/
hearthstone.tar.gz
hearthstone/
hill_climb_racing.tar.gz
hill_climb_racing/
junes_journey.tar.gz
junes_journey/
kartrider_rush.tar.gz
kartrider_rush/
klondike_adventures.tar.gz
klondike_adventures/
league_of_legends_wild_rift.tar.gz
league_of_legends_wild_rift/
lego_legacy.tar.gz
lego_legacy/
lineage_m.tar.gz
lineage_m/
magic_tiles_3.tar.gz
magic_tiles_3/
manhattan_10.tar.gz
manhattan_10/
manhattan_31.tar.gz
manhattan_31/
marvel_contest_of_champions.tar.gz
marvel_contest_of_champions/
messenger_lite.tar.gz
messenger_lite/
minecraft.tar.gz
minecraft/
mobile_legends.tar.gz
mobile_legends/
nba2k20_800.tar.gz
nba2k20_800/
one_punch_man.tar.gz
one_punch_man/
plants_vs_zombies_2.tar.gz
plants_vs_zombies_2/
pubg_mobile_lite.tar.gz
pubg_mobile_lite/
ragnarok_m_eternal_love.tar.gz
ragnarok_m_eternal_love/
raid_shadow_legends.tar.gz
raid_shadow_legends/
real_commando_secret_mission.tar.gz
real_commando_secret_mission/
real_cricket_20.tar.gz
real_cricket_20/
real_gangster_crime.tar.gz
real_gangster_crime/
rise_of_kingdoms.tar.gz
rise_of_kingdoms/
romancing_saga.tar.gz
romancing_saga/
rope_hero_vice_town.tar.gz
rope_hero_vice_town/
saint_seiya_awakening.tar.gz
saint_seiya_awakening/
shadow_fight_2.tar.gz
shadow_fight_2/
sniper_3d.tar.gz
sniper_3d/
standoff_2.tar.gz
standoff_2/
subway_surfers.tar.gz
subway_surfers/
talking_tom_hero_dash.tar.gz
talking_tom_hero_dash/
temple_run_2.tar.gz
temple_run_2/
temple_run_300.tar.gz
temple_run_300/
trex_200.tar.gz
trex_200/
whatsapp.tar.gz
whatsapp/
world_of_tanks_blitz.tar.gz
world_of_tanks_blitz/
world_war_doh.tar.gz
world_war_doh/
worms_zone_io.tar.gz
worms_zone_io/
\ No newline at end of file
......@@ -18,59 +18,31 @@ angle_shared_library("angle_restricted_trace_loader") {
deps = [ "$angle_root:includes" ]
}
angle_trace_fixture("angle_restricted_trace_fixture") {
gl_header = "angle_trace_gl.h"
public_deps = [ ":angle_restricted_trace_loader" ]
public_configs = [ "$angle_root:no_gl_prototypes" ]
}
# Imports "angle_restricted_traces"
import("restricted_traces_autogen.gni")
_traces = []
foreach(_test_info, angle_restricted_traces) {
# Empty out the "_test_and_ctx" list so GN doesn't complain about replacing non-empty list.
_test_and_ctx = []
_test_and_ctx = string_split(_test_info)
_test = _test_and_ctx[0]
_ctx = _test_and_ctx[1]
_test_dir = "${_test}"
_test_ctx = "${_test_dir}/${_test}_capture_context${_ctx}"
_target = "angle_restricted_trace_" + _test
_traces += [ ":$_target" ]
angle_shared_library(_target) {
testonly = true
# Similar to capture replay sample, use the file index for sources
sources = [ "angle_trace_gl.h" ] +
rebase_path(read_file("${_test_ctx}_files.txt", "list lines"),
".",
"${_test_dir}") +
[
"${_test_ctx}.cpp",
"${_test_ctx}.h",
]
configs += [ "$angle_root:no_gl_prototypes" ]
data = [ "${_test_dir}/${_test}_capture_context${_ctx}.angledata.gz" ]
defines = [ "ANGLE_REPLAY_IMPLEMENTATION" ]
inputs = [ "${_test}.tar.gz.sha1" ]
suppressed_configs += [ "$angle_root:constructor_and_destructor_warnings" ]
public_deps = [ ":angle_restricted_trace_loader" ]
deps = [ "$angle_root:includes" ]
if (is_android) {
libs = [ "log" ]
}
# Disable optimization in the trace perf tests to avoid optimizing huge files.
if (!is_debug) {
suppressed_configs += [
"//build/config/compiler:afdo",
"//build/config/compiler:afdo_optimize_size",
"//build/config/compiler:default_optimization",
"//build/config/compiler/pgo:default_pgo_flags",
]
configs += [ "//build/config/compiler:no_optimize" ]
}
include_dirs = [ "." ]
_trace_headers = []
foreach(_trace_data, angle_restricted_traces) {
_trace = _trace_data[0]
_target = "angle_restricted_trace_${_trace}"
angle_trace(_target) {
trace_name = _trace
trace_dir = _trace
trace_ctx = _trace_data[1]
sources = _trace_data[2]
fixture = ":angle_restricted_trace_fixture"
}
_traces += [ ":${_target}" ]
_trace_headers += [ ":${_target}_headers" ]
}
angle_shared_library("angle_restricted_traces") {
......@@ -81,13 +53,13 @@ angle_shared_library("angle_restricted_traces") {
"restricted_traces_autogen.h",
]
data = []
data_deps = _traces
defines = [ "ANGLE_TRACE_IMPLEMENTATION" ]
deps = [
"$angle_root:angle_common",
"$angle_root/util:angle_util",
] + _traces
] + _trace_headers
public_deps = [ ":angle_restricted_trace_loader" ]
}
......
......@@ -7,10 +7,9 @@ to share publicly.
## Accessing the traces
In order to compile and run with these, you must be granted access by Google,
then authenticate with the cloud with your @google account:
then authenticate with [CIPD](CIPD). Googlers, use your @google account.
```
download_from_google_storage --config
<enter 0 for the project ID>
cipd auth-login
```
Add the following to ANGLE's .gclient file:
```
......@@ -18,9 +17,9 @@ Add the following to ANGLE's .gclient file:
"checkout_angle_internal":"True"
},
```
Then use gclient to pull down binary files from a cloud storage bucket.
Then use gclient to pull down binary files from CIPD.
```
gclient runhooks
gclient sync -D
```
This should result in a number of directories created in `src/tests/restricted_traces` that contain
the trace files listed in [restricted_traces.json](restricted_traces.json):
......@@ -39,6 +38,8 @@ src/tests/restricted_traces/cod_mobile/
...
```
[CIPD]: https://chromium.googlesource.com/infra/luci/luci-go/+/master/cipd/README.md
## Building the trace tests
To build for Android, follow the steps in [DevSetupAndroid.md](../../../doc/DevSetupAndroid.md)
......@@ -60,7 +61,8 @@ Run them like so:
out/<config>/angle_perftests --gtest_filter=TracePerfTest*
```
# Adding new Android traces
# Capturing and adding new Android traces
Generally we want to use a Debug setup for recording new traces. That allows us to see asserts and
errors if the tracer needs to be improved.
Add the following GN arg to your Debug setup:
......@@ -73,6 +75,7 @@ After [building](../../../doc/DevSetupAndroid.md#building-angle-for-android) and
we're ready to start capturing.
## Determine the target app
We first need to identify which application we want to trace. That can generally be done by
looking at the web-based Play Store entry for your app. For instance, Angry Birds 2 is listed
here: https://play.google.com/store/apps/details?id=com.rovio.baba
......@@ -100,22 +103,27 @@ Track the package name for use in later steps:
```
export PACKAGE_NAME=com.rovio.baba
```
## Choose a trace label
Next, we need to chose a label for the trace. This is a style based choice, but we want to choose
something simple that identifies the app, then use snake case. This will end up being the name of
the trace, including the directory it is written to. Changing this value later is possible, but
tedious, since it will appear in all source files for the trace:
## Choose a trace name
Next, we need to chose a name for the trace. Choose something simple that identifies the app, then use snake
case. This will be the name of the trace files, including the trace directory. Changing this value later is possible,
but not recommended.
```
export LABEL=angry_birds_2
```
## Opt the application into ANGLE
Next, opt the application into using your ANGLE with capture enabled by default:
```
adb shell settings put global angle_debug_package org.chromium.angle
adb shell settings put global angle_gl_driver_selection_pkgs $PACKAGE_NAME
adb shell settings put global angle_gl_driver_selection_values angle
```
## Set up some Capture/Replay properties
We also need to set some debug properties used by the tracer.
Ensure frame capture is enabled. This might be redundant, but ensure the property isn't set to
......@@ -138,13 +146,17 @@ require more. Use your discretion here:
```
adb shell setprop debug.angle.capture.trigger 10
```
## Create output location
We need to write out the trace file in a location accessible by the app. We use the app's data
storage on sdcard, but create a subfolder to isolate ANGLE's files:
```
adb shell mkdir -p /sdcard/Android/data/$PACKAGE_NAME/angle_capture
```
## Start the target app
From here, you can start the application. You should see logcat entries like the following,
indicating that we've succesfully turned on capturing:
```
......@@ -158,6 +170,7 @@ ANGLE : INFO: Disabling GL_NV_shader_noperspective_interpolation during captur
ANGLE : INFO: Limiting draw buffer count to 4 while FrameCapture enabled
```
## Trigger the capture
When you have reached the content in your application that you want to record, set the trigger
value to zero:
```
......@@ -172,7 +185,7 @@ the file system:
```
adb shell ls -la /sdcard/Android/data/$PACKAGE_NAME/angle_capture
```
Allow the app to run until the *angledata.gz” file is non-zero and no longer growing. The app
Allow the app to run until the `*angledata.gz` file is non-zero and no longer growing. The app
should continue rendering after that:
```
$ adb shell ls -s -w 1 /sdcard/Android/data/$PACKAGE_NAME/angle_capture
......@@ -195,17 +208,22 @@ $ adb shell ls -s -w 1 /sdcard/Android/data/$PACKAGE_NAME/angle_capture
Note, you may see multiple contexts captured in the output. When this happens, look at the size of
the files. The larger files should be the context you care about it. You should move or delete the
other context files.
## Pull the trace files
Next, we want to pull those files over to the host and run some scripts.
```
cd $CHROMIUM_SRC/third_party/angle/src/tests/restricted_traces
mkdir -p $LABEL
adb pull /sdcard/Android/data/$PACKAGE_NAME/angle_capture/. $LABEL/
```
## Add the new trace to our list
The list of traces is tracked in [restricted_traces.json](restricted_traces.json).
For simplicity, we use a tool called `jq` to update the list. This ensures we get them in
## Add the new trace to the JSON list
The list of traces is tracked in [restricted_traces.json](restricted_traces.json). Manually add your
new trace to this list. Use version "1" for the trace version.
You can also use a tool called `jq` to update the list. This ensures we get them in
alphabetical order with no duplicates. It can also be done by hand if you are unable to install it,
for some reason.
```
......@@ -213,16 +231,12 @@ sudo apt-get install jq
```
Then run the following command:
```
jq ".traces = (.traces + [\"$LABEL\"] | unique)" restricted_traces.json \ | sponge restricted_traces.json
```
## Generate a sha1
For local testing, we must first create an empty sha1. This is to satisfy GN dependencies elsewhere
in the build. It will be overwritten with a real value if/when you upload the trace to our cloud
bucket:
export $VERSION=1
jq ".traces = (.traces + [\"$LABEL $VERSION\"] | unique)" restricted_traces.json \ | sponge restricted_traces.json
```
touch ${LABEL}.tar.gz.sha1
```
## Autogen the wrappers
## Run code auto-generation
We use two scripts to update the test harness so it will compile and run the new trace:
```
python ./gen_restricted_traces.py
......@@ -243,31 +257,22 @@ $ git diff --stat
Note the absence of the traces themselves listed above. They are automatically .gitignored since
they won't be checked in directly to the repo.
## Upload to the cloud
Once you feel good about your trace, you can upload it to our collection of traces. Again, this
requires special access granted by Google.
## Upload your trace to CIPD
Once you feel good about your trace, you can upload it to our collection of traces. This can only
be done by Googlers with write access to the trace CIPD prefix. If you need write access contact
someone listed in the `OWNERS` file.
Starting from your ANGLE root directory:
```
cd src/tests/restricted_traces
upload_to_google_storage.py --bucket chrome-angle-capture-binaries --archive $LABEL
sync_restricted_traces_to_cipd.py
```
After uploading, the sha1 file you touched above will be populated.
## Upload your CL
Before you can submit, you'll need to re-run the last code generation script to track the new sha1:
```
cd ../../..
python ./scripts/run_code_generation.py
```
The additional diff to reflect the new sha1 should be quite small:
```
$ git diff --stat
scripts/code_generation_hashes/restricted_traces.json | 2 +-
src/tests/restricted_traces/angry_birds_2.tar.gz.sha1 | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
```
Add those to your CL and upload away!
Ensure your current working directory is up-to-date, and upload:
```
git cl upload
```
You're now ready to run your new trace on CI!
87342919c07138ba6195b6278057344ace5d3486
\ No newline at end of file
5746d4cfd3906da66a8b4c20f20b30028b22f93a
\ No newline at end of file
......@@ -11,4 +11,6 @@
#include "trace_egl_loader_autogen.h"
#include "trace_gles_loader_autogen.h"
#include "trace_fixture.h"
#endif // ANGLE_TRACE_GL_H_
0d203516903fbcb29bdce4a98872601e0bd2e997
\ No newline at end of file
f2434b91f61c891206bd8f7525a21e2af2f434a8
\ No newline at end of file
61d230cbbdf0b750b32b95922eaefe5fc4fd2de6
\ No newline at end of file
eeb22e4f17e63bc87a4adb31b53a13c2c11bf31d
\ No newline at end of file
e363a3fe0f4be16f9bccaed3be8fd125ded48027
\ No newline at end of file
069f4d8054c431d4eba80e4e29204199079f95e3
\ No newline at end of file
59e030badaf17d6ea7983df52755ea2ff96fdd77
\ No newline at end of file
afa47ce758fee454ff4d84e21e286d7b5d0d53d6
\ No newline at end of file
aea3942e06f350ab4fa1c6457bf2f8653002ba09
\ No newline at end of file
8c072335309ce5fafeec8e4903c514ae7092ced1
\ No newline at end of file
626688da1b196a57ed6cfbbf75fd3ec9ebee8e75
\ No newline at end of file
96eaf2dde096f479f5f484854edffbf839e7f93c
\ No newline at end of file
#!/usr/bin/python3
#
# 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.
#
# download_restricted_traces.py:
# download restricted traces and update their timestamp for build
import fnmatch
import json
import os
import subprocess
import sys
def reject_duplicate_keys(pairs):
found_keys = {}
for key, value in pairs:
if key in found_keys:
raise ValueError("duplicate key: %r" % (key,))
else:
found_keys[key] = value
return found_keys
def read_json(json_file):
with open(json_file) as map_file:
return json.loads(map_file.read(), object_pairs_hook=reject_duplicate_keys)
def run_command(command):
env = os.environ.copy()
env['PYTHONUNBUFFERED'] = '1'
with subprocess.Popen(
command, stdout=subprocess.PIPE, universal_newlines=True, env=env) as proc:
while proc.poll() is None:
out = proc.stdout.read(1)
sys.stdout.write(out)
sys.stdout.flush()
if proc.returncode:
raise subprocess.CalledProcessError(proc.returncode, command)
def main():
if (len(sys.argv) != 2):
print('Missing restricted traces directory')
return 1
trace_dir = sys.argv[1]
# issue download command
download_script = 'download_from_google_storage'
if os.name == 'nt':
download_script += '.bat'
cmd = [
download_script,
'--directory',
'--recursive',
'--extract',
'--num_threads=4',
'--bucket',
'chrome-angle-capture-binaries',
trace_dir,
]
run_command(cmd)
json_file = os.path.join(trace_dir, 'restricted_traces.json')
json_data = read_json(json_file)
if 'traces' not in json_data:
print('Trace data missing traces key.')
return 1
traces = json_data['traces']
for trace in traces:
for dirname, dirnames, filenames in os.walk(os.path.join(trace_dir, trace)):
# update timestamp on directory
os.utime(dirname, None)
# update timestamp on the files
for filename in filenames:
target = os.path.join(trace_dir, trace, filename)
os.utime(target, None)
return 0
if __name__ == '__main__':
sys.exit(main())
8a608ff7870e4da83da1a7d3399150cde9b80f17
\ No newline at end of file
559fcf0c657e9faf6b85ccac47fc5c6d8ac094d3
\ No newline at end of file
d7100142098ed239fbcf19bccb6f277a87032b8b
\ No newline at end of file
66b4629425ca87700e05a0ede32d417b0cf83e84
\ No newline at end of file
3640aa7efa16972968f4c5e71ddf76ea8d9681c2
\ No newline at end of file
00191b4920b79bd5a78d8fd70c00dd55db593718
\ No newline at end of file
e25e23c286d4d6791cdf0ca3e5f755abc9e846e7
\ No newline at end of file
18cf2315ad731cfce18901329f35319957e16dec
\ No newline at end of file
4d32f796e9c319d0584ec7f39f9318ad306fca05
\ No newline at end of file
......@@ -89,12 +89,6 @@ enum class RestrictedTraceID
{trace_ids}, InvalidEnum, EnumCount = InvalidEnum
}};
using ReplayFunc = void (*)(uint32_t);
using ResetFunc = void (*)();
using SetupFunc = void (*)();
using DecompressFunc = uint8_t *(*)(const std::vector<uint8_t> &);
using SetBinaryDataDirFunc = void (*)(const char *);
static constexpr size_t kTraceInfoMaxNameLen = 32;
static constexpr uint32_t kDefaultReplayContextClientMajorVersion = 3;
......@@ -111,14 +105,7 @@ struct TraceInfo
char name[kTraceInfoMaxNameLen];
}};
using DecompressCallback = uint8_t *(*)(const std::vector<uint8_t> &);
ANGLE_TRACE_EXPORT const TraceInfo &GetTraceInfo(RestrictedTraceID traceID);
ANGLE_TRACE_EXPORT void ReplayFrame(RestrictedTraceID traceID, uint32_t frameIndex);
ANGLE_TRACE_EXPORT void ResetReplay(RestrictedTraceID traceID);
ANGLE_TRACE_EXPORT void SetupReplay(RestrictedTraceID traceID);
ANGLE_TRACE_EXPORT void SetBinaryDataDir(RestrictedTraceID traceID, const char *dataDir);
ANGLE_TRACE_EXPORT void SetBinaryDataDecompressCallback(RestrictedTraceID traceID, DecompressCallback callback);
}} // namespace angle
#endif // ANGLE_RESTRICTED_TRACES_H_
......@@ -137,6 +124,7 @@ SOURCE_TEMPLATE = """\
#include "{filename}.h"
#include "common/PackedEnums.h"
#include "common/system_utils.h"
{trace_includes}
......@@ -153,100 +141,24 @@ const TraceInfo &GetTraceInfo(RestrictedTraceID traceID)
{{
return kTraceInfos[traceID];
}}
void ReplayFrame(RestrictedTraceID traceID, uint32_t frameIndex)
{{
switch (traceID)
{{
{replay_func_cases}
default:
fprintf(stderr, "Error in switch.\\n");
assert(0);
break;
}}
}}
void ResetReplay(RestrictedTraceID traceID)
{{
switch (traceID)
{{
{reset_func_cases}
default:
fprintf(stderr, "Error in switch.\\n");
assert(0);
break;
}}
}}
void SetupReplay(RestrictedTraceID traceID)
{{
switch (traceID)
{{
{setup_func_cases}
default:
fprintf(stderr, "Error in switch.\\n");
assert(0);
break;
}}
}}
void SetBinaryDataDir(RestrictedTraceID traceID, const char *dataDir)
{{
switch (traceID)
{{
{set_binary_data_dir_cases}
default:
fprintf(stderr, "Error in switch.\\n");
assert(0);
break;
}}
}}
void SetBinaryDataDecompressCallback(RestrictedTraceID traceID, DecompressCallback callback)
{{
switch (traceID)
{{
{decompress_callback_cases}
default:
fprintf(stderr, "Error in switch.\\n");
assert(0);
break;
}}
}}
}} // namespace angle
"""
INCLUDE_FILE_TEMPLATE = """\
// GENERATED FILE - DO NOT EDIT.
// Generated by ${script_name} using data from ${data_source_name}.
//
// Copyright 2019 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.
#pragma once
#include <cstdint>
#include <vector>
#if !defined(ANGLE_RESTRICTED_TRACE_EXPORT)
# if defined(_WIN32)
# if defined(ANGLE_RESTRICTED_TRACE_IMPLEMENTATION)
# define ANGLE_RESTRICTED_TRACE_EXPORT __declspec(dllexport)
# else
# define ANGLE_RESTRICTED_TRACE_EXPORT __declspec(dllimport)
# endif
# elif defined(__GNUC__)
# define ANGLE_RESTRICTED_TRACE_EXPORT __attribute__((visibility("default")))
# else
# define ANGLE_RESTRICTED_TRACE_EXPORT
# endif
#endif // !defined(ANGLE_RESTRICTED_TRACE_EXPORT)
namespace {namespace}
{{
{funcs}\
}} // namespace {namespace}
CIPD_TRACE_PREFIX = 'angle/traces'
DEPS_PATH = '../../../DEPS'
DEPS_START = '# === ANGLE Restricted Trace Generated Code Start ==='
DEPS_END = '# === ANGLE Restricted Trace Generated Code End ==='
DEPS_TEMPLATE = """\
'src/tests/restricted_traces/{trace}': {{
'packages': [
{{
'package': '{trace_prefix}/{trace}',
'version': 'version:{version}',
}},
],
'dep_type': 'cipd',
'condition': 'checkout_angle_internal',
}},
"""
......@@ -261,8 +173,17 @@ def reject_duplicate_keys(pairs):
def gen_gni(traces, gni_file, format_args):
format_args["test_list"] = ",\n".join(
['"%s %s"' % (trace, get_context(trace)) for trace in traces])
test_list = []
for trace in traces:
context = get_context(trace)
files = []
with open('%s/%s_capture_context%s_files.txt' % (trace, trace, context)) as f:
files = f.readlines()
f.close()
files = ['"%s/%s"' % (trace, file.strip()) for file in files]
test_list += ['["%s", %s, [%s]]' % (trace, context, ','.join(files))]
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)
......@@ -316,14 +237,6 @@ def get_context(trace):
return context
def get_cases(traces, function, args):
funcs = [
"case RestrictedTraceID::%s: %s::%s(%s); break;" % (trace, trace, function, args)
for trace in traces
]
return "\n".join(funcs)
def get_header_name(trace):
return "%s/%s_capture_context%s.h" % (trace, trace, get_context(trace))
......@@ -332,18 +245,6 @@ def get_source_name(trace):
return "%s/%s_capture_context%s.cpp" % (trace, trace, get_context(trace))
def get_sha1_name(trace):
return "%s.tar.gz.sha1" % trace
def get_cases_with_context(traces, function_start, function_end, args):
funcs = [
"case RestrictedTraceID::%s: %s::%s%s%s(%s); break;" %
(trace, trace, function_start, get_context(trace), function_end, args) for trace in traces
]
return "\n".join(funcs)
def gen_header(header_file, format_args):
header_data = HEADER_TEMPLATE.format(**format_args)
with open(header_file, "w") as out_file:
......@@ -359,7 +260,7 @@ def gen_source(source_file, format_args):
def gen_git_ignore(traces):
ignores = ['%s/' % trace for trace in traces] + ['%s.tar.gz' % trace for trace in traces]
ignores = ['%s/' % trace for trace in traces]
with open('.gitignore', 'w') as out_file:
out_file.write('\n'.join(sorted(ignores)))
return True
......@@ -370,6 +271,38 @@ def read_json(json_file):
return json.loads(map_file.read(), object_pairs_hook=reject_duplicate_keys)
def update_deps(trace_pairs):
# Generate substitution string
replacement = ""
for (trace, version) in trace_pairs:
sub = {'trace': trace, 'version': version, 'trace_prefix': CIPD_TRACE_PREFIX}
replacement += DEPS_TEMPLATE.format(**sub)
# Update DEPS to download CIPD dependencies
new_deps = ""
with open(DEPS_PATH) as f:
in_deps = False
for line in f:
if in_deps:
if DEPS_END in line:
new_deps += replacement
new_deps += line
in_deps = False
else:
if DEPS_START in line:
new_deps += line
in_deps = True
else:
new_deps += line
f.close()
with open(DEPS_PATH, 'w') as f:
f.write(new_deps)
f.close()
return True
def main():
json_file = 'restricted_traces.json'
gni_file = 'restricted_traces_autogen.gni'
......@@ -380,11 +313,15 @@ def main():
if 'traces' not in json_data:
print('Trace data missing traces key.')
return 1
traces = json_data['traces']
trace_pairs = [trace.split(' ') for trace in json_data['traces']]
traces = [trace_pair[0] for trace_pair in trace_pairs]
# auto_script parameters.
if len(sys.argv) > 1:
inputs = [json_file] + [get_sha1_name(trace) for trace in traces]
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']
if sys.argv[1] == 'inputs':
......@@ -414,13 +351,6 @@ def main():
format_args["trace_ids"] = ",\n".join(traces)
format_args["trace_includes"] = "\n".join(includes)
format_args["trace_infos"] = ",\n".join(trace_infos)
format_args["replay_func_cases"] = get_cases_with_context(traces, "ReplayContext", "Frame",
"frameIndex")
format_args["reset_func_cases"] = get_cases_with_context(traces, "ResetContext", "Replay", "")
format_args["setup_func_cases"] = get_cases_with_context(traces, "SetupContext", "Replay", "")
format_args["set_binary_data_dir_cases"] = get_cases(traces, "SetBinaryDataDir", "dataDir")
format_args["decompress_callback_cases"] = get_cases(traces, "SetBinaryDataDecompressCallback",
"callback")
if not gen_header(header_file, format_args):
print('.h file generation failed.')
return 1
......@@ -433,6 +363,10 @@ def main():
print('.gitignore file generation failed')
return 1
if not update_deps(trace_pairs):
print('DEPS file update failed')
return 1
return 0
......
b41428b6614769f8d32eac1a6350d91fe3c78105
\ No newline at end of file
187146487bf9b644b41763b63e24e4f80e491b3d
\ No newline at end of file
c9d6d3c2b5d19948f87152f234ba7315a4599eda
\ No newline at end of file
09fe5baf075a9a2a26b86f170d7f4dffceb544cd
\ No newline at end of file
55ec2ff4c6edb611f6d7e59320217b3baa21ba5a
\ No newline at end of file
824a47b0bc7eac79c03c9315a666ebc641cfc147
\ No newline at end of file
4565f1f2067e6bc80c247f222f818fcbebcccffc
\ No newline at end of file
fefa6bc72036d675f2703540f711bd7a877120b5
\ No newline at end of file
2761d929ab61e51bc28cf4f9fab60bc4a641a4d7
\ No newline at end of file
879a935c39e609d85122e0fb6240f5a90ef77c00
\ No newline at end of file
e26c86a225d7820b9419f53a930fe630e18d6178
\ No newline at end of file
c8e802bea85f4e8eacb3bb53e62c95feeb7830a7
\ No newline at end of file
d654e25bb600a5871329543b5a5ce96bb9803406
\ No newline at end of file
e4f4e73c2f27e3d504a7445e4308d148ca799569
\ No newline at end of file
dd5540ad7fb10d5345003f8a77eca4c2381eab02
\ No newline at end of file
57ff11166f556b3f34a3903d92a4f4b765627b5a
\ No newline at end of file
05faee9f2f6c4c898705bda6edf16526cb31f7e3
\ No newline at end of file
b2b8c0c9f0602f26b38e859da4e93474042b2a38
\ No newline at end of file
71782dacd5dc4bc0e58b30a77cd7d59a9d277084
\ No newline at end of file
e2db39e5a073c34a69986537684de2512ccb0602
\ No newline at end of file
8b688b150151d18facfbe5e42fbc51560d2e0127
\ No newline at end of file
86fcba6b18f882cb41f3544b8f8e109011af35d5
\ No newline at end of file
dbc9e93eb869b743f1f75c731405817ef6374cb8
\ No newline at end of file
10472ddea67f8b3179b3f5235666ccc1d8a7b8dd
\ No newline at end of file
e19aac74efb2ab406749a08ec4355d8071c7ccb3
\ No newline at end of file
9c4fd0b64f9a6b630b47ecdb95734e126d352315
\ No newline at end of file
......@@ -4,76 +4,77 @@
"Use of this source code is governed by a BSD-style license that can be",
"found in the LICENSE file.",
"",
"restricted_traces.json: List of restricted trace tests in ANGLE."
"restricted_traces.json: List of restricted trace tests in ANGLE.",
" The number to the right of the trace name is the trace version."
],
"traces": [
"aliexpress",
"among_us",
"angry_birds_2_1500",
"arena_of_valor",
"asphalt_8",
"avakin_life",
"aztec_ruins",
"brawl_stars",
"bus_simulator_indonesia",
"candy_crush_500",
"car_parking_multiplayer",
"clash_of_clans",
"clash_royale",
"cod_mobile",
"coin_master",
"dragon_ball_legends",
"dragon_raja",
"efootball_pes_2021",
"egypt_1500",
"eight_ball_pool",
"extreme_car_driving_simulator",
"fallout_shelter_online",
"fate_grand_order",
"fifa_mobile",
"free_fire",
"google_maps",
"happy_color",
"hay_day",
"hearthstone",
"hill_climb_racing",
"junes_journey",
"kartrider_rush",
"klondike_adventures",
"league_of_legends_wild_rift",
"lego_legacy",
"lineage_m",
"magic_tiles_3",
"manhattan_10",
"manhattan_31",
"marvel_contest_of_champions",
"messenger_lite",
"minecraft",
"mobile_legends",
"nba2k20_800",
"one_punch_man",
"plants_vs_zombies_2",
"pubg_mobile_lite",
"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",
"shadow_fight_2",
"sniper_3d",
"standoff_2",
"subway_surfers",
"talking_tom_hero_dash",
"temple_run_2",
"temple_run_300",
"trex_200",
"whatsapp",
"world_of_tanks_blitz",
"world_war_doh",
"worms_zone_io"
"aliexpress 1",
"among_us 1",
"angry_birds_2_1500 1",
"arena_of_valor 1",
"asphalt_8 1",
"avakin_life 1",
"aztec_ruins 1",
"brawl_stars 1",
"bus_simulator_indonesia 1",
"candy_crush_500 1",
"car_parking_multiplayer 1",
"clash_of_clans 1",
"clash_royale 1",
"cod_mobile 1",
"coin_master 1",
"dragon_ball_legends 1",
"dragon_raja 1",
"efootball_pes_2021 1",
"egypt_1500 1",
"eight_ball_pool 1",
"extreme_car_driving_simulator 1",
"fallout_shelter_online 1",
"fate_grand_order 1",
"fifa_mobile 1",
"free_fire 1",
"google_maps 1",
"happy_color 1",
"hay_day 1",
"hearthstone 1",
"hill_climb_racing 1",
"junes_journey 1",
"kartrider_rush 1",
"klondike_adventures 1",
"league_of_legends_wild_rift 1",
"lego_legacy 1",
"lineage_m 1",
"magic_tiles_3 1",
"manhattan_10 1",
"manhattan_31 1",
"marvel_contest_of_champions 1",
"messenger_lite 1",
"minecraft 1",
"mobile_legends 1",
"nba2k20_800 1",
"one_punch_man 1",
"plants_vs_zombies_2 1",
"pubg_mobile_lite 1",
"ragnarok_m_eternal_love 1",
"raid_shadow_legends 1",
"real_commando_secret_mission 1",
"real_cricket_20 1",
"real_gangster_crime 1",
"rise_of_kingdoms 1",
"romancing_saga 1",
"rope_hero_vice_town 1",
"saint_seiya_awakening 1",
"shadow_fight_2 1",
"sniper_3d 1",
"standoff_2 1",
"subway_surfers 1",
"talking_tom_hero_dash 1",
"temple_run_2 1",
"temple_run_300 1",
"trex_200 1",
"whatsapp 1",
"world_of_tanks_blitz 1",
"world_war_doh 1",
"worms_zone_io 1"
]
}
......@@ -126,12 +126,6 @@ enum class RestrictedTraceID
EnumCount = InvalidEnum
};
using ReplayFunc = void (*)(uint32_t);
using ResetFunc = void (*)();
using SetupFunc = void (*)();
using DecompressFunc = uint8_t *(*)(const std::vector<uint8_t> &);
using SetBinaryDataDirFunc = void (*)(const char *);
static constexpr size_t kTraceInfoMaxNameLen = 32;
static constexpr uint32_t kDefaultReplayContextClientMajorVersion = 3;
......@@ -148,15 +142,7 @@ struct TraceInfo
char name[kTraceInfoMaxNameLen];
};
using DecompressCallback = uint8_t *(*)(const std::vector<uint8_t> &);
ANGLE_TRACE_EXPORT const TraceInfo &GetTraceInfo(RestrictedTraceID traceID);
ANGLE_TRACE_EXPORT void ReplayFrame(RestrictedTraceID traceID, uint32_t frameIndex);
ANGLE_TRACE_EXPORT void ResetReplay(RestrictedTraceID traceID);
ANGLE_TRACE_EXPORT void SetupReplay(RestrictedTraceID traceID);
ANGLE_TRACE_EXPORT void SetBinaryDataDir(RestrictedTraceID traceID, const char *dataDir);
ANGLE_TRACE_EXPORT void SetBinaryDataDecompressCallback(RestrictedTraceID traceID,
DecompressCallback callback);
} // namespace angle
#endif // ANGLE_RESTRICTED_TRACES_H_
......@@ -114,7 +114,7 @@ def main():
with open(os.path.join(script_dir, DEFAULT_TEST_JSON)) as f:
traces = json.loads(f.read())
traces = traces['traces']
traces = [trace.split(' ')[0] for trace in traces['traces']]
binary = os.path.join(args.gn_path, DEFAULT_TEST_SUITE)
if os.name == 'nt':
......@@ -145,11 +145,8 @@ def main():
run_args = [
binary,
trace_filter,
'--no-warmup',
'--trials',
'1',
'--start-trace-after-setup',
'--steps',
'--retrace-mode',
'--max-steps-performed',
str(num_frames),
'--enable-all-trace-tests',
]
......
e53c0d9b2133f457b240cadd246947875f19d0fd
\ No newline at end of file
911351845ae57dbc20c435e4a639ffb946a75fb3
\ No newline at end of file
b6a7b80b8ee0bd084ff0399e515d0986d296217a
\ No newline at end of file
dbca9d334690dd372a7ea2c5a330ed4bfdfda8f4
\ No newline at end of file
fff620629e58e58866d6670f3083388cc44a9d2a
\ No newline at end of file
45c194cf5e0657030ff43aeb3fd43295367dc5cc
\ No newline at end of file
47fc42ec1b5667147ebd1fe3789fbf6d26a31b5d
\ No newline at end of file
b9f386dc76f152e612d60e987ff30cf4507897e6
\ No newline at end of file
#!/usr/bin/python3
#
# Copyright 2021 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.
#
# sync_restricted_traces_to_cipd.py:
# Ensures the restricted traces are uploaded to CIPD. Versions are encoded in
# restricted_traces.json. Requires access to the CIPD path to work.
import argparse
import logging
import json
import os
import platform
import subprocess
import sys
CIPD_PREFIX = 'angle/traces'
LOG_LEVEL = 'info'
JSON_PATH = 'restricted_traces.json'
SCRIPT_DIR = os.path.dirname(sys.argv[0])
def cipd(*args):
logging.debug('running cipd with args: %s', ' '.join(args))
exe = 'cipd.bat' if platform.system() == 'Windows' else 'cipd'
completed = subprocess.run([exe] + list(args), stderr=subprocess.STDOUT)
if completed.stdout:
logging.debug('cipd stdout:\n%s' % completed.stdout)
return completed.returncode
def main(args):
with open(os.path.join(SCRIPT_DIR, JSON_PATH)) as f:
traces = json.loads(f.read())
for trace_info in traces['traces']:
trace, trace_version = trace_info.split(' ')
trace_name = '%s/%s' % (args.prefix, trace)
# Determine if this version exists
if cipd('describe', trace_name, '-version', 'version:%s' % trace_version) == 0:
logging.info('%s version %s already present', (trace, trace_version))
continue
logging.info('%s version %s missing. calling create.' % (trace, trace_version))
trace_folder = os.path.join(SCRIPT_DIR, trace)
if cipd('create', '-name', trace_name, '-in', trace_folder, '-tag', 'version:%s' %
trace_version, '-log-level', args.log.lower(), '-install-mode', 'copy') != 0:
logging.error('%s version %s create failed' % (trace, trace_version))
return 1
return 0
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'-p', '--prefix', help='CIPD Prefix. Default: %s' % CIPD_PREFIX, default=CIPD_PREFIX)
parser.add_argument(
'-l', '--log', help='Logging level. Default: %s' % LOG_LEVEL, default=LOG_LEVEL)
args, extra_flags = parser.parse_known_args()
logging.basicConfig(level=args.log.upper())
sys.exit(main(args))
0c93ed0954f72f25adb0ae91c366947f9d08c77c
\ No newline at end of file
2120ca39c665298cebc34da8d5be303f929d7237
\ No newline at end of file
1a35ac066a09bd475031a976e6eb2459542f8023
\ No newline at end of file
6186110f03d595ee1260b0166e5760243970209d
\ No newline at end of file
a842cc143166f20e4d416c59583734e6a82fe634
\ No newline at end of file
9646d325e0821f97425234fdbdc9c0aecfd19183
\ No newline at end of file
9ed0f6a4ed93ca192637cce887e4ea0aa1d2e9c8
\ No newline at end of file
21e33c3db742ac7012ab7bf37283e43da61baf1f
\ No newline at end of file
......@@ -12,9 +12,12 @@
#include <iostream>
#include <memory>
#include <sstream>
#include <type_traits>
#include <vector>
#include "common/angleutils.h"
#include "common/system_utils.h"
#define USE_SYSTEM_ZLIB
#include "compression_utils_portable.h"
......@@ -47,6 +50,72 @@ inline uint8_t *DecompressBinaryData(const std::vector<uint8_t> &compressedData)
return uncompressedData.release();
}
using DecompressCallback = uint8_t *(*)(const std::vector<uint8_t> &);
using SetBinaryDataDecompressCallbackFunc = void (*)(DecompressCallback);
using SetBinaryDataDirFunc = void (*)(const char *);
using SetupReplayFunc = void (*)();
using ReplayFrameFunc = void (*)(uint32_t);
using ResetReplayFunc = void (*)();
using FinishReplayFunc = void (*)();
using GetSerializedContextStateFunc = const char *(*)(uint32_t);
class TraceLibrary
{
public:
TraceLibrary(const char *traceNameIn)
{
std::stringstream traceNameStr;
#if !defined(ANGLE_PLATFORM_WINDOWS)
traceNameStr << "lib";
#endif // !defined(ANGLE_PLATFORM_WINDOWS)
traceNameStr << traceNameIn;
std::string traceName = traceNameStr.str();
mTraceLibrary.reset(OpenSharedLibrary(traceName.c_str(), SearchType::ApplicationDir));
}
bool valid() const { return mTraceLibrary != nullptr; }
void setBinaryDataDir(const char *dataDir)
{
callFunc<SetBinaryDataDirFunc>("SetBinaryDataDir", dataDir);
}
void setBinaryDataDecompressCallback(DecompressCallback callback)
{
callFunc<SetBinaryDataDecompressCallbackFunc>("SetBinaryDataDecompressCallback", callback);
}
void replayFrame(uint32_t frameIndex) { callFunc<ReplayFrameFunc>("ReplayFrame", frameIndex); }
void setupReplay() { callFunc<SetupReplayFunc>("SetupReplay"); }
void resetReplay() { callFunc<ResetReplayFunc>("ResetReplay"); }
void finishReplay() { callFunc<FinishReplayFunc>("FinishReplay"); }
const char *getSerializedContextState(uint32_t frameIndex)
{
return callFunc<GetSerializedContextStateFunc>("GetSerializedContextState", frameIndex);
}
private:
template <typename FuncT, typename... ArgsT>
typename std::result_of<FuncT(ArgsT...)>::type callFunc(const char *funcName, ArgsT... args)
{
void *untypedFunc = mTraceLibrary->getSymbol(funcName);
if (!untypedFunc)
{
fprintf(stderr, "Error loading function: %s\n", funcName);
ASSERT(untypedFunc);
}
auto typedFunc = reinterpret_cast<FuncT>(untypedFunc);
return typedFunc(args...);
}
std::unique_ptr<Library> mTraceLibrary;
};
} // namespace angle
#endif // UTIL_FRAME_CAPTURE_TEST_UTILS_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment