Isolate commit_id.h from other code.

Instead of recompiling multiple source files, we can seal off the
files that include commit_id to prevent recompilations when the
commit changes and source files don't change.

Bug: angleproject:2551
Change-Id: I98800c5a8e04ec7d4c3e57ea0eb3b636d3b224bb
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3212895
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
This commit is contained in:
Jamie Madill 2021-10-08 13:00:19 -04:00 коммит произвёл Angle LUCI CQ
Родитель ddedcdaff2
Коммит 6d7ebf656d
15 изменённых файлов: 130 добавлений и 50 удалений

Просмотреть файл

@ -376,7 +376,6 @@ angle_static_library("angle_common") {
public_deps = [
":angle_abseil",
":angle_version",
":includes",
]
public_configs += [ ":angle_common_config" ]
@ -663,10 +662,12 @@ config("angle_commit_id_config") {
visibility = [ ":angle_commit_id" ]
}
_commit_id_output_file = "$root_gen_dir/angle/angle_commit.h"
action("angle_commit_id") {
_commit_id_header = "$root_gen_dir/angle/angle_commit.h"
script = "src/commit_id.py"
outputs = [ _commit_id_output_file ]
outputs = [ _commit_id_header ]
visibility = [ ":angle_version" ]
# Add git as a dependency if it is available.
if (angle_enable_commit_id &&
@ -692,7 +693,7 @@ action("angle_commit_id") {
args = [
"gen",
rebase_path(_commit_id_output_file, root_build_dir),
rebase_path(_commit_id_header, root_build_dir),
]
public_configs = [ ":angle_commit_id_config" ]
@ -701,6 +702,30 @@ action("angle_commit_id") {
angle_source_set("angle_version") {
sources = [ "src/common/angle_version.h" ]
public_deps = [ ":angle_commit_id" ]
visibility = [
":angle_version_info",
":libEGL",
":libGL",
":libGLESv1_CM",
":libGLESv2",
":libGLESv2_capture_complement",
]
# TODO(jmadill): Remove once headers isolated. http://anglebug.com/2551
if (build_with_chromium) {
visibility += [
"//content/browser:browser",
"//gpu/command_buffer/service:gles2_sources",
]
}
}
angle_source_set("angle_version_info") {
sources = [
"src/common/angle_version_info.cpp",
"src/common/angle_version_info.h",
]
deps = [ ":angle_version" ]
}
config("angle_backend_config") {
@ -854,7 +879,7 @@ angle_source_set("libANGLE_base") {
public_deps = [
":angle_common",
":angle_gpu_info_util",
":angle_version",
":angle_version_info",
":libANGLE_headers",
":translator",
]
@ -1117,9 +1142,11 @@ template("angle_libGLESv2") {
if (angle_enable_cl) {
sources += libglesv2_cl_sources
}
if (is_win) {
sources += [ "src/libGLESv2/${invoker.output_name}_autogen.def" ]
sources += [
"src/libGLESv2/${invoker.output_name}_autogen.def",
"src/libGLESv2/libGLESv2.rc",
]
}
output_name = "${invoker.output_name}${angle_libs_suffix}"
@ -1132,9 +1159,10 @@ template("angle_libGLESv2") {
defines = [ "LIBGLESV2_IMPLEMENTATION" ]
deps = invoker.deps + [ ":includes" ]
public_deps = [ ":angle_version" ]
deps = invoker.deps + [
":angle_version",
":includes",
]
}
}
@ -1178,11 +1206,10 @@ if (is_win && !angle_is_winuwp) {
]
deps = [
":angle_version",
":includes",
":libANGLE",
]
public_deps = [ ":angle_version" ]
}
}
@ -1211,6 +1238,7 @@ angle_shared_library("libGLESv1_CM") {
defines = []
deps = [
":angle_version",
":includes",
":libGLESv2",
]
@ -1240,6 +1268,10 @@ angle_source_set("libEGL_egl_loader") {
angle_shared_library("libEGL") {
sources = libegl_sources
if (is_win) {
sources += [ "src/libEGL/libEGL.rc" ]
}
output_name = "libEGL${angle_libs_suffix}"
configs += [

Просмотреть файл

@ -0,0 +1,31 @@
//
// 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.
//
// angle_version_info.cpp: ANGLE version queries.
#include "common/angle_version.h"
namespace angle
{
int GetANGLERevision()
{
return ANGLE_REVISION;
}
const char *GetANGLEVersionString()
{
return ANGLE_VERSION_STRING;
}
const char *GetANGLECommitHash()
{
return ANGLE_COMMIT_HASH;
}
int GetANGLECommitHashSize()
{
return ANGLE_COMMIT_HASH_SIZE;
}
} // namespace angle

Просмотреть файл

@ -0,0 +1,19 @@
//
// 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.
//
// angle_version_info.h: ANGLE version queries.
#ifndef COMMON_VERSION_H_
#define COMMON_VERSION_H_
namespace angle
{
int GetANGLERevision();
const char *GetANGLEVersionString();
const char *GetANGLECommitHash();
int GetANGLECommitHashSize();
} // namespace angle
#endif // COMMON_VERSION_H_

Просмотреть файл

@ -15,7 +15,7 @@
#include <vector>
#include "common/PackedEnums.h"
#include "common/angle_version.h"
#include "common/angle_version_info.h"
#include "common/matrix_utils.h"
#include "common/platform.h"
#include "common/system_utils.h"
@ -3210,7 +3210,7 @@ void Context::initVersionStrings()
versionString << "OpenGL ES ";
}
versionString << clientVersion.major << "." << clientVersion.minor << ".0 (ANGLE "
<< ANGLE_VERSION_STRING << ")";
<< angle::GetANGLEVersionString() << ")";
mVersionString = MakeStaticString(versionString.str());
std::ostringstream shadingLanguageVersionString;
@ -3224,8 +3224,8 @@ void Context::initVersionStrings()
shadingLanguageVersionString << "OpenGL GLSL ";
}
shadingLanguageVersionString << (clientVersion.major == 2 ? 1 : clientVersion.major) << "."
<< clientVersion.minor << "0 (ANGLE " << ANGLE_VERSION_STRING
<< ")";
<< clientVersion.minor << "0 (ANGLE "
<< angle::GetANGLEVersionString() << ")";
mShadingLanguageString = MakeStaticString(shadingLanguageVersionString.str());
}

Просмотреть файл

@ -16,7 +16,7 @@
#include <GLSLANG/ShaderVars.h>
#include <anglebase/sha1.h>
#include "common/angle_version.h"
#include "common/angle_version_info.h"
#include "common/utilities.h"
#include "libANGLE/BinaryStream.h"
#include "libANGLE/Context.h"
@ -116,7 +116,7 @@ void MemoryProgramCache::ComputeHash(const Context *context,
}
// Add some ANGLE metadata and Context properties, such as version and back-end.
hashStream << ANGLE_COMMIT_HASH << context->getClientMajorVersion()
hashStream << angle::GetANGLECommitHash() << context->getClientMajorVersion()
<< context->getClientMinorVersion() << context->getString(GL_RENDERER);
// Hash pre-link program properties.

Просмотреть файл

@ -12,7 +12,7 @@
#include <algorithm>
#include <utility>
#include "common/angle_version.h"
#include "common/angle_version_info.h"
#include "common/bitset_utils.h"
#include "common/debug.h"
#include "common/platform.h"
@ -4635,8 +4635,8 @@ angle::Result Program::serialize(const Context *context, angle::MemoryBuffer *bi
{
BinaryOutputStream stream;
stream.writeBytes(reinterpret_cast<const unsigned char *>(ANGLE_COMMIT_HASH),
ANGLE_COMMIT_HASH_SIZE);
stream.writeBytes(reinterpret_cast<const unsigned char *>(angle::GetANGLECommitHash()),
angle::GetANGLECommitHashSize());
// nullptr context is supported when computing binary length.
if (context)
@ -4716,7 +4716,7 @@ angle::Result Program::serialize(const Context *context, angle::MemoryBuffer *bi
}
else
{
// If we dont have an attached shader, which would occur if this program was
// If we don't have an attached shader, which would occur if this program was
// created via glProgramBinary, pull from our cached copy
const angle::ProgramSources &cachedLinkedSources =
context->getShareGroup()->getFrameCaptureShared()->getProgramSources(id());
@ -4744,10 +4744,9 @@ angle::Result Program::deserialize(const Context *context,
BinaryInputStream &stream,
InfoLog &infoLog)
{
unsigned char commitString[ANGLE_COMMIT_HASH_SIZE];
stream.readBytes(commitString, ANGLE_COMMIT_HASH_SIZE);
if (memcmp(commitString, ANGLE_COMMIT_HASH, sizeof(unsigned char) * ANGLE_COMMIT_HASH_SIZE) !=
0)
std::vector<uint8_t> commitString(angle::GetANGLECommitHashSize(), 0);
stream.readBytes(commitString.data(), commitString.size());
if (memcmp(commitString.data(), angle::GetANGLECommitHash(), commitString.size()) != 0)
{
infoLog << "Invalid program binary version.";
return angle::Result::Stop;

Просмотреть файл

@ -16,7 +16,7 @@
#include "sys/stat.h"
#include "common/angle_version.h"
#include "common/angle_version_info.h"
#include "common/mathutil.h"
#include "common/serializer/JsonSerializer.h"
#include "common/string_utils.h"
@ -6034,7 +6034,7 @@ void FrameCaptureShared::writeCppReplayIndexFiles(const gl::Context *context,
JsonSerializer json;
json.startGroup("TraceMetadata");
json.addScalar("CaptureRevision", ANGLE_REVISION);
json.addScalar("CaptureRevision", GetANGLERevision());
json.addScalar("ContextClientMajorVersion", context->getClientMajorVersion());
json.addScalar("ContextClientMinorVersion", context->getClientMinorVersion());
json.addHexValue("DisplayPlatformType", displayAttribs.getAsInt(EGL_PLATFORM_ANGLE_TYPE_ANGLE));

Просмотреть файл

@ -40,6 +40,7 @@ angle_source_set("angle_cl_backend") {
sources = _cl_backend_sources
public_deps = [
"$angle_root:angle_version_info",
"$angle_root:libANGLE_headers",
"$angle_root/third_party/OpenCL-ICD-Loader:opencl_icd_loader",
]

Просмотреть файл

@ -7,15 +7,13 @@
#include "libANGLE/renderer/cl/CLPlatformCL.h"
#include "libANGLE/renderer/cl/CLContextCL.h"
#include "libANGLE/renderer/cl/CLDeviceCL.h"
#include "libANGLE/renderer/cl/cl_util.h"
#include "common/angle_version_info.h"
#include "libANGLE/CLContext.h"
#include "libANGLE/CLDevice.h"
#include "libANGLE/CLPlatform.h"
#include "common/angle_version.h"
#include "libANGLE/renderer/cl/CLContextCL.h"
#include "libANGLE/renderer/cl/CLDeviceCL.h"
#include "libANGLE/renderer/cl/cl_util.h"
extern "C" {
#include "icd.h"
@ -173,7 +171,7 @@ CLPlatformImpl::Info CLPlatformCL::createInfo() const
}
// Customize version string and name
info.versionStr += " (ANGLE " ANGLE_VERSION_STRING ")";
info.versionStr += std::string(" (ANGLE ") + angle::GetANGLEVersionString() + ")";
info.name.insert(0u, "ANGLE pass-through -> ");
if (version >= CL_MAKE_VERSION(2, 1, 0) &&

Просмотреть файл

@ -264,6 +264,10 @@ angle_source_set("angle_vulkan_backend") {
"$angle_spirv_headers_dir:spv_headers",
]
if (angle_enable_cl || is_android) {
deps += [ "$angle_root:angle_version_info" ]
}
public_deps = [
"$angle_root:angle_glslang_wrapper",
"$angle_root:libANGLE_headers",

Просмотреть файл

@ -12,7 +12,7 @@
#include "libANGLE/CLPlatform.h"
#include "anglebase/no_destructor.h"
#include "common/angle_version.h"
#include "common/angle_version_info.h"
namespace rx
{
@ -98,7 +98,8 @@ const std::string &CLPlatformVk::GetVersionString()
{
static const angle::base::NoDestructor<const std::string> sVersion(
"OpenCL " + std::to_string(CL_VERSION_MAJOR(GetVersion())) + "." +
std::to_string(CL_VERSION_MINOR(GetVersion())) + " ANGLE " ANGLE_VERSION_STRING);
std::to_string(CL_VERSION_MINOR(GetVersion())) + " ANGLE " +
angle::GetANGLEVersionString());
return *sVersion;
}

Просмотреть файл

@ -13,7 +13,7 @@
#include <android/native_window.h>
#include <vulkan/vulkan.h>
#include "common/angle_version.h"
#include "common/angle_version_info.h"
#include "libANGLE/renderer/driver_utils.h"
#include "libANGLE/renderer/vulkan/RendererVk.h"
#include "libANGLE/renderer/vulkan/android/HardwareBufferImageSiblingVkAndroid.h"
@ -30,7 +30,7 @@ egl::Error DisplayVkAndroid::initialize(egl::Display *display)
ANGLE_TRY(DisplayVk::initialize(display));
std::stringstream strstr;
strstr << "Version (" << ANGLE_VERSION_STRING << "), ";
strstr << "Version (" << angle::GetANGLEVersionString() << "), ";
strstr << "Renderer (" << mRenderer->getRendererDescription() << ")";
__android_log_print(ANDROID_LOG_INFO, "ANGLE", "%s", strstr.str().c_str());

Просмотреть файл

@ -7,7 +7,6 @@
#include "entry_points_wgl.h"
#include "common/angle_version.h"
#include "common/debug.h"
#include "common/event_tracer.h"
#include "common/utilities.h"

Просмотреть файл

@ -626,10 +626,6 @@ libglesv2_cl_sources = [
"src/libGLESv2/proc_table_cl_autogen.cpp",
]
if (is_win) {
libglesv2_sources += [ "src/libGLESv2/libGLESv2.rc" ]
}
libglesv1_cm_sources = [
"src/libGLESv1_CM/libGLESv1_CM.cpp",
"src/libGLESv1_CM/resource.h",
@ -646,7 +642,3 @@ libegl_sources = [
"src/libGLESv2/entry_points_egl_autogen.h",
"src/libGLESv2/entry_points_egl_ext_autogen.h",
]
if (is_win) {
libegl_sources += [ "src/libEGL/libEGL.rc" ]
}

Просмотреть файл

@ -8,7 +8,7 @@
#include "libGLESv2/egl_stubs_autogen.h"
#include "common/angle_version.h"
#include "common/angle_version_info.h"
#include "libANGLE/Context.h"
#include "libANGLE/Display.h"
#include "libANGLE/EGLSync.h"
@ -534,8 +534,12 @@ const char *QueryString(Thread *thread, Display *display, EGLint name)
result = display->getVendorString().c_str();
break;
case EGL_VERSION:
result = "1.5 (ANGLE " ANGLE_VERSION_STRING ")";
{
static const char *sVersionString =
MakeStaticString(std::string("1.5 (ANGLE ") + angle::GetANGLEVersionString() + ")");
result = sVersionString;
break;
}
default:
UNREACHABLE();
break;