Hash :
78dde332
Author :
Date :
2021-03-29T17:31:52
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: Cody Northrop <cnorthrop@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
//
// 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);
}