Hash :
bdf91e5f
Author :
Date :
2020-06-29T13:47:13
Refactor frame_capture_utils.h to frame_capture_test_utils.h frame_capture_utils.h is only used in tests so changing the name to be frame_capture_test_utils.h is more appropriate. Also frame_capture_utils.h will now be a file in libANGLE_with_capture library where serialization code is stored. Bug: angleproject:4806 Change-Id: I7482693a75b2d0edda7e84ae9b777fd3f46f1855 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2273917 Commit-Queue: Manh Nguyen <nguyenmh@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
//
// 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.
//
// frame_capture_test_utils:
// Helper functions for capture and replay of traces.
//
#ifndef UTIL_FRAME_CAPTURE_TEST_UTILS_H_
#define UTIL_FRAME_CAPTURE_TEST_UTILS_H_
#include <iostream>
#include <memory>
#include <vector>
#include "common/angleutils.h"
#define USE_SYSTEM_ZLIB
#include "compression_utils_portable.h"
#define ANGLE_MACRO_STRINGIZE_AUX(a) #a
#define ANGLE_MACRO_STRINGIZE(a) ANGLE_MACRO_STRINGIZE_AUX(a)
#define ANGLE_MACRO_CONCAT_AUX(a, b) a##b
#define ANGLE_MACRO_CONCAT(a, b) ANGLE_MACRO_CONCAT_AUX(a, b)
namespace angle
{
inline uint8_t *DecompressBinaryData(const std::vector<uint8_t> &compressedData)
{
uint32_t uncompressedSize =
zlib_internal::GetGzipUncompressedSize(compressedData.data(), compressedData.size());
std::unique_ptr<uint8_t[]> uncompressedData(new uint8_t[uncompressedSize]);
uLong destLen = uncompressedSize;
int zResult =
zlib_internal::GzipUncompressHelper(uncompressedData.get(), &destLen, compressedData.data(),
static_cast<uLong>(compressedData.size()));
if (zResult != Z_OK)
{
std::cerr << "Failure to decompressed binary data: " << zResult << "\n";
return nullptr;
}
return uncompressedData.release();
}
} // namespace angle
#endif // UTIL_FRAME_CAPTURE_TEST_UTILS_H_