aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorMark Young <marky@lunarg.com>2017-01-19 21:10:49 -0700
committerLenny Komow <lenny@lunarg.com>2017-01-24 14:07:22 -0700
commit82ea0b0103880d011ca679b14f0fc5542c5b2012 (patch)
tree11be85261197447e58e046affecbd43c36b4a8d8 /layers/core_validation.cpp
parent8fc3d170de6515c0d26fb6b17bd3b5e27711e607 (diff)
downloadusermoji-82ea0b0103880d011ca679b14f0fc5542c5b2012.tar.xz
loader: Update the loader to 1.0.39
Add new extensions for 1.0.39. Also, updated layers to include minimal set of functionality for 1.0.39 extensions. Extensions include: - VK_KHR_get_physical_device_properties2 - VK_KHR_shader_draw_parameters - VK_EXT_direct_mode_display - VK_EXT_display_surface_counter - VK_EXT_display_control Also, redo the LoaderAndLayerIf document. Change-Id: I10412086da7a798afe832a3892e18f606259b5af
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp54
1 files changed, 53 insertions, 1 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index fd21f013..b6b9c821 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -117,6 +117,8 @@ struct instance_layer_data {
CALL_STATE vkEnumeratePhysicalDevicesState = UNCALLED;
uint32_t physical_devices_count = 0;
+ CALL_STATE vkEnumeratePhysicalDeviceGroupsState = UNCALLED;
+ uint32_t physical_device_groups_count = 0;
CHECK_DISABLED disabled = {};
unordered_map<VkPhysicalDevice, PHYSICAL_DEVICE_STATE> physical_device_map;
@@ -182,6 +184,8 @@ struct layer_data {
static unordered_map<void *, layer_data *> layer_data_map;
static unordered_map<void *, instance_layer_data *> instance_layer_data_map;
+static uint32_t loader_layer_if_version = CURRENT_LOADER_LAYER_INTERFACE_VERSION;
+
static const VkLayerProperties global_layer = {
"VK_LAYER_LUNARG_core_validation", VK_LAYER_API_VERSION, 1, "LunarG Validation Layer",
};
@@ -4103,7 +4107,6 @@ CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallba
instance_layer_data *instance_data = get_my_data_ptr(get_dispatch_key(*pInstance), instance_layer_data_map);
instance_data->instance = *pInstance;
layer_init_instance_dispatch_table(*pInstance, &instance_data->dispatch_table, fpGetInstanceProcAddr);
-
instance_data->report_data = debug_report_create_instance(
&instance_data->dispatch_table, *pInstance, pCreateInfo->enabledExtensionCount, pCreateInfo->ppEnabledExtensionNames);
checkInstanceRegisterExtensions(pCreateInfo, instance_data);
@@ -12941,6 +12944,9 @@ intercept_khr_swapchain_command(const char *name, VkDevice dev);
static PFN_vkVoidFunction
intercept_khr_surface_command(const char *name, VkInstance instance);
+static PFN_vkVoidFunction
+intercept_extension_instance_commands(const char *name, VkInstance instance);
+
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice dev, const char *funcName) {
PFN_vkVoidFunction proc = intercept_core_device_command(funcName);
if (proc)
@@ -12978,12 +12984,27 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(VkInstance instance
if (proc)
return proc;
+ proc = intercept_extension_instance_commands(funcName, instance);
+ if (proc)
+ return proc;
+
auto &table = instance_data->dispatch_table;
if (!table.GetInstanceProcAddr)
return nullptr;
return table.GetInstanceProcAddr(instance, funcName);
}
+VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetPhysicalDeviceProcAddr(VkInstance instance, const char *funcName) {
+ assert(instance);
+
+ instance_layer_data *instance_data = get_my_data_ptr(get_dispatch_key(instance), instance_layer_data_map);
+
+ auto &table = instance_data->dispatch_table;
+ if (!table.GetPhysicalDeviceProcAddr)
+ return nullptr;
+ return table.GetPhysicalDeviceProcAddr(instance, funcName);
+}
+
static PFN_vkVoidFunction
intercept_core_instance_command(const char *name) {
static const struct {
@@ -12991,6 +13012,7 @@ intercept_core_instance_command(const char *name) {
PFN_vkVoidFunction proc;
} core_instance_commands[] = {
{ "vkGetInstanceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetInstanceProcAddr) },
+ { "vk_layerGetPhysicalDeviceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceProcAddr) },
{ "vkGetDeviceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetDeviceProcAddr) },
{ "vkCreateInstance", reinterpret_cast<PFN_vkVoidFunction>(CreateInstance) },
{ "vkCreateDevice", reinterpret_cast<PFN_vkVoidFunction>(CreateDevice) },
@@ -13240,6 +13262,11 @@ intercept_khr_surface_command(const char *name, VkInstance instance) {
return nullptr;
}
+static PFN_vkVoidFunction
+intercept_extension_instance_commands(const char *name, VkInstance instance) {
+ return NULL;
+}
+
} // namespace core_validation
// vk_layer_logging.h expects these to be defined
@@ -13297,3 +13324,28 @@ VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkD
VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *funcName) {
return core_validation::GetInstanceProcAddr(instance, funcName);
}
+
+VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_layerGetPhysicalDeviceProcAddr(VkInstance instance, const char *funcName) {
+ return core_validation::GetPhysicalDeviceProcAddr(instance, funcName);
+}
+
+VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkNegotiateLoaderLayerInterfaceVersion(VkNegotiateLayerInterface *pVersionStruct) {
+ assert(pVersionStruct != NULL);
+ assert(pVersionStruct->sType == LAYER_NEGOTIATE_INTERFACE_STRUCT);
+
+ // Fill in the function pointers if our version is at least capable of having the structure contain them.
+ if (pVersionStruct->loaderLayerInterfaceVersion >= 2) {
+ pVersionStruct->pfnGetInstanceProcAddr = vkGetInstanceProcAddr;
+ pVersionStruct->pfnGetDeviceProcAddr = vkGetDeviceProcAddr;
+ pVersionStruct->pfnGetPhysicalDeviceProcAddr = vk_layerGetPhysicalDeviceProcAddr;
+ }
+
+ if (pVersionStruct->loaderLayerInterfaceVersion < CURRENT_LOADER_LAYER_INTERFACE_VERSION) {
+ core_validation::loader_layer_if_version = pVersionStruct->loaderLayerInterfaceVersion;
+ } else if (pVersionStruct->loaderLayerInterfaceVersion > CURRENT_LOADER_LAYER_INTERFACE_VERSION) {
+ pVersionStruct->loaderLayerInterfaceVersion = CURRENT_LOADER_LAYER_INTERFACE_VERSION;
+ }
+
+ return VK_SUCCESS;
+}
+