Add check to ensure memory and heap with DEVICE_LOCAL flags are
authorDavid Sodman <dsodman@google.com>
Mon, 21 Mar 2016 17:16:39 +0000 (10:16 -0700)
committerDavid Sodman <dsodman@google.com>
Mon, 21 Mar 2016 18:01:12 +0000 (11:01 -0700)
consistent

Fixes Vulkan-CTS/issues/5

Change-Id: I678fb69082d8c68bfe6ee13387ef64baa21223dc

external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp

index 4c66021..60f0498 100755 (executable)
@@ -873,6 +873,23 @@ tcu::TestStatus deviceMemoryProperties (Context& context)
                                << memProps->memoryTypes[memoryNdx].propertyFlags << " not valid" << TestLog::EndMessage;
                        return tcu::TestStatus::fail("deviceMemoryProperties propertyFlags not valid");
                }
+
+               if (memProps->memoryTypes[memoryNdx].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
+               {
+                       if ((memProps->memoryHeaps[memProps->memoryTypes[memoryNdx].heapIndex].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) == 0)
+                       {
+                               log << TestLog::Message << "deviceMemoryProperties - DEVICE_LOCAL memory type references heap which is not DEVICE_LOCAL" << TestLog::EndMessage;
+                               return tcu::TestStatus::fail("deviceMemoryProperties inconsistent memoryType and HeapFlags");
+                       }
+               }
+               else
+               {
+                       if (memProps->memoryHeaps[memProps->memoryTypes[memoryNdx].heapIndex].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT)
+                       {
+                               log << TestLog::Message << "deviceMemoryProperties - non-DEVICE_LOCAL memory type references heap with is DEVICE_LOCAL" << TestLog::EndMessage;
+                               return tcu::TestStatus::fail("deviceMemoryProperties inconsistent memoryType and HeapFlags");
+                       }
+               }
        }
 
        bool* requiredFlagsFoundIterator = std::find(DE_ARRAY_BEGIN(requiredFlagsFound), DE_ARRAY_END(requiredFlagsFound), false);