Reland "Add vulkan information in about::gpu page"
This reverts commitfdda085df1
. Reason for revert: Reland with fixing. Original change's description: > Revert "Add vulkan information in about::gpu page" > > This reverts commit2ef6fce852
. > > Reason for revert: This CL broke GPU FYI Win x64 DX12 Vulkan Builder (dbg) > > https://ci.chromium.org/p/chromium/builders/ci/GPU%20FYI%20Win%20x64%20DX12%20Vulkan%20Builder%20%28dbg%29 > > lld-link: error: obj/gpu/vulkan/vulkan/vulkan_instance.obj: locally defined symbol imported: public: __cdecl gpu::VulkanInfo::VulkanInfo(void) (defined in obj/gpu/config/vulkan_info/vulkan_info.obj) [LNK4217] > > > Original change's description: > > Add vulkan information in about::gpu page > > > > This CL adds VulkanInfo in GPUInfo, and then send it to browser > > process with GPUInfo. And it will be serialized to binary data and pass > > to about:gpu page for displaying. > > > > This CL adds a vulkan_types.mojom generated from vulkan header file. > > The structs in that files have many fields. It increases binary size. > > The increasing is expected. > > > > Bug: 887018 > > Change-Id: I2725326091ef47c3034939b3970d0e5bbaf6dc3f > > Binary-Size: Size increase is unavoidable (see above) > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1868832 > > Reviewed-by: Zhenyao Mo <zmo@chromium.org> > > Reviewed-by: Tom Sepez <tsepez@chromium.org> > > Reviewed-by: Alex Moshchuk <alexmos@chromium.org> > > Reviewed-by: Jonathan Backer <backer@chromium.org> > > Commit-Queue: Peng Huang <penghuang@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#714424} > > TBR=penghuang@chromium.org,backer@chromium.org,zmo@chromium.org,kbr@chromium.org,tsepez@chromium.org,alexmos@chromium.org > > Change-Id: I3b0aff2cfcfa8b65df2ca9109325451567cf8039 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: 887018 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1913565 > Reviewed-by: Chris Blume <cblume@chromium.org> > Commit-Queue: Chris Blume <cblume@chromium.org> > Cr-Commit-Position: refs/heads/master@{#714714} TBR=penghuang@chromium.org,backer@chromium.org,zmo@chromium.org,kbr@chromium.org,tsepez@chromium.org,alexmos@chromium.org,cblume@chromium.org Change-Id: I2061c0a8508be602777467b7ae16cb51827bf5f8 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 887018 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1914294 Reviewed-by: Peng Huang <penghuang@chromium.org> Commit-Queue: Peng Huang <penghuang@chromium.org> Cr-Commit-Position: refs/heads/master@{#715034}
This commit is contained in:
content
gpu
config
ipc
common
BUILD.gnOWNERSPRESUBMIT.pygenerate_vulkan_types.pygpu_info.mojomgpu_info_mojom_traits.ccgpu_info_mojom_traits.htypemaps.gnivulkan_info.mojomvulkan_info.typemapvulkan_info_mojom_traits.hvulkan_types.hvulkan_types.mojomvulkan_types.typemapvulkan_types_mojom_traits.ccvulkan_types_mojom_traits.h
service
vulkan
@ -126,6 +126,7 @@ grit("resources") {
|
||||
]
|
||||
deps = [
|
||||
"//content/browser/process_internals:mojo_bindings_js",
|
||||
"//gpu/ipc/common:vulkan_interface_js",
|
||||
"//url/mojom:url_mojom_origin_js",
|
||||
]
|
||||
}
|
||||
|
@ -88,6 +88,11 @@ class AuxGPUInfoEnumerator : public gpu::GPUInfo::Enumerator {
|
||||
dictionary_->setDouble(name, value.InSecondsF());
|
||||
}
|
||||
|
||||
void AddBinary(const char* name,
|
||||
const base::span<const uint8_t>& value) override {
|
||||
// TODO(penghuang): send vulkan info to devtool
|
||||
}
|
||||
|
||||
void BeginGPUDevice() override {}
|
||||
|
||||
void EndGPUDevice() override {}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/base64.h"
|
||||
#include "base/bind.h"
|
||||
#include "base/bind_helpers.h"
|
||||
#include "base/command_line.h"
|
||||
@ -73,6 +74,8 @@ WebUIDataSource* CreateGpuHTMLSource() {
|
||||
|
||||
source->UseStringsJs();
|
||||
source->AddResourcePath("gpu_internals.js", IDR_GPU_INTERNALS_JS);
|
||||
source->AddResourcePath("vulkan_info.mojom.js", IDR_VULKAN_INFO_MOJO_JS);
|
||||
source->AddResourcePath("vulkan_types.mojom.js", IDR_VULKAN_TYPES_MOJO_JS);
|
||||
source->SetDefaultResource(IDR_GPU_INTERNALS_HTML);
|
||||
return source;
|
||||
}
|
||||
@ -327,6 +330,13 @@ std::unique_ptr<base::DictionaryValue> GpuInfoAsDictionaryValue() {
|
||||
info->Set("diagnostics", std::move(dx_info));
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_VULKAN)
|
||||
if (gpu_info.vulkan_info) {
|
||||
auto blob = gpu_info.vulkan_info->Serialize();
|
||||
info->SetString("vulkanInfo", base::Base64Encode(blob));
|
||||
}
|
||||
#endif
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,9 @@ tabbox tabpanels {
|
||||
<script src="chrome://resources/js/cr/ui/tabs.js"></script>
|
||||
<script src="chrome://resources/js/load_time_data.js"></script>
|
||||
<script src="chrome://resources/js/util.js"></script>
|
||||
<script src="chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js"></script>
|
||||
<script src="chrome://resources/gpu/ipc/common/vulkan_types.mojom-lite.js"></script>
|
||||
<script src="chrome://resources/gpu/ipc/common/vulkan_info.mojom-lite.js"></script>
|
||||
<script src="gpu_internals.js"></script>
|
||||
<script src="strings.js"></script>
|
||||
</head>
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
// <include src="browser_bridge.js">
|
||||
// <include src="info_view.js">
|
||||
// <include src="vulkan_info.js">
|
||||
|
||||
let browserBridge;
|
||||
|
||||
|
@ -67,6 +67,10 @@
|
||||
color: rgb(128, 128, 128);
|
||||
}
|
||||
|
||||
#vulkan-info-value {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
#copy-to-clipboard {
|
||||
user-select: none;
|
||||
}
|
||||
|
@ -61,6 +61,11 @@ found in the LICENSE file.
|
||||
<div id="video-acceleration-info"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3>Vulkan Information</h3>
|
||||
<div id="vulkan-info"></div>
|
||||
</div>
|
||||
|
||||
<div class="diagnostics">
|
||||
<h3>Diagnostics</h3>
|
||||
<div class="diagnostics-loading">... loading ...</div>
|
||||
@ -112,7 +117,7 @@ found in the LICENSE file.
|
||||
<span class="row-title" jscontent="description">title</span>
|
||||
</td>
|
||||
<td jsdisplay="!(value instanceof Array)">
|
||||
<span jscontent="value">value</span>
|
||||
<span jscontent="value" jsvalues=".id:id">value</span>
|
||||
</td>
|
||||
<td jsdisplay="value instanceof Array" colspan=2>
|
||||
<span jscontent="description" class="row-title"></span>
|
||||
|
@ -211,6 +211,19 @@ cr.define('gpu', function() {
|
||||
} else {
|
||||
diagnosticsDiv.hidden = true;
|
||||
}
|
||||
|
||||
if (gpuInfo.vulkanInfo) {
|
||||
const vulkanInfo = new gpu.VulkanInfo(gpuInfo.vulkanInfo);
|
||||
const data = [{
|
||||
'description': 'info',
|
||||
'value': vulkanInfo.toString(),
|
||||
'id': 'vulkan-info-value'
|
||||
}];
|
||||
this.setTable_('vulkan-info', data);
|
||||
} else {
|
||||
this.setTable_('vulkan-info', []);
|
||||
}
|
||||
|
||||
} else {
|
||||
this.setText_('basic-info', '... loading ...');
|
||||
diagnosticsDiv.hidden = true;
|
||||
|
19
content/browser/resources/gpu/vulkan_info.js
Normal file
19
content/browser/resources/gpu/vulkan_info.js
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
cr.define('gpu', function() {
|
||||
class VulkanInfo {
|
||||
constructor(base64Data) {
|
||||
const array = Uint8Array.from(atob(base64Data), c => c.charCodeAt(0));
|
||||
const dataView = new DataView(array.buffer);
|
||||
this.vulkanInfo_ = gpu.mojom.VulkanInfo_Deserialize(dataView);
|
||||
}
|
||||
|
||||
toString() {
|
||||
return JSON.stringify(this.vulkanInfo_, null, 2);
|
||||
}
|
||||
}
|
||||
|
||||
return {VulkanInfo: VulkanInfo};
|
||||
});
|
@ -99,6 +99,8 @@ const std::map<int, std::string> CreateContentResourceIdToAliasMap() {
|
||||
"mojo/mojo/public/mojom/base/unguessable_token.mojom-lite.js"},
|
||||
{IDR_URL_MOJO_HTML, "mojo/url/mojom/url.mojom.html"},
|
||||
{IDR_URL_MOJO_JS, "mojo/url/mojom/url.mojom-lite.js"},
|
||||
{IDR_VULKAN_INFO_MOJO_JS, "gpu/ipc/common/vulkan_info.mojom-lite.js"},
|
||||
{IDR_VULKAN_TYPES_MOJO_JS, "gpu/ipc/common/vulkan_types.mojom-lite.js"},
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,8 @@
|
||||
<include name="IDR_UNGUESSABLE_TOKEN_MOJO_JS" file="${root_gen_dir}/mojo/public/mojom/base/unguessable_token.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
|
||||
<include name="IDR_URL_MOJO_HTML" file="${root_gen_dir}/url/mojom/url.mojom.html" use_base_dir="false" type="BINDATA" compress="gzip" />
|
||||
<include name="IDR_URL_MOJO_JS" file="${root_gen_dir}/url/mojom/url.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
|
||||
<include name="IDR_VULKAN_INFO_MOJO_JS" file="${root_gen_dir}/gpu/ipc/common/vulkan_info.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
|
||||
<include name="IDR_VULKAN_TYPES_MOJO_JS" file="${root_gen_dir}/gpu/ipc/common/vulkan_types.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
|
||||
</includes>
|
||||
</release>
|
||||
</grit>
|
||||
|
@ -6,6 +6,7 @@ import("//build/config/chrome_build.gni")
|
||||
import("//build/config/chromecast_build.gni")
|
||||
import("//build/config/jumbo.gni")
|
||||
import("//build/config/ui.gni")
|
||||
import("//gpu/vulkan/features.gni")
|
||||
|
||||
group("config") {
|
||||
if (is_component_build) {
|
||||
@ -89,6 +90,31 @@ action("workaround_list") {
|
||||
}
|
||||
}
|
||||
|
||||
if (enable_vulkan) {
|
||||
component("vulkan_info") {
|
||||
sources = [
|
||||
"vulkan_info.cc",
|
||||
"vulkan_info.h",
|
||||
]
|
||||
|
||||
configs += [ "//gpu:gpu_implementation" ]
|
||||
|
||||
deps = [
|
||||
"//gpu/ipc/common:vulkan_interface",
|
||||
]
|
||||
|
||||
all_dependent_configs = [ "//third_party/vulkan:vulkan_config" ]
|
||||
|
||||
# surpass linke error 4217. It is because vulkan_info depends on
|
||||
# //gpu/ipc/common:vulkan_interface and //gpu/ipc/common:vulkan_interface"
|
||||
# depends on this target.
|
||||
# TODO(penghuang): Fix this link error
|
||||
if (is_win && is_component_build) {
|
||||
ldflags = [ "/IGNORE:4217" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jumbo_source_set("config_sources") {
|
||||
# External code should depend on this via //gpu/config above rather than
|
||||
# depending on this directly or the component build will break.
|
||||
@ -152,6 +178,10 @@ jumbo_source_set("config_sources") {
|
||||
"//components/crash/core/common:crash_key",
|
||||
]
|
||||
|
||||
if (enable_vulkan) {
|
||||
public_deps += [ ":vulkan_info" ]
|
||||
}
|
||||
|
||||
deps = [
|
||||
":process_json",
|
||||
"//base",
|
||||
|
@ -266,6 +266,10 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
|
||||
|
||||
bool oop_rasterization_supported;
|
||||
bool subpixel_font_rendering;
|
||||
|
||||
#if BUILDFLAG(ENABLE_VULKAN)
|
||||
base::Optional<VulkanInfo> vulkan_info;
|
||||
#endif
|
||||
};
|
||||
|
||||
// If this assert fails then most likely something below needs to be updated.
|
||||
@ -336,6 +340,12 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
|
||||
#endif
|
||||
enumerator->AddBool("oopRasterizationSupported", oop_rasterization_supported);
|
||||
enumerator->AddBool("subpixelFontRendering", subpixel_font_rendering);
|
||||
#if BUILDFLAG(ENABLE_VULKAN)
|
||||
if (vulkan_info) {
|
||||
auto blob = vulkan_info->Serialize();
|
||||
enumerator->AddBinary("vulkanInfo", base::span<const uint8_t>(blob));
|
||||
}
|
||||
#endif
|
||||
enumerator->EndAuxAttributes();
|
||||
}
|
||||
|
||||
|
@ -13,17 +13,24 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/containers/span.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/time/time.h"
|
||||
#include "base/version.h"
|
||||
#include "build/build_config.h"
|
||||
#include "gpu/config/dx_diag_node.h"
|
||||
#include "gpu/gpu_export.h"
|
||||
#include "gpu/vulkan/buildflags.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
|
||||
#if defined(USE_X11)
|
||||
typedef unsigned long VisualID;
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_VULKAN)
|
||||
#include "gpu/config/vulkan_info.h"
|
||||
#endif
|
||||
|
||||
namespace gpu {
|
||||
|
||||
// These values are persisted to logs. Entries should not be renumbered and
|
||||
@ -357,6 +364,10 @@ struct GPU_EXPORT GPUInfo {
|
||||
|
||||
bool subpixel_font_rendering;
|
||||
|
||||
#if BUILDFLAG(ENABLE_VULKAN)
|
||||
base::Optional<VulkanInfo> vulkan_info;
|
||||
#endif
|
||||
|
||||
// Note: when adding new members, please remember to update EnumerateFields
|
||||
// in gpu_info.cc.
|
||||
|
||||
@ -376,6 +387,8 @@ struct GPU_EXPORT GPUInfo {
|
||||
virtual void AddBool(const char* name, bool value) = 0;
|
||||
virtual void AddTimeDeltaInSecondsF(const char* name,
|
||||
const base::TimeDelta& value) = 0;
|
||||
virtual void AddBinary(const char* name,
|
||||
const base::span<const uint8_t>& blob) = 0;
|
||||
|
||||
// Markers indicating that a GPUDevice is being described.
|
||||
virtual void BeginGPUDevice() = 0;
|
||||
|
@ -27,6 +27,9 @@ class TestGPUInfoEnumerator : public gpu::GPUInfo::Enumerator {
|
||||
|
||||
void AddBool(const char* name, bool value) override {}
|
||||
|
||||
void AddBinary(const char* name,
|
||||
const base::span<const uint8_t>& blob) override {}
|
||||
|
||||
void AddTimeDeltaInSecondsF(const char* name,
|
||||
const base::TimeDelta& value) override {}
|
||||
|
||||
|
78
gpu/config/vulkan_info.cc
Normal file
78
gpu/config/vulkan_info.cc
Normal file
@ -0,0 +1,78 @@
|
||||
// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "gpu/config/vulkan_info.h"
|
||||
|
||||
#include "gpu/ipc/common/vulkan_info.mojom.h"
|
||||
#include "gpu/ipc/common/vulkan_info_mojom_traits.h"
|
||||
|
||||
namespace gpu {
|
||||
|
||||
VulkanPhysicalDeviceInfo::VulkanPhysicalDeviceInfo() = default;
|
||||
VulkanPhysicalDeviceInfo::VulkanPhysicalDeviceInfo(
|
||||
const VulkanPhysicalDeviceInfo& other) = default;
|
||||
VulkanPhysicalDeviceInfo::~VulkanPhysicalDeviceInfo() = default;
|
||||
VulkanPhysicalDeviceInfo& VulkanPhysicalDeviceInfo::operator=(
|
||||
const VulkanPhysicalDeviceInfo& info) = default;
|
||||
|
||||
VulkanInfo::VulkanInfo() = default;
|
||||
VulkanInfo::~VulkanInfo() = default;
|
||||
|
||||
VulkanInfo::VulkanInfo(const VulkanInfo& other) {
|
||||
*this = other;
|
||||
}
|
||||
|
||||
VulkanInfo& VulkanInfo::operator=(const VulkanInfo& other) {
|
||||
api_version = other.api_version;
|
||||
used_api_version = other.used_api_version;
|
||||
instance_extensions = other.instance_extensions;
|
||||
instance_layers = other.instance_layers;
|
||||
physical_devices = other.physical_devices;
|
||||
SetEnabledInstanceExtensions(other.enabled_instance_extensions);
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> VulkanInfo::Serialize() const {
|
||||
return gpu::mojom::VulkanInfo::Serialize(this);
|
||||
}
|
||||
|
||||
void VulkanInfo::SetEnabledInstanceExtensions(
|
||||
const std::vector<const char*>& extensions) {
|
||||
enabled_instance_extensions.clear();
|
||||
for (const auto* const extension : extensions) {
|
||||
bool found = false;
|
||||
for (const auto& instance_extension : instance_extensions) {
|
||||
if (strcmp(extension, instance_extension.extensionName) == 0) {
|
||||
enabled_instance_extensions.push_back(instance_extension.extensionName);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
LOG(ERROR) << "The enabled extension '" << extension
|
||||
<< "' is not in instance_extensions!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanInfo::SetEnabledInstanceExtensions(
|
||||
const std::vector<base::StringPiece>& extensions) {
|
||||
enabled_instance_extensions.clear();
|
||||
for (const auto& extension : extensions) {
|
||||
bool found = false;
|
||||
for (const auto& instance_extension : instance_extensions) {
|
||||
if (extension == instance_extension.extensionName) {
|
||||
enabled_instance_extensions.push_back(instance_extension.extensionName);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
LOG(ERROR) << "The enabled extension '" << extension
|
||||
<< "' is not in instance_extensions!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gpu
|
62
gpu/config/vulkan_info.h
Normal file
62
gpu/config/vulkan_info.h
Normal file
@ -0,0 +1,62 @@
|
||||
// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef GPU_CONFIG_VULKAN_INFO_H_
|
||||
#define GPU_CONFIG_VULKAN_INFO_H_
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <vector>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "gpu/gpu_export.h"
|
||||
#include "ui/gfx/extension_set.h"
|
||||
|
||||
namespace gpu {
|
||||
|
||||
class GPU_EXPORT VulkanPhysicalDeviceInfo {
|
||||
public:
|
||||
VulkanPhysicalDeviceInfo();
|
||||
VulkanPhysicalDeviceInfo(const VulkanPhysicalDeviceInfo& other);
|
||||
~VulkanPhysicalDeviceInfo();
|
||||
VulkanPhysicalDeviceInfo& operator=(const VulkanPhysicalDeviceInfo& other);
|
||||
|
||||
// This is a local variable in GPU process, it will not be sent via IPC.
|
||||
VkPhysicalDevice device = VK_NULL_HANDLE;
|
||||
|
||||
VkPhysicalDeviceProperties properties = {};
|
||||
std::vector<VkLayerProperties> layers;
|
||||
|
||||
VkPhysicalDeviceFeatures features = {};
|
||||
// Extended physical device features:
|
||||
bool feature_sampler_ycbcr_conversion = false;
|
||||
bool feature_protected_memory = false;
|
||||
|
||||
std::vector<VkQueueFamilyProperties> queue_families;
|
||||
};
|
||||
|
||||
class GPU_EXPORT VulkanInfo {
|
||||
public:
|
||||
VulkanInfo();
|
||||
VulkanInfo(const VulkanInfo& other);
|
||||
~VulkanInfo();
|
||||
VulkanInfo& operator=(const VulkanInfo& other);
|
||||
|
||||
std::vector<uint8_t> Serialize() const;
|
||||
|
||||
void SetEnabledInstanceExtensions(const std::vector<const char*>& extensions);
|
||||
void SetEnabledInstanceExtensions(
|
||||
const std::vector<base::StringPiece>& extensions);
|
||||
|
||||
uint32_t api_version = VK_MAKE_VERSION(1, 0, 0);
|
||||
uint32_t used_api_version = VK_MAKE_VERSION(1, 0, 0);
|
||||
std::vector<VkExtensionProperties> instance_extensions;
|
||||
std::vector<const char*> enabled_instance_extensions;
|
||||
std::vector<VkLayerProperties> instance_layers;
|
||||
std::vector<VulkanPhysicalDeviceInfo> physical_devices;
|
||||
};
|
||||
|
||||
} // namespace gpu
|
||||
|
||||
#endif // GPU_CONFIG_VULKAN_INFO_H_
|
@ -3,6 +3,7 @@
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//build/config/ui.gni")
|
||||
import("//gpu/vulkan/features.gni")
|
||||
import("//mojo/public/tools/bindings/mojom.gni")
|
||||
import("//ui/ozone/ozone.gni")
|
||||
|
||||
@ -199,6 +200,17 @@ component("vulkan_ycbcr_info") {
|
||||
configs += [ "//gpu:gpu_implementation" ]
|
||||
}
|
||||
|
||||
source_set("vulkan_types") {
|
||||
sources = [
|
||||
"vulkan_types.h",
|
||||
]
|
||||
public_deps = [
|
||||
"//ui/gfx",
|
||||
]
|
||||
all_dependent_configs = [ "//third_party/vulkan:vulkan_config" ]
|
||||
configs += [ "//gpu:gpu_implementation" ]
|
||||
}
|
||||
|
||||
mojom("interfaces") {
|
||||
generate_java = true
|
||||
sources = [
|
||||
@ -222,6 +234,10 @@ mojom("interfaces") {
|
||||
"//ui/gfx/geometry/mojom",
|
||||
"//ui/gfx/mojom",
|
||||
]
|
||||
if (enable_vulkan) {
|
||||
public_deps += [ ":vulkan_interface" ]
|
||||
enabled_features = [ "supports_vulkan" ]
|
||||
}
|
||||
}
|
||||
|
||||
mojom("gpu_preferences_interface") {
|
||||
@ -241,6 +257,20 @@ mojom("gpu_preferences_interface") {
|
||||
}
|
||||
}
|
||||
|
||||
mojom("vulkan_interface") {
|
||||
generate_java = true
|
||||
sources = [
|
||||
"vulkan_info.mojom",
|
||||
"vulkan_types.mojom",
|
||||
]
|
||||
|
||||
public_deps = [
|
||||
"//mojo/public/mojom/base",
|
||||
]
|
||||
|
||||
js_generate_struct_deserializers = true
|
||||
}
|
||||
|
||||
mojom("test_interfaces") {
|
||||
testonly = true
|
||||
sources = [
|
||||
@ -251,6 +281,21 @@ mojom("test_interfaces") {
|
||||
":gpu_preferences_interface",
|
||||
":interfaces",
|
||||
]
|
||||
|
||||
if (enable_vulkan) {
|
||||
public_deps += [ ":vulkan_interface" ]
|
||||
}
|
||||
}
|
||||
|
||||
source_set("vulkan_types_mojom_traits") {
|
||||
sources = [
|
||||
"vulkan_types_mojom_traits.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":vulkan_interface_shared_cpp_sources",
|
||||
":vulkan_types",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("mojom_traits") {
|
||||
@ -273,4 +318,7 @@ source_set("mojom_traits") {
|
||||
if (is_android) {
|
||||
sources += [ "vulkan_ycbcr_info_mojom_traits.h" ]
|
||||
}
|
||||
if (enable_vulkan) {
|
||||
deps += [ ":vulkan_types_mojom_traits" ]
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,8 @@
|
||||
set noparent
|
||||
file://ipc/SECURITY_OWNERS
|
||||
|
||||
per-file generate_vulkan_types.py=file://gpu/OWNERS
|
||||
|
||||
# The following lines are redundant, they're just to silence the presubmit
|
||||
per-file *_messages*.h=set noparent
|
||||
per-file *_messages*.h=file://ipc/SECURITY_OWNERS
|
||||
|
55
gpu/ipc/common/PRESUBMIT.py
Normal file
55
gpu/ipc/common/PRESUBMIT.py
Normal file
@ -0,0 +1,55 @@
|
||||
# Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""Enforces Vulkan types autogen matches script output.
|
||||
|
||||
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
|
||||
for more details on the presubmit API built into depot_tools.
|
||||
"""
|
||||
|
||||
import os.path
|
||||
|
||||
|
||||
def CommonChecks(input_api, output_api):
|
||||
generating_files = input_api.AffectedFiles(
|
||||
file_filter=lambda x: os.path.basename(x.LocalPath()) in [
|
||||
'generate_vulkan_types.py'])
|
||||
generated_files = input_api.AffectedFiles(
|
||||
file_filter=lambda x: os.path.basename(x.LocalPath()) in [
|
||||
'vulkan_types.mojom', 'vulkan_types_mojom_traits.h',
|
||||
'vulkan_types_mojom_traits.cc', 'vulkan_types.typemap'
|
||||
])
|
||||
|
||||
|
||||
messages = []
|
||||
|
||||
if generated_files and not generating_files:
|
||||
long_text = 'Changed files:\n'
|
||||
for file in generated_files:
|
||||
long_text += file.LocalPath() + '\n'
|
||||
long_text += '\n'
|
||||
messages.append(output_api.PresubmitError(
|
||||
'Vulkan types generated files changed but the generator '
|
||||
'did not.', long_text=long_text))
|
||||
|
||||
with input_api.temporary_directory() as temp_dir:
|
||||
commands = []
|
||||
if generating_files:
|
||||
commands.append(input_api.Command(name='generate_vulkan_types',
|
||||
cmd=[input_api.python_executable,
|
||||
'generate_vulkan_types.py',
|
||||
'--check',
|
||||
'--output-dir=' + temp_dir],
|
||||
kwargs={},
|
||||
message=output_api.PresubmitError))
|
||||
if commands:
|
||||
messages.extend(input_api.RunTests(commands))
|
||||
|
||||
return messages
|
||||
|
||||
def CheckChangeOnUpload(input_api, output_api):
|
||||
return CommonChecks(input_api, output_api)
|
||||
|
||||
def CheckChangeOnCommit(input_api, output_api):
|
||||
return CommonChecks(input_api, output_api)
|
598
gpu/ipc/common/generate_vulkan_types.py
Executable file
598
gpu/ipc/common/generate_vulkan_types.py
Executable file
@ -0,0 +1,598 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import filecmp
|
||||
import optparse
|
||||
import os.path
|
||||
import platform
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
_VULKAN_HEADER_FILE = "third_party/vulkan/include/vulkan/vulkan_core.h"
|
||||
|
||||
_STRUCTS = [
|
||||
"VkExtensionProperties",
|
||||
"VkLayerProperties",
|
||||
"VkPhysicalDeviceProperties",
|
||||
"VkPhysicalDeviceFeatures",
|
||||
"VkQueueFamilyProperties",
|
||||
]
|
||||
|
||||
_SELF_LOCATION = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
_MOJO_TYPES = set([
|
||||
"uint8",
|
||||
"uint16",
|
||||
"uint32",
|
||||
"int8",
|
||||
"int16",
|
||||
"int32",
|
||||
"float",
|
||||
"string",
|
||||
])
|
||||
|
||||
_VULKAN_BASIC_TYPE_MAP = set([
|
||||
"uint8_t",
|
||||
"uint16_t",
|
||||
"uint32_t",
|
||||
"uint64_t",
|
||||
"int8_t",
|
||||
"int16_t",
|
||||
"int32_t",
|
||||
"int64_t",
|
||||
"size_t",
|
||||
"VkBool32",
|
||||
"float",
|
||||
"char",
|
||||
])
|
||||
|
||||
# types to mojo type
|
||||
_type_map = {
|
||||
"uint8_t" : "uint8",
|
||||
"uint16_t" : "uint16",
|
||||
"uint32_t" : "uint32",
|
||||
"uint64_t" : "uint64",
|
||||
"int8_t" : "int8",
|
||||
"int16_t" : "int16",
|
||||
"int32_t" : "int32",
|
||||
"int64_t" : "int64",
|
||||
"size_t" : "uint64",
|
||||
"VkBool32" : "bool",
|
||||
"float" : "float",
|
||||
"char" : "char",
|
||||
}
|
||||
|
||||
_structs = {}
|
||||
_enums = {}
|
||||
_defines = {}
|
||||
_handles = set([])
|
||||
_generated_types = []
|
||||
|
||||
|
||||
def ValueNameToVALUE_NAME(name):
|
||||
return re.sub(
|
||||
r'(?<=[a-z])[A-Z]|(?<!^)[A-Z](?=[a-z])', r"_\g<0>", name).upper()
|
||||
|
||||
|
||||
def ParseHandle(line):
|
||||
if line.startswith("VK_DEFINE_HANDLE("):
|
||||
name = line[len("VK_DEFINE_HANDLE("):-1]
|
||||
elif line.startswith("VK_DEFINE_NON_DISPATCHABLE_HANDLE("):
|
||||
name = line[len("VK_DEFINE_NON_DISPATCHABLE_HANDLE("):-1]
|
||||
elif line.startswith("VK_DEFINE_DISPATCHABLE_HANDLE("):
|
||||
name = line[len("VK_DEFINE_DISPATCHABLE_HANDLE("):-1]
|
||||
else:
|
||||
return
|
||||
_handles.add(name)
|
||||
|
||||
|
||||
def ParseTypedef(line):
|
||||
# typedef Type1 Type1;
|
||||
line = line.rstrip(';')
|
||||
line = line.split()
|
||||
if len(line) == 3:
|
||||
typedef, t1, t2 = line
|
||||
assert typedef == "typedef"
|
||||
# We would like to use bool instead uint32 for VkBool32
|
||||
if t2 == "VkBool32":
|
||||
return
|
||||
if t1 in _type_map:
|
||||
_type_map[t2] = _type_map[t1]
|
||||
else:
|
||||
assert t1 in _structs or t1 in _enums or t1 in _handles, \
|
||||
"Undefined type '%s'" % t1
|
||||
else:
|
||||
pass
|
||||
# skip typdef for function pointer
|
||||
|
||||
|
||||
def ParseEnum(line, header_file):
|
||||
# typedef enum kName {
|
||||
# ...
|
||||
# } kName;
|
||||
name = line.split()[2]
|
||||
|
||||
# Skip VkResult and NameBits
|
||||
if name == "VkResult":
|
||||
value_name_prefix = "VK"
|
||||
elif name.endswith("FlagBits"):
|
||||
value_name_prefix = ValueNameToVALUE_NAME(name[:-len("FlagBits")])
|
||||
elif name.endswith("FlagBitsKHR"):
|
||||
value_name_prefix = ValueNameToVALUE_NAME(name[:-len("FlagBitsKHR")])
|
||||
else:
|
||||
value_name_prefix = ValueNameToVALUE_NAME(name)
|
||||
|
||||
values = []
|
||||
while True:
|
||||
line = header_file.readline().strip()
|
||||
# } kName;
|
||||
if line == "} %s;" % name:
|
||||
break
|
||||
# VK_NAME = value,
|
||||
value_name, value = line.rstrip(',').split(" = ")
|
||||
if not value.isdigit():
|
||||
# Ignore VK_NAME_BEGIN_RANGE
|
||||
# Ignore VK_NAME_END_RANGE
|
||||
# Ignore VK_NAME_RANGE_SIZE
|
||||
# Ignore VK_NAME_MAX_ENUM = 0x7FFFFFFF
|
||||
continue
|
||||
assert len(value_name_prefix) + 1 < len(value_name), \
|
||||
"Wrong enum value name `%s`" % value_name
|
||||
mojom_value_name = value_name[len(value_name_prefix) + 1:]
|
||||
values.append((value_name, value, mojom_value_name))
|
||||
assert name not in _enums, "enum '%s' has been defined." % name
|
||||
_enums[name] = values
|
||||
|
||||
|
||||
def ParseStruct(line, header_file):
|
||||
# typedef struct kName {
|
||||
# ...
|
||||
# } kName;
|
||||
name = line.split()[2]
|
||||
|
||||
fields = []
|
||||
while True:
|
||||
line = header_file.readline().strip()
|
||||
# } kName;
|
||||
if line == "} %s;" % name:
|
||||
break
|
||||
# type name;
|
||||
# const type name;
|
||||
# type name[L];
|
||||
line = line.rstrip(";")
|
||||
field_type, field_name = line.rsplit(None, 1)
|
||||
array_len = None
|
||||
if '[' in field_name:
|
||||
assert ']' in field_name
|
||||
field_name, array_len = field_name.rstrip(']').split('[')
|
||||
assert array_len.isdigit() or array_len in _defines
|
||||
fields.append((field_name, field_type, array_len))
|
||||
assert name not in _structs, "struct '%s' has been defined." % name
|
||||
_structs[name] = fields
|
||||
|
||||
|
||||
def ParseDefine(line):
|
||||
# not parse multi-line macros
|
||||
if line.endswith('\\'):
|
||||
return
|
||||
# not parse #define NAME() ...
|
||||
if '(' in line or ')' in line:
|
||||
return
|
||||
|
||||
define, name, value = line.split()
|
||||
assert define == "#define"
|
||||
assert name not in _defines, "macro '%s' has been defined." % name
|
||||
_defines[name] = value
|
||||
|
||||
|
||||
def ParseVulkanHeaderFile(path):
|
||||
with open(path) as header_file:
|
||||
while True:
|
||||
line = header_file.readline()
|
||||
if not line:
|
||||
break
|
||||
line = line.strip()
|
||||
|
||||
if line.startswith("#define"):
|
||||
ParseDefine(line)
|
||||
elif line.startswith("typedef enum "):
|
||||
ParseEnum(line, header_file)
|
||||
elif line.startswith("typedef struct "):
|
||||
ParseStruct(line, header_file)
|
||||
elif line.startswith("typedef "):
|
||||
ParseTypedef(line)
|
||||
elif line.startswith("VK_DEFINE_"):
|
||||
ParseHandle(line)
|
||||
|
||||
|
||||
def WriteMojomEnum(name, mojom_file):
|
||||
if name in _generated_types:
|
||||
return
|
||||
_generated_types.append(name)
|
||||
|
||||
values = _enums[name]
|
||||
mojom_file.write("\n")
|
||||
mojom_file.write("enum %s {\n" % name)
|
||||
for _, value, mojom_value_name in values:
|
||||
mojom_file.write(" %s = %s,\n" % (mojom_value_name, value))
|
||||
mojom_file.write(" INVALID_VALUE = -1,\n")
|
||||
mojom_file.write("};\n")
|
||||
|
||||
|
||||
def WriteMojomStruct(name, mojom_file):
|
||||
if name in _generated_types:
|
||||
return
|
||||
_generated_types.append(name)
|
||||
|
||||
fields = _structs[name]
|
||||
deps = []
|
||||
for field_name, field_type, array_len in fields:
|
||||
if field_type in _structs or field_type in _enums:
|
||||
deps.append(field_type)
|
||||
WriteMojomTypes(deps, mojom_file)
|
||||
|
||||
mojom_file.write("\n")
|
||||
mojom_file.write("struct %s {\n" % name)
|
||||
for field_name, field_type, array_len in fields:
|
||||
if field_type in _type_map:
|
||||
field_type = _type_map[field_type]
|
||||
else:
|
||||
assert field_type in _structs or field_type in _enums or \
|
||||
field_type in _handles, "Undefine type: '%s'" % field_type
|
||||
if field_type == "char":
|
||||
assert array_len
|
||||
array_len = _defines[array_len]
|
||||
mojom_file.write(" string %s;\n" % field_name)
|
||||
elif not array_len:
|
||||
mojom_file.write(" %s %s;\n" % (field_type, field_name))
|
||||
else:
|
||||
if not array_len.isdigit():
|
||||
array_len = _defines[array_len]
|
||||
assert array_len.isdigit(), "%s is not a digit." % array_len
|
||||
mojom_file.write(
|
||||
" array<%s, %s> %s;\n" % (field_type, array_len, field_name))
|
||||
mojom_file.write("};\n")
|
||||
|
||||
|
||||
def WriteMojomTypes(types, mojom_file):
|
||||
for t in types:
|
||||
if t in _structs:
|
||||
WriteMojomStruct(t, mojom_file)
|
||||
elif t in _enums:
|
||||
WriteMojomEnum(t, mojom_file)
|
||||
else:
|
||||
pass
|
||||
|
||||
|
||||
def GenerateMojom(mojom_file):
|
||||
mojom_file.write(
|
||||
'''// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// This file is auto-generated from
|
||||
// gpu/ipc/common/generate_vulkan_types.py
|
||||
// It's formatted by clang-format using chromium coding style:
|
||||
// clang-format -i -style=chromium filename
|
||||
// DO NOT EDIT!
|
||||
|
||||
module gpu.mojom;
|
||||
''')
|
||||
WriteMojomTypes(_STRUCTS, mojom_file)
|
||||
|
||||
|
||||
def WriteStructTraits(name, traits_header_file, traits_source_file):
|
||||
traits_header_file.write(
|
||||
"""
|
||||
template <>
|
||||
struct StructTraits<gpu::mojom::%sDataView, %s> {
|
||||
""" % (name, name)
|
||||
)
|
||||
|
||||
fields = _structs[name]
|
||||
for field_name, field_type, array_len in fields:
|
||||
if field_type == "VkBool32":
|
||||
field_type = "bool"
|
||||
elif field_type == "VkDeviceSize":
|
||||
field_type = "bool"
|
||||
|
||||
if field_type == "char":
|
||||
assert array_len
|
||||
traits_header_file.write(
|
||||
"""
|
||||
static base::StringPiece %s(const %s& input) {
|
||||
return input.%s;
|
||||
}
|
||||
""" % (field_name, name, field_name))
|
||||
elif array_len:
|
||||
traits_header_file.write(
|
||||
"""
|
||||
static base::span<const %s> %s(const %s& input) {
|
||||
return input.%s;
|
||||
}
|
||||
""" % (field_type, field_name, name, field_name))
|
||||
elif field_type in _structs:
|
||||
traits_header_file.write(
|
||||
"""
|
||||
static const %s& %s(const %s& input) {
|
||||
return input.%s;
|
||||
}
|
||||
""" % (field_type, field_name, name, field_name))
|
||||
else:
|
||||
traits_header_file.write(
|
||||
"""
|
||||
static %s %s(const %s& input) {
|
||||
return input.%s;
|
||||
}
|
||||
""" % (field_type, field_name, name, field_name))
|
||||
|
||||
traits_header_file.write(
|
||||
"""
|
||||
static bool Read(gpu::mojom::%sDataView data, %s* out);
|
||||
""" % (name, name))
|
||||
|
||||
traits_source_file.write(
|
||||
"""
|
||||
// static
|
||||
bool StructTraits<gpu::mojom::%sDataView, %s>::Read(
|
||||
gpu::mojom::%sDataView data, %s* out) {
|
||||
""" % (name, name, name, name))
|
||||
|
||||
fields = _structs[name]
|
||||
for field_name, field_type, array_len in fields:
|
||||
if field_type == "VkBool32":
|
||||
field_type = "bool"
|
||||
elif field_type == "VkDeviceSize":
|
||||
field_type = "bool"
|
||||
|
||||
if field_type == "char":
|
||||
assert array_len
|
||||
read_method = "Read%s%s" % (field_name[0].upper(), field_name[1:])
|
||||
traits_source_file.write(
|
||||
"""
|
||||
base::StringPiece %s;
|
||||
if (!data.%s(&%s))
|
||||
return false;
|
||||
%s.copy(out->%s, sizeof(out->%s));
|
||||
""" % (field_name, read_method, field_name, field_name, field_name, field_name))
|
||||
elif array_len:
|
||||
read_method = "Read%s%s" % (field_name[0].upper(), field_name[1:])
|
||||
traits_source_file.write(
|
||||
"""
|
||||
base::span<%s> %s(out->%s);
|
||||
if (!data.%s(&%s))
|
||||
return false;
|
||||
""" % (field_type, field_name, field_name, read_method, field_name))
|
||||
elif field_type in _structs or field_type in _enums:
|
||||
traits_source_file.write(
|
||||
"""
|
||||
if (!data.Read%s%s(&out->%s))
|
||||
return false;
|
||||
""" % (field_name[0].upper(), field_name[1:], field_name))
|
||||
else:
|
||||
traits_source_file.write(
|
||||
"""
|
||||
out->%s = data.%s();
|
||||
""" % (field_name, field_name))
|
||||
|
||||
|
||||
traits_source_file.write(
|
||||
"""
|
||||
return true;
|
||||
}
|
||||
""")
|
||||
|
||||
|
||||
traits_header_file.write("};\n")
|
||||
|
||||
|
||||
def WriteEnumTraits(name, traits_header_file):
|
||||
traits_header_file.write(
|
||||
"""
|
||||
template <>
|
||||
struct EnumTraits<gpu::mojom::%s, %s> {
|
||||
static gpu::mojom::%s ToMojom(%s input) {
|
||||
switch (input) {
|
||||
""" % (name, name, name, name))
|
||||
|
||||
for value_name, _, mojom_value_name in _enums[name]:
|
||||
traits_header_file.write(
|
||||
"""
|
||||
case %s::%s:
|
||||
return gpu::mojom::%s::%s;"""
|
||||
% (name, value_name, name, mojom_value_name))
|
||||
|
||||
traits_header_file.write(
|
||||
"""
|
||||
default:
|
||||
NOTREACHED();
|
||||
return gpu::mojom::%s::INVALID_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
static bool FromMojom(gpu::mojom::%s input, %s* out) {
|
||||
switch (input) {
|
||||
""" % (name, name, name))
|
||||
|
||||
for value_name, _, mojom_value_name in _enums[name]:
|
||||
traits_header_file.write(
|
||||
"""
|
||||
case gpu::mojom::%s::%s:
|
||||
*out = %s::%s;
|
||||
return true;""" % (name, mojom_value_name, name, value_name))
|
||||
|
||||
traits_header_file.write(
|
||||
"""
|
||||
case gpu::mojom::%s::INVALID_VALUE:
|
||||
NOTREACHED();
|
||||
return false;
|
||||
|
||||
}
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
};""" % name)
|
||||
|
||||
|
||||
|
||||
def GenerateTraitsFile(traits_header_file, traits_source_file):
|
||||
traits_header_file.write(
|
||||
"""// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// This file is auto-generated from
|
||||
// gpu/ipc/common/generate_vulkan_types.py
|
||||
// It's formatted by clang-format using chromium coding style:
|
||||
// clang-format -i -style=chromium filename
|
||||
// DO NOT EDIT!
|
||||
|
||||
#ifndef GPU_IPC_COMMON_VULKAN_TYPES_MOJOM_TRAITS_H_
|
||||
#define GPU_IPC_COMMON_VULKAN_TYPES_MOJOM_TRAITS_H_
|
||||
|
||||
#include "base/containers/span.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "gpu/ipc/common/vulkan_types.h"
|
||||
#include "gpu/ipc/common/vulkan_types.mojom-shared.h"
|
||||
|
||||
namespace mojo {
|
||||
""")
|
||||
|
||||
traits_source_file.write(
|
||||
"""// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// This file is auto-generated from
|
||||
// gpu/ipc/common/generate_vulkan_types.py
|
||||
// It's formatted by clang-format using chromium coding style:
|
||||
// clang-format -i -style=chromium filename
|
||||
// DO NOT EDIT!
|
||||
|
||||
#include "gpu/ipc/common/vulkan_info_mojom_traits.h"
|
||||
|
||||
namespace mojo {
|
||||
""")
|
||||
|
||||
for t in _generated_types:
|
||||
if t in _structs:
|
||||
WriteStructTraits(t, traits_header_file, traits_source_file)
|
||||
elif t in _enums:
|
||||
WriteEnumTraits(t, traits_header_file)
|
||||
|
||||
traits_header_file.write(
|
||||
"""
|
||||
} // namespace mojo
|
||||
|
||||
#endif // GPU_IPC_COMMON_VULKAN_TYPES_MOJOM_TRAITS_H_""")
|
||||
|
||||
traits_source_file.write(
|
||||
"""
|
||||
} // namespace mojo""")
|
||||
|
||||
|
||||
def GenerateTypemapFile(typemap_file):
|
||||
typemap_file.write(
|
||||
"""# Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# This file is auto-generated from
|
||||
# gpu/ipc/common/generate_vulkan_types.py
|
||||
# DO NOT EDIT!
|
||||
|
||||
mojom = "//gpu/ipc/common/vulkan_types.mojom"
|
||||
public_headers = [ "//gpu/ipc/common/vulkan_types.h" ]
|
||||
traits_headers = [ "//gpu/ipc/common/vulkan_types_mojom_traits.h" ]
|
||||
sources = [
|
||||
"//gpu/ipc/common/vulkan_types_mojom_traits.cc",
|
||||
]
|
||||
public_deps = [
|
||||
"//gpu/ipc/common:vulkan_types",
|
||||
]
|
||||
type_mappings = [
|
||||
""")
|
||||
for t in _generated_types:
|
||||
typemap_file.write(" \"gpu.mojom.%s=::%s\",\n" % (t, t))
|
||||
typemap_file.write("]\n")
|
||||
|
||||
|
||||
def main(argv):
|
||||
"""This is the main function."""
|
||||
|
||||
parser = optparse.OptionParser()
|
||||
parser.add_option(
|
||||
"--output-dir",
|
||||
help="Output directory for generated files. Defaults to this script's "
|
||||
"directory.")
|
||||
parser.add_option(
|
||||
"-c", "--check", action="store_true",
|
||||
help="Check if output files match generated files in chromium root "
|
||||
"directory. Use this in PRESUBMIT scripts with --output-dir.")
|
||||
|
||||
(options, _) = parser.parse_args(args=argv)
|
||||
|
||||
# Support generating files for PRESUBMIT.
|
||||
if options.output_dir:
|
||||
output_dir = options.output_dir
|
||||
else:
|
||||
output_dir = _SELF_LOCATION
|
||||
|
||||
def ClangFormat(filename):
|
||||
formatter = "clang-format"
|
||||
if platform.system() == "Windows":
|
||||
formatter += ".bat"
|
||||
subprocess.call([formatter, "-i", "-style=chromium", filename])
|
||||
|
||||
vulkan_header_file_path = os.path.join(
|
||||
_SELF_LOCATION, "../../..", _VULKAN_HEADER_FILE)
|
||||
ParseVulkanHeaderFile(vulkan_header_file_path)
|
||||
|
||||
mojom_file_name = "vulkan_types.mojom"
|
||||
mojom_file = open(
|
||||
os.path.join(output_dir, mojom_file_name), 'wb')
|
||||
GenerateMojom(mojom_file)
|
||||
mojom_file.close()
|
||||
ClangFormat(mojom_file.name)
|
||||
|
||||
traits_header_file_name = "vulkan_types_mojom_traits.h"
|
||||
traits_header_file = \
|
||||
open(os.path.join(output_dir, traits_header_file_name), 'wb')
|
||||
traits_source_file_name = "vulkan_types_mojom_traits.cc"
|
||||
traits_source_file = \
|
||||
open(os.path.join(output_dir, traits_source_file_name), 'wb')
|
||||
GenerateTraitsFile(traits_header_file, traits_source_file)
|
||||
traits_header_file.close()
|
||||
ClangFormat(traits_header_file.name)
|
||||
traits_source_file.close()
|
||||
ClangFormat(traits_source_file.name)
|
||||
|
||||
typemap_file_name = "vulkan_types.typemap"
|
||||
typemap_file = open(
|
||||
os.path.join(output_dir, typemap_file_name), 'wb')
|
||||
GenerateTypemapFile(typemap_file)
|
||||
typemap_file.close()
|
||||
|
||||
check_failed_filenames = []
|
||||
if options.check:
|
||||
for filename in [mojom_file_name, traits_header_file_name,
|
||||
traits_source_file_name, typemap_file_name]:
|
||||
if not filecmp.cmp(os.path.join(output_dir, filename),
|
||||
os.path.join(_SELF_LOCATION, filename)):
|
||||
check_failed_filenames.append(filename)
|
||||
|
||||
if len(check_failed_filenames) > 0:
|
||||
print 'Please run gpu/ipc/common/generate_vulkan_types.py'
|
||||
print 'Failed check on generated files:'
|
||||
for filename in check_failed_filenames:
|
||||
print filename
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv))
|
@ -9,6 +9,9 @@ import "gpu/ipc/common/dx_diag_node.mojom";
|
||||
import "mojo/public/mojom/base/time.mojom";
|
||||
import "ui/gfx/geometry/mojom/geometry.mojom";
|
||||
|
||||
[EnableIf=supports_vulkan]
|
||||
import "gpu/ipc/common/vulkan_info.mojom";
|
||||
|
||||
// gpu::GPUInfo::GPUDevice
|
||||
struct GpuDevice {
|
||||
uint32 vendor_id;
|
||||
@ -173,4 +176,7 @@ struct GpuInfo {
|
||||
uint64 rgba_visual;
|
||||
bool oop_rasterization_supported;
|
||||
bool subpixel_font_rendering;
|
||||
|
||||
[EnableIf=supports_vulkan]
|
||||
VulkanInfo? vulkan_info;
|
||||
};
|
||||
|
@ -8,6 +8,10 @@
|
||||
#include "base/logging.h"
|
||||
#include "mojo/public/cpp/base/time_mojom_traits.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_VULKAN)
|
||||
#include "gpu/ipc/common/vulkan_info_mojom_traits.h"
|
||||
#endif
|
||||
|
||||
namespace mojo {
|
||||
|
||||
// static
|
||||
@ -413,7 +417,11 @@ bool StructTraits<gpu::mojom::GpuInfoDataView, gpu::GPUInfo>::Read(
|
||||
data.ReadVideoEncodeAcceleratorSupportedProfiles(
|
||||
&out->video_encode_accelerator_supported_profiles) &&
|
||||
data.ReadImageDecodeAcceleratorSupportedProfiles(
|
||||
&out->image_decode_accelerator_supported_profiles);
|
||||
&out->image_decode_accelerator_supported_profiles) &&
|
||||
#if BUILDFLAG(ENABLE_VULKAN)
|
||||
data.ReadVulkanInfo(&out->vulkan_info) &&
|
||||
#endif
|
||||
true;
|
||||
}
|
||||
|
||||
} // namespace mojo
|
||||
|
@ -395,6 +395,13 @@ struct StructTraits<gpu::mojom::GpuInfoDataView, gpu::GPUInfo> {
|
||||
static bool subpixel_font_rendering(const gpu::GPUInfo& input) {
|
||||
return input.subpixel_font_rendering;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_VULKAN)
|
||||
static const base::Optional<gpu::VulkanInfo> vulkan_info(
|
||||
const gpu::GPUInfo& input) {
|
||||
return input.vulkan_info;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace mojo
|
||||
|
@ -16,4 +16,6 @@ typemaps = [
|
||||
"//gpu/ipc/common/surface_handle.typemap",
|
||||
"//gpu/ipc/common/sync_token.typemap",
|
||||
"//gpu/ipc/common/vulkan_ycbcr_info.typemap",
|
||||
"//gpu/ipc/common/vulkan_info.typemap",
|
||||
"//gpu/ipc/common/vulkan_types.typemap",
|
||||
]
|
||||
|
26
gpu/ipc/common/vulkan_info.mojom
Normal file
26
gpu/ipc/common/vulkan_info.mojom
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// gpu/config/vulkan_info.h
|
||||
module gpu.mojom;
|
||||
|
||||
import "gpu/ipc/common/vulkan_types.mojom";
|
||||
|
||||
struct VulkanPhysicalDeviceInfo {
|
||||
VkPhysicalDeviceProperties properties;
|
||||
array<VkLayerProperties> layers;
|
||||
VkPhysicalDeviceFeatures features;
|
||||
bool feature_sampler_ycbcr_conversion;
|
||||
bool feature_protected_memory;
|
||||
array<VkQueueFamilyProperties> queue_families;
|
||||
};
|
||||
|
||||
struct VulkanInfo {
|
||||
uint32 api_version;
|
||||
uint32 used_api_version;
|
||||
array<VkExtensionProperties> instance_extensions;
|
||||
array<string> enabled_instance_extensions;
|
||||
array<VkLayerProperties> instance_layers;
|
||||
array<VulkanPhysicalDeviceInfo> physical_devices;
|
||||
};
|
16
gpu/ipc/common/vulkan_info.typemap
Normal file
16
gpu/ipc/common/vulkan_info.typemap
Normal file
@ -0,0 +1,16 @@
|
||||
# Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
mojom = "//gpu/ipc/common/vulkan_info.mojom"
|
||||
public_headers = [ "//gpu/config/vulkan_info.h" ]
|
||||
traits_headers = [ "//gpu/ipc/common/vulkan_info_mojom_traits.h" ]
|
||||
public_deps = [
|
||||
# "//gpu/config",
|
||||
"//gpu/ipc/common:vulkan_types",
|
||||
"//gpu/ipc/common:vulkan_types_mojom_traits",
|
||||
]
|
||||
type_mappings = [
|
||||
"gpu.mojom.VulkanPhysicalDeviceInfo=::gpu::VulkanPhysicalDeviceInfo",
|
||||
"gpu.mojom.VulkanInfo=::gpu::VulkanInfo",
|
||||
]
|
118
gpu/ipc/common/vulkan_info_mojom_traits.h
Normal file
118
gpu/ipc/common/vulkan_info_mojom_traits.h
Normal file
@ -0,0 +1,118 @@
|
||||
// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef GPU_IPC_COMMON_VULKAN_INFO_MOJOM_TRAITS_H_
|
||||
#define GPU_IPC_COMMON_VULKAN_INFO_MOJOM_TRAITS_H_
|
||||
|
||||
#include "base/containers/span.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "gpu/config/vulkan_info.h"
|
||||
#include "gpu/ipc/common/vulkan_info.mojom-shared.h"
|
||||
#include "gpu/ipc/common/vulkan_types_mojom_traits.h"
|
||||
|
||||
namespace mojo {
|
||||
|
||||
template <>
|
||||
struct StructTraits<gpu::mojom::VulkanPhysicalDeviceInfoDataView,
|
||||
gpu::VulkanPhysicalDeviceInfo> {
|
||||
static const VkPhysicalDeviceProperties& properties(
|
||||
const gpu::VulkanPhysicalDeviceInfo& input) {
|
||||
return input.properties;
|
||||
}
|
||||
|
||||
static const std::vector<VkLayerProperties>& layers(
|
||||
const gpu::VulkanPhysicalDeviceInfo& input) {
|
||||
return input.layers;
|
||||
}
|
||||
|
||||
static const VkPhysicalDeviceFeatures& features(
|
||||
const gpu::VulkanPhysicalDeviceInfo& input) {
|
||||
return input.features;
|
||||
}
|
||||
|
||||
static bool feature_sampler_ycbcr_conversion(
|
||||
const gpu::VulkanPhysicalDeviceInfo& input) {
|
||||
return input.feature_sampler_ycbcr_conversion;
|
||||
}
|
||||
|
||||
static bool feature_protected_memory(
|
||||
const gpu::VulkanPhysicalDeviceInfo& input) {
|
||||
return input.feature_protected_memory;
|
||||
}
|
||||
|
||||
static const std::vector<VkQueueFamilyProperties>& queue_families(
|
||||
const gpu::VulkanPhysicalDeviceInfo& input) {
|
||||
return input.queue_families;
|
||||
}
|
||||
|
||||
static bool Read(gpu::mojom::VulkanPhysicalDeviceInfoDataView data,
|
||||
gpu::VulkanPhysicalDeviceInfo* out) {
|
||||
if (!data.ReadProperties(&out->properties))
|
||||
return false;
|
||||
if (!data.ReadLayers(&out->layers))
|
||||
return false;
|
||||
if (!data.ReadFeatures(&out->features))
|
||||
return false;
|
||||
out->feature_sampler_ycbcr_conversion =
|
||||
data.feature_sampler_ycbcr_conversion();
|
||||
out->feature_protected_memory = data.feature_protected_memory();
|
||||
if (!data.ReadQueueFamilies(&out->queue_families))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct StructTraits<gpu::mojom::VulkanInfoDataView, gpu::VulkanInfo> {
|
||||
static uint32_t api_version(const gpu::VulkanInfo& input) {
|
||||
return input.api_version;
|
||||
}
|
||||
|
||||
static uint32_t used_api_version(const gpu::VulkanInfo& input) {
|
||||
return input.used_api_version;
|
||||
}
|
||||
|
||||
static const std::vector<VkExtensionProperties>& instance_extensions(
|
||||
const gpu::VulkanInfo& input) {
|
||||
return input.instance_extensions;
|
||||
}
|
||||
|
||||
static std::vector<base::StringPiece> enabled_instance_extensions(
|
||||
const gpu::VulkanInfo& input) {
|
||||
std::vector<base::StringPiece> extensions;
|
||||
extensions.reserve(input.enabled_instance_extensions.size());
|
||||
for (const char* extension : input.enabled_instance_extensions)
|
||||
extensions.emplace_back(extension);
|
||||
return extensions;
|
||||
}
|
||||
|
||||
static const std::vector<VkLayerProperties>& instance_layers(
|
||||
const gpu::VulkanInfo& input) {
|
||||
return input.instance_layers;
|
||||
}
|
||||
|
||||
static const std::vector<gpu::VulkanPhysicalDeviceInfo>& physical_devices(
|
||||
const gpu::VulkanInfo& input) {
|
||||
return input.physical_devices;
|
||||
}
|
||||
|
||||
static bool Read(gpu::mojom::VulkanInfoDataView data, gpu::VulkanInfo* out) {
|
||||
out->api_version = data.api_version();
|
||||
out->used_api_version = data.used_api_version();
|
||||
|
||||
if (!data.ReadInstanceExtensions(&out->instance_extensions))
|
||||
return false;
|
||||
|
||||
std::vector<base::StringPiece> extensions;
|
||||
if (!data.ReadEnabledInstanceExtensions(&extensions))
|
||||
return false;
|
||||
out->SetEnabledInstanceExtensions(extensions);
|
||||
return data.ReadInstanceLayers(&out->instance_layers) &&
|
||||
data.ReadPhysicalDevices(&out->physical_devices);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace mojo
|
||||
|
||||
#endif // GPU_IPC_COMMON_VULKAN_INFO_MOJOM_TRAITS_H_
|
10
gpu/ipc/common/vulkan_types.h
Normal file
10
gpu/ipc/common/vulkan_types.h
Normal file
@ -0,0 +1,10 @@
|
||||
// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef GPU_IPC_COMMON_VULKAN_TYPES_H_
|
||||
#define GPU_IPC_COMMON_VULKAN_TYPES_H_
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
#endif // GPU_IPC_COMMON_VULKAN_TYPES_H_
|
232
gpu/ipc/common/vulkan_types.mojom
Normal file
232
gpu/ipc/common/vulkan_types.mojom
Normal file
@ -0,0 +1,232 @@
|
||||
// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// This file is auto-generated from
|
||||
// gpu/ipc/common/generate_vulkan_types.py
|
||||
// It's formatted by clang-format using chromium coding style:
|
||||
// clang-format -i -style=chromium filename
|
||||
// DO NOT EDIT!
|
||||
|
||||
module gpu.mojom;
|
||||
|
||||
struct VkExtensionProperties {
|
||||
string extensionName;
|
||||
uint32 specVersion;
|
||||
};
|
||||
|
||||
struct VkLayerProperties {
|
||||
string layerName;
|
||||
uint32 specVersion;
|
||||
uint32 implementationVersion;
|
||||
string description;
|
||||
};
|
||||
|
||||
enum VkPhysicalDeviceType {
|
||||
OTHER = 0,
|
||||
INTEGRATED_GPU = 1,
|
||||
DISCRETE_GPU = 2,
|
||||
VIRTUAL_GPU = 3,
|
||||
CPU = 4,
|
||||
INVALID_VALUE = -1,
|
||||
};
|
||||
|
||||
struct VkPhysicalDeviceLimits {
|
||||
uint32 maxImageDimension1D;
|
||||
uint32 maxImageDimension2D;
|
||||
uint32 maxImageDimension3D;
|
||||
uint32 maxImageDimensionCube;
|
||||
uint32 maxImageArrayLayers;
|
||||
uint32 maxTexelBufferElements;
|
||||
uint32 maxUniformBufferRange;
|
||||
uint32 maxStorageBufferRange;
|
||||
uint32 maxPushConstantsSize;
|
||||
uint32 maxMemoryAllocationCount;
|
||||
uint32 maxSamplerAllocationCount;
|
||||
uint64 bufferImageGranularity;
|
||||
uint64 sparseAddressSpaceSize;
|
||||
uint32 maxBoundDescriptorSets;
|
||||
uint32 maxPerStageDescriptorSamplers;
|
||||
uint32 maxPerStageDescriptorUniformBuffers;
|
||||
uint32 maxPerStageDescriptorStorageBuffers;
|
||||
uint32 maxPerStageDescriptorSampledImages;
|
||||
uint32 maxPerStageDescriptorStorageImages;
|
||||
uint32 maxPerStageDescriptorInputAttachments;
|
||||
uint32 maxPerStageResources;
|
||||
uint32 maxDescriptorSetSamplers;
|
||||
uint32 maxDescriptorSetUniformBuffers;
|
||||
uint32 maxDescriptorSetUniformBuffersDynamic;
|
||||
uint32 maxDescriptorSetStorageBuffers;
|
||||
uint32 maxDescriptorSetStorageBuffersDynamic;
|
||||
uint32 maxDescriptorSetSampledImages;
|
||||
uint32 maxDescriptorSetStorageImages;
|
||||
uint32 maxDescriptorSetInputAttachments;
|
||||
uint32 maxVertexInputAttributes;
|
||||
uint32 maxVertexInputBindings;
|
||||
uint32 maxVertexInputAttributeOffset;
|
||||
uint32 maxVertexInputBindingStride;
|
||||
uint32 maxVertexOutputComponents;
|
||||
uint32 maxTessellationGenerationLevel;
|
||||
uint32 maxTessellationPatchSize;
|
||||
uint32 maxTessellationControlPerVertexInputComponents;
|
||||
uint32 maxTessellationControlPerVertexOutputComponents;
|
||||
uint32 maxTessellationControlPerPatchOutputComponents;
|
||||
uint32 maxTessellationControlTotalOutputComponents;
|
||||
uint32 maxTessellationEvaluationInputComponents;
|
||||
uint32 maxTessellationEvaluationOutputComponents;
|
||||
uint32 maxGeometryShaderInvocations;
|
||||
uint32 maxGeometryInputComponents;
|
||||
uint32 maxGeometryOutputComponents;
|
||||
uint32 maxGeometryOutputVertices;
|
||||
uint32 maxGeometryTotalOutputComponents;
|
||||
uint32 maxFragmentInputComponents;
|
||||
uint32 maxFragmentOutputAttachments;
|
||||
uint32 maxFragmentDualSrcAttachments;
|
||||
uint32 maxFragmentCombinedOutputResources;
|
||||
uint32 maxComputeSharedMemorySize;
|
||||
array<uint32, 3> maxComputeWorkGroupCount;
|
||||
uint32 maxComputeWorkGroupInvocations;
|
||||
array<uint32, 3> maxComputeWorkGroupSize;
|
||||
uint32 subPixelPrecisionBits;
|
||||
uint32 subTexelPrecisionBits;
|
||||
uint32 mipmapPrecisionBits;
|
||||
uint32 maxDrawIndexedIndexValue;
|
||||
uint32 maxDrawIndirectCount;
|
||||
float maxSamplerLodBias;
|
||||
float maxSamplerAnisotropy;
|
||||
uint32 maxViewports;
|
||||
array<uint32, 2> maxViewportDimensions;
|
||||
array<float, 2> viewportBoundsRange;
|
||||
uint32 viewportSubPixelBits;
|
||||
uint64 minMemoryMapAlignment;
|
||||
uint64 minTexelBufferOffsetAlignment;
|
||||
uint64 minUniformBufferOffsetAlignment;
|
||||
uint64 minStorageBufferOffsetAlignment;
|
||||
int32 minTexelOffset;
|
||||
uint32 maxTexelOffset;
|
||||
int32 minTexelGatherOffset;
|
||||
uint32 maxTexelGatherOffset;
|
||||
float minInterpolationOffset;
|
||||
float maxInterpolationOffset;
|
||||
uint32 subPixelInterpolationOffsetBits;
|
||||
uint32 maxFramebufferWidth;
|
||||
uint32 maxFramebufferHeight;
|
||||
uint32 maxFramebufferLayers;
|
||||
uint32 framebufferColorSampleCounts;
|
||||
uint32 framebufferDepthSampleCounts;
|
||||
uint32 framebufferStencilSampleCounts;
|
||||
uint32 framebufferNoAttachmentsSampleCounts;
|
||||
uint32 maxColorAttachments;
|
||||
uint32 sampledImageColorSampleCounts;
|
||||
uint32 sampledImageIntegerSampleCounts;
|
||||
uint32 sampledImageDepthSampleCounts;
|
||||
uint32 sampledImageStencilSampleCounts;
|
||||
uint32 storageImageSampleCounts;
|
||||
uint32 maxSampleMaskWords;
|
||||
bool timestampComputeAndGraphics;
|
||||
float timestampPeriod;
|
||||
uint32 maxClipDistances;
|
||||
uint32 maxCullDistances;
|
||||
uint32 maxCombinedClipAndCullDistances;
|
||||
uint32 discreteQueuePriorities;
|
||||
array<float, 2> pointSizeRange;
|
||||
array<float, 2> lineWidthRange;
|
||||
float pointSizeGranularity;
|
||||
float lineWidthGranularity;
|
||||
bool strictLines;
|
||||
bool standardSampleLocations;
|
||||
uint64 optimalBufferCopyOffsetAlignment;
|
||||
uint64 optimalBufferCopyRowPitchAlignment;
|
||||
uint64 nonCoherentAtomSize;
|
||||
};
|
||||
|
||||
struct VkPhysicalDeviceSparseProperties {
|
||||
bool residencyStandard2DBlockShape;
|
||||
bool residencyStandard2DMultisampleBlockShape;
|
||||
bool residencyStandard3DBlockShape;
|
||||
bool residencyAlignedMipSize;
|
||||
bool residencyNonResidentStrict;
|
||||
};
|
||||
|
||||
struct VkPhysicalDeviceProperties {
|
||||
uint32 apiVersion;
|
||||
uint32 driverVersion;
|
||||
uint32 vendorID;
|
||||
uint32 deviceID;
|
||||
VkPhysicalDeviceType deviceType;
|
||||
string deviceName;
|
||||
array<uint8, 16> pipelineCacheUUID;
|
||||
VkPhysicalDeviceLimits limits;
|
||||
VkPhysicalDeviceSparseProperties sparseProperties;
|
||||
};
|
||||
|
||||
struct VkPhysicalDeviceFeatures {
|
||||
bool robustBufferAccess;
|
||||
bool fullDrawIndexUint32;
|
||||
bool imageCubeArray;
|
||||
bool independentBlend;
|
||||
bool geometryShader;
|
||||
bool tessellationShader;
|
||||
bool sampleRateShading;
|
||||
bool dualSrcBlend;
|
||||
bool logicOp;
|
||||
bool multiDrawIndirect;
|
||||
bool drawIndirectFirstInstance;
|
||||
bool depthClamp;
|
||||
bool depthBiasClamp;
|
||||
bool fillModeNonSolid;
|
||||
bool depthBounds;
|
||||
bool wideLines;
|
||||
bool largePoints;
|
||||
bool alphaToOne;
|
||||
bool multiViewport;
|
||||
bool samplerAnisotropy;
|
||||
bool textureCompressionETC2;
|
||||
bool textureCompressionASTC_LDR;
|
||||
bool textureCompressionBC;
|
||||
bool occlusionQueryPrecise;
|
||||
bool pipelineStatisticsQuery;
|
||||
bool vertexPipelineStoresAndAtomics;
|
||||
bool fragmentStoresAndAtomics;
|
||||
bool shaderTessellationAndGeometryPointSize;
|
||||
bool shaderImageGatherExtended;
|
||||
bool shaderStorageImageExtendedFormats;
|
||||
bool shaderStorageImageMultisample;
|
||||
bool shaderStorageImageReadWithoutFormat;
|
||||
bool shaderStorageImageWriteWithoutFormat;
|
||||
bool shaderUniformBufferArrayDynamicIndexing;
|
||||
bool shaderSampledImageArrayDynamicIndexing;
|
||||
bool shaderStorageBufferArrayDynamicIndexing;
|
||||
bool shaderStorageImageArrayDynamicIndexing;
|
||||
bool shaderClipDistance;
|
||||
bool shaderCullDistance;
|
||||
bool shaderFloat64;
|
||||
bool shaderInt64;
|
||||
bool shaderInt16;
|
||||
bool shaderResourceResidency;
|
||||
bool shaderResourceMinLod;
|
||||
bool sparseBinding;
|
||||
bool sparseResidencyBuffer;
|
||||
bool sparseResidencyImage2D;
|
||||
bool sparseResidencyImage3D;
|
||||
bool sparseResidency2Samples;
|
||||
bool sparseResidency4Samples;
|
||||
bool sparseResidency8Samples;
|
||||
bool sparseResidency16Samples;
|
||||
bool sparseResidencyAliased;
|
||||
bool variableMultisampleRate;
|
||||
bool inheritedQueries;
|
||||
};
|
||||
|
||||
struct VkExtent3D {
|
||||
uint32 width;
|
||||
uint32 height;
|
||||
uint32 depth;
|
||||
};
|
||||
|
||||
struct VkQueueFamilyProperties {
|
||||
uint32 queueFlags;
|
||||
uint32 queueCount;
|
||||
uint32 timestampValidBits;
|
||||
VkExtent3D minImageTransferGranularity;
|
||||
};
|
28
gpu/ipc/common/vulkan_types.typemap
Normal file
28
gpu/ipc/common/vulkan_types.typemap
Normal file
@ -0,0 +1,28 @@
|
||||
# Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# This file is auto-generated from
|
||||
# gpu/ipc/common/generate_vulkan_types.py
|
||||
# DO NOT EDIT!
|
||||
|
||||
mojom = "//gpu/ipc/common/vulkan_types.mojom"
|
||||
public_headers = [ "//gpu/ipc/common/vulkan_types.h" ]
|
||||
traits_headers = [ "//gpu/ipc/common/vulkan_types_mojom_traits.h" ]
|
||||
sources = [
|
||||
"//gpu/ipc/common/vulkan_types_mojom_traits.cc",
|
||||
]
|
||||
public_deps = [
|
||||
"//gpu/ipc/common:vulkan_types",
|
||||
]
|
||||
type_mappings = [
|
||||
"gpu.mojom.VkExtensionProperties=::VkExtensionProperties",
|
||||
"gpu.mojom.VkLayerProperties=::VkLayerProperties",
|
||||
"gpu.mojom.VkPhysicalDeviceProperties=::VkPhysicalDeviceProperties",
|
||||
"gpu.mojom.VkPhysicalDeviceType=::VkPhysicalDeviceType",
|
||||
"gpu.mojom.VkPhysicalDeviceLimits=::VkPhysicalDeviceLimits",
|
||||
"gpu.mojom.VkPhysicalDeviceSparseProperties=::VkPhysicalDeviceSparseProperties",
|
||||
"gpu.mojom.VkPhysicalDeviceFeatures=::VkPhysicalDeviceFeatures",
|
||||
"gpu.mojom.VkQueueFamilyProperties=::VkQueueFamilyProperties",
|
||||
"gpu.mojom.VkExtent3D=::VkExtent3D",
|
||||
]
|
510
gpu/ipc/common/vulkan_types_mojom_traits.cc
Normal file
510
gpu/ipc/common/vulkan_types_mojom_traits.cc
Normal file
@ -0,0 +1,510 @@
|
||||
// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// This file is auto-generated from
|
||||
// gpu/ipc/common/generate_vulkan_types.py
|
||||
// It's formatted by clang-format using chromium coding style:
|
||||
// clang-format -i -style=chromium filename
|
||||
// DO NOT EDIT!
|
||||
|
||||
#include "gpu/ipc/common/vulkan_info_mojom_traits.h"
|
||||
|
||||
namespace mojo {
|
||||
|
||||
// static
|
||||
bool StructTraits<
|
||||
gpu::mojom::VkExtensionPropertiesDataView,
|
||||
VkExtensionProperties>::Read(gpu::mojom::VkExtensionPropertiesDataView data,
|
||||
VkExtensionProperties* out) {
|
||||
base::StringPiece extensionName;
|
||||
if (!data.ReadExtensionName(&extensionName))
|
||||
return false;
|
||||
extensionName.copy(out->extensionName, sizeof(out->extensionName));
|
||||
|
||||
out->specVersion = data.specVersion();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
bool StructTraits<gpu::mojom::VkLayerPropertiesDataView, VkLayerProperties>::
|
||||
Read(gpu::mojom::VkLayerPropertiesDataView data, VkLayerProperties* out) {
|
||||
base::StringPiece layerName;
|
||||
if (!data.ReadLayerName(&layerName))
|
||||
return false;
|
||||
layerName.copy(out->layerName, sizeof(out->layerName));
|
||||
|
||||
out->specVersion = data.specVersion();
|
||||
|
||||
out->implementationVersion = data.implementationVersion();
|
||||
|
||||
base::StringPiece description;
|
||||
if (!data.ReadDescription(&description))
|
||||
return false;
|
||||
description.copy(out->description, sizeof(out->description));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
bool StructTraits<gpu::mojom::VkPhysicalDevicePropertiesDataView,
|
||||
VkPhysicalDeviceProperties>::
|
||||
Read(gpu::mojom::VkPhysicalDevicePropertiesDataView data,
|
||||
VkPhysicalDeviceProperties* out) {
|
||||
out->apiVersion = data.apiVersion();
|
||||
|
||||
out->driverVersion = data.driverVersion();
|
||||
|
||||
out->vendorID = data.vendorID();
|
||||
|
||||
out->deviceID = data.deviceID();
|
||||
|
||||
if (!data.ReadDeviceType(&out->deviceType))
|
||||
return false;
|
||||
|
||||
base::StringPiece deviceName;
|
||||
if (!data.ReadDeviceName(&deviceName))
|
||||
return false;
|
||||
deviceName.copy(out->deviceName, sizeof(out->deviceName));
|
||||
|
||||
base::span<uint8_t> pipelineCacheUUID(out->pipelineCacheUUID);
|
||||
if (!data.ReadPipelineCacheUUID(&pipelineCacheUUID))
|
||||
return false;
|
||||
|
||||
if (!data.ReadLimits(&out->limits))
|
||||
return false;
|
||||
|
||||
if (!data.ReadSparseProperties(&out->sparseProperties))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
bool StructTraits<gpu::mojom::VkPhysicalDeviceLimitsDataView,
|
||||
VkPhysicalDeviceLimits>::
|
||||
Read(gpu::mojom::VkPhysicalDeviceLimitsDataView data,
|
||||
VkPhysicalDeviceLimits* out) {
|
||||
out->maxImageDimension1D = data.maxImageDimension1D();
|
||||
|
||||
out->maxImageDimension2D = data.maxImageDimension2D();
|
||||
|
||||
out->maxImageDimension3D = data.maxImageDimension3D();
|
||||
|
||||
out->maxImageDimensionCube = data.maxImageDimensionCube();
|
||||
|
||||
out->maxImageArrayLayers = data.maxImageArrayLayers();
|
||||
|
||||
out->maxTexelBufferElements = data.maxTexelBufferElements();
|
||||
|
||||
out->maxUniformBufferRange = data.maxUniformBufferRange();
|
||||
|
||||
out->maxStorageBufferRange = data.maxStorageBufferRange();
|
||||
|
||||
out->maxPushConstantsSize = data.maxPushConstantsSize();
|
||||
|
||||
out->maxMemoryAllocationCount = data.maxMemoryAllocationCount();
|
||||
|
||||
out->maxSamplerAllocationCount = data.maxSamplerAllocationCount();
|
||||
|
||||
out->bufferImageGranularity = data.bufferImageGranularity();
|
||||
|
||||
out->sparseAddressSpaceSize = data.sparseAddressSpaceSize();
|
||||
|
||||
out->maxBoundDescriptorSets = data.maxBoundDescriptorSets();
|
||||
|
||||
out->maxPerStageDescriptorSamplers = data.maxPerStageDescriptorSamplers();
|
||||
|
||||
out->maxPerStageDescriptorUniformBuffers =
|
||||
data.maxPerStageDescriptorUniformBuffers();
|
||||
|
||||
out->maxPerStageDescriptorStorageBuffers =
|
||||
data.maxPerStageDescriptorStorageBuffers();
|
||||
|
||||
out->maxPerStageDescriptorSampledImages =
|
||||
data.maxPerStageDescriptorSampledImages();
|
||||
|
||||
out->maxPerStageDescriptorStorageImages =
|
||||
data.maxPerStageDescriptorStorageImages();
|
||||
|
||||
out->maxPerStageDescriptorInputAttachments =
|
||||
data.maxPerStageDescriptorInputAttachments();
|
||||
|
||||
out->maxPerStageResources = data.maxPerStageResources();
|
||||
|
||||
out->maxDescriptorSetSamplers = data.maxDescriptorSetSamplers();
|
||||
|
||||
out->maxDescriptorSetUniformBuffers = data.maxDescriptorSetUniformBuffers();
|
||||
|
||||
out->maxDescriptorSetUniformBuffersDynamic =
|
||||
data.maxDescriptorSetUniformBuffersDynamic();
|
||||
|
||||
out->maxDescriptorSetStorageBuffers = data.maxDescriptorSetStorageBuffers();
|
||||
|
||||
out->maxDescriptorSetStorageBuffersDynamic =
|
||||
data.maxDescriptorSetStorageBuffersDynamic();
|
||||
|
||||
out->maxDescriptorSetSampledImages = data.maxDescriptorSetSampledImages();
|
||||
|
||||
out->maxDescriptorSetStorageImages = data.maxDescriptorSetStorageImages();
|
||||
|
||||
out->maxDescriptorSetInputAttachments =
|
||||
data.maxDescriptorSetInputAttachments();
|
||||
|
||||
out->maxVertexInputAttributes = data.maxVertexInputAttributes();
|
||||
|
||||
out->maxVertexInputBindings = data.maxVertexInputBindings();
|
||||
|
||||
out->maxVertexInputAttributeOffset = data.maxVertexInputAttributeOffset();
|
||||
|
||||
out->maxVertexInputBindingStride = data.maxVertexInputBindingStride();
|
||||
|
||||
out->maxVertexOutputComponents = data.maxVertexOutputComponents();
|
||||
|
||||
out->maxTessellationGenerationLevel = data.maxTessellationGenerationLevel();
|
||||
|
||||
out->maxTessellationPatchSize = data.maxTessellationPatchSize();
|
||||
|
||||
out->maxTessellationControlPerVertexInputComponents =
|
||||
data.maxTessellationControlPerVertexInputComponents();
|
||||
|
||||
out->maxTessellationControlPerVertexOutputComponents =
|
||||
data.maxTessellationControlPerVertexOutputComponents();
|
||||
|
||||
out->maxTessellationControlPerPatchOutputComponents =
|
||||
data.maxTessellationControlPerPatchOutputComponents();
|
||||
|
||||
out->maxTessellationControlTotalOutputComponents =
|
||||
data.maxTessellationControlTotalOutputComponents();
|
||||
|
||||
out->maxTessellationEvaluationInputComponents =
|
||||
data.maxTessellationEvaluationInputComponents();
|
||||
|
||||
out->maxTessellationEvaluationOutputComponents =
|
||||
data.maxTessellationEvaluationOutputComponents();
|
||||
|
||||
out->maxGeometryShaderInvocations = data.maxGeometryShaderInvocations();
|
||||
|
||||
out->maxGeometryInputComponents = data.maxGeometryInputComponents();
|
||||
|
||||
out->maxGeometryOutputComponents = data.maxGeometryOutputComponents();
|
||||
|
||||
out->maxGeometryOutputVertices = data.maxGeometryOutputVertices();
|
||||
|
||||
out->maxGeometryTotalOutputComponents =
|
||||
data.maxGeometryTotalOutputComponents();
|
||||
|
||||
out->maxFragmentInputComponents = data.maxFragmentInputComponents();
|
||||
|
||||
out->maxFragmentOutputAttachments = data.maxFragmentOutputAttachments();
|
||||
|
||||
out->maxFragmentDualSrcAttachments = data.maxFragmentDualSrcAttachments();
|
||||
|
||||
out->maxFragmentCombinedOutputResources =
|
||||
data.maxFragmentCombinedOutputResources();
|
||||
|
||||
out->maxComputeSharedMemorySize = data.maxComputeSharedMemorySize();
|
||||
|
||||
base::span<uint32_t> maxComputeWorkGroupCount(out->maxComputeWorkGroupCount);
|
||||
if (!data.ReadMaxComputeWorkGroupCount(&maxComputeWorkGroupCount))
|
||||
return false;
|
||||
|
||||
out->maxComputeWorkGroupInvocations = data.maxComputeWorkGroupInvocations();
|
||||
|
||||
base::span<uint32_t> maxComputeWorkGroupSize(out->maxComputeWorkGroupSize);
|
||||
if (!data.ReadMaxComputeWorkGroupSize(&maxComputeWorkGroupSize))
|
||||
return false;
|
||||
|
||||
out->subPixelPrecisionBits = data.subPixelPrecisionBits();
|
||||
|
||||
out->subTexelPrecisionBits = data.subTexelPrecisionBits();
|
||||
|
||||
out->mipmapPrecisionBits = data.mipmapPrecisionBits();
|
||||
|
||||
out->maxDrawIndexedIndexValue = data.maxDrawIndexedIndexValue();
|
||||
|
||||
out->maxDrawIndirectCount = data.maxDrawIndirectCount();
|
||||
|
||||
out->maxSamplerLodBias = data.maxSamplerLodBias();
|
||||
|
||||
out->maxSamplerAnisotropy = data.maxSamplerAnisotropy();
|
||||
|
||||
out->maxViewports = data.maxViewports();
|
||||
|
||||
base::span<uint32_t> maxViewportDimensions(out->maxViewportDimensions);
|
||||
if (!data.ReadMaxViewportDimensions(&maxViewportDimensions))
|
||||
return false;
|
||||
|
||||
base::span<float> viewportBoundsRange(out->viewportBoundsRange);
|
||||
if (!data.ReadViewportBoundsRange(&viewportBoundsRange))
|
||||
return false;
|
||||
|
||||
out->viewportSubPixelBits = data.viewportSubPixelBits();
|
||||
|
||||
out->minMemoryMapAlignment = data.minMemoryMapAlignment();
|
||||
|
||||
out->minTexelBufferOffsetAlignment = data.minTexelBufferOffsetAlignment();
|
||||
|
||||
out->minUniformBufferOffsetAlignment = data.minUniformBufferOffsetAlignment();
|
||||
|
||||
out->minStorageBufferOffsetAlignment = data.minStorageBufferOffsetAlignment();
|
||||
|
||||
out->minTexelOffset = data.minTexelOffset();
|
||||
|
||||
out->maxTexelOffset = data.maxTexelOffset();
|
||||
|
||||
out->minTexelGatherOffset = data.minTexelGatherOffset();
|
||||
|
||||
out->maxTexelGatherOffset = data.maxTexelGatherOffset();
|
||||
|
||||
out->minInterpolationOffset = data.minInterpolationOffset();
|
||||
|
||||
out->maxInterpolationOffset = data.maxInterpolationOffset();
|
||||
|
||||
out->subPixelInterpolationOffsetBits = data.subPixelInterpolationOffsetBits();
|
||||
|
||||
out->maxFramebufferWidth = data.maxFramebufferWidth();
|
||||
|
||||
out->maxFramebufferHeight = data.maxFramebufferHeight();
|
||||
|
||||
out->maxFramebufferLayers = data.maxFramebufferLayers();
|
||||
|
||||
out->framebufferColorSampleCounts = data.framebufferColorSampleCounts();
|
||||
|
||||
out->framebufferDepthSampleCounts = data.framebufferDepthSampleCounts();
|
||||
|
||||
out->framebufferStencilSampleCounts = data.framebufferStencilSampleCounts();
|
||||
|
||||
out->framebufferNoAttachmentsSampleCounts =
|
||||
data.framebufferNoAttachmentsSampleCounts();
|
||||
|
||||
out->maxColorAttachments = data.maxColorAttachments();
|
||||
|
||||
out->sampledImageColorSampleCounts = data.sampledImageColorSampleCounts();
|
||||
|
||||
out->sampledImageIntegerSampleCounts = data.sampledImageIntegerSampleCounts();
|
||||
|
||||
out->sampledImageDepthSampleCounts = data.sampledImageDepthSampleCounts();
|
||||
|
||||
out->sampledImageStencilSampleCounts = data.sampledImageStencilSampleCounts();
|
||||
|
||||
out->storageImageSampleCounts = data.storageImageSampleCounts();
|
||||
|
||||
out->maxSampleMaskWords = data.maxSampleMaskWords();
|
||||
|
||||
out->timestampComputeAndGraphics = data.timestampComputeAndGraphics();
|
||||
|
||||
out->timestampPeriod = data.timestampPeriod();
|
||||
|
||||
out->maxClipDistances = data.maxClipDistances();
|
||||
|
||||
out->maxCullDistances = data.maxCullDistances();
|
||||
|
||||
out->maxCombinedClipAndCullDistances = data.maxCombinedClipAndCullDistances();
|
||||
|
||||
out->discreteQueuePriorities = data.discreteQueuePriorities();
|
||||
|
||||
base::span<float> pointSizeRange(out->pointSizeRange);
|
||||
if (!data.ReadPointSizeRange(&pointSizeRange))
|
||||
return false;
|
||||
|
||||
base::span<float> lineWidthRange(out->lineWidthRange);
|
||||
if (!data.ReadLineWidthRange(&lineWidthRange))
|
||||
return false;
|
||||
|
||||
out->pointSizeGranularity = data.pointSizeGranularity();
|
||||
|
||||
out->lineWidthGranularity = data.lineWidthGranularity();
|
||||
|
||||
out->strictLines = data.strictLines();
|
||||
|
||||
out->standardSampleLocations = data.standardSampleLocations();
|
||||
|
||||
out->optimalBufferCopyOffsetAlignment =
|
||||
data.optimalBufferCopyOffsetAlignment();
|
||||
|
||||
out->optimalBufferCopyRowPitchAlignment =
|
||||
data.optimalBufferCopyRowPitchAlignment();
|
||||
|
||||
out->nonCoherentAtomSize = data.nonCoherentAtomSize();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
bool StructTraits<gpu::mojom::VkPhysicalDeviceSparsePropertiesDataView,
|
||||
VkPhysicalDeviceSparseProperties>::
|
||||
Read(gpu::mojom::VkPhysicalDeviceSparsePropertiesDataView data,
|
||||
VkPhysicalDeviceSparseProperties* out) {
|
||||
out->residencyStandard2DBlockShape = data.residencyStandard2DBlockShape();
|
||||
|
||||
out->residencyStandard2DMultisampleBlockShape =
|
||||
data.residencyStandard2DMultisampleBlockShape();
|
||||
|
||||
out->residencyStandard3DBlockShape = data.residencyStandard3DBlockShape();
|
||||
|
||||
out->residencyAlignedMipSize = data.residencyAlignedMipSize();
|
||||
|
||||
out->residencyNonResidentStrict = data.residencyNonResidentStrict();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
bool StructTraits<gpu::mojom::VkPhysicalDeviceFeaturesDataView,
|
||||
VkPhysicalDeviceFeatures>::
|
||||
Read(gpu::mojom::VkPhysicalDeviceFeaturesDataView data,
|
||||
VkPhysicalDeviceFeatures* out) {
|
||||
out->robustBufferAccess = data.robustBufferAccess();
|
||||
|
||||
out->fullDrawIndexUint32 = data.fullDrawIndexUint32();
|
||||
|
||||
out->imageCubeArray = data.imageCubeArray();
|
||||
|
||||
out->independentBlend = data.independentBlend();
|
||||
|
||||
out->geometryShader = data.geometryShader();
|
||||
|
||||
out->tessellationShader = data.tessellationShader();
|
||||
|
||||
out->sampleRateShading = data.sampleRateShading();
|
||||
|
||||
out->dualSrcBlend = data.dualSrcBlend();
|
||||
|
||||
out->logicOp = data.logicOp();
|
||||
|
||||
out->multiDrawIndirect = data.multiDrawIndirect();
|
||||
|
||||
out->drawIndirectFirstInstance = data.drawIndirectFirstInstance();
|
||||
|
||||
out->depthClamp = data.depthClamp();
|
||||
|
||||
out->depthBiasClamp = data.depthBiasClamp();
|
||||
|
||||
out->fillModeNonSolid = data.fillModeNonSolid();
|
||||
|
||||
out->depthBounds = data.depthBounds();
|
||||
|
||||
out->wideLines = data.wideLines();
|
||||
|
||||
out->largePoints = data.largePoints();
|
||||
|
||||
out->alphaToOne = data.alphaToOne();
|
||||
|
||||
out->multiViewport = data.multiViewport();
|
||||
|
||||
out->samplerAnisotropy = data.samplerAnisotropy();
|
||||
|
||||
out->textureCompressionETC2 = data.textureCompressionETC2();
|
||||
|
||||
out->textureCompressionASTC_LDR = data.textureCompressionASTC_LDR();
|
||||
|
||||
out->textureCompressionBC = data.textureCompressionBC();
|
||||
|
||||
out->occlusionQueryPrecise = data.occlusionQueryPrecise();
|
||||
|
||||
out->pipelineStatisticsQuery = data.pipelineStatisticsQuery();
|
||||
|
||||
out->vertexPipelineStoresAndAtomics = data.vertexPipelineStoresAndAtomics();
|
||||
|
||||
out->fragmentStoresAndAtomics = data.fragmentStoresAndAtomics();
|
||||
|
||||
out->shaderTessellationAndGeometryPointSize =
|
||||
data.shaderTessellationAndGeometryPointSize();
|
||||
|
||||
out->shaderImageGatherExtended = data.shaderImageGatherExtended();
|
||||
|
||||
out->shaderStorageImageExtendedFormats =
|
||||
data.shaderStorageImageExtendedFormats();
|
||||
|
||||
out->shaderStorageImageMultisample = data.shaderStorageImageMultisample();
|
||||
|
||||
out->shaderStorageImageReadWithoutFormat =
|
||||
data.shaderStorageImageReadWithoutFormat();
|
||||
|
||||
out->shaderStorageImageWriteWithoutFormat =
|
||||
data.shaderStorageImageWriteWithoutFormat();
|
||||
|
||||
out->shaderUniformBufferArrayDynamicIndexing =
|
||||
data.shaderUniformBufferArrayDynamicIndexing();
|
||||
|
||||
out->shaderSampledImageArrayDynamicIndexing =
|
||||
data.shaderSampledImageArrayDynamicIndexing();
|
||||
|
||||
out->shaderStorageBufferArrayDynamicIndexing =
|
||||
data.shaderStorageBufferArrayDynamicIndexing();
|
||||
|
||||
out->shaderStorageImageArrayDynamicIndexing =
|
||||
data.shaderStorageImageArrayDynamicIndexing();
|
||||
|
||||
out->shaderClipDistance = data.shaderClipDistance();
|
||||
|
||||
out->shaderCullDistance = data.shaderCullDistance();
|
||||
|
||||
out->shaderFloat64 = data.shaderFloat64();
|
||||
|
||||
out->shaderInt64 = data.shaderInt64();
|
||||
|
||||
out->shaderInt16 = data.shaderInt16();
|
||||
|
||||
out->shaderResourceResidency = data.shaderResourceResidency();
|
||||
|
||||
out->shaderResourceMinLod = data.shaderResourceMinLod();
|
||||
|
||||
out->sparseBinding = data.sparseBinding();
|
||||
|
||||
out->sparseResidencyBuffer = data.sparseResidencyBuffer();
|
||||
|
||||
out->sparseResidencyImage2D = data.sparseResidencyImage2D();
|
||||
|
||||
out->sparseResidencyImage3D = data.sparseResidencyImage3D();
|
||||
|
||||
out->sparseResidency2Samples = data.sparseResidency2Samples();
|
||||
|
||||
out->sparseResidency4Samples = data.sparseResidency4Samples();
|
||||
|
||||
out->sparseResidency8Samples = data.sparseResidency8Samples();
|
||||
|
||||
out->sparseResidency16Samples = data.sparseResidency16Samples();
|
||||
|
||||
out->sparseResidencyAliased = data.sparseResidencyAliased();
|
||||
|
||||
out->variableMultisampleRate = data.variableMultisampleRate();
|
||||
|
||||
out->inheritedQueries = data.inheritedQueries();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
bool StructTraits<gpu::mojom::VkQueueFamilyPropertiesDataView,
|
||||
VkQueueFamilyProperties>::
|
||||
Read(gpu::mojom::VkQueueFamilyPropertiesDataView data,
|
||||
VkQueueFamilyProperties* out) {
|
||||
out->queueFlags = data.queueFlags();
|
||||
|
||||
out->queueCount = data.queueCount();
|
||||
|
||||
out->timestampValidBits = data.timestampValidBits();
|
||||
|
||||
if (!data.ReadMinImageTransferGranularity(&out->minImageTransferGranularity))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
bool StructTraits<gpu::mojom::VkExtent3DDataView, VkExtent3D>::Read(
|
||||
gpu::mojom::VkExtent3DDataView data,
|
||||
VkExtent3D* out) {
|
||||
out->width = data.width();
|
||||
|
||||
out->height = data.height();
|
||||
|
||||
out->depth = data.depth();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace mojo
|
951
gpu/ipc/common/vulkan_types_mojom_traits.h
Normal file
951
gpu/ipc/common/vulkan_types_mojom_traits.h
Normal file
@ -0,0 +1,951 @@
|
||||
// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// This file is auto-generated from
|
||||
// gpu/ipc/common/generate_vulkan_types.py
|
||||
// It's formatted by clang-format using chromium coding style:
|
||||
// clang-format -i -style=chromium filename
|
||||
// DO NOT EDIT!
|
||||
|
||||
#ifndef GPU_IPC_COMMON_VULKAN_TYPES_MOJOM_TRAITS_H_
|
||||
#define GPU_IPC_COMMON_VULKAN_TYPES_MOJOM_TRAITS_H_
|
||||
|
||||
#include "base/containers/span.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "gpu/ipc/common/vulkan_types.h"
|
||||
#include "gpu/ipc/common/vulkan_types.mojom-shared.h"
|
||||
|
||||
namespace mojo {
|
||||
|
||||
template <>
|
||||
struct StructTraits<gpu::mojom::VkExtensionPropertiesDataView,
|
||||
VkExtensionProperties> {
|
||||
static base::StringPiece extensionName(const VkExtensionProperties& input) {
|
||||
return input.extensionName;
|
||||
}
|
||||
|
||||
static uint32_t specVersion(const VkExtensionProperties& input) {
|
||||
return input.specVersion;
|
||||
}
|
||||
|
||||
static bool Read(gpu::mojom::VkExtensionPropertiesDataView data,
|
||||
VkExtensionProperties* out);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct StructTraits<gpu::mojom::VkLayerPropertiesDataView, VkLayerProperties> {
|
||||
static base::StringPiece layerName(const VkLayerProperties& input) {
|
||||
return input.layerName;
|
||||
}
|
||||
|
||||
static uint32_t specVersion(const VkLayerProperties& input) {
|
||||
return input.specVersion;
|
||||
}
|
||||
|
||||
static uint32_t implementationVersion(const VkLayerProperties& input) {
|
||||
return input.implementationVersion;
|
||||
}
|
||||
|
||||
static base::StringPiece description(const VkLayerProperties& input) {
|
||||
return input.description;
|
||||
}
|
||||
|
||||
static bool Read(gpu::mojom::VkLayerPropertiesDataView data,
|
||||
VkLayerProperties* out);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct StructTraits<gpu::mojom::VkPhysicalDevicePropertiesDataView,
|
||||
VkPhysicalDeviceProperties> {
|
||||
static uint32_t apiVersion(const VkPhysicalDeviceProperties& input) {
|
||||
return input.apiVersion;
|
||||
}
|
||||
|
||||
static uint32_t driverVersion(const VkPhysicalDeviceProperties& input) {
|
||||
return input.driverVersion;
|
||||
}
|
||||
|
||||
static uint32_t vendorID(const VkPhysicalDeviceProperties& input) {
|
||||
return input.vendorID;
|
||||
}
|
||||
|
||||
static uint32_t deviceID(const VkPhysicalDeviceProperties& input) {
|
||||
return input.deviceID;
|
||||
}
|
||||
|
||||
static VkPhysicalDeviceType deviceType(
|
||||
const VkPhysicalDeviceProperties& input) {
|
||||
return input.deviceType;
|
||||
}
|
||||
|
||||
static base::StringPiece deviceName(const VkPhysicalDeviceProperties& input) {
|
||||
return input.deviceName;
|
||||
}
|
||||
|
||||
static base::span<const uint8_t> pipelineCacheUUID(
|
||||
const VkPhysicalDeviceProperties& input) {
|
||||
return input.pipelineCacheUUID;
|
||||
}
|
||||
|
||||
static const VkPhysicalDeviceLimits& limits(
|
||||
const VkPhysicalDeviceProperties& input) {
|
||||
return input.limits;
|
||||
}
|
||||
|
||||
static const VkPhysicalDeviceSparseProperties& sparseProperties(
|
||||
const VkPhysicalDeviceProperties& input) {
|
||||
return input.sparseProperties;
|
||||
}
|
||||
|
||||
static bool Read(gpu::mojom::VkPhysicalDevicePropertiesDataView data,
|
||||
VkPhysicalDeviceProperties* out);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct EnumTraits<gpu::mojom::VkPhysicalDeviceType, VkPhysicalDeviceType> {
|
||||
static gpu::mojom::VkPhysicalDeviceType ToMojom(VkPhysicalDeviceType input) {
|
||||
switch (input) {
|
||||
case VkPhysicalDeviceType::VK_PHYSICAL_DEVICE_TYPE_OTHER:
|
||||
return gpu::mojom::VkPhysicalDeviceType::OTHER;
|
||||
case VkPhysicalDeviceType::VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU:
|
||||
return gpu::mojom::VkPhysicalDeviceType::INTEGRATED_GPU;
|
||||
case VkPhysicalDeviceType::VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU:
|
||||
return gpu::mojom::VkPhysicalDeviceType::DISCRETE_GPU;
|
||||
case VkPhysicalDeviceType::VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU:
|
||||
return gpu::mojom::VkPhysicalDeviceType::VIRTUAL_GPU;
|
||||
case VkPhysicalDeviceType::VK_PHYSICAL_DEVICE_TYPE_CPU:
|
||||
return gpu::mojom::VkPhysicalDeviceType::CPU;
|
||||
default:
|
||||
NOTREACHED();
|
||||
return gpu::mojom::VkPhysicalDeviceType::INVALID_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
static bool FromMojom(gpu::mojom::VkPhysicalDeviceType input,
|
||||
VkPhysicalDeviceType* out) {
|
||||
switch (input) {
|
||||
case gpu::mojom::VkPhysicalDeviceType::OTHER:
|
||||
*out = VkPhysicalDeviceType::VK_PHYSICAL_DEVICE_TYPE_OTHER;
|
||||
return true;
|
||||
case gpu::mojom::VkPhysicalDeviceType::INTEGRATED_GPU:
|
||||
*out = VkPhysicalDeviceType::VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU;
|
||||
return true;
|
||||
case gpu::mojom::VkPhysicalDeviceType::DISCRETE_GPU:
|
||||
*out = VkPhysicalDeviceType::VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU;
|
||||
return true;
|
||||
case gpu::mojom::VkPhysicalDeviceType::VIRTUAL_GPU:
|
||||
*out = VkPhysicalDeviceType::VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU;
|
||||
return true;
|
||||
case gpu::mojom::VkPhysicalDeviceType::CPU:
|
||||
*out = VkPhysicalDeviceType::VK_PHYSICAL_DEVICE_TYPE_CPU;
|
||||
return true;
|
||||
case gpu::mojom::VkPhysicalDeviceType::INVALID_VALUE:
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct StructTraits<gpu::mojom::VkPhysicalDeviceLimitsDataView,
|
||||
VkPhysicalDeviceLimits> {
|
||||
static uint32_t maxImageDimension1D(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxImageDimension1D;
|
||||
}
|
||||
|
||||
static uint32_t maxImageDimension2D(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxImageDimension2D;
|
||||
}
|
||||
|
||||
static uint32_t maxImageDimension3D(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxImageDimension3D;
|
||||
}
|
||||
|
||||
static uint32_t maxImageDimensionCube(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxImageDimensionCube;
|
||||
}
|
||||
|
||||
static uint32_t maxImageArrayLayers(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxImageArrayLayers;
|
||||
}
|
||||
|
||||
static uint32_t maxTexelBufferElements(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxTexelBufferElements;
|
||||
}
|
||||
|
||||
static uint32_t maxUniformBufferRange(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxUniformBufferRange;
|
||||
}
|
||||
|
||||
static uint32_t maxStorageBufferRange(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxStorageBufferRange;
|
||||
}
|
||||
|
||||
static uint32_t maxPushConstantsSize(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxPushConstantsSize;
|
||||
}
|
||||
|
||||
static uint32_t maxMemoryAllocationCount(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxMemoryAllocationCount;
|
||||
}
|
||||
|
||||
static uint32_t maxSamplerAllocationCount(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxSamplerAllocationCount;
|
||||
}
|
||||
|
||||
static bool bufferImageGranularity(const VkPhysicalDeviceLimits& input) {
|
||||
return input.bufferImageGranularity;
|
||||
}
|
||||
|
||||
static bool sparseAddressSpaceSize(const VkPhysicalDeviceLimits& input) {
|
||||
return input.sparseAddressSpaceSize;
|
||||
}
|
||||
|
||||
static uint32_t maxBoundDescriptorSets(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxBoundDescriptorSets;
|
||||
}
|
||||
|
||||
static uint32_t maxPerStageDescriptorSamplers(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxPerStageDescriptorSamplers;
|
||||
}
|
||||
|
||||
static uint32_t maxPerStageDescriptorUniformBuffers(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxPerStageDescriptorUniformBuffers;
|
||||
}
|
||||
|
||||
static uint32_t maxPerStageDescriptorStorageBuffers(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxPerStageDescriptorStorageBuffers;
|
||||
}
|
||||
|
||||
static uint32_t maxPerStageDescriptorSampledImages(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxPerStageDescriptorSampledImages;
|
||||
}
|
||||
|
||||
static uint32_t maxPerStageDescriptorStorageImages(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxPerStageDescriptorStorageImages;
|
||||
}
|
||||
|
||||
static uint32_t maxPerStageDescriptorInputAttachments(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxPerStageDescriptorInputAttachments;
|
||||
}
|
||||
|
||||
static uint32_t maxPerStageResources(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxPerStageResources;
|
||||
}
|
||||
|
||||
static uint32_t maxDescriptorSetSamplers(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxDescriptorSetSamplers;
|
||||
}
|
||||
|
||||
static uint32_t maxDescriptorSetUniformBuffers(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxDescriptorSetUniformBuffers;
|
||||
}
|
||||
|
||||
static uint32_t maxDescriptorSetUniformBuffersDynamic(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxDescriptorSetUniformBuffersDynamic;
|
||||
}
|
||||
|
||||
static uint32_t maxDescriptorSetStorageBuffers(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxDescriptorSetStorageBuffers;
|
||||
}
|
||||
|
||||
static uint32_t maxDescriptorSetStorageBuffersDynamic(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxDescriptorSetStorageBuffersDynamic;
|
||||
}
|
||||
|
||||
static uint32_t maxDescriptorSetSampledImages(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxDescriptorSetSampledImages;
|
||||
}
|
||||
|
||||
static uint32_t maxDescriptorSetStorageImages(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxDescriptorSetStorageImages;
|
||||
}
|
||||
|
||||
static uint32_t maxDescriptorSetInputAttachments(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxDescriptorSetInputAttachments;
|
||||
}
|
||||
|
||||
static uint32_t maxVertexInputAttributes(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxVertexInputAttributes;
|
||||
}
|
||||
|
||||
static uint32_t maxVertexInputBindings(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxVertexInputBindings;
|
||||
}
|
||||
|
||||
static uint32_t maxVertexInputAttributeOffset(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxVertexInputAttributeOffset;
|
||||
}
|
||||
|
||||
static uint32_t maxVertexInputBindingStride(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxVertexInputBindingStride;
|
||||
}
|
||||
|
||||
static uint32_t maxVertexOutputComponents(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxVertexOutputComponents;
|
||||
}
|
||||
|
||||
static uint32_t maxTessellationGenerationLevel(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxTessellationGenerationLevel;
|
||||
}
|
||||
|
||||
static uint32_t maxTessellationPatchSize(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxTessellationPatchSize;
|
||||
}
|
||||
|
||||
static uint32_t maxTessellationControlPerVertexInputComponents(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxTessellationControlPerVertexInputComponents;
|
||||
}
|
||||
|
||||
static uint32_t maxTessellationControlPerVertexOutputComponents(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxTessellationControlPerVertexOutputComponents;
|
||||
}
|
||||
|
||||
static uint32_t maxTessellationControlPerPatchOutputComponents(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxTessellationControlPerPatchOutputComponents;
|
||||
}
|
||||
|
||||
static uint32_t maxTessellationControlTotalOutputComponents(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxTessellationControlTotalOutputComponents;
|
||||
}
|
||||
|
||||
static uint32_t maxTessellationEvaluationInputComponents(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxTessellationEvaluationInputComponents;
|
||||
}
|
||||
|
||||
static uint32_t maxTessellationEvaluationOutputComponents(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxTessellationEvaluationOutputComponents;
|
||||
}
|
||||
|
||||
static uint32_t maxGeometryShaderInvocations(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxGeometryShaderInvocations;
|
||||
}
|
||||
|
||||
static uint32_t maxGeometryInputComponents(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxGeometryInputComponents;
|
||||
}
|
||||
|
||||
static uint32_t maxGeometryOutputComponents(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxGeometryOutputComponents;
|
||||
}
|
||||
|
||||
static uint32_t maxGeometryOutputVertices(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxGeometryOutputVertices;
|
||||
}
|
||||
|
||||
static uint32_t maxGeometryTotalOutputComponents(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxGeometryTotalOutputComponents;
|
||||
}
|
||||
|
||||
static uint32_t maxFragmentInputComponents(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxFragmentInputComponents;
|
||||
}
|
||||
|
||||
static uint32_t maxFragmentOutputAttachments(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxFragmentOutputAttachments;
|
||||
}
|
||||
|
||||
static uint32_t maxFragmentDualSrcAttachments(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxFragmentDualSrcAttachments;
|
||||
}
|
||||
|
||||
static uint32_t maxFragmentCombinedOutputResources(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxFragmentCombinedOutputResources;
|
||||
}
|
||||
|
||||
static uint32_t maxComputeSharedMemorySize(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxComputeSharedMemorySize;
|
||||
}
|
||||
|
||||
static base::span<const uint32_t> maxComputeWorkGroupCount(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxComputeWorkGroupCount;
|
||||
}
|
||||
|
||||
static uint32_t maxComputeWorkGroupInvocations(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxComputeWorkGroupInvocations;
|
||||
}
|
||||
|
||||
static base::span<const uint32_t> maxComputeWorkGroupSize(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxComputeWorkGroupSize;
|
||||
}
|
||||
|
||||
static uint32_t subPixelPrecisionBits(const VkPhysicalDeviceLimits& input) {
|
||||
return input.subPixelPrecisionBits;
|
||||
}
|
||||
|
||||
static uint32_t subTexelPrecisionBits(const VkPhysicalDeviceLimits& input) {
|
||||
return input.subTexelPrecisionBits;
|
||||
}
|
||||
|
||||
static uint32_t mipmapPrecisionBits(const VkPhysicalDeviceLimits& input) {
|
||||
return input.mipmapPrecisionBits;
|
||||
}
|
||||
|
||||
static uint32_t maxDrawIndexedIndexValue(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxDrawIndexedIndexValue;
|
||||
}
|
||||
|
||||
static uint32_t maxDrawIndirectCount(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxDrawIndirectCount;
|
||||
}
|
||||
|
||||
static float maxSamplerLodBias(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxSamplerLodBias;
|
||||
}
|
||||
|
||||
static float maxSamplerAnisotropy(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxSamplerAnisotropy;
|
||||
}
|
||||
|
||||
static uint32_t maxViewports(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxViewports;
|
||||
}
|
||||
|
||||
static base::span<const uint32_t> maxViewportDimensions(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxViewportDimensions;
|
||||
}
|
||||
|
||||
static base::span<const float> viewportBoundsRange(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.viewportBoundsRange;
|
||||
}
|
||||
|
||||
static uint32_t viewportSubPixelBits(const VkPhysicalDeviceLimits& input) {
|
||||
return input.viewportSubPixelBits;
|
||||
}
|
||||
|
||||
static size_t minMemoryMapAlignment(const VkPhysicalDeviceLimits& input) {
|
||||
return input.minMemoryMapAlignment;
|
||||
}
|
||||
|
||||
static bool minTexelBufferOffsetAlignment(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.minTexelBufferOffsetAlignment;
|
||||
}
|
||||
|
||||
static bool minUniformBufferOffsetAlignment(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.minUniformBufferOffsetAlignment;
|
||||
}
|
||||
|
||||
static bool minStorageBufferOffsetAlignment(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.minStorageBufferOffsetAlignment;
|
||||
}
|
||||
|
||||
static int32_t minTexelOffset(const VkPhysicalDeviceLimits& input) {
|
||||
return input.minTexelOffset;
|
||||
}
|
||||
|
||||
static uint32_t maxTexelOffset(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxTexelOffset;
|
||||
}
|
||||
|
||||
static int32_t minTexelGatherOffset(const VkPhysicalDeviceLimits& input) {
|
||||
return input.minTexelGatherOffset;
|
||||
}
|
||||
|
||||
static uint32_t maxTexelGatherOffset(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxTexelGatherOffset;
|
||||
}
|
||||
|
||||
static float minInterpolationOffset(const VkPhysicalDeviceLimits& input) {
|
||||
return input.minInterpolationOffset;
|
||||
}
|
||||
|
||||
static float maxInterpolationOffset(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxInterpolationOffset;
|
||||
}
|
||||
|
||||
static uint32_t subPixelInterpolationOffsetBits(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.subPixelInterpolationOffsetBits;
|
||||
}
|
||||
|
||||
static uint32_t maxFramebufferWidth(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxFramebufferWidth;
|
||||
}
|
||||
|
||||
static uint32_t maxFramebufferHeight(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxFramebufferHeight;
|
||||
}
|
||||
|
||||
static uint32_t maxFramebufferLayers(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxFramebufferLayers;
|
||||
}
|
||||
|
||||
static VkSampleCountFlags framebufferColorSampleCounts(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.framebufferColorSampleCounts;
|
||||
}
|
||||
|
||||
static VkSampleCountFlags framebufferDepthSampleCounts(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.framebufferDepthSampleCounts;
|
||||
}
|
||||
|
||||
static VkSampleCountFlags framebufferStencilSampleCounts(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.framebufferStencilSampleCounts;
|
||||
}
|
||||
|
||||
static VkSampleCountFlags framebufferNoAttachmentsSampleCounts(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.framebufferNoAttachmentsSampleCounts;
|
||||
}
|
||||
|
||||
static uint32_t maxColorAttachments(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxColorAttachments;
|
||||
}
|
||||
|
||||
static VkSampleCountFlags sampledImageColorSampleCounts(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.sampledImageColorSampleCounts;
|
||||
}
|
||||
|
||||
static VkSampleCountFlags sampledImageIntegerSampleCounts(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.sampledImageIntegerSampleCounts;
|
||||
}
|
||||
|
||||
static VkSampleCountFlags sampledImageDepthSampleCounts(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.sampledImageDepthSampleCounts;
|
||||
}
|
||||
|
||||
static VkSampleCountFlags sampledImageStencilSampleCounts(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.sampledImageStencilSampleCounts;
|
||||
}
|
||||
|
||||
static VkSampleCountFlags storageImageSampleCounts(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.storageImageSampleCounts;
|
||||
}
|
||||
|
||||
static uint32_t maxSampleMaskWords(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxSampleMaskWords;
|
||||
}
|
||||
|
||||
static bool timestampComputeAndGraphics(const VkPhysicalDeviceLimits& input) {
|
||||
return input.timestampComputeAndGraphics;
|
||||
}
|
||||
|
||||
static float timestampPeriod(const VkPhysicalDeviceLimits& input) {
|
||||
return input.timestampPeriod;
|
||||
}
|
||||
|
||||
static uint32_t maxClipDistances(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxClipDistances;
|
||||
}
|
||||
|
||||
static uint32_t maxCullDistances(const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxCullDistances;
|
||||
}
|
||||
|
||||
static uint32_t maxCombinedClipAndCullDistances(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.maxCombinedClipAndCullDistances;
|
||||
}
|
||||
|
||||
static uint32_t discreteQueuePriorities(const VkPhysicalDeviceLimits& input) {
|
||||
return input.discreteQueuePriorities;
|
||||
}
|
||||
|
||||
static base::span<const float> pointSizeRange(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.pointSizeRange;
|
||||
}
|
||||
|
||||
static base::span<const float> lineWidthRange(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.lineWidthRange;
|
||||
}
|
||||
|
||||
static float pointSizeGranularity(const VkPhysicalDeviceLimits& input) {
|
||||
return input.pointSizeGranularity;
|
||||
}
|
||||
|
||||
static float lineWidthGranularity(const VkPhysicalDeviceLimits& input) {
|
||||
return input.lineWidthGranularity;
|
||||
}
|
||||
|
||||
static bool strictLines(const VkPhysicalDeviceLimits& input) {
|
||||
return input.strictLines;
|
||||
}
|
||||
|
||||
static bool standardSampleLocations(const VkPhysicalDeviceLimits& input) {
|
||||
return input.standardSampleLocations;
|
||||
}
|
||||
|
||||
static bool optimalBufferCopyOffsetAlignment(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.optimalBufferCopyOffsetAlignment;
|
||||
}
|
||||
|
||||
static bool optimalBufferCopyRowPitchAlignment(
|
||||
const VkPhysicalDeviceLimits& input) {
|
||||
return input.optimalBufferCopyRowPitchAlignment;
|
||||
}
|
||||
|
||||
static bool nonCoherentAtomSize(const VkPhysicalDeviceLimits& input) {
|
||||
return input.nonCoherentAtomSize;
|
||||
}
|
||||
|
||||
static bool Read(gpu::mojom::VkPhysicalDeviceLimitsDataView data,
|
||||
VkPhysicalDeviceLimits* out);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct StructTraits<gpu::mojom::VkPhysicalDeviceSparsePropertiesDataView,
|
||||
VkPhysicalDeviceSparseProperties> {
|
||||
static bool residencyStandard2DBlockShape(
|
||||
const VkPhysicalDeviceSparseProperties& input) {
|
||||
return input.residencyStandard2DBlockShape;
|
||||
}
|
||||
|
||||
static bool residencyStandard2DMultisampleBlockShape(
|
||||
const VkPhysicalDeviceSparseProperties& input) {
|
||||
return input.residencyStandard2DMultisampleBlockShape;
|
||||
}
|
||||
|
||||
static bool residencyStandard3DBlockShape(
|
||||
const VkPhysicalDeviceSparseProperties& input) {
|
||||
return input.residencyStandard3DBlockShape;
|
||||
}
|
||||
|
||||
static bool residencyAlignedMipSize(
|
||||
const VkPhysicalDeviceSparseProperties& input) {
|
||||
return input.residencyAlignedMipSize;
|
||||
}
|
||||
|
||||
static bool residencyNonResidentStrict(
|
||||
const VkPhysicalDeviceSparseProperties& input) {
|
||||
return input.residencyNonResidentStrict;
|
||||
}
|
||||
|
||||
static bool Read(gpu::mojom::VkPhysicalDeviceSparsePropertiesDataView data,
|
||||
VkPhysicalDeviceSparseProperties* out);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct StructTraits<gpu::mojom::VkPhysicalDeviceFeaturesDataView,
|
||||
VkPhysicalDeviceFeatures> {
|
||||
static bool robustBufferAccess(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.robustBufferAccess;
|
||||
}
|
||||
|
||||
static bool fullDrawIndexUint32(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.fullDrawIndexUint32;
|
||||
}
|
||||
|
||||
static bool imageCubeArray(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.imageCubeArray;
|
||||
}
|
||||
|
||||
static bool independentBlend(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.independentBlend;
|
||||
}
|
||||
|
||||
static bool geometryShader(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.geometryShader;
|
||||
}
|
||||
|
||||
static bool tessellationShader(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.tessellationShader;
|
||||
}
|
||||
|
||||
static bool sampleRateShading(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.sampleRateShading;
|
||||
}
|
||||
|
||||
static bool dualSrcBlend(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.dualSrcBlend;
|
||||
}
|
||||
|
||||
static bool logicOp(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.logicOp;
|
||||
}
|
||||
|
||||
static bool multiDrawIndirect(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.multiDrawIndirect;
|
||||
}
|
||||
|
||||
static bool drawIndirectFirstInstance(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.drawIndirectFirstInstance;
|
||||
}
|
||||
|
||||
static bool depthClamp(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.depthClamp;
|
||||
}
|
||||
|
||||
static bool depthBiasClamp(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.depthBiasClamp;
|
||||
}
|
||||
|
||||
static bool fillModeNonSolid(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.fillModeNonSolid;
|
||||
}
|
||||
|
||||
static bool depthBounds(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.depthBounds;
|
||||
}
|
||||
|
||||
static bool wideLines(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.wideLines;
|
||||
}
|
||||
|
||||
static bool largePoints(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.largePoints;
|
||||
}
|
||||
|
||||
static bool alphaToOne(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.alphaToOne;
|
||||
}
|
||||
|
||||
static bool multiViewport(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.multiViewport;
|
||||
}
|
||||
|
||||
static bool samplerAnisotropy(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.samplerAnisotropy;
|
||||
}
|
||||
|
||||
static bool textureCompressionETC2(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.textureCompressionETC2;
|
||||
}
|
||||
|
||||
static bool textureCompressionASTC_LDR(
|
||||
const VkPhysicalDeviceFeatures& input) {
|
||||
return input.textureCompressionASTC_LDR;
|
||||
}
|
||||
|
||||
static bool textureCompressionBC(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.textureCompressionBC;
|
||||
}
|
||||
|
||||
static bool occlusionQueryPrecise(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.occlusionQueryPrecise;
|
||||
}
|
||||
|
||||
static bool pipelineStatisticsQuery(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.pipelineStatisticsQuery;
|
||||
}
|
||||
|
||||
static bool vertexPipelineStoresAndAtomics(
|
||||
const VkPhysicalDeviceFeatures& input) {
|
||||
return input.vertexPipelineStoresAndAtomics;
|
||||
}
|
||||
|
||||
static bool fragmentStoresAndAtomics(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.fragmentStoresAndAtomics;
|
||||
}
|
||||
|
||||
static bool shaderTessellationAndGeometryPointSize(
|
||||
const VkPhysicalDeviceFeatures& input) {
|
||||
return input.shaderTessellationAndGeometryPointSize;
|
||||
}
|
||||
|
||||
static bool shaderImageGatherExtended(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.shaderImageGatherExtended;
|
||||
}
|
||||
|
||||
static bool shaderStorageImageExtendedFormats(
|
||||
const VkPhysicalDeviceFeatures& input) {
|
||||
return input.shaderStorageImageExtendedFormats;
|
||||
}
|
||||
|
||||
static bool shaderStorageImageMultisample(
|
||||
const VkPhysicalDeviceFeatures& input) {
|
||||
return input.shaderStorageImageMultisample;
|
||||
}
|
||||
|
||||
static bool shaderStorageImageReadWithoutFormat(
|
||||
const VkPhysicalDeviceFeatures& input) {
|
||||
return input.shaderStorageImageReadWithoutFormat;
|
||||
}
|
||||
|
||||
static bool shaderStorageImageWriteWithoutFormat(
|
||||
const VkPhysicalDeviceFeatures& input) {
|
||||
return input.shaderStorageImageWriteWithoutFormat;
|
||||
}
|
||||
|
||||
static bool shaderUniformBufferArrayDynamicIndexing(
|
||||
const VkPhysicalDeviceFeatures& input) {
|
||||
return input.shaderUniformBufferArrayDynamicIndexing;
|
||||
}
|
||||
|
||||
static bool shaderSampledImageArrayDynamicIndexing(
|
||||
const VkPhysicalDeviceFeatures& input) {
|
||||
return input.shaderSampledImageArrayDynamicIndexing;
|
||||
}
|
||||
|
||||
static bool shaderStorageBufferArrayDynamicIndexing(
|
||||
const VkPhysicalDeviceFeatures& input) {
|
||||
return input.shaderStorageBufferArrayDynamicIndexing;
|
||||
}
|
||||
|
||||
static bool shaderStorageImageArrayDynamicIndexing(
|
||||
const VkPhysicalDeviceFeatures& input) {
|
||||
return input.shaderStorageImageArrayDynamicIndexing;
|
||||
}
|
||||
|
||||
static bool shaderClipDistance(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.shaderClipDistance;
|
||||
}
|
||||
|
||||
static bool shaderCullDistance(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.shaderCullDistance;
|
||||
}
|
||||
|
||||
static bool shaderFloat64(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.shaderFloat64;
|
||||
}
|
||||
|
||||
static bool shaderInt64(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.shaderInt64;
|
||||
}
|
||||
|
||||
static bool shaderInt16(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.shaderInt16;
|
||||
}
|
||||
|
||||
static bool shaderResourceResidency(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.shaderResourceResidency;
|
||||
}
|
||||
|
||||
static bool shaderResourceMinLod(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.shaderResourceMinLod;
|
||||
}
|
||||
|
||||
static bool sparseBinding(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.sparseBinding;
|
||||
}
|
||||
|
||||
static bool sparseResidencyBuffer(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.sparseResidencyBuffer;
|
||||
}
|
||||
|
||||
static bool sparseResidencyImage2D(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.sparseResidencyImage2D;
|
||||
}
|
||||
|
||||
static bool sparseResidencyImage3D(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.sparseResidencyImage3D;
|
||||
}
|
||||
|
||||
static bool sparseResidency2Samples(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.sparseResidency2Samples;
|
||||
}
|
||||
|
||||
static bool sparseResidency4Samples(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.sparseResidency4Samples;
|
||||
}
|
||||
|
||||
static bool sparseResidency8Samples(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.sparseResidency8Samples;
|
||||
}
|
||||
|
||||
static bool sparseResidency16Samples(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.sparseResidency16Samples;
|
||||
}
|
||||
|
||||
static bool sparseResidencyAliased(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.sparseResidencyAliased;
|
||||
}
|
||||
|
||||
static bool variableMultisampleRate(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.variableMultisampleRate;
|
||||
}
|
||||
|
||||
static bool inheritedQueries(const VkPhysicalDeviceFeatures& input) {
|
||||
return input.inheritedQueries;
|
||||
}
|
||||
|
||||
static bool Read(gpu::mojom::VkPhysicalDeviceFeaturesDataView data,
|
||||
VkPhysicalDeviceFeatures* out);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct StructTraits<gpu::mojom::VkQueueFamilyPropertiesDataView,
|
||||
VkQueueFamilyProperties> {
|
||||
static VkQueueFlags queueFlags(const VkQueueFamilyProperties& input) {
|
||||
return input.queueFlags;
|
||||
}
|
||||
|
||||
static uint32_t queueCount(const VkQueueFamilyProperties& input) {
|
||||
return input.queueCount;
|
||||
}
|
||||
|
||||
static uint32_t timestampValidBits(const VkQueueFamilyProperties& input) {
|
||||
return input.timestampValidBits;
|
||||
}
|
||||
|
||||
static const VkExtent3D& minImageTransferGranularity(
|
||||
const VkQueueFamilyProperties& input) {
|
||||
return input.minImageTransferGranularity;
|
||||
}
|
||||
|
||||
static bool Read(gpu::mojom::VkQueueFamilyPropertiesDataView data,
|
||||
VkQueueFamilyProperties* out);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct StructTraits<gpu::mojom::VkExtent3DDataView, VkExtent3D> {
|
||||
static uint32_t width(const VkExtent3D& input) { return input.width; }
|
||||
|
||||
static uint32_t height(const VkExtent3D& input) { return input.height; }
|
||||
|
||||
static uint32_t depth(const VkExtent3D& input) { return input.depth; }
|
||||
|
||||
static bool Read(gpu::mojom::VkExtent3DDataView data, VkExtent3D* out);
|
||||
};
|
||||
|
||||
} // namespace mojo
|
||||
|
||||
#endif // GPU_IPC_COMMON_VULKAN_TYPES_MOJOM_TRAITS_H_
|
@ -62,6 +62,7 @@ jumbo_component("service") {
|
||||
public_deps = [
|
||||
"//base",
|
||||
"//components/viz/common",
|
||||
"//gpu/config",
|
||||
"//ipc",
|
||||
"//ui/base",
|
||||
"//ui/display",
|
||||
|
@ -51,6 +51,7 @@
|
||||
#if BUILDFLAG(ENABLE_VULKAN)
|
||||
#include "gpu/vulkan/init/vulkan_factory.h"
|
||||
#include "gpu/vulkan/vulkan_implementation.h"
|
||||
#include "gpu/vulkan/vulkan_instance.h"
|
||||
#endif
|
||||
|
||||
namespace gpu {
|
||||
@ -659,6 +660,9 @@ void GpuInit::InitializeVulkan() {
|
||||
gpu_preferences_.use_vulkan = gpu::VulkanImplementationName::kNone;
|
||||
gpu_feature_info_.status_values[gpu::GPU_FEATURE_TYPE_VULKAN] =
|
||||
gpu::kGpuFeatureStatusDisabled;
|
||||
} else {
|
||||
gpu_info_.vulkan_info =
|
||||
vulkan_implementation_->GetVulkanInstance()->vulkan_info();
|
||||
}
|
||||
#else
|
||||
gpu_preferences_.use_vulkan = gpu::VulkanImplementationName::kNone;
|
||||
|
@ -43,8 +43,6 @@ if (enable_vulkan) {
|
||||
"vulkan_function_pointers.h",
|
||||
"vulkan_implementation.cc",
|
||||
"vulkan_implementation.h",
|
||||
"vulkan_info.cc",
|
||||
"vulkan_info.h",
|
||||
"vulkan_instance.cc",
|
||||
"vulkan_instance.h",
|
||||
"vulkan_surface.cc",
|
||||
@ -69,7 +67,9 @@ if (enable_vulkan) {
|
||||
"//base",
|
||||
"//ui/gfx",
|
||||
]
|
||||
public_deps = []
|
||||
public_deps = [
|
||||
"//gpu/config:vulkan_info",
|
||||
]
|
||||
data_deps = []
|
||||
|
||||
if (is_posix) {
|
||||
|
@ -22,7 +22,7 @@ def CommonChecks(input_api, output_api):
|
||||
|
||||
messages = []
|
||||
|
||||
if (len(generated_files) > 0 and len(generating_files) == 0):
|
||||
if generated_files and not generating_files:
|
||||
long_text = 'Changed files:\n'
|
||||
for file in generated_files:
|
||||
long_text += file.LocalPath() + '\n'
|
||||
@ -33,7 +33,7 @@ def CommonChecks(input_api, output_api):
|
||||
|
||||
with input_api.temporary_directory() as temp_dir:
|
||||
commands = []
|
||||
if len(generating_files) > 0:
|
||||
if generating_files:
|
||||
commands.append(input_api.Command(name='generate_bindings',
|
||||
cmd=[input_api.python_executable,
|
||||
'generate_bindings.py',
|
||||
@ -41,7 +41,7 @@ def CommonChecks(input_api, output_api):
|
||||
'--output-dir=' + temp_dir],
|
||||
kwargs={},
|
||||
message=output_api.PresubmitError))
|
||||
if len(commands) > 0:
|
||||
if commands:
|
||||
messages.extend(input_api.RunTests(commands))
|
||||
|
||||
return messages
|
||||
|
@ -8,10 +8,10 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "gpu/config/vulkan_info.h"
|
||||
#include "gpu/vulkan/vulkan_command_pool.h"
|
||||
#include "gpu/vulkan/vulkan_fence_helper.h"
|
||||
#include "gpu/vulkan/vulkan_function_pointers.h"
|
||||
#include "gpu/vulkan/vulkan_info.h"
|
||||
|
||||
namespace gpu {
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "gpu/vulkan/vulkan_info.h"
|
||||
|
||||
namespace gpu {
|
||||
|
||||
VulkanInfo::VulkanInfo() = default;
|
||||
VulkanInfo::~VulkanInfo() = default;
|
||||
VulkanInfo::PhysicalDeviceInfo::PhysicalDeviceInfo() = default;
|
||||
VulkanInfo::PhysicalDeviceInfo::PhysicalDeviceInfo(
|
||||
const PhysicalDeviceInfo& other) = default;
|
||||
VulkanInfo::PhysicalDeviceInfo::~PhysicalDeviceInfo() = default;
|
||||
VulkanInfo::PhysicalDeviceInfo& VulkanInfo::PhysicalDeviceInfo::operator=(
|
||||
const PhysicalDeviceInfo& info) = default;
|
||||
|
||||
} // namespace gpu
|
@ -1,51 +0,0 @@
|
||||
// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef GPU_VULKAN_VULKAN_INFO_H_
|
||||
#define GPU_VULKAN_VULKAN_INFO_H_
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <vector>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "gpu/vulkan/vulkan_export.h"
|
||||
#include "ui/gfx/extension_set.h"
|
||||
|
||||
namespace gpu {
|
||||
|
||||
class VULKAN_EXPORT VulkanInfo {
|
||||
public:
|
||||
VulkanInfo();
|
||||
~VulkanInfo();
|
||||
|
||||
class PhysicalDeviceInfo {
|
||||
public:
|
||||
PhysicalDeviceInfo();
|
||||
PhysicalDeviceInfo(const PhysicalDeviceInfo& other);
|
||||
~PhysicalDeviceInfo();
|
||||
PhysicalDeviceInfo& operator=(const PhysicalDeviceInfo& other);
|
||||
|
||||
VkPhysicalDevice device = VK_NULL_HANDLE;
|
||||
VkPhysicalDeviceProperties properties = {};
|
||||
std::vector<VkLayerProperties> layers;
|
||||
|
||||
VkPhysicalDeviceFeatures features = {};
|
||||
// Extended physical device features:
|
||||
bool feature_sampler_ycbcr_conversion = false;
|
||||
bool feature_protected_memory = false;
|
||||
|
||||
std::vector<VkQueueFamilyProperties> queue_families;
|
||||
};
|
||||
|
||||
uint32_t api_version = VK_MAKE_VERSION(1, 0, 0);
|
||||
uint32_t used_api_version = VK_MAKE_VERSION(1, 0, 0);
|
||||
std::vector<VkExtensionProperties> instance_extensions;
|
||||
std::vector<const char*> enabled_instance_extensions;
|
||||
std::vector<VkLayerProperties> instance_layers;
|
||||
std::vector<PhysicalDeviceInfo> physical_devices;
|
||||
};
|
||||
|
||||
} // namespace gpu
|
||||
|
||||
#endif // GPU_VULKAN_VULKAN_INFO_H_
|
@ -10,8 +10,8 @@
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/macros.h"
|
||||
#include "gpu/config/vulkan_info.h"
|
||||
#include "gpu/vulkan/vulkan_export.h"
|
||||
#include "gpu/vulkan/vulkan_info.h"
|
||||
#include "ui/gfx/extension_set.h"
|
||||
|
||||
namespace gpu {
|
||||
|
Reference in New Issue
Block a user