Hash :
d8c18ac6
Author :
Date :
2021-10-08T13:00:19
Re-land: "Isolate commit_id.h from other code." Re-land limits the angle_version deps to Windows to fix an iOS visibility rule violation in GN. 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: I033f00ec7afe4bfd01e29e0eea8848eea27747a0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3233899 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: 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 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
//
// 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.
//
// CLPlatformVk.cpp: Implements the class methods for CLPlatformVk.
#include "libANGLE/renderer/vulkan/CLPlatformVk.h"
#include "libANGLE/renderer/vulkan/CLDeviceVk.h"
#include "libANGLE/CLPlatform.h"
#include "anglebase/no_destructor.h"
#include "common/angle_version_info.h"
namespace rx
{
namespace
{
std::string CreateExtensionString(const NameVersionVector &extList)
{
std::string extensions;
for (const cl_name_version &ext : extList)
{
extensions += ext.name;
extensions += ' ';
}
if (!extensions.empty())
{
extensions.pop_back();
}
return extensions;
}
} // namespace
CLPlatformVk::~CLPlatformVk() = default;
CLPlatformImpl::Info CLPlatformVk::createInfo() const
{
NameVersionVector extList = {
cl_name_version{CL_MAKE_VERSION(1, 0, 0), "cl_khr_icd"},
cl_name_version{CL_MAKE_VERSION(1, 0, 0), "cl_khr_extended_versioning"}};
Info info;
info.initializeExtensions(CreateExtensionString(extList));
info.profile.assign("FULL_PROFILE");
info.versionStr.assign(GetVersionString());
info.version = GetVersion();
info.name.assign("ANGLE Vulkan");
info.extensionsWithVersion = std::move(extList);
info.hostTimerRes = 0u;
return info;
}
CLDeviceImpl::CreateDatas CLPlatformVk::createDevices() const
{
cl::DeviceType type; // TODO(jplate) Fetch device type from Vulkan
CLDeviceImpl::CreateDatas createDatas;
createDatas.emplace_back(
type, [](const cl::Device &device) { return CLDeviceVk::Ptr(new CLDeviceVk(device)); });
return createDatas;
}
CLContextImpl::Ptr CLPlatformVk::createContext(cl::Context &context,
const cl::DevicePtrs &devices,
bool userSync,
cl_int &errorCode)
{
CLContextImpl::Ptr contextImpl;
return contextImpl;
}
CLContextImpl::Ptr CLPlatformVk::createContextFromType(cl::Context &context,
cl::DeviceType deviceType,
bool userSync,
cl_int &errorCode)
{
CLContextImpl::Ptr contextImpl;
return contextImpl;
}
cl_int CLPlatformVk::unloadCompiler()
{
return CL_SUCCESS;
}
void CLPlatformVk::Initialize(CreateFuncs &createFuncs)
{
createFuncs.emplace_back(
[](const cl::Platform &platform) { return Ptr(new CLPlatformVk(platform)); });
}
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::GetANGLEVersionString());
return *sVersion;
}
CLPlatformVk::CLPlatformVk(const cl::Platform &platform) : CLPlatformImpl(platform) {}
} // namespace rx