зеркало из https://github.com/AvaloniaUI/angle.git
Trace Interpreter: Support Genshin Impact.
Includes a couple fixes: - parsing hexidecimal values instead of enums - support sharing strings and functions between modules - support 32-bit int pointers Bug: angleproject:7887 Change-Id: I6e20a64a862c45c17ccde78a58d6069d83b31867 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4135797 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
This commit is contained in:
Родитель
2c582dcb7b
Коммит
2c4de3a744
|
@ -1603,7 +1603,7 @@
|
|||
"args": [
|
||||
"--log=debug",
|
||||
"interpret",
|
||||
"among_us:manhattan_10:trex_200",
|
||||
"among_us:genshin_impact:manhattan_10:trex_200",
|
||||
"-L=2",
|
||||
"--show-test-stdout"
|
||||
],
|
||||
|
@ -2413,7 +2413,7 @@
|
|||
"args": [
|
||||
"--log=debug",
|
||||
"interpret",
|
||||
"among_us:manhattan_10:trex_200",
|
||||
"among_us:genshin_impact:manhattan_10:trex_200",
|
||||
"-L=2",
|
||||
"--show-test-stdout"
|
||||
],
|
||||
|
@ -4397,7 +4397,7 @@
|
|||
"args": [
|
||||
"--log=debug",
|
||||
"interpret",
|
||||
"among_us:manhattan_10:trex_200",
|
||||
"among_us:genshin_impact:manhattan_10:trex_200",
|
||||
"-L=2",
|
||||
"--show-test-stdout"
|
||||
],
|
||||
|
@ -5281,7 +5281,7 @@
|
|||
"args": [
|
||||
"--log=debug",
|
||||
"interpret",
|
||||
"among_us:manhattan_10:trex_200",
|
||||
"among_us:genshin_impact:manhattan_10:trex_200",
|
||||
"-L=2",
|
||||
"--show-test-stdout"
|
||||
],
|
||||
|
|
|
@ -759,7 +759,7 @@
|
|||
'args': [
|
||||
'--log=debug',
|
||||
'interpret',
|
||||
'among_us:manhattan_10:trex_200',
|
||||
'among_us:genshin_impact:manhattan_10:trex_200',
|
||||
'-L=2',
|
||||
'--show-test-stdout',
|
||||
],
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"infra/specs/angle.json":
|
||||
"40ceba904a16f0d182788f0d224860a0",
|
||||
"3ac8c901de32ab0f967b19dbc10c29aa",
|
||||
"infra/specs/generate_test_spec_json.py":
|
||||
"55db0ebf31449241041560f53752d3fb",
|
||||
"infra/specs/mixins.pyl":
|
||||
|
@ -8,7 +8,7 @@
|
|||
"infra/specs/test_suite_exceptions.pyl":
|
||||
"47f7e288f077652df8ecd85dc671c32b",
|
||||
"infra/specs/test_suites.pyl":
|
||||
"69169f28bf6473edeadd1cb6aaea56b0",
|
||||
"baec371e74566ee4864011d14a89dfbe",
|
||||
"infra/specs/variants.pyl":
|
||||
"8cfcaa99fa07ad2a2d5d14f220fd5037",
|
||||
"infra/specs/waterfalls.pyl":
|
||||
|
|
|
@ -339,8 +339,10 @@ def interpret_traces(args, traces):
|
|||
logging.debug('Using temporary path %s.' % out_path)
|
||||
if upgrade_single_trace(args, trace_binary, trace, out_path, False, True):
|
||||
if restore_single_trace(trace, out_path):
|
||||
if validate_single_trace(args, trace_binary, trace,
|
||||
['--trace-interpreter'], {}):
|
||||
validate_args = ['--trace-interpreter']
|
||||
if args.verbose:
|
||||
validate_args += ['--verbose-logging']
|
||||
if validate_single_trace(args, trace_binary, trace, validate_args, {}):
|
||||
logging.info('%s passed!' % trace)
|
||||
result = PASS
|
||||
finally:
|
||||
|
@ -600,6 +602,12 @@ def main():
|
|||
add_upgrade_args(interpret_parser)
|
||||
interpret_parser.add_argument(
|
||||
'--show-test-stdout', help='Log test output.', action='store_true', default=False)
|
||||
interpret_parser.add_argument(
|
||||
'-v',
|
||||
'--verbose',
|
||||
help='Verbose logging in the trace tests.',
|
||||
action='store_true',
|
||||
default=False)
|
||||
|
||||
get_min_reqs_parser = subparsers.add_parser(
|
||||
'get_min_reqs',
|
||||
|
|
|
@ -33,27 +33,35 @@ bool ShouldSkipFile(const std::string &file)
|
|||
class Parser : angle::NonCopyable
|
||||
{
|
||||
public:
|
||||
Parser(const std::string &stream, bool verboseLogging)
|
||||
: mStream(stream), mIndex(0), mVerboseLogging(verboseLogging)
|
||||
Parser(const std::string &stream,
|
||||
TraceFunctionMap &functionsIn,
|
||||
TraceStringMap &stringsIn,
|
||||
bool verboseLogging)
|
||||
: mStream(stream),
|
||||
mFunctions(functionsIn),
|
||||
mStrings(stringsIn),
|
||||
mIndex(0),
|
||||
mVerboseLogging(verboseLogging)
|
||||
{}
|
||||
|
||||
void getFunctionsAndStrings(TraceFunctionMap &functionsOut, TraceStringMap &stringsOut)
|
||||
void parse()
|
||||
{
|
||||
parse();
|
||||
for (auto &iter : mFunctions)
|
||||
while (mIndex < mStream.size())
|
||||
{
|
||||
std::string name = iter.first;
|
||||
TraceFunction &func = iter.second;
|
||||
functionsOut.emplace(std::move(name), std::move(func));
|
||||
if (peek() == '#' || peek() == '/')
|
||||
{
|
||||
skipLine();
|
||||
}
|
||||
else if (peek() == 'v')
|
||||
{
|
||||
ASSERT(check("void "));
|
||||
readFunction();
|
||||
}
|
||||
else
|
||||
{
|
||||
readMultilineString();
|
||||
}
|
||||
}
|
||||
mFunctions.clear();
|
||||
for (auto &iter : mStrings)
|
||||
{
|
||||
std::string name = iter.first;
|
||||
TraceString &traceStr = iter.second;
|
||||
stringsOut.emplace(std::move(name), std::move(traceStr));
|
||||
}
|
||||
mStrings.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -302,30 +310,10 @@ class Parser : angle::NonCopyable
|
|||
mFunctions[funcName] = std::move(func);
|
||||
}
|
||||
|
||||
void parse()
|
||||
{
|
||||
while (mIndex < mStream.size())
|
||||
{
|
||||
if (peek() == '#' || peek() == '/')
|
||||
{
|
||||
skipLine();
|
||||
}
|
||||
else if (peek() == 'v')
|
||||
{
|
||||
ASSERT(check("void "));
|
||||
readFunction();
|
||||
}
|
||||
else
|
||||
{
|
||||
readMultilineString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const std::string &mStream;
|
||||
TraceFunctionMap &mFunctions;
|
||||
TraceStringMap &mStrings;
|
||||
size_t mIndex;
|
||||
TraceFunctionMap mFunctions;
|
||||
TraceStringMap mStrings;
|
||||
bool mVerboseLogging = false;
|
||||
};
|
||||
|
||||
|
@ -412,7 +400,14 @@ void PackIntParameter(ParamBuffer ¶ms, ParamType paramType, const Token &tok
|
|||
else
|
||||
{
|
||||
ASSERT(isdigit(token[0]));
|
||||
value = static_cast<IntT>(atoi(token));
|
||||
if (token[0] == '0' && token[1] == 'x')
|
||||
{
|
||||
value = static_cast<IntT>(strtol(token, nullptr, 16));
|
||||
}
|
||||
else
|
||||
{
|
||||
value = static_cast<IntT>(atoi(token));
|
||||
}
|
||||
}
|
||||
|
||||
params.addUnnamedParam(paramType, value);
|
||||
|
@ -535,8 +530,8 @@ void TraceInterpreter::setupReplay()
|
|||
UNREACHABLE();
|
||||
}
|
||||
|
||||
Parser parser(fileData, mVerboseLogging);
|
||||
parser.getFunctionsAndStrings(mTraceFunctions, mTraceStrings);
|
||||
Parser parser(fileData, mTraceFunctions, mTraceStrings, mVerboseLogging);
|
||||
parser.parse();
|
||||
}
|
||||
|
||||
if (mTraceFunctions.count("SetupReplay") == 0)
|
||||
|
@ -635,7 +630,7 @@ void PackParameter<int32_t *>(ParamBuffer ¶ms,
|
|||
const Token &token,
|
||||
const TraceStringMap &strings)
|
||||
{
|
||||
UNREACHABLE();
|
||||
PackMutablePointerParameter<int32_t>(params, ParamType::TGLintPointer, token);
|
||||
}
|
||||
|
||||
template <>
|
||||
|
@ -761,7 +756,11 @@ void PackParameter<const char *const *>(ParamBuffer ¶ms,
|
|||
{
|
||||
// Find the string that corresponds to "token". Currently we only support string arrays.
|
||||
auto iter = strings.find(token);
|
||||
ASSERT(iter != strings.end());
|
||||
if (iter == strings.end())
|
||||
{
|
||||
printf("Could not find string: %s\n", token);
|
||||
UNREACHABLE();
|
||||
}
|
||||
const TraceString &traceStr = iter->second;
|
||||
params.addUnnamedParam(ParamType::TGLcharConstPointerPointer, traceStr.pointers.data());
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче