Add Vulkan 1.1, ABP, and specific ext testing to the CDD
Bug: 260582500
Bug: 251907070
Test: tools/cts-tradefed run commandAndExit cts -m CtsGraphicsTestCase
Change-Id: If3d6f1780de55b32cd9b852d2b73689240006c3b
diff --git a/tests/tests/graphics/src/android/graphics/cts/VulkanFeaturesTest.java b/tests/tests/graphics/src/android/graphics/cts/VulkanFeaturesTest.java
index 3cfad6e..ae48f24 100644
--- a/tests/tests/graphics/src/android/graphics/cts/VulkanFeaturesTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/VulkanFeaturesTest.java
@@ -65,6 +65,22 @@
private static final String VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME =
"VK_ANDROID_external_memory_android_hardware_buffer";
private static final int VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION = 2;
+
+ private static final String VK_KHR_SURFACE = "VK_KHR_surface";
+ private static final int VK_KHR_SURFACE_SPEC_VERSION = 25;
+
+ private static final String VK_KHR_ANDROID_SURFACE = "VK_KHR_android_surface";
+ private static final int VK_KHR_ANDROID_SURFACE_SPEC_VERSION = 6;
+
+ private static final String VK_KHR_SWAPCHAIN = "VK_KHR_swapchain";
+ private static final int VK_KHR_SWAPCHAIN_SPEC_VERSION = 68;
+
+ private static final String VK_KHR_MAINTENANCE1 = "VK_KHR_maintenance1";
+ private static final int VK_KHR_MAINTENANCE1_SPEC_VERSION = 1;
+
+ private static final String VK_KHR_INCREMENTAL_PRESENT = "VK_KHR_incremental_present";
+ private static final int VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION = 1;
+
private static final int VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT = 0x8;
private static final int VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT = 0x10;
private static final int VK_PHYSICAL_DEVICE_TYPE_CPU = 4;
@@ -108,6 +124,7 @@
mVulkanDevices = getVulkanDevices(mVkJSON);
mBestDevice = getBestDevice();
}
+
@CddTest(requirement = "7.1.4.2/C-1-1,C-2-1")
@Test
public void testVulkanHardwareFeatures() throws JSONException {
@@ -182,6 +199,28 @@
}
}
+ @CddTest(requirement = "3.3.1/C-0-12")
+ @Test
+ public void testVulkanApplicationBinaryInterfaceRequirements() throws JSONException {
+ assumeTrue("Skipping because Vulkan is not supported", mVulkanHardwareVersion != null);
+
+ if (hasOnlyCpuDevice()) {
+ return;
+ }
+
+ assertTrue("Devices must support the core Vulkan 1.1",
+ mVulkanHardwareVersion.version >= VULKAN_1_1);
+ }
+
+ @CddTest(requirement = "7.1.4.2/C-1-3")
+ @Test
+ public void testVulkanApiForEachDevice() throws JSONException {
+ for (JSONObject device : mVulkanDevices) {
+ assertTrue("All enumerated VPhysicalDevice must support Vulkan 1.1",
+ determineHardwareVersion(device) >= VULKAN_1_1);
+ }
+ }
+
@CddTest(requirement = "7.1.4.2/C-3-1")
@Test
public void testVulkan1_1Requirements() throws JSONException {
@@ -214,15 +253,18 @@
"externalFenceFeatures", 0x3 /* importable + exportable */));
}
- @CddTest(requirement = "7.1.4.2/C-1-7")
+ @CddTest(requirement = "7.1.4.2/C-1-7, 3.3.1/C-0-12")
@Test
public void testVulkanRequiredExtensions() throws JSONException {
assumeTrue("Skipping because Vulkan is not supported", mVulkanDevices.length > 0);
- assertVulkanInstanceExtension("VK_KHR_surface", 25);
- assertVulkanInstanceExtension("VK_KHR_android_surface", 6);
- assertVulkanDeviceExtension("VK_KHR_swapchain", 68);
- assertVulkanDeviceExtension("VK_KHR_incremental_present", 1);
+ assertVulkanInstanceExtension(VK_KHR_SURFACE, VK_KHR_SURFACE_SPEC_VERSION);
+ assertVulkanInstanceExtension(VK_KHR_ANDROID_SURFACE, VK_KHR_ANDROID_SURFACE_SPEC_VERSION);
+
+ assertVulkanDeviceExtension(VK_KHR_SWAPCHAIN, VK_KHR_SWAPCHAIN_SPEC_VERSION);
+ assertVulkanDeviceExtension(VK_KHR_INCREMENTAL_PRESENT,
+ VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION);
+ assertVulkanDeviceExtension(VK_KHR_MAINTENANCE1, VK_KHR_MAINTENANCE1_SPEC_VERSION);
}
@CddTest(requirement = "7.9.2/C-1-5")
@@ -257,6 +299,161 @@
assertEquals(expectedVariant, actualVariant);
}
+ @CddTest(requirement = "7.1.4.2/C-1-13")
+ @Test
+ public void testAndroidBaselineProfile2021Support() throws JSONException {
+ // TODO(vantablack) This should be replaced by the Vulkan-Profiles header utility
+ assumeTrue("Skipping because Vulkan is not supported", mVulkanHardwareVersion != null);
+
+ // Check for instance extensions
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_surface",
+ hasInstanceExtension(
+ "VK_KHR_surface", 1));
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_android_surface",
+ hasInstanceExtension(
+ "VK_KHR_android_surface", 1));
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_get_physical_device_properties2",
+ hasInstanceExtension(
+ "VK_KHR_get_physical_device_properties2", 1));
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_EXT_swapchain_colorspace",
+ hasInstanceExtension(
+ "VK_EXT_swapchain_colorspace", 1));
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_get_surface_capabilities2",
+ hasInstanceExtension(
+ "VK_KHR_get_surface_capabilities2", 1));
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_external_semaphore_capabilities",
+ hasInstanceExtension(
+ "VK_KHR_external_semaphore_capabilities", 1));
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_external_memory_capabilities",
+ hasInstanceExtension(
+ "VK_KHR_external_memory_capabilities", 1));
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_external_fence_capabilities",
+ hasInstanceExtension(
+ "VK_KHR_external_fence_capabilities", 1));
+
+ // Check for device Extensions
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_swapchain",
+ hasDeviceExtension(
+ mBestDevice, "VK_KHR_swapchain", 1));
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_maintenance1",
+ hasDeviceExtension(
+ mBestDevice, "VK_KHR_maintenance1", 1));
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_incremental_present",
+ hasDeviceExtension(
+ mBestDevice, "VK_KHR_incremental_present", 1));
+ // cuttlefish does not support VK_GOOGLE_display_timing
+ if (!hasOnlyCpuDevice()) {
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_GOOGLE_display_timing",
+ hasDeviceExtension(
+ mBestDevice, "VK_GOOGLE_display_timing", 1));
+ }
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_descriptor_update_template",
+ hasDeviceExtension(
+ mBestDevice, "VK_KHR_descriptor_update_template", 1));
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_get_memory_requirements2",
+ hasDeviceExtension(
+ mBestDevice, "VK_KHR_get_memory_requirements2", 1));
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_dedicated_allocation",
+ hasDeviceExtension(
+ mBestDevice, "VK_KHR_dedicated_allocation", 1));
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_storage_buffer_storage_class",
+ hasDeviceExtension(
+ mBestDevice, "VK_KHR_storage_buffer_storage_class", 1));
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_external_semaphore",
+ hasDeviceExtension(
+ mBestDevice, "VK_KHR_external_semaphore", 1));
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_external_memory",
+ hasDeviceExtension(
+ mBestDevice, "VK_KHR_external_memory", 1));
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_external_semaphore_fd",
+ hasDeviceExtension(
+ mBestDevice, "VK_KHR_external_semaphore_fd", 1));
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_external_fence",
+ hasDeviceExtension(
+ mBestDevice, "VK_KHR_external_fence", 1));
+ // cuttlefish does not support VK_KHR_external_fence_fd or VK_KHR_variable_pointers
+ if (!hasOnlyCpuDevice()) {
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_external_fence_fd",
+ hasDeviceExtension(
+ mBestDevice, "VK_KHR_external_fence_fd", 1));
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "VK_KHR_variable_pointers",
+ hasDeviceExtension(
+ mBestDevice, "VK_KHR_variable_pointers", 1));
+ }
+
+ // Check for required VkPhysicalDeviceFeatures
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "depthBiasClamp",
+ mBestDevice.getJSONObject("features")
+ .getInt("depthBiasClamp") != 0);
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "fragmentStoresAndAtomics",
+ mBestDevice.getJSONObject("features")
+ .getInt("fragmentStoresAndAtomics") != 0);
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "fullDrawIndexUint32",
+ mBestDevice.getJSONObject("features")
+ .getInt("fullDrawIndexUint32") != 0);
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "imageCubeArray",
+ mBestDevice.getJSONObject("features")
+ .getInt("imageCubeArray") != 0);
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "independentBlend",
+ mBestDevice.getJSONObject("features")
+ .getInt("independentBlend") != 0);
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "robustBufferAccess",
+ mBestDevice.getJSONObject("features")
+ .getInt("robustBufferAccess") != 0);
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "sampleRateShading",
+ mBestDevice.getJSONObject("features")
+ .getInt("sampleRateShading") != 0);
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "shaderSampledImageArrayDynamicIndexing",
+ mBestDevice.getJSONObject("features")
+ .getInt("shaderSampledImageArrayDynamicIndexing") != 0);
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "shaderStorageImageArrayDynamicIndexing",
+ mBestDevice.getJSONObject("features")
+ .getInt("shaderStorageImageArrayDynamicIndexing") != 0);
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "shaderUniformBufferArrayDynamicIndexing",
+ mBestDevice.getJSONObject("features")
+ .getInt("shaderUniformBufferArrayDynamicIndexing") != 0);
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "textureCompressionASTC_LDR",
+ mBestDevice.getJSONObject("features")
+ .getInt("textureCompressionASTC_LDR") != 0);
+ assertTrue("This device must support the ABP 2021, and therefore must also support "
+ + "textureCompressionETC2",
+ mBestDevice.getJSONObject("features")
+ .getInt("textureCompressionETC2") != 0);
+ }
+
private JSONObject getBestDevice() throws JSONException {
JSONObject bestDevice = null;
int bestDeviceLevel = -1;