2018-07-18 09:40:26 +00:00
|
|
|
// Copyright 2017 The Dawn Authors
|
2017-11-17 22:52:04 +00:00
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2018-07-24 14:42:33 +00:00
|
|
|
#ifndef DAWNNATIVE_VULKAN_VULKANINFO_H_
|
|
|
|
#define DAWNNATIVE_VULKAN_VULKANINFO_H_
|
2017-11-17 22:52:04 +00:00
|
|
|
|
2018-01-15 20:56:35 +00:00
|
|
|
#include "common/vulkan_platform.h"
|
2017-11-17 22:52:04 +00:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2017-11-24 19:18:09 +00:00
|
|
|
namespace backend { namespace vulkan {
|
2017-11-17 22:52:04 +00:00
|
|
|
|
|
|
|
class Device;
|
|
|
|
|
2017-11-20 15:51:23 +00:00
|
|
|
extern const char kLayerNameLunargStandardValidation[];
|
2018-01-26 21:07:48 +00:00
|
|
|
extern const char kLayerNameLunargVKTrace[];
|
|
|
|
extern const char kLayerNameRenderDocCapture[];
|
2017-11-20 15:51:23 +00:00
|
|
|
|
|
|
|
extern const char kExtensionNameExtDebugReport[];
|
2017-11-21 17:52:03 +00:00
|
|
|
extern const char kExtensionNameKhrSurface[];
|
|
|
|
extern const char kExtensionNameKhrSwapchain[];
|
2017-11-20 15:51:23 +00:00
|
|
|
|
2017-11-21 17:52:03 +00:00
|
|
|
// Global information - gathered before the instance is created
|
|
|
|
struct VulkanGlobalKnobs {
|
2017-11-20 15:51:23 +00:00
|
|
|
// Layers
|
|
|
|
bool standardValidation = false;
|
2018-01-26 21:07:48 +00:00
|
|
|
bool vktrace = false;
|
|
|
|
bool renderDocCapture = false;
|
2017-11-20 15:51:23 +00:00
|
|
|
|
|
|
|
// Extensions
|
|
|
|
bool debugReport = false;
|
2017-11-21 17:52:03 +00:00
|
|
|
bool surface = false;
|
2017-11-20 15:51:23 +00:00
|
|
|
};
|
|
|
|
|
2017-11-21 17:52:03 +00:00
|
|
|
struct VulkanGlobalInfo : VulkanGlobalKnobs {
|
|
|
|
std::vector<VkLayerProperties> layers;
|
|
|
|
std::vector<VkExtensionProperties> extensions;
|
|
|
|
// TODO(cwallez@chromium.org): layer instance extensions
|
2017-11-17 22:52:04 +00:00
|
|
|
};
|
|
|
|
|
2017-11-21 17:52:03 +00:00
|
|
|
// Device information - gathered before the device is created.
|
|
|
|
struct VulkanDeviceKnobs {
|
|
|
|
VkPhysicalDeviceFeatures features;
|
|
|
|
|
|
|
|
// Extensions
|
|
|
|
bool swapchain = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct VulkanDeviceInfo : VulkanDeviceKnobs {
|
|
|
|
VkPhysicalDeviceProperties properties;
|
|
|
|
std::vector<VkQueueFamilyProperties> queueFamilies;
|
|
|
|
|
|
|
|
std::vector<VkMemoryType> memoryTypes;
|
|
|
|
std::vector<VkMemoryHeap> memoryHeaps;
|
|
|
|
|
|
|
|
std::vector<VkLayerProperties> layers;
|
|
|
|
std::vector<VkExtensionProperties> extensions;
|
|
|
|
// TODO(cwallez@chromium.org): layer instance extensions
|
|
|
|
};
|
|
|
|
|
2018-01-19 17:54:45 +00:00
|
|
|
struct VulkanSurfaceInfo {
|
|
|
|
VkSurfaceCapabilitiesKHR capabilities;
|
|
|
|
std::vector<VkSurfaceFormatKHR> formats;
|
|
|
|
std::vector<VkPresentModeKHR> presentModes;
|
|
|
|
std::vector<bool> supportedQueueFamilies;
|
|
|
|
};
|
|
|
|
|
2017-11-21 17:52:03 +00:00
|
|
|
bool GatherGlobalInfo(const Device& device, VulkanGlobalInfo* info);
|
|
|
|
bool GetPhysicalDevices(const Device& device, std::vector<VkPhysicalDevice>* physicalDevices);
|
2017-11-24 19:18:09 +00:00
|
|
|
bool GatherDeviceInfo(const Device& device,
|
|
|
|
VkPhysicalDevice physicalDevice,
|
|
|
|
VulkanDeviceInfo* info);
|
2018-01-19 17:54:45 +00:00
|
|
|
bool GatherSurfaceInfo(const Device& device, VkSurfaceKHR surface, VulkanSurfaceInfo* info);
|
|
|
|
|
2017-11-24 19:18:09 +00:00
|
|
|
}} // namespace backend::vulkan
|
2017-11-17 22:52:04 +00:00
|
|
|
|
2018-07-24 14:42:33 +00:00
|
|
|
#endif // DAWNNATIVE_VULKAN_VULKANINFO_H_
|