Skip to content

Commit

Permalink
tests: Fix various missing extension errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyg-lunarg committed Jan 16, 2025
1 parent d6dee3b commit 0f4f347
Show file tree
Hide file tree
Showing 17 changed files with 170 additions and 57 deletions.
14 changes: 12 additions & 2 deletions tests/framework/video_objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -2805,6 +2805,10 @@ class VkVideoLayerTest : public VkLayerTest {

protected_no_fault_supported_ = (prot_mem_props.protectedNoFault == VK_TRUE);

// TODO: these tests use features and capabilities structures for extensions that
// aren't enabled on all platforms.
m_errorMonitor->SetAllowedFailureMsg("VUID-VkDeviceCreateInfo-pNext-pNext");
m_errorMonitor->SetAllowedFailureMsg("VUID-VkVideoCapabilitiesKHR-pNext-pNext");
RETURN_IF_SKIP(InitState());

uint32_t qf_count;
Expand Down Expand Up @@ -3635,7 +3639,10 @@ class PositiveVideo : public VkVideoLayerTest {};

class VkVideoSyncLayerTest : public VkVideoLayerTest {
public:
VkVideoSyncLayerTest() { setInstancePNext(&features_); }
VkVideoSyncLayerTest() {
setInstancePNext(&features_);
AddRequiredExtensions(VK_EXT_VALIDATION_FEATURES_EXTENSION_NAME);
}

private:
const VkValidationFeatureEnableEXT enables_[1] = {VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT};
Expand All @@ -3650,7 +3657,10 @@ class PositiveSyncValVideo : public VkVideoSyncLayerTest {};

class VkVideoBestPracticesLayerTest : public VkVideoLayerTest {
public:
VkVideoBestPracticesLayerTest() { setInstancePNext(&features_); }
VkVideoBestPracticesLayerTest() {
setInstancePNext(&features_);
AddRequiredExtensions(VK_EXT_VALIDATION_FEATURES_EXTENSION_NAME);
}

private:
VkValidationFeatureEnableEXT enables_[1] = {VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT};
Expand Down
27 changes: 21 additions & 6 deletions tests/unit/best_practices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ void VkBestPracticesLayerTest::InitBestPracticesFramework(const char *vendor_che

features_.pNext = &layer_settings_create_info;

AddRequiredExtensions(VK_EXT_VALIDATION_FEATURES_EXTENSION_NAME);
InitFramework(&features_);
}

Expand Down Expand Up @@ -104,28 +105,42 @@ TEST_F(VkBestPracticesLayerTest, UseDeprecatedInstanceExtensions) {
m_errorMonitor->SetDesiredWarning("BestPractices-deprecated-extension");
}

m_errorMonitor->SetDesiredWarning("BestPractices-deprecated-extension"); // VK_KHR_get_physical_device_properties2,
m_errorMonitor->SetDesiredWarning("BestPractices-deprecated-extension"); // VK_KHR_get_physical_device_properties2
m_errorMonitor->SetDesiredWarning("BestPractices-deprecated-extension"); // VK_EXT_validation_features
m_errorMonitor->SetDesiredWarning("BestPractices-specialuse-extension"); // VK_EXT_debug_utils
VkInstance dummy;
m_errorMonitor->SetDesiredWarning("BestPractices-specialuse-extension"); // VK_EXT_validation_features

VkInstance dummy = VK_NULL_HANDLE;
auto features = features_;
auto ici = GetInstanceCreateInfo();
features.pNext = ici.pNext;
ici.pNext = &features;
vk::CreateInstance(&ici, nullptr, &dummy);
m_errorMonitor->VerifyFound();

// Create a 1.0 vulkan instance and request an extension promoted to core in 1.1
m_errorMonitor->SetUnexpectedError("khronos-Validation-debug-build-warning-message");
m_errorMonitor->SetUnexpectedError("khronos-Validation-fine-grained-locking-warning-message");
VkApplicationInfo new_info{};
new_info.apiVersion = VK_API_VERSION_1_0;
new_info.pApplicationName = ici.pApplicationInfo->pApplicationName;
new_info.applicationVersion = ici.pApplicationInfo->applicationVersion;
new_info.pEngineName = ici.pApplicationInfo->pEngineName;
new_info.engineVersion = ici.pApplicationInfo->engineVersion;
ici.pApplicationInfo = &new_info;

// Create a 1.0 vulkan instance and request an extension promoted to core in 1.1
if (IsExtensionsEnabled(VK_EXT_DEBUG_REPORT_EXTENSION_NAME)) {
// Extra error if VK_EXT_debug_report is used on Android still
m_errorMonitor->SetDesiredWarning("BestPractices-deprecated-extension");
}
m_errorMonitor->SetUnexpectedError("khronos-Validation-debug-build-warning-message");
m_errorMonitor->SetUnexpectedError("khronos-Validation-fine-grained-locking-warning-message");
m_errorMonitor->SetDesiredWarning("BestPractices-deprecated-extension"); // VK_EXT_validation_features
m_errorMonitor->SetDesiredWarning("BestPractices-specialuse-extension"); // VK_EXT_debug_utils
m_errorMonitor->SetDesiredWarning("BestPractices-specialuse-extension"); // VK_EXT_validation_features
vk::CreateInstance(&ici, nullptr, &dummy);
vk::DestroyInstance(dummy, nullptr);
m_errorMonitor->VerifyFound();
if (dummy != VK_NULL_HANDLE) {
vk::DestroyInstance(dummy, nullptr);
}
}

TEST_F(VkBestPracticesLayerTest, UseDeprecatedDeviceExtensions) {
Expand Down
1 change: 1 addition & 0 deletions tests/unit/debug_printf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ void DebugPrintfTests::InitDebugPrintfFramework(void *p_next, bool reserve_slot)

SetTargetApiVersion(VK_API_VERSION_1_1);
AddRequiredExtensions(VK_KHR_SHADER_NON_SEMANTIC_INFO_EXTENSION_NAME);
AddRequiredExtensions(VK_EXT_VALIDATION_FEATURES_EXTENSION_NAME);
RETURN_IF_SKIP(InitFramework(&features));

if (!CanEnableGpuAV(*this)) {
Expand Down
28 changes: 9 additions & 19 deletions tests/unit/device_feature_property.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2024 The Khronos Group Inc.
* Copyright (c) 2024 Valve Corporation
* Copyright (c) 2024 LunarG, Inc.
* Copyright (c) 2025 The Khronos Group Inc.
* Copyright (c) 2025 Valve Corporation
* Copyright (c) 2025 LunarG, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -248,7 +248,6 @@ TEST_F(NegativeDeviceFeatureProperty, VertexAttributeDivisor) {
VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT vadf = vku::InitStructHelper();
m_second_device_ci.pNext = &vadf;
m_errorMonitor->SetDesiredError("VUID-VkDeviceCreateInfo-pNext-pNext");
m_errorMonitor->SetDesiredError("VUID-VkDeviceCreateInfo-pNext-pNext");
vk::CreateDevice(Gpu(), &m_second_device_ci, nullptr, &m_second_device);
m_errorMonitor->VerifyFound();
}
Expand Down Expand Up @@ -392,7 +391,6 @@ TEST_F(NegativeDeviceFeatureProperty, PhysicalDeviceGlobalPriorityQueryFeaturesK
query_feature.globalPriorityQuery = VK_TRUE;
m_second_device_ci.pNext = &query_feature;

m_errorMonitor->SetDesiredError("VUID-VkDeviceCreateInfo-pNext-pNext");
m_errorMonitor->SetDesiredError("VUID-VkDeviceCreateInfo-pNext-pNext");
vk::CreateDevice(Gpu(), &m_second_device_ci, nullptr, &m_second_device);
m_errorMonitor->VerifyFound();
Expand Down Expand Up @@ -432,15 +430,9 @@ TEST_F(NegativeDeviceFeatureProperty, MissingExtensionPromoted) {
}

TEST_F(NegativeDeviceFeatureProperty, Features11WithoutVulkan12) {
SetTargetApiVersion(VK_API_VERSION_1_1);
TEST_DESCRIPTION("VkPhysicalDeviceVulkan11Features was added in Vulkan1.2");
if (m_instance_api_version < VK_API_VERSION_1_2) {
GTEST_SKIP() << "Need 1.2 instance support";
}
app_info_.apiVersion = m_instance_api_version.Value();
RETURN_IF_SKIP(InitDeviceFeatureProperty());
if (PhysicalDeviceProps().apiVersion > VK_API_VERSION_1_1) {
GTEST_SKIP() << "Need 1.0/1.1 device support";
}

VkPhysicalDeviceVulkan11Features features11 = vku::InitStructHelper();
m_second_device_ci.pNext = &features11;
Expand All @@ -449,13 +441,11 @@ TEST_F(NegativeDeviceFeatureProperty, Features11WithoutVulkan12) {
vk::CreateDevice(Gpu(), &m_second_device_ci, nullptr, &m_second_device);
m_errorMonitor->VerifyFound();

if (PhysicalDeviceProps().apiVersion == VK_API_VERSION_1_1) {
VkPhysicalDeviceVulkan12Properties bad_version_1_1_struct = vku::InitStructHelper();
VkPhysicalDeviceProperties2 phys_dev_props_2 = vku::InitStructHelper(&bad_version_1_1_struct);
m_errorMonitor->SetDesiredError("VUID-VkPhysicalDeviceProperties2-pNext-pNext");
vk::GetPhysicalDeviceProperties2(Gpu(), &phys_dev_props_2);
m_errorMonitor->VerifyFound();
}
VkPhysicalDeviceVulkan12Properties bad_version_1_1_struct = vku::InitStructHelper();
VkPhysicalDeviceProperties2 phys_dev_props_2 = vku::InitStructHelper(&bad_version_1_1_struct);
m_errorMonitor->SetDesiredError("VUID-VkPhysicalDeviceProperties2-pNext-pNext");
vk::GetPhysicalDeviceProperties2(Gpu(), &phys_dev_props_2);
m_errorMonitor->VerifyFound();
}

TEST_F(NegativeDeviceFeatureProperty, Robustness2WithoutRobustness) {
Expand Down
25 changes: 21 additions & 4 deletions tests/unit/dynamic_rendering.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2015-2024 The Khronos Group Inc.
* Copyright (c) 2015-2024 Valve Corporation
* Copyright (c) 2015-2024 LunarG, Inc.
* Copyright (c) 2015-2025 The Khronos Group Inc.
* Copyright (c) 2015-2025 Valve Corporation
* Copyright (c) 2015-2025 LunarG, Inc.
* Copyright (c) 2015-2024 Google, Inc.
* Modifications Copyright (C) 2020-2022 Advanced Micro Devices, Inc. All rights reserved.
* Modifications Copyright (C) 2021-2022 ARM, Inc. All rights reserved.
Expand All @@ -24,8 +24,16 @@ TEST_F(NegativeDynamicRendering, CommandBufferInheritanceRenderingInfo) {
TEST_DESCRIPTION("VkCommandBufferInheritanceRenderingInfo Dynamic Rendering Tests.");
SetTargetApiVersion(VK_API_VERSION_1_2);
AddRequiredExtensions(VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME);
AddOptionalExtensions(VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME);
AddOptionalExtensions(VK_NV_FRAMEBUFFER_MIXED_SAMPLES_EXTENSION_NAME);
AddRequiredFeature(vkt::Feature::dynamicRendering);

RETURN_IF_SKIP(Init());
const bool amd_samples = IsExtensionsEnabled(VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME);
const bool nv_samples = IsExtensionsEnabled(VK_NV_FRAMEBUFFER_MIXED_SAMPLES_EXTENSION_NAME);
if (!amd_samples && !nv_samples) {
GTEST_SKIP() << "Test requires either VK_AMD_mixed_attachment_samples or VK_NV_framebuffer_mixed_samples";
}

VkPhysicalDeviceMultiviewProperties multiview_props = vku::InitStructHelper();
GetPhysicalDeviceProperties2(multiview_props);
Expand Down Expand Up @@ -1557,7 +1565,9 @@ TEST_F(NegativeDynamicRendering, PipelineMissingFlags) {
bool shading_rate = IsExtensionsEnabled(VK_KHR_FRAGMENT_SHADING_RATE_EXTENSION_NAME);

VkPhysicalDeviceFragmentShadingRatePropertiesKHR fsr_properties = vku::InitStructHelper();
GetPhysicalDeviceProperties2(fsr_properties);
if (IsExtensionsEnabled(VK_KHR_FRAGMENT_SHADING_RATE_EXTENSION_NAME)) {
GetPhysicalDeviceProperties2(fsr_properties);
}

InitRenderTarget();

Expand Down Expand Up @@ -2897,8 +2907,15 @@ TEST_F(NegativeDynamicRendering, LibraryViewMask) {

TEST_F(NegativeDynamicRendering, AttachmentSampleCount) {
TEST_DESCRIPTION("Create pipeline with invalid color attachment samples");
AddOptionalExtensions(VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME);
AddOptionalExtensions(VK_NV_FRAMEBUFFER_MIXED_SAMPLES_EXTENSION_NAME);
RETURN_IF_SKIP(InitBasicDynamicRendering());
InitRenderTarget();
const bool amd_samples = IsExtensionsEnabled(VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME);
const bool nv_samples = IsExtensionsEnabled(VK_NV_FRAMEBUFFER_MIXED_SAMPLES_EXTENSION_NAME);
if (!amd_samples && !nv_samples) {
GTEST_SKIP() << "Test requires either VK_AMD_mixed_attachment_samples or VK_NV_framebuffer_mixed_samples";
}

VkSampleCountFlagBits color_attachment_samples = VK_SAMPLE_COUNT_FLAG_BITS_MAX_ENUM;

Expand Down
Loading

0 comments on commit 0f4f347

Please sign in to comment.