dawn-cmake/third_party/khronos/vulkan/vk_icd.h

246 lines
7.8 KiB
C
Raw Normal View History

//
// File: vk_icd.h
//
/*
* Copyright (c) 2015-2016 The Khronos Group Inc.
* Copyright (c) 2015-2016 Valve Corporation
* Copyright (c) 2015-2016 LunarG, Inc.
*
* 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.
*
*/
#ifndef VKICD_H
#define VKICD_H
#include "vulkan.h"
#include <stdbool.h>
// Loader-ICD version negotiation API. Versions add the following features:
// Version 0 - Initial. Doesn't support vk_icdGetInstanceProcAddr
// or vk_icdNegotiateLoaderICDInterfaceVersion.
// Version 1 - Add support for vk_icdGetInstanceProcAddr.
// Version 2 - Add Loader/ICD Interface version negotiation
// via vk_icdNegotiateLoaderICDInterfaceVersion.
// Version 3 - Add ICD creation/destruction of KHR_surface objects.
// Version 4 - Add unknown physical device extension querying via
// vk_icdGetPhysicalDeviceProcAddr.
// Version 5 - Tells ICDs that the loader is now paying attention to the
// application version of Vulkan passed into the ApplicationInfo
// structure during vkCreateInstance. This will tell the ICD
// that if the loader is older, it should automatically fail a
// call for any API version > 1.0. Otherwise, the loader will
// manually determine if it can support the expected version.
// Version 6 - Add support for vk_icdEnumerateAdapterPhysicalDevices.
#define CURRENT_LOADER_ICD_INTERFACE_VERSION 6
#define MIN_SUPPORTED_LOADER_ICD_INTERFACE_VERSION 0
#define MIN_PHYS_DEV_EXTENSION_ICD_INTERFACE_VERSION 4
// Old typedefs that don't follow a proper naming convention but are preserved for compatibility
typedef VkResult(VKAPI_PTR *PFN_vkNegotiateLoaderICDInterfaceVersion)(uint32_t *pVersion);
// This is defined in vk_layer.h which will be found by the loader, but if an ICD is building against this
// file directly, it won't be found.
#ifndef PFN_GetPhysicalDeviceProcAddr
typedef PFN_vkVoidFunction(VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char *pName);
#endif
// Typedefs for loader/ICD interface
typedef VkResult (VKAPI_PTR *PFN_vk_icdNegotiateLoaderICDInterfaceVersion)(uint32_t* pVersion);
typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vk_icdGetInstanceProcAddr)(VkInstance instance, const char* pName);
typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vk_icdGetPhysicalDeviceProcAddr)(VkInstance instance, const char* pName);
#if defined(VK_USE_PLATFORM_WIN32_KHR)
typedef VkResult (VKAPI_PTR *PFN_vk_icdEnumerateAdapterPhysicalDevices)(VkInstance instance, LUID adapterLUID,
uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices);
#endif
// Prototypes for loader/ICD interface
#if !defined(VK_NO_PROTOTYPES)
#ifdef __cplusplus
extern "C" {
#endif
VKAPI_ATTR VkResult VKAPI_CALL vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pVersion);
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName);
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetPhysicalDeviceProcAddr(VkInstance isntance, const char* pName);
#if defined(VK_USE_PLATFORM_WIN32_KHR)
VKAPI_ATTR VkResult VKAPI_CALL vk_icdEnumerateAdapterPhysicalDevices(VkInstance instance, LUID adapterLUID,
uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices);
#endif
#ifdef __cplusplus
}
#endif
#endif
/*
* The ICD must reserve space for a pointer for the loader's dispatch
* table, at the start of <each object>.
* The ICD must initialize this variable using the SET_LOADER_MAGIC_VALUE macro.
*/
#define ICD_LOADER_MAGIC 0x01CDC0DE
typedef union {
uintptr_t loaderMagic;
void *loaderData;
} VK_LOADER_DATA;
static inline void set_loader_magic_value(void *pNewObject) {
VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *)pNewObject;
loader_info->loaderMagic = ICD_LOADER_MAGIC;
}
static inline bool valid_loader_magic_value(void *pNewObject) {
const VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *)pNewObject;
return (loader_info->loaderMagic & 0xffffffff) == ICD_LOADER_MAGIC;
}
/*
* Windows and Linux ICDs will treat VkSurfaceKHR as a pointer to a struct that
* contains the platform-specific connection and surface information.
*/
typedef enum {
VK_ICD_WSI_PLATFORM_MIR,
VK_ICD_WSI_PLATFORM_WAYLAND,
VK_ICD_WSI_PLATFORM_WIN32,
VK_ICD_WSI_PLATFORM_XCB,
VK_ICD_WSI_PLATFORM_XLIB,
VK_ICD_WSI_PLATFORM_ANDROID,
VK_ICD_WSI_PLATFORM_MACOS,
VK_ICD_WSI_PLATFORM_IOS,
VK_ICD_WSI_PLATFORM_DISPLAY,
VK_ICD_WSI_PLATFORM_HEADLESS,
VK_ICD_WSI_PLATFORM_METAL,
VK_ICD_WSI_PLATFORM_DIRECTFB,
VK_ICD_WSI_PLATFORM_VI,
VK_ICD_WSI_PLATFORM_GGP,
VK_ICD_WSI_PLATFORM_SCREEN,
} VkIcdWsiPlatform;
typedef struct {
VkIcdWsiPlatform platform;
} VkIcdSurfaceBase;
#ifdef VK_USE_PLATFORM_MIR_KHR
typedef struct {
VkIcdSurfaceBase base;
MirConnection *connection;
MirSurface *mirSurface;
} VkIcdSurfaceMir;
#endif // VK_USE_PLATFORM_MIR_KHR
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
typedef struct {
VkIcdSurfaceBase base;
struct wl_display *display;
struct wl_surface *surface;
} VkIcdSurfaceWayland;
#endif // VK_USE_PLATFORM_WAYLAND_KHR
#ifdef VK_USE_PLATFORM_WIN32_KHR
typedef struct {
VkIcdSurfaceBase base;
HINSTANCE hinstance;
HWND hwnd;
} VkIcdSurfaceWin32;
#endif // VK_USE_PLATFORM_WIN32_KHR
#ifdef VK_USE_PLATFORM_XCB_KHR
typedef struct {
VkIcdSurfaceBase base;
xcb_connection_t *connection;
xcb_window_t window;
} VkIcdSurfaceXcb;
#endif // VK_USE_PLATFORM_XCB_KHR
#ifdef VK_USE_PLATFORM_XLIB_KHR
typedef struct {
VkIcdSurfaceBase base;
Display *dpy;
Window window;
} VkIcdSurfaceXlib;
#endif // VK_USE_PLATFORM_XLIB_KHR
#ifdef VK_USE_PLATFORM_DIRECTFB_EXT
typedef struct {
VkIcdSurfaceBase base;
IDirectFB *dfb;
IDirectFBSurface *surface;
} VkIcdSurfaceDirectFB;
#endif // VK_USE_PLATFORM_DIRECTFB_EXT
#ifdef VK_USE_PLATFORM_ANDROID_KHR
typedef struct {
VkIcdSurfaceBase base;
struct ANativeWindow *window;
} VkIcdSurfaceAndroid;
#endif // VK_USE_PLATFORM_ANDROID_KHR
#ifdef VK_USE_PLATFORM_MACOS_MVK
typedef struct {
VkIcdSurfaceBase base;
const void *pView;
} VkIcdSurfaceMacOS;
#endif // VK_USE_PLATFORM_MACOS_MVK
#ifdef VK_USE_PLATFORM_IOS_MVK
typedef struct {
VkIcdSurfaceBase base;
const void *pView;
} VkIcdSurfaceIOS;
#endif // VK_USE_PLATFORM_IOS_MVK
Roll vulkan-headers right before the ray tracing breakage. The next commit in vulkan-headers contains breaking changes that removes the provisional ray-tracing extension and add the final version of it. To ease the roll past that, we first roll just before the breaking changes. A smaller scale breaking change required rolling the Vulkan Validation Layers at the same time. Roll third_party/vulkan-headers/ ced848d69..30e70cbd9 (11 commits) https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Headers/+log/ced848d699b5..30e70cbd9850 $ git log ced848d69..30e70cbd9 --date=short --no-merges --format='%ad %ae %s' 2020-11-16 jdrouan Add GGP (Stadia) WSI platform support to vk_icd.h 2020-11-15 oddhack Update for Vulkan-Docs 1.2.161 2020-11-08 oddhack Update for Vulkan-Docs 1.2.160 2020-11-01 oddhack Update for Vulkan-Docs 1.2.159 2020-10-18 oddhack Update for Vulkan-Docs 1.2.158 2020-10-12 oddhack Update for Vulkan-Docs 1.2.157 2020-10-12 oddhack Update for Vulkan-Docs 1.2.157 2020-10-04 oddhack Update for Vulkan-Docs 1.2.156 2020-09-28 oddhack Update for Vulkan-Docs 1.2.155 2020-09-21 oddhack Update for Vulkan-Docs 1.2.154 2020-09-06 oddhack Update for Vulkan-Docs 1.2.153 Created with: roll-dep third_party/vulkan-headers Roll third_party/vulkan-validation-layers/ e8b96e86f..8756b1cb9 (498 commits) https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-ValidationLayers/+log/e8b96e86fe2e..8756b1cb930a $ git log e8b96e86f..8756b1cb9 --date=short --no-merges --format='%ad %ae %s' 2020-11-25 mark threading: Check DevWaitIdle ext sync on all device queues 2020-11-25 s.fricke layers: Label VU 04563 2020-11-25 locke tests: Fix wrong descriptor type 2020-11-24 locke layers: Skip some CMD_TYPE 2020-11-23 mark tests: Add some checks for imageFormatMaybeLinear & 02259 2020-11-20 mark stateless: Calculate correct state for 02257, add 02259 2020-11-17 mark corechecks: Use named initializing for vuid structs 2020-11-17 mark drawdispatch: Use named initializing for DrawDispatch structs 2020-11-12 mark corechecks: Moved some #defines to static consts 2020-11-12 mark cmddraw: Align non-CF'd source 2020-11-19 locke layers: Attachment lifetime 2020-10-27 locke tests: Test protected, instance index, filter cubic 2020-10-26 locke layers: Validate filter cubic 2020-10-26 locke layers: Set enum for push constat byte state 2020-10-26 locke layers: Move validation for both image and sampler 2020-10-25 locke layers: Change map lastBound into array 2020-10-20 locke layers: Find Sampler in CmdBind 2020-10-23 locke layers: Validate maxMultiviewInstanceIndex 2020-11-18 locke layers: Save shared_ptr 2020-10-23 locke layers: Protected command buffer 2020-11-23 tony layers: Fix spirv-headers known good 2020-11-19 marky build: Fix clang warnings 2020-11-18 shannon build: Update known-good files for 1.2.161 header 2020-11-16 jeremyg syncval: Use correct raster order for depth/stencil resolve 2020-11-16 mark lifetimes: Correct for non-device parent objects 2020-11-13 shannon build: Reconcile VUIDs for 1.2.160 header 2020-11-13 shannon build: Update known-good files for 1.2.160 header 2020-11-16 locke tests: Using depth stencil image in both 2020-11-16 locke layers: VUID 02687 to 04584 2020-11-11 karl tests: Add test for destroyed buffer during draw validate 2020-11-11 karl layers: Remove duplicate handles from Descriptor subclasses 2020-11-16 mark repo: Update issue templates 2020-11-16 mark repo: Update issue templates 2020-11-13 pankratz layers: Removed duplicate type declaration 2020-11-13 mark scripts: Suppress warning for empty difflist 2020-11-12 mark scripts: Remove format checking shell scripts 2020-11-11 mark scripts: Add python format-checking script and update travis 2020-11-05 mark tests: Add oldSwapchain-from-different-device test 2020-11-09 mark threading: Make swapchain objects traceable to parent 2020-11-10 mark tests: Added specialuse extension BP tests 2020-11-10 mark practices: Add checking of specialuse extensions 2020-11-09 mark practices: Check for specialuse extensions and warn 2020-11-09 mark practices: Added specialuse extension table 2020-11-10 karl layers: Fix typedef and spelling 2020-11-09 jeremyg syncval: Convert enum SyncStageAccessFlags to a std::bitset 2020-11-09 jeremyg syncval: Change generated lookup tables to be const. 2020-11-06 marshall tests: Test queue retirement over timeline semaphores 2020-11-06 marshall layers: Fix queue retirement via waited-on timeline semaphores 2020-11-06 rgarcia layers: Check nullDescriptor when validating vertex attributes 2020-11-02 shannon build: Update known-good files for 1.2.159 header (...) 2020-04-07 jzulauf layers: Add support for fake device memory address 2020-04-07 locke syncval: Refactor Image encoder/generator 2020-04-06 jzulauf syncval: Cleanup/Refactor AccessContext 2020-04-03 jzulauf layers: Add range operator + and copy constructor 2020-03-20 jzulauf layers: Add subpass transition info to RP state 2020-04-03 jzulauf syncval: Clean up and bugfix Access state resolve 2020-03-25 locke syncval: Change offset generator to image generator 2020-03-17 locke syncval: Add default constructors for Encoders 2020-03-19 jzulauf syncval: Clean attachment first/last for RP creation 2020-03-18 jzulauf syncval: Add end renderpass access context resolve 2020-03-10 jzulauf syncval: Change hazard check to use resolved map. 2020-03-10 locke syncval: Add function name to hazard log messages 2020-03-04 locke tests: Test copy buffer image and blit hazards 2020-03-02 locke syncval: Add copy buffer image and blit entry points 2020-02-28 locke syncval: Use new generator in synchronization 2020-03-04 locke tests: Fix test synchronization errors 2020-03-02 locke syncval: Add dest image adjustment for compressed 2020-02-27 locke syncval: Add new RangeEncoder and RangeGenerator 2020-03-09 jzulauf syncval: Add context interface for detect/update 2020-02-21 jzulauf layers: Enhance Subpass DAG tree information 2020-02-10 jzulauf syncval: Adding race hazard support 2020-02-03 jzulauf syncval: Add logical stage extension to exec scope 2020-01-31 jzulauf sync: Add earlier/later stage maps to codegen 2020-01-23 jzulauf syncval: Add image layout transition hazard checks 2019-12-26 jzulauf tests: Add first image sync tests 2019-12-26 jzulauf syncval: Add image sync validation for CopyImage 2019-12-26 jzulauf tests: Add more flexible interface to VkImageObj 2019-12-18 jzulauf tests: Add testcases for buffer region copies 2019-09-30 jzulauf syncval: Init Sync Val Resource Hazard 2020-07-03 s.fricke tests: Add Protected Resource VUIDs 2020-07-03 s.fricke layers: Add Protected Resource VUIDs 2020-07-09 timvp build: Add a virtual dtor to AspectParameters 2020-07-08 jan-harald.fredriksen tests: Add VUID 04059 2020-07-08 jan-harald.fredriksen layers: Add VUID 04059 2020-07-09 s.fricke tests: Add YCbCr Swizzle VUIDs 2020-07-04 s.fricke layers: Add YCbCr Swizzle VUIDs 2020-07-09 tony layers: Remove leftover enum 2020-07-08 liyl chassis: Fix memory leaks 2020-07-02 lionel.g.landwerlin layers: fix image/view with modifier format feature storage 2020-07-06 shannon build: Fix VUID inconsistencies for 1.2.146 header 2020-07-06 shannon build: Update known-good files for 1.2.146 header 2020-07-08 tony layers: Fix log message 2020-07-07 tony gpu: Fix enabling of required features 2020-07-07 tony tests: Add PhysicalDeviceFeatures to device profile api 2020-07-03 s.fricke layers: Move some sparse VU to stateless 2020-07-08 40687079+rumblehhh Update BUILD.md to use correct helper.cmake path 2020-07-02 s.fricke tests: Add VUID 02711 2020-07-01 s.fricke layers: Add VUID 02711 2020-07-06 mark objtracker: Don't report undestroyable objects 2020-07-01 mark threading: Audit VkDisplay, VkDisplayMode object handling Created with: roll-dep third_party/vulkan-validation-layers Change-Id: Ie55286cecb8b7d0163a629968786195d211ea662 Bug: chromium:1153258 Change-Id: I0bb6a910c5a7d3f13731097abb1fe4b8de38c6d0 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/34143 Commit-Queue: David Neto <dneto@google.com> Reviewed-by: David Neto <dneto@google.com>
2020-11-27 15:30:07 +00:00
#ifdef VK_USE_PLATFORM_GGP
typedef struct {
VkIcdSurfaceBase base;
GgpStreamDescriptor streamDescriptor;
} VkIcdSurfaceGgp;
#endif // VK_USE_PLATFORM_GGP
typedef struct {
VkIcdSurfaceBase base;
VkDisplayModeKHR displayMode;
uint32_t planeIndex;
uint32_t planeStackIndex;
VkSurfaceTransformFlagBitsKHR transform;
float globalAlpha;
VkDisplayPlaneAlphaFlagBitsKHR alphaMode;
VkExtent2D imageExtent;
} VkIcdSurfaceDisplay;
typedef struct {
VkIcdSurfaceBase base;
} VkIcdSurfaceHeadless;
#ifdef VK_USE_PLATFORM_METAL_EXT
typedef struct {
VkIcdSurfaceBase base;
const CAMetalLayer *pLayer;
} VkIcdSurfaceMetal;
#endif // VK_USE_PLATFORM_METAL_EXT
#ifdef VK_USE_PLATFORM_VI_NN
typedef struct {
VkIcdSurfaceBase base;
void *window;
} VkIcdSurfaceVi;
#endif // VK_USE_PLATFORM_VI_NN
#ifdef VK_USE_PLATFORM_SCREEN_QNX
typedef struct {
VkIcdSurfaceBase base;
struct _screen_context *context;
struct _screen_window *window;
} VkIcdSurfaceScreen;
#endif // VK_USE_PLATFORM_SCREEN_QNX
#endif // VKICD_H