2016-02-18 01:42:25 +00:00
|
|
|
//
|
|
|
|
// File: vk_layer.h
|
|
|
|
//
|
|
|
|
/*
|
2017-05-12 01:09:31 +00:00
|
|
|
* Copyright (c) 2015-2017 The Khronos Group Inc.
|
|
|
|
* Copyright (c) 2015-2017 Valve Corporation
|
|
|
|
* Copyright (c) 2015-2017 LunarG, Inc.
|
2016-02-18 01:42:25 +00:00
|
|
|
*
|
2016-06-18 00:32:21 +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
|
2016-02-18 01:42:25 +00:00
|
|
|
*
|
2016-06-18 00:32:21 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2016-02-18 01:42:25 +00:00
|
|
|
*
|
2016-06-18 00:32:21 +00:00
|
|
|
* 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.
|
2016-02-18 01:42:25 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Need to define dispatch table
|
|
|
|
* Core struct can then have ptr to dispatch table at the top
|
|
|
|
* Along with object ptrs for current and next OBJ
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "vulkan.h"
|
|
|
|
#if defined(__GNUC__) && __GNUC__ >= 4
|
|
|
|
#define VK_LAYER_EXPORT __attribute__((visibility("default")))
|
|
|
|
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
|
|
|
|
#define VK_LAYER_EXPORT __attribute__((visibility("default")))
|
|
|
|
#else
|
|
|
|
#define VK_LAYER_EXPORT
|
|
|
|
#endif
|
|
|
|
|
2017-05-12 01:09:31 +00:00
|
|
|
// Definition for VkLayerDispatchTable and VkLayerInstanceDispatchTable now appear in externally generated header
|
|
|
|
#include "vk_layer_dispatch_table.h"
|
|
|
|
|
2017-01-27 05:57:54 +00:00
|
|
|
#define MAX_NUM_UNKNOWN_EXTS 250
|
|
|
|
|
|
|
|
// Loader-Layer version negotiation API. Versions add the following features:
|
|
|
|
// Versions 0/1 - Initial. Doesn't support vk_layerGetPhysicalDeviceProcAddr
|
|
|
|
// or vk_icdNegotiateLoaderLayerInterfaceVersion.
|
|
|
|
// Version 2 - Add support for vk_layerGetPhysicalDeviceProcAddr and
|
|
|
|
// vk_icdNegotiateLoaderLayerInterfaceVersion.
|
|
|
|
#define CURRENT_LOADER_LAYER_INTERFACE_VERSION 2
|
|
|
|
#define MIN_SUPPORTED_LOADER_LAYER_INTERFACE_VERSION 1
|
|
|
|
|
|
|
|
// Version negotiation values
|
|
|
|
typedef enum VkNegotiateLayerStructType {
|
|
|
|
LAYER_NEGOTIATE_UNINTIALIZED = 0,
|
|
|
|
LAYER_NEGOTIATE_INTERFACE_STRUCT = 1,
|
|
|
|
} VkNegotiateLayerStructType;
|
|
|
|
|
|
|
|
// Version negotiation structures
|
|
|
|
typedef struct VkNegotiateLayerInterface {
|
|
|
|
VkNegotiateLayerStructType sType;
|
|
|
|
void *pNext;
|
|
|
|
uint32_t loaderLayerInterfaceVersion;
|
|
|
|
PFN_vkGetInstanceProcAddr pfnGetInstanceProcAddr;
|
|
|
|
PFN_vkGetDeviceProcAddr pfnGetDeviceProcAddr;
|
|
|
|
PFN_GetPhysicalDeviceProcAddr pfnGetPhysicalDeviceProcAddr;
|
|
|
|
} VkNegotiateLayerInterface;
|
|
|
|
|
|
|
|
// Version negotiation functions
|
|
|
|
typedef VkResult (VKAPI_PTR *PFN_vkNegotiateLoaderLayerInterfaceVersion)(VkNegotiateLayerInterface *pVersionStruct);
|
|
|
|
|
|
|
|
// Function prototype for unknown physical device extension command
|
2017-08-09 01:44:24 +00:00
|
|
|
typedef VkResult(VKAPI_PTR *PFN_PhysDevExt)(VkPhysicalDevice phys_device);
|
2017-01-27 05:57:54 +00:00
|
|
|
|
2016-02-18 01:42:25 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// CreateInstance and CreateDevice support structures
|
|
|
|
|
2016-06-18 00:32:21 +00:00
|
|
|
/* Sub type of structure for instance and device loader ext of CreateInfo.
|
|
|
|
* When sType == VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
|
|
|
|
* or sType == VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
|
|
|
|
* then VkLayerFunction indicates struct type pointed to by pNext
|
|
|
|
*/
|
2016-02-18 01:42:25 +00:00
|
|
|
typedef enum VkLayerFunction_ {
|
|
|
|
VK_LAYER_LINK_INFO = 0,
|
2016-06-18 00:32:21 +00:00
|
|
|
VK_LOADER_DATA_CALLBACK = 1
|
2016-02-18 01:42:25 +00:00
|
|
|
} VkLayerFunction;
|
|
|
|
|
|
|
|
typedef struct VkLayerInstanceLink_ {
|
|
|
|
struct VkLayerInstanceLink_ *pNext;
|
|
|
|
PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
|
2017-01-27 05:57:54 +00:00
|
|
|
PFN_GetPhysicalDeviceProcAddr pfnNextGetPhysicalDeviceProcAddr;
|
2016-02-18 01:42:25 +00:00
|
|
|
} VkLayerInstanceLink;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* When creating the device chain the loader needs to pass
|
|
|
|
* down information about it's device structure needed at
|
|
|
|
* the end of the chain. Passing the data via the
|
|
|
|
* VkLayerDeviceInfo avoids issues with finding the
|
|
|
|
* exact instance being used.
|
|
|
|
*/
|
|
|
|
typedef struct VkLayerDeviceInfo_ {
|
|
|
|
void *device_info;
|
|
|
|
PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
|
|
|
|
} VkLayerDeviceInfo;
|
|
|
|
|
2016-06-18 00:32:21 +00:00
|
|
|
typedef VkResult (VKAPI_PTR *PFN_vkSetInstanceLoaderData)(VkInstance instance,
|
|
|
|
void *object);
|
|
|
|
typedef VkResult (VKAPI_PTR *PFN_vkSetDeviceLoaderData)(VkDevice device,
|
|
|
|
void *object);
|
|
|
|
|
2016-02-18 01:42:25 +00:00
|
|
|
typedef struct {
|
2016-06-18 00:32:21 +00:00
|
|
|
VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
|
2016-02-18 01:42:25 +00:00
|
|
|
const void *pNext;
|
|
|
|
VkLayerFunction function;
|
|
|
|
union {
|
|
|
|
VkLayerInstanceLink *pLayerInfo;
|
2016-06-18 00:32:21 +00:00
|
|
|
PFN_vkSetInstanceLoaderData pfnSetInstanceLoaderData;
|
2016-02-18 01:42:25 +00:00
|
|
|
} u;
|
|
|
|
} VkLayerInstanceCreateInfo;
|
|
|
|
|
|
|
|
typedef struct VkLayerDeviceLink_ {
|
|
|
|
struct VkLayerDeviceLink_ *pNext;
|
|
|
|
PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
|
|
|
|
PFN_vkGetDeviceProcAddr pfnNextGetDeviceProcAddr;
|
|
|
|
} VkLayerDeviceLink;
|
|
|
|
|
|
|
|
typedef struct {
|
2016-06-18 00:32:21 +00:00
|
|
|
VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
|
2016-02-18 01:42:25 +00:00
|
|
|
const void *pNext;
|
|
|
|
VkLayerFunction function;
|
|
|
|
union {
|
|
|
|
VkLayerDeviceLink *pLayerInfo;
|
2016-06-18 00:32:21 +00:00
|
|
|
PFN_vkSetDeviceLoaderData pfnSetDeviceLoaderData;
|
2016-02-18 01:42:25 +00:00
|
|
|
} u;
|
|
|
|
} VkLayerDeviceCreateInfo;
|
|
|
|
|
2017-08-09 01:44:24 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
VKAPI_ATTR VkResult VKAPI_CALL vkNegotiateLoaderLayerInterfaceVersion(VkNegotiateLayerInterface *pVersionStruct);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|