From cacdfc62d5b6e36b7e2584c2494d9c0b23acf7e7 Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Thu, 1 Jun 2017 07:56:38 -0600 Subject: layers: Move CV to use new extension helper Change-Id: Idb18d0f358fd359c1c5862fba394c833e2fa13f1 --- layers/core_validation.cpp | 85 +++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 42 deletions(-) (limited to 'layers/core_validation.cpp') diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 1cd39735..bd95f323 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -2209,13 +2209,13 @@ static bool validate_shader_capabilities(layer_data *dev_data, shader_module con {spv::CapabilityMultiViewport, {"multiViewport", &F::multiViewport}}, // Capabilities that require an extension - {spv::CapabilityDrawParameters, {VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME, nullptr, &E::khr_shader_draw_parameters}}, - {spv::CapabilityGeometryShaderPassthroughNV, {VK_NV_GEOMETRY_SHADER_PASSTHROUGH_EXTENSION_NAME, nullptr, &E::nv_geometry_shader_passthrough}}, - {spv::CapabilitySampleMaskOverrideCoverageNV, {VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_EXTENSION_NAME, nullptr, &E::nv_sample_mask_override_coverage}}, - {spv::CapabilityShaderViewportIndexLayerNV, {VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME, nullptr, &E::nv_viewport_array2}}, - {spv::CapabilityShaderViewportMaskNV, {VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME, nullptr, &E::nv_viewport_array2}}, - {spv::CapabilitySubgroupBallotKHR, {VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME, nullptr, &E::khr_subgroup_ballot}}, - {spv::CapabilitySubgroupVoteKHR, {VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME, nullptr, &E::khr_subgroup_vote}}, + {spv::CapabilityDrawParameters, {VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME, nullptr, &E::vk_khr_shader_draw_parameters}}, + {spv::CapabilityGeometryShaderPassthroughNV, {VK_NV_GEOMETRY_SHADER_PASSTHROUGH_EXTENSION_NAME, nullptr, &E::vk_nv_geometry_shader_passthrough}}, + {spv::CapabilitySampleMaskOverrideCoverageNV, {VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_EXTENSION_NAME, nullptr, &E::vk_nv_sample_mask_override_coverage}}, + {spv::CapabilityShaderViewportIndexLayerNV, {VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME, nullptr, &E::vk_nv_viewport_array2}}, + {spv::CapabilityShaderViewportMaskNV, {VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME, nullptr, &E::vk_nv_viewport_array2}}, + {spv::CapabilitySubgroupBallotKHR, {VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME, nullptr, &E::vk_ext_shader_subgroup_ballot }}, + {spv::CapabilitySubgroupVoteKHR, {VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME, nullptr, &E::vk_ext_shader_subgroup_vote }}, }; // clang-format on @@ -3451,7 +3451,7 @@ static bool ValidatePhysicalDeviceQueueFamily(instance_layer_data *instance_data if (!vu_note) vu_note = validation_error_map[err_code]; const char *conditional_ext_cmd = - instance_data->extensions.khr_get_physical_device_properties2 ? "or vkGetPhysicalDeviceQueueFamilyProperties2KHR" : ""; + instance_data->extensions.vk_khr_get_physical_device_properties_2 ? "or vkGetPhysicalDeviceQueueFamilyProperties2KHR" : ""; std::string count_note = (UNCALLED == pd_state->vkGetPhysicalDeviceQueueFamilyPropertiesState) ? "the pQueueFamilyPropertyCount was never obtained" @@ -3486,7 +3486,7 @@ static bool ValidateDeviceQueueCreateInfos(instance_layer_data *instance_data, c const auto requested_queue_count = infos[i].queueCount; const auto queue_family_props_count = pd_state->queue_family_properties.size(); const bool queue_family_has_props = requested_queue_family < queue_family_props_count; - const char *conditional_ext_cmd = instance_data->extensions.khr_get_physical_device_properties2 + const char *conditional_ext_cmd = instance_data->extensions.vk_khr_get_physical_device_properties_2 ? "or vkGetPhysicalDeviceQueueFamilyProperties2KHR" : ""; std::string count_note = @@ -3605,7 +3605,8 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice gpu, const VkDevice device_data->physical_device = gpu; device_data->report_data = layer_debug_report_create_device(instance_data->report_data, *pDevice); - device_data->device_extensions.InitFromDeviceCreateInfo(pCreateInfo); + device_data->device_extensions.InitFromDeviceCreateInfo(&instance_data->extensions, pCreateInfo); + // Get physical device limits for this device instance_data->dispatch_table.GetPhysicalDeviceProperties(gpu, &(device_data->phys_dev_properties.properties)); uint32_t count; @@ -8787,7 +8788,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateShaderModule(VkDevice device, const VkShade spv_result_t spv_valid = SPV_SUCCESS; if (!GetDisables(dev_data)->shader_validation) { - if (!dev_data->device_extensions.nv_glsl_shader && (pCreateInfo->codeSize % 4)) { + if (!dev_data->device_extensions.vk_nv_glsl_shader && (pCreateInfo->codeSize % 4)) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_12a00ac0, "SC", "SPIR-V module not valid: Codesize must be a multiple of 4 but is " PRINTF_SIZE_T_SPECIFIER ". %s", @@ -8800,7 +8801,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateShaderModule(VkDevice device, const VkShade spv_valid = spvValidate(ctx, &binary, &diag); if (spv_valid != SPV_SUCCESS) { - if (!dev_data->device_extensions.nv_glsl_shader || (pCreateInfo->pCode[0] == spv::MagicNumber)) { + if (!dev_data->device_extensions.vk_nv_glsl_shader || (pCreateInfo->pCode[0] == spv::MagicNumber)) { skip |= log_msg(dev_data->report_data, spv_valid == SPV_WARNING ? VK_DEBUG_REPORT_WARNING_BIT_EXT : VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, SHADER_CHECKER_INCONSISTENT_SPIRV, "SC", @@ -10062,7 +10063,7 @@ static bool PreCallValidateCreateSwapchainKHR(layer_data *dev_data, const char * // All physical devices and queue families are required to be able // to present to any native window on Android; require the // application to have established support on any other platform. - if (!dev_data->instance_data->extensions.khr_android_surface) { + if (!dev_data->instance_data->extensions.vk_khr_android_surface) { auto support_predicate = [dev_data](decltype(surface_state->gpu_queue_support)::const_reference qs) -> bool { // TODO: should restrict search only to queue families of VkDeviceQueueCreateInfos, not whole phys. device return (qs.first.gpu == dev_data->physical_device) && qs.second; @@ -10279,7 +10280,7 @@ static bool PreCallValidateCreateSwapchainKHR(layer_data *dev_data, const char * // Validate state for shared presentable case if (VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR == pCreateInfo->presentMode || VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR == pCreateInfo->presentMode) { - if (!dev_data->device_extensions.khr_shared_presentable_image) { + if (!dev_data->device_extensions.vk_khr_shared_presentable_image) { if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, HandleToUint64(dev_data->device), __LINE__, DRAWSTATE_EXTENSION_NOT_ENABLED, "DS", "%s called with presentMode %s which requires the VK_KHR_shared_presentable_image extension, which has not " @@ -10471,7 +10472,7 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf if (FindLayouts(dev_data, image, layouts)) { for (auto layout : layouts) { if ((layout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR) && - (!dev_data->device_extensions.khr_shared_presentable_image || + (!dev_data->device_extensions.vk_khr_shared_presentable_image || (layout != VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR))) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT, @@ -10487,7 +10488,7 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf // All physical devices and queue families are required to be able // to present to any native window on Android; require the // application to have established support on any other platform. - if (!dev_data->instance_data->extensions.khr_android_surface) { + if (!dev_data->instance_data->extensions.vk_khr_android_surface) { auto surface_state = GetSurfaceState(dev_data->instance_data, swapchain_data->createInfo.surface); auto support_it = surface_state->gpu_queue_support.find({dev_data->physical_device, queue_state->queueFamilyIndex}); @@ -11797,13 +11798,13 @@ static PFN_vkVoidFunction intercept_device_extension_command(const char *name, V bool enabled; } device_extension_commands[] = { {"vkCreateDescriptorUpdateTemplateKHR", reinterpret_cast(CreateDescriptorUpdateTemplateKHR), - device_data->device_extensions.khr_descriptor_update_template}, + device_data->device_extensions.vk_khr_descriptor_update_template}, {"vkDestroyDescriptorUpdateTemplateKHR", reinterpret_cast(DestroyDescriptorUpdateTemplateKHR), - device_data->device_extensions.khr_descriptor_update_template}, + device_data->device_extensions.vk_khr_descriptor_update_template}, {"vkUpdateDescriptorSetWithTemplateKHR", reinterpret_cast(UpdateDescriptorSetWithTemplateKHR), - device_data->device_extensions.khr_descriptor_update_template}, + device_data->device_extensions.vk_khr_descriptor_update_template}, {"vkCmdPushDescriptorSetWithTemplateKHR", reinterpret_cast(CmdPushDescriptorSetWithTemplateKHR), - device_data->device_extensions.khr_descriptor_update_template}, + device_data->device_extensions.vk_khr_descriptor_update_template}, }; if (!device_data) return nullptr; @@ -11831,7 +11832,7 @@ static PFN_vkVoidFunction intercept_khr_swapchain_command(const char *name, VkDe if (dev) { dev_data = GetLayerDataPtr(get_dispatch_key(dev), layer_data_map); - if (!dev_data->device_extensions.khr_swapchain) return nullptr; + if (!dev_data->device_extensions.vk_khr_swapchain) return nullptr; } for (size_t i = 0; i < ARRAY_SIZE(khr_swapchain_commands); i++) { @@ -11839,7 +11840,7 @@ static PFN_vkVoidFunction intercept_khr_swapchain_command(const char *name, VkDe } if (dev_data) { - if (!dev_data->device_extensions.khr_display_swapchain) return nullptr; + if (!dev_data->device_extensions.vk_khr_display_swapchain) return nullptr; } if (!strcmp("vkCreateSharedSwapchainsKHR", name)) return reinterpret_cast(CreateSharedSwapchainsKHR); @@ -11855,49 +11856,49 @@ static PFN_vkVoidFunction intercept_khr_surface_command(const char *name, VkInst bool E::*enable; } khr_surface_commands[] = { #ifdef VK_USE_PLATFORM_ANDROID_KHR - {"vkCreateAndroidSurfaceKHR", reinterpret_cast(CreateAndroidSurfaceKHR), &E::khr_android_surface}, + {"vkCreateAndroidSurfaceKHR", reinterpret_cast(CreateAndroidSurfaceKHR), &E::vk_khr_android_surface}, #endif // VK_USE_PLATFORM_ANDROID_KHR #ifdef VK_USE_PLATFORM_MIR_KHR - {"vkCreateMirSurfaceKHR", reinterpret_cast(CreateMirSurfaceKHR), &E::khr_mir_surface}, + {"vkCreateMirSurfaceKHR", reinterpret_cast(CreateMirSurfaceKHR), &E::vk_khr_mir_surface}, {"vkGetPhysicalDeviceMirPresentationSupportKHR", - reinterpret_cast(GetPhysicalDeviceMirPresentationSupportKHR), &E::khr_mir_surface}, + reinterpret_cast(GetPhysicalDeviceMirPresentationSupportKHR), &E::vk_khr_mir_surface}, #endif // VK_USE_PLATFORM_MIR_KHR #ifdef VK_USE_PLATFORM_WAYLAND_KHR - {"vkCreateWaylandSurfaceKHR", reinterpret_cast(CreateWaylandSurfaceKHR), &E::khr_wayland_surface}, + {"vkCreateWaylandSurfaceKHR", reinterpret_cast(CreateWaylandSurfaceKHR), &E::vk_khr_wayland_surface}, {"vkGetPhysicalDeviceWaylandPresentationSupportKHR", - reinterpret_cast(GetPhysicalDeviceWaylandPresentationSupportKHR), &E::khr_wayland_surface}, + reinterpret_cast(GetPhysicalDeviceWaylandPresentationSupportKHR), &E::vk_khr_wayland_surface}, #endif // VK_USE_PLATFORM_WAYLAND_KHR #ifdef VK_USE_PLATFORM_WIN32_KHR - {"vkCreateWin32SurfaceKHR", reinterpret_cast(CreateWin32SurfaceKHR), &E::khr_win32_surface}, + {"vkCreateWin32SurfaceKHR", reinterpret_cast(CreateWin32SurfaceKHR), &E::vk_khr_win32_surface}, {"vkGetPhysicalDeviceWin32PresentationSupportKHR", - reinterpret_cast(GetPhysicalDeviceWin32PresentationSupportKHR), &E::khr_win32_surface}, + reinterpret_cast(GetPhysicalDeviceWin32PresentationSupportKHR), &E::vk_khr_win32_surface}, #endif // VK_USE_PLATFORM_WIN32_KHR #ifdef VK_USE_PLATFORM_XCB_KHR - {"vkCreateXcbSurfaceKHR", reinterpret_cast(CreateXcbSurfaceKHR), &E::khr_xcb_surface}, + {"vkCreateXcbSurfaceKHR", reinterpret_cast(CreateXcbSurfaceKHR), &E::vk_khr_xcb_surface}, {"vkGetPhysicalDeviceXcbPresentationSupportKHR", - reinterpret_cast(GetPhysicalDeviceXcbPresentationSupportKHR), &E::khr_xcb_surface}, + reinterpret_cast(GetPhysicalDeviceXcbPresentationSupportKHR), &E::vk_khr_xcb_surface}, #endif // VK_USE_PLATFORM_XCB_KHR #ifdef VK_USE_PLATFORM_XLIB_KHR - {"vkCreateXlibSurfaceKHR", reinterpret_cast(CreateXlibSurfaceKHR), &E::khr_xlib_surface}, + {"vkCreateXlibSurfaceKHR", reinterpret_cast(CreateXlibSurfaceKHR), &E::vk_khr_xlib_surface}, {"vkGetPhysicalDeviceXlibPresentationSupportKHR", - reinterpret_cast(GetPhysicalDeviceXlibPresentationSupportKHR), &E::khr_xlib_surface}, + reinterpret_cast(GetPhysicalDeviceXlibPresentationSupportKHR), &E::vk_khr_xlib_surface}, #endif // VK_USE_PLATFORM_XLIB_KHR - {"vkCreateDisplayPlaneSurfaceKHR", reinterpret_cast(CreateDisplayPlaneSurfaceKHR), &E::khr_display}, - {"vkDestroySurfaceKHR", reinterpret_cast(DestroySurfaceKHR), &E::khr_surface}, + {"vkCreateDisplayPlaneSurfaceKHR", reinterpret_cast(CreateDisplayPlaneSurfaceKHR), &E::vk_khr_display}, + {"vkDestroySurfaceKHR", reinterpret_cast(DestroySurfaceKHR), &E::vk_khr_surface}, {"vkGetPhysicalDeviceSurfaceCapabilitiesKHR", reinterpret_cast(GetPhysicalDeviceSurfaceCapabilitiesKHR), - &E::khr_surface}, + &E::vk_khr_surface}, {"vkGetPhysicalDeviceSurfaceCapabilities2KHR", - reinterpret_cast(GetPhysicalDeviceSurfaceCapabilities2KHR), &E::khr_get_surface_capabilities2}, + reinterpret_cast(GetPhysicalDeviceSurfaceCapabilities2KHR), &E::vk_khr_get_surface_capabilities_2}, {"vkGetPhysicalDeviceSurfaceCapabilities2EXT", - reinterpret_cast(GetPhysicalDeviceSurfaceCapabilities2EXT), &E::ext_display_surface_counter}, + reinterpret_cast(GetPhysicalDeviceSurfaceCapabilities2EXT), &E::vk_ext_display_surface_counter}, {"vkGetPhysicalDeviceSurfaceSupportKHR", reinterpret_cast(GetPhysicalDeviceSurfaceSupportKHR), - &E::khr_surface}, + &E::vk_khr_surface}, {"vkGetPhysicalDeviceSurfacePresentModesKHR", reinterpret_cast(GetPhysicalDeviceSurfacePresentModesKHR), - &E::khr_surface}, + &E::vk_khr_surface}, {"vkGetPhysicalDeviceSurfaceFormatsKHR", reinterpret_cast(GetPhysicalDeviceSurfaceFormatsKHR), - &E::khr_surface}, + &E::vk_khr_surface}, {"vkGetPhysicalDeviceSurfaceFormats2KHR", reinterpret_cast(GetPhysicalDeviceSurfaceFormats2KHR), - &E::khr_get_surface_capabilities2}, + &E::vk_khr_get_surface_capabilities_2}, }; instance_layer_data *instance_data = nullptr; -- cgit v1.2.3