New tests for the VK_EXT_external_memory_host extension
authorFlisikowski <pawel.flisikowski@intel.com>
Thu, 12 Jul 2018 09:22:28 +0000 (11:22 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 13 Sep 2018 14:30:06 +0000 (10:30 -0400)
Components: Vulkan

VK-GL-CTS issue: 1301

New tests: dEQP-VK.memory.external_memory_host.*

Change-Id: I0220286b526d4b5b4f6ef30e8178b2d11f66772c

21 files changed:
AndroidGen.mk
android/cts/master/vk-master.txt
external/vulkancts/framework/vulkan/vkBasicTypes.inl
external/vulkancts/framework/vulkan/vkConcreteDeviceInterface.inl
external/vulkancts/framework/vulkan/vkDeviceDriverImpl.inl
external/vulkancts/framework/vulkan/vkDeviceFunctionPointers.inl
external/vulkancts/framework/vulkan/vkFunctionPointerTypes.inl
external/vulkancts/framework/vulkan/vkGetStructureTypeImpl.inl
external/vulkancts/framework/vulkan/vkInitDeviceFunctionPointers.inl
external/vulkancts/framework/vulkan/vkNullDriverImpl.inl
external/vulkancts/framework/vulkan/vkStrUtil.inl
external/vulkancts/framework/vulkan/vkStrUtilImpl.inl
external/vulkancts/framework/vulkan/vkStructTypes.inl
external/vulkancts/framework/vulkan/vkVirtualDeviceInterface.inl
external/vulkancts/modules/vulkan/memory/CMakeLists.txt
external/vulkancts/modules/vulkan/memory/vktMemoryExternalMemoryHostTests.cpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/memory/vktMemoryExternalMemoryHostTests.hpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/memory/vktMemoryTests.cpp
external/vulkancts/mustpass/1.1.3/vk-default-no-waivers.txt
external/vulkancts/mustpass/1.1.3/vk-default.txt
external/vulkancts/scripts/src/vulkan.h.in

index e22f427df1387c51a02f123111c7baba7017c6b8..2041701aaf792a1303da9d31edf4ea57e91b150c 100644 (file)
@@ -140,6 +140,7 @@ LOCAL_SRC_FILES := \
        external/vulkancts/modules/vulkan/image/vktImageTranscodingSupportTests.cpp \
        external/vulkancts/modules/vulkan/memory/vktMemoryAllocationTests.cpp \
        external/vulkancts/modules/vulkan/memory/vktMemoryBindingTests.cpp \
+       external/vulkancts/modules/vulkan/memory/vktMemoryExternalMemoryHostTests.cpp \
        external/vulkancts/modules/vulkan/memory/vktMemoryMappingTests.cpp \
        external/vulkancts/modules/vulkan/memory/vktMemoryPipelineBarrierTests.cpp \
        external/vulkancts/modules/vulkan/memory/vktMemoryRequirementsTests.cpp \
index c8c5a2e85cd5f812e016d1f33a570eb1b04bbe1e..208bb9105c63506e2129550a3b10f809ffbb140e 100755 (executable)
@@ -83778,6 +83778,17 @@ dEQP-VK.memory.binding.aliasing.suballocated.image_33_257
 dEQP-VK.memory.binding.aliasing.suballocated.image_257_8
 dEQP-VK.memory.binding.aliasing.suballocated.image_257_33
 dEQP-VK.memory.binding.aliasing.suballocated.image_257_257
+dEQP-VK.memory.external_memory_host.simple_allocation.minImportedHostPointerAlignment_x1
+dEQP-VK.memory.external_memory_host.simple_allocation.minImportedHostPointerAlignment_x3
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_zero_offset.r8g8b8a8_unorm
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_zero_offset.r16g16b16a16_unorm
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_zero_offset.r16g16b16a16_sfloat
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_zero_offset.r32g32b32a32_sfloat
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_non_zero_offset.r8g8b8a8_unorm
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_non_zero_offset.r16g16b16a16_unorm
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_non_zero_offset.r16g16b16a16_sfloat
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_non_zero_offset.r32g32b32a32_sfloat
+dEQP-VK.memory.external_memory_host.synchronization.synchronization
 dEQP-VK.pipeline.stencil.format.s8_uint.states.fail_keep.pass_keep.dfail_keep.comp_never
 dEQP-VK.pipeline.stencil.format.s8_uint.states.fail_keep.pass_keep.dfail_keep.comp_less
 dEQP-VK.pipeline.stencil.format.s8_uint.states.fail_keep.pass_keep.dfail_keep.comp_equal
index 1df9b911b002f9f6705364b38935129d0befbdca..06698ba6bcae755b4c856a6b0abd37c9e0ffa3e8 100644 (file)
@@ -324,6 +324,9 @@ enum VkStructureType
        VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT               = 1000190000,
        VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT                   = 1000190001,
        VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT                 = 1000190002,
+       VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT                                                   = 1000178000,
+       VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT                                                    = 1000178001,
+       VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT                   = 1000178002,
 };
 
 enum VkSystemAllocationScope
@@ -1627,6 +1630,8 @@ enum VkExternalMemoryHandleTypeFlagBits
        VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT                            = 0x00000010,
        VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT                                           = 0x00000020,
        VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT                                       = 0x00000040,
+       VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT                          = 0x00000080,
+       VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT       = 0x00000100,
        VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID      = 0x00000400,
 };
 typedef deUint32 VkExternalMemoryHandleTypeFlags;
index 53235e35c46786d20054e7becf74773302239a2b..b0e9af8c26556b3ad99ab1d4107d4c43b2c4aade 100644 (file)
@@ -198,5 +198,6 @@ virtual VkResult                    createValidationCacheEXT                                        (VkDevice device, const VkValida
 virtual void                           destroyValidationCacheEXT                                       (VkDevice device, VkValidationCacheEXT validationCache, const VkAllocationCallbacks* pAllocator) const;
 virtual VkResult                       mergeValidationCachesEXT                                        (VkDevice device, VkValidationCacheEXT dstCache, deUint32 srcCacheCount, const VkValidationCacheEXT* pSrcCaches) const;
 virtual VkResult                       getValidationCacheDataEXT                                       (VkDevice device, VkValidationCacheEXT validationCache, deUintptr* pDataSize, void* pData) const;
+virtual VkResult                       getMemoryHostPointerPropertiesEXT                       (VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, const void* pHostPointer, VkMemoryHostPointerPropertiesEXT* pMemoryHostPointerProperties) const;
 virtual VkResult                       getAndroidHardwareBufferPropertiesANDROID       (VkDevice device, const struct pt::AndroidHardwareBufferPtr buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties) const;
 virtual VkResult                       getMemoryAndroidHardwareBufferANDROID           (VkDevice device, const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo, struct pt::AndroidHardwareBufferPtr* pBuffer) const;
index dd64fddce9c5f11ee1862f4f2c9f17d299115a39..20543f12872862cd514082a313411704fad5f280 100644 (file)
@@ -987,6 +987,11 @@ VkResult DeviceDriver::getValidationCacheDataEXT (VkDevice device, VkValidationC
        return m_vk.getValidationCacheDataEXT(device, validationCache, pDataSize, pData);
 }
 
+VkResult DeviceDriver::getMemoryHostPointerPropertiesEXT (VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, const void* pHostPointer, VkMemoryHostPointerPropertiesEXT* pMemoryHostPointerProperties) const
+{
+       return m_vk.getMemoryHostPointerPropertiesEXT(device, handleType, pHostPointer, pMemoryHostPointerProperties);
+}
+
 VkResult DeviceDriver::getAndroidHardwareBufferPropertiesANDROID (VkDevice device, const struct pt::AndroidHardwareBufferPtr buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties) const
 {
        return m_vk.getAndroidHardwareBufferPropertiesANDROID(device, buffer, pProperties);
index 09ea12e7f18ae5c29ce0ae9c94eb9fdb48712e46..4374ffa66e90d06da58e4642212770fa50e63ab6 100644 (file)
@@ -198,5 +198,6 @@ CreateValidationCacheEXTFunc                                        createValidationCacheEXT;
 DestroyValidationCacheEXTFunc                                  destroyValidationCacheEXT;
 MergeValidationCachesEXTFunc                                   mergeValidationCachesEXT;
 GetValidationCacheDataEXTFunc                                  getValidationCacheDataEXT;
+GetMemoryHostPointerPropertiesEXTFunc                  getMemoryHostPointerPropertiesEXT;
 GetAndroidHardwareBufferPropertiesANDROIDFunc  getAndroidHardwareBufferPropertiesANDROID;
 GetMemoryAndroidHardwareBufferANDROIDFunc              getMemoryAndroidHardwareBufferANDROID;
index e938b0d5e3cddf6c4686f0a349bd0e2aeb4f49bf..fd81bb37bc9f0c0e39c16a1b9dc2ce7532c4a706 100644 (file)
@@ -295,5 +295,6 @@ typedef VKAPI_ATTR VkResult                         (VKAPI_CALL* CreateValidationCacheEXTFunc)
 typedef VKAPI_ATTR void                                        (VKAPI_CALL* DestroyValidationCacheEXTFunc)                                                     (VkDevice device, VkValidationCacheEXT validationCache, const VkAllocationCallbacks* pAllocator);
 typedef VKAPI_ATTR VkResult                            (VKAPI_CALL* MergeValidationCachesEXTFunc)                                                      (VkDevice device, VkValidationCacheEXT dstCache, deUint32 srcCacheCount, const VkValidationCacheEXT* pSrcCaches);
 typedef VKAPI_ATTR VkResult                            (VKAPI_CALL* GetValidationCacheDataEXTFunc)                                                     (VkDevice device, VkValidationCacheEXT validationCache, deUintptr* pDataSize, void* pData);
+typedef VKAPI_ATTR VkResult                            (VKAPI_CALL* GetMemoryHostPointerPropertiesEXTFunc)                                     (VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, const void* pHostPointer, VkMemoryHostPointerPropertiesEXT* pMemoryHostPointerProperties);
 typedef VKAPI_ATTR VkResult                            (VKAPI_CALL* GetAndroidHardwareBufferPropertiesANDROIDFunc)                     (VkDevice device, const struct pt::AndroidHardwareBufferPtr buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties);
 typedef VKAPI_ATTR VkResult                            (VKAPI_CALL* GetMemoryAndroidHardwareBufferANDROIDFunc)                         (VkDevice device, const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo, struct pt::AndroidHardwareBufferPtr* pBuffer);
index dc03462259a9e73c069020e3338ad4856fa348bf..276278daa6d06cd8391ba97ad594f9626364c383 100644 (file)
@@ -1121,6 +1121,21 @@ template<> VkStructureType getStructureType<VkExternalFormatANDROID> (void)
        return VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID;
 }
 
+template<> VkStructureType getStructureType<VkImportMemoryHostPointerInfoEXT> (void)
+{
+       return VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT;
+}
+
+template<> VkStructureType getStructureType<VkMemoryHostPointerPropertiesEXT> (void)
+{
+       return VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT;
+}
+
+template<> VkStructureType getStructureType<VkPhysicalDeviceExternalMemoryHostPropertiesEXT> (void)
+{
+       return VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT;
+}
+
 template<> VkStructureType getStructureType<VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT> (void)
 {
        return VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT;
index 382e76318933f596c7e5b248a3526ff9f804d2ac..760b893123984e4406e2157d17d4e6f1e4d5e7dd 100644 (file)
@@ -228,5 +228,6 @@ m_vk.createValidationCacheEXT                                       = (CreateValidationCacheEXTFunc)                                        GET_PROC_
 m_vk.destroyValidationCacheEXT                                 = (DestroyValidationCacheEXTFunc)                                       GET_PROC_ADDR("vkDestroyValidationCacheEXT");
 m_vk.mergeValidationCachesEXT                                  = (MergeValidationCachesEXTFunc)                                        GET_PROC_ADDR("vkMergeValidationCachesEXT");
 m_vk.getValidationCacheDataEXT                                 = (GetValidationCacheDataEXTFunc)                                       GET_PROC_ADDR("vkGetValidationCacheDataEXT");
+m_vk.getMemoryHostPointerPropertiesEXT                 = (GetMemoryHostPointerPropertiesEXTFunc)                       GET_PROC_ADDR("vkGetMemoryHostPointerPropertiesEXT");
 m_vk.getAndroidHardwareBufferPropertiesANDROID = (GetAndroidHardwareBufferPropertiesANDROIDFunc)       GET_PROC_ADDR("vkGetAndroidHardwareBufferPropertiesANDROID");
 m_vk.getMemoryAndroidHardwareBufferANDROID             = (GetMemoryAndroidHardwareBufferANDROIDFunc)           GET_PROC_ADDR("vkGetMemoryAndroidHardwareBufferANDROID");
index e81b3aba91577fc3a1fa5014ef19b5752d7ad59b..2af700e4c7f53123ab3120fc3b0002a4952812a7 100644 (file)
@@ -1845,6 +1845,15 @@ VKAPI_ATTR VkResult VKAPI_CALL getValidationCacheDataEXT (VkDevice device, VkVal
        return VK_SUCCESS;
 }
 
+VKAPI_ATTR VkResult VKAPI_CALL getMemoryHostPointerPropertiesEXT (VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, const void* pHostPointer, VkMemoryHostPointerPropertiesEXT* pMemoryHostPointerProperties)
+{
+       DE_UNREF(device);
+       DE_UNREF(handleType);
+       DE_UNREF(pHostPointer);
+       DE_UNREF(pMemoryHostPointerProperties);
+       return VK_SUCCESS;
+}
+
 VKAPI_ATTR VkResult VKAPI_CALL getAndroidHardwareBufferPropertiesANDROID (VkDevice device, const struct pt::AndroidHardwareBufferPtr buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties)
 {
        DE_UNREF(device);
@@ -2157,6 +2166,7 @@ static const tcu::StaticFunctionLibrary::Entry s_deviceFunctions[] =
        VK_NULL_FUNC_ENTRY(vkDestroyValidationCacheEXT,                                 destroyValidationCacheEXT),
        VK_NULL_FUNC_ENTRY(vkMergeValidationCachesEXT,                                  mergeValidationCachesEXT),
        VK_NULL_FUNC_ENTRY(vkGetValidationCacheDataEXT,                                 getValidationCacheDataEXT),
+       VK_NULL_FUNC_ENTRY(vkGetMemoryHostPointerPropertiesEXT,                 getMemoryHostPointerPropertiesEXT),
        VK_NULL_FUNC_ENTRY(vkGetAndroidHardwareBufferPropertiesANDROID, getAndroidHardwareBufferPropertiesANDROID),
        VK_NULL_FUNC_ENTRY(vkGetMemoryAndroidHardwareBufferANDROID,             getMemoryAndroidHardwareBufferANDROID),
 };
index 78aba07c6b71878b227a0b53272868ddb47d276b..380203c7ee0da42cae3c7623f25e0c307f847981 100644 (file)
@@ -591,6 +591,9 @@ std::ostream&       operator<<      (std::ostream& s, const VkAndroidHardwareBufferFormatPr
 std::ostream&  operator<<      (std::ostream& s, const VkImportAndroidHardwareBufferInfoANDROID& value);
 std::ostream&  operator<<      (std::ostream& s, const VkMemoryGetAndroidHardwareBufferInfoANDROID& value);
 std::ostream&  operator<<      (std::ostream& s, const VkExternalFormatANDROID& value);
+std::ostream&  operator<<      (std::ostream& s, const VkImportMemoryHostPointerInfoEXT& value);
+std::ostream&  operator<<      (std::ostream& s, const VkMemoryHostPointerPropertiesEXT& value);
+std::ostream&  operator<<      (std::ostream& s, const VkPhysicalDeviceExternalMemoryHostPropertiesEXT& value);
 std::ostream&  operator<<      (std::ostream& s, const VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT& value);
 std::ostream&  operator<<      (std::ostream& s, const VkVertexInputBindingDivisorDescriptionEXT& value);
 std::ostream&  operator<<      (std::ostream& s, const VkPipelineVertexInputDivisorStateCreateInfoEXT& value);
index 6de9d499869d7c965604b69ef42e4793677fb6bd..dc63ae76f3471b34639a9a382ddccf9a3faa3880 100644 (file)
@@ -335,6 +335,9 @@ const char* getStructureTypeName (VkStructureType value)
                case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT:                 return "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT";
                case VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT:                             return "VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT";
                case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT:                   return "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT";
+               case VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT:                                                             return "VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT";
+               case VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT:                                                              return "VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT";
+               case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT:                             return "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT";
                default:                                                                                                                                                                return DE_NULL;
        }
 }
@@ -1876,6 +1879,8 @@ tcu::Format::Bitfield<32> getExternalMemoryHandleTypeFlagsStr (VkExternalMemoryH
                tcu::Format::BitDesc(VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT,                                      "VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT"),
                tcu::Format::BitDesc(VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT,                                                     "VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT"),
                tcu::Format::BitDesc(VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT,                                         "VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT"),
+               tcu::Format::BitDesc(VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT,                            "VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT"),
+               tcu::Format::BitDesc(VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT,         "VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT"),
                tcu::Format::BitDesc(VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID,        "VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID"),
        };
        return tcu::Format::Bitfield<32>(value, DE_ARRAY_BEGIN(s_desc), DE_ARRAY_END(s_desc));
@@ -6194,6 +6199,37 @@ std::ostream& operator<< (std::ostream& s, const VkExternalFormatANDROID& value)
        return s;
 }
 
+std::ostream& operator<< (std::ostream& s, const VkImportMemoryHostPointerInfoEXT& value)
+{
+       s << "VkImportMemoryHostPointerInfoEXT = {\n";
+       s << "\tsType = " << value.sType << '\n';
+       s << "\tpNext = " << value.pNext << '\n';
+       s << "\thandleType = " << value.handleType << '\n';
+       s << "\tpHostPointer = " << value.pHostPointer << '\n';
+       s << '}';
+       return s;
+}
+
+std::ostream& operator<< (std::ostream& s, const VkMemoryHostPointerPropertiesEXT& value)
+{
+       s << "VkMemoryHostPointerPropertiesEXT = {\n";
+       s << "\tsType = " << value.sType << '\n';
+       s << "\tpNext = " << value.pNext << '\n';
+       s << "\tmemoryTypeBits = " << value.memoryTypeBits << '\n';
+       s << '}';
+       return s;
+}
+
+std::ostream& operator<< (std::ostream& s, const VkPhysicalDeviceExternalMemoryHostPropertiesEXT& value)
+{
+       s << "VkPhysicalDeviceExternalMemoryHostPropertiesEXT = {\n";
+       s << "\tsType = " << value.sType << '\n';
+       s << "\tpNext = " << value.pNext << '\n';
+       s << "\tminImportedHostPointerAlignment = " << value.minImportedHostPointerAlignment << '\n';
+       s << '}';
+       return s;
+}
+
 std::ostream& operator<< (std::ostream& s, const VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT& value)
 {
        s << "VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT = {\n";
index e4c6312a18d2a9b9e6b12ec006a05a8556919206..fade743b5617148406e8183c2b1a81e20d8a561f 100644 (file)
@@ -2953,6 +2953,28 @@ struct VkExternalFormatANDROID
        deUint64                externalFormat;
 };
 
+struct VkImportMemoryHostPointerInfoEXT
+{
+       VkStructureType                                         sType;
+       const void*                                                     pNext;
+       VkExternalMemoryHandleTypeFlagBits      handleType;
+       void*                                                           pHostPointer;
+};
+
+struct VkMemoryHostPointerPropertiesEXT
+{
+       VkStructureType sType;
+       void*                   pNext;
+       deUint32                memoryTypeBits;
+};
+
+struct VkPhysicalDeviceExternalMemoryHostPropertiesEXT
+{
+       VkStructureType sType;
+       void*                   pNext;
+       VkDeviceSize    minImportedHostPointerAlignment;
+};
+
 struct VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT
 {
        VkStructureType sType;
index 028d6ca8b88db20a9e58e4218e400b8389ecb46a..67a47ac0f6d617a84c002326118a7fc59260b158 100644 (file)
@@ -198,5 +198,6 @@ virtual VkResult                    createValidationCacheEXT                                        (VkDevice device, const VkValida
 virtual void                           destroyValidationCacheEXT                                       (VkDevice device, VkValidationCacheEXT validationCache, const VkAllocationCallbacks* pAllocator) const = 0;
 virtual VkResult                       mergeValidationCachesEXT                                        (VkDevice device, VkValidationCacheEXT dstCache, deUint32 srcCacheCount, const VkValidationCacheEXT* pSrcCaches) const = 0;
 virtual VkResult                       getValidationCacheDataEXT                                       (VkDevice device, VkValidationCacheEXT validationCache, deUintptr* pDataSize, void* pData) const = 0;
+virtual VkResult                       getMemoryHostPointerPropertiesEXT                       (VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, const void* pHostPointer, VkMemoryHostPointerPropertiesEXT* pMemoryHostPointerProperties) const = 0;
 virtual VkResult                       getAndroidHardwareBufferPropertiesANDROID       (VkDevice device, const struct pt::AndroidHardwareBufferPtr buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties) const = 0;
 virtual VkResult                       getMemoryAndroidHardwareBufferANDROID           (VkDevice device, const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo, struct pt::AndroidHardwareBufferPtr* pBuffer) const = 0;
index f259a6cc4a68c39eca41a9e9db8ceabaf6a08c71..4727e63083d99a46ca221f6d83add6891c6c412c 100644 (file)
@@ -15,6 +15,8 @@ set(DEQP_VK_MEMORY_SRCS
        vktMemoryRequirementsTests.hpp
        vktMemoryBindingTests.cpp
        vktMemoryBindingTests.hpp
+       vktMemoryExternalMemoryHostTests.cpp
+       vktMemoryExternalMemoryHostTests.hpp
        )
 
 set(DEQP_VK_MEMORY_LIBS
diff --git a/external/vulkancts/modules/vulkan/memory/vktMemoryExternalMemoryHostTests.cpp b/external/vulkancts/modules/vulkan/memory/vktMemoryExternalMemoryHostTests.cpp
new file mode 100644 (file)
index 0000000..67c0482
--- /dev/null
@@ -0,0 +1,1057 @@
+/*------------------------------------------------------------------------
+* Vulkan Conformance Tests
+* ------------------------
+*
+* Copyright (c) 2018 The Khronos Group Inc.
+* Copyright (c) 2018 Intel Corporation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*//*!
+* \file
+* \brief VK_EXT_external_memory_host extension tests.
+*//*--------------------------------------------------------------------*/
+
+#include "vktMemoryExternalMemoryHostTests.hpp"
+
+#include "vktTestCaseUtil.hpp"
+
+#include "deMath.h"
+
+#include "vkQueryUtil.hpp"
+#include "vkImageUtil.hpp"
+#include "vkBuilderUtil.hpp"
+#include "vkRefUtil.hpp"
+#include "vkObjUtil.hpp"
+#include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
+
+
+#include "tcuTestLog.hpp"
+#include "tcuImageCompare.hpp"
+
+namespace vkt
+{
+namespace memory
+{
+namespace
+{
+
+using namespace vk;
+
+inline deUint32 getBit (deUint32 src, int ndx)
+{
+       return (src >> ndx) & 1;
+}
+
+inline bool isBitSet (deUint32 src, int ndx)
+{
+       return getBit(src, ndx) != 0;
+}
+
+struct TestParams
+{
+       VkFormat                m_format;
+       bool                    m_useOffset;
+
+       TestParams              (VkFormat f, bool offset = false) : m_format(f) , m_useOffset(offset) {}
+};
+
+class ExternalMemoryHostBaseTestInstance : public TestInstance
+{
+public:
+                                                                       ExternalMemoryHostBaseTestInstance                      (Context& context, VkDeviceSize allocationSize);
+                                                                       ~ExternalMemoryHostBaseTestInstance                     (void);
+protected:
+       virtual tcu::TestStatus                 iterate                                                                         (void);
+       VkDeviceSize                                    getMinImportedHostPointerAlignment                      (void);
+       deUint32                                                getHostPointerMemoryTypeBits                            (void* hostPointer);
+       Move<VkDeviceMemory>                    allocateMemoryFromHostPointer                           (deUint32 memoryTypeIndex);
+       void                                                    logMemoryTypeIndexPropertyFlags                         (deUint32 index);
+       bool                                                    findMemoryTypeIndexToTest                                       (deUint32 hostPointerMemoryTypeBits, deUint32* outMemoryTypeIndexToTest);
+
+       const InstanceInterface&                                                m_vki;
+       const DeviceInterface&                                                  m_vkd;
+       tcu::TestLog&                                                                   m_log;
+       const VkDevice                                                                  m_device;
+       const VkPhysicalDevice                                                  m_physicalDevice;
+       const VkQueue                                                                   m_queue;
+       const vk::VkPhysicalDeviceMemoryProperties              m_memoryProps;
+       VkDeviceSize                                                                    m_minImportedHostPointerAlignment;
+       VkDeviceSize                                                                    m_allocationSize;
+       void*                                                                                   m_hostMemoryAlloc;
+       Allocator&                                                                              m_allocator;
+       Move<VkDeviceMemory>                                                    m_deviceMemoryAllocatedFromHostPointer;
+};
+
+class ExternalMemoryHostRenderImageTestInstance : public ExternalMemoryHostBaseTestInstance
+{
+public:
+                                                                       ExternalMemoryHostRenderImageTestInstance       (Context& context, TestParams testParams);
+protected:
+       virtual tcu::TestStatus                 iterate                                                                         (void);
+       Move<VkImage>                                   createImage                                                                     (VkImageTiling tiling);
+       Move<VkImageView>                               createImageView                                                         (void);
+       Move<VkBuffer>                                  createBindMemoryInitializeVertexBuffer          (void);
+       Move<VkBuffer>                                  createBindMemoryResultBuffer                            (void);
+       Move<VkFramebuffer>                             createFramebuffer                                                       (void);
+       Move<VkDescriptorSet>                   createAndUpdateDescriptorSet                            (void);
+       Move<VkPipelineLayout>                  createPipelineLayout                                            (void);
+       Move<VkPipeline>                                createPipeline                                                          (void);
+       Move<VkRenderPass>                              createRenderPass                                                        (void);
+       void                                                    clear                                                                           (VkClearColorValue color);
+       void                                                    draw                                                                            (void);
+       void                                                    copyResultImagetoBuffer                                         (void);
+       void                                                    prepareReferenceImage                                           (tcu::PixelBufferAccess& reference);
+
+       TestParams                                                                              m_testParams;
+       Move<VkImage>                                                                   m_image;
+       Move<VkImageView>                                                               m_imageView;
+       Move<VkRenderPass>                                                              m_renderPass;
+       Move<VkFramebuffer>                                                             m_framebuffer;
+       Move<VkBuffer>                                                                  m_vertexBuffer;
+       Move<VkBuffer>                                                                  m_resultBuffer;
+       de::MovePtr<Allocation>                                                 m_vertexBufferAllocation;
+       de::MovePtr<Allocation>                                                 m_resultBufferAllocation;
+       Move<VkDescriptorPool>                                                  m_descriptorPool;
+       Move<VkDescriptorSetLayout>                                             m_descriptorSetLayout;
+       Move<VkDescriptorSet>                                                   m_descriptorSet;
+       Move<VkShaderModule>                                                    m_vertexShaderModule;
+       Move<VkShaderModule>                                                    m_fragmentShaderModule;
+       Move<VkPipelineLayout>                                                  m_pipelineLayout;
+       Move<VkPipeline>                                                                m_pipeline;
+       Move<VkCommandPool>                                                             m_cmdPool;
+       Move<VkCommandBuffer>                                                   m_cmdBuffer;
+};
+
+class ExternalMemoryHostSynchronizationTestInstance : public ExternalMemoryHostRenderImageTestInstance
+{
+public:
+                                                               ExternalMemoryHostSynchronizationTestInstance   (Context& context, TestParams testParams);
+protected:
+       virtual tcu::TestStatus         iterate                                                                                 (void);
+       void                                            prepareBufferForHostAccess                                              (void);
+       void                                            copyResultBuffertoBuffer                                                (void);
+       void                                            submitCommands                                                                  (VkCommandBuffer commandBuffer, VkFence fence);
+       Move<VkBuffer>                          createDataBuffer                                                                (void);
+       void                                            fillBuffer                                                                              (void);
+
+       Move<VkBuffer>                          m_dataBuffer;
+       Move<VkCommandPool>                     m_cmdPoolCopy;
+       Move<VkCommandBuffer>           m_cmdBufferCopy;
+       Move<VkFence>                           m_fence_1;
+       Move<VkFence>                           m_fence_2;
+       Move<VkEvent>                           m_event;
+};
+
+ExternalMemoryHostBaseTestInstance::ExternalMemoryHostBaseTestInstance (Context& context, VkDeviceSize allocationSize)
+       : TestInstance                                                  (context)
+       , m_vki                                                                 (m_context.getInstanceInterface())
+       , m_vkd                                                                 (m_context.getDeviceInterface())
+       , m_log                                                                 (m_context.getTestContext().getLog())
+       , m_device                                                              (m_context.getDevice())
+       , m_physicalDevice                                              (m_context.getPhysicalDevice())
+       , m_queue                                                               (m_context.getUniversalQueue())
+       , m_memoryProps                                                 (getPhysicalDeviceMemoryProperties(m_vki, m_physicalDevice))
+       , m_minImportedHostPointerAlignment             (getMinImportedHostPointerAlignment())
+       , m_allocationSize                                              (m_minImportedHostPointerAlignment * allocationSize)
+       , m_allocator                                                   (m_context.getDefaultAllocator())
+{
+       if (!isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_external_memory_host"))
+               throw tcu::NotSupportedError("VK_EXT_external_memory_host is not supported");
+
+       m_hostMemoryAlloc       =       deAlignedMalloc((size_t)m_allocationSize, (size_t)m_minImportedHostPointerAlignment);
+
+       if (!m_hostMemoryAlloc)
+               TCU_FAIL("Failed to allocate memory block.");
+
+       DE_ASSERT(deIsAlignedPtr(m_hostMemoryAlloc, (deUintptr)m_minImportedHostPointerAlignment));
+}
+
+ExternalMemoryHostBaseTestInstance::~ExternalMemoryHostBaseTestInstance (void)
+{
+       deAlignedFree(m_hostMemoryAlloc);
+}
+
+VkDeviceSize ExternalMemoryHostBaseTestInstance::getMinImportedHostPointerAlignment (void)
+{
+       VkPhysicalDeviceExternalMemoryHostPropertiesEXT externalMemoryHostProperties    =
+       {
+               VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT,          //VkStructureType               sType
+               DE_NULL,                                                                                                                                        //void*                                 pNext
+               0                                                                                                                                                       //VkDeviceSize                  minImportedHostPointerAlignment
+       };
+
+       VkPhysicalDeviceProperties2                                             propertiesDeviceProperties2;
+       propertiesDeviceProperties2.sType                               = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
+       propertiesDeviceProperties2.pNext                               = &externalMemoryHostProperties;
+
+       m_vki.getPhysicalDeviceProperties2(m_physicalDevice, &propertiesDeviceProperties2);
+
+       m_log   << tcu::TestLog::Message << "VkPhysicalDeviceExternalMemoryHostPropertiesEXT::minImportedHostPointerAlignment is "
+                       << externalMemoryHostProperties.minImportedHostPointerAlignment << tcu::TestLog::EndMessage;
+
+       if (externalMemoryHostProperties.minImportedHostPointerAlignment > 65536)
+               TCU_FAIL("minImportedHostPointerAlignment is exceeding the supported limit");
+
+       return externalMemoryHostProperties.minImportedHostPointerAlignment;
+}
+
+deUint32 ExternalMemoryHostBaseTestInstance::getHostPointerMemoryTypeBits (void* hostPointer)
+{
+       VkExternalMemoryHandleTypeFlagBits                      externalMemoryHandleTypeFlagBits = VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT;
+
+       VkMemoryHostPointerPropertiesEXT                        memoryHostPointerProperties;
+       memoryHostPointerProperties.sType                       = VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT;
+       memoryHostPointerProperties.pNext                       = DE_NULL;
+
+       VK_CHECK(m_vkd.getMemoryHostPointerPropertiesEXT(m_device, externalMemoryHandleTypeFlagBits, hostPointer, &memoryHostPointerProperties));
+
+       m_log << tcu::TestLog::Message << "memoryTypeBits value: " << memoryHostPointerProperties.memoryTypeBits << tcu::TestLog::EndMessage;
+
+       return memoryHostPointerProperties.memoryTypeBits;
+}
+
+Move<VkDeviceMemory> ExternalMemoryHostBaseTestInstance::allocateMemoryFromHostPointer (deUint32 memoryTypeIndex)
+{
+       VkImportMemoryHostPointerInfoEXT                                                        importMemoryHostPointerInfo;
+       importMemoryHostPointerInfo.sType                                                       = VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT;
+       importMemoryHostPointerInfo.pNext                                                       = DE_NULL;
+       importMemoryHostPointerInfo.handleType                                          = VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT;
+       importMemoryHostPointerInfo.pHostPointer                                        = m_hostMemoryAlloc;
+
+       VkMemoryAllocateInfo                                                                            memoryAllocateInfo;
+       memoryAllocateInfo.sType                                                                        = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
+       memoryAllocateInfo.pNext                                                                        = &importMemoryHostPointerInfo;
+       memoryAllocateInfo.allocationSize                                                       = m_allocationSize;
+       memoryAllocateInfo.memoryTypeIndex                                                      = memoryTypeIndex;
+
+       return allocateMemory(m_vkd, m_device, &memoryAllocateInfo, DE_NULL);
+}
+
+void ExternalMemoryHostBaseTestInstance::logMemoryTypeIndexPropertyFlags (deUint32 index)
+{
+       m_log << tcu::TestLog::Message << "Memory Type index " << index << " property flags:" << tcu::TestLog::EndMessage;
+       m_log << tcu::TestLog::Message << getMemoryPropertyFlagsStr(m_memoryProps.memoryTypes[index].propertyFlags) << tcu::TestLog::EndMessage;
+}
+
+bool ExternalMemoryHostBaseTestInstance::findMemoryTypeIndexToTest (deUint32 hostPointerMemoryTypeBits, deUint32* outMemoryTypeIndexToTest)
+{
+       for (deUint32 bitMaskPosition = 0; bitMaskPosition < VK_MAX_MEMORY_TYPES; bitMaskPosition++)
+       {
+               if (isBitSet(hostPointerMemoryTypeBits, bitMaskPosition))
+               {
+                       logMemoryTypeIndexPropertyFlags(bitMaskPosition);
+                       *outMemoryTypeIndexToTest = bitMaskPosition;
+                       return true;
+               }
+       }
+       return false;
+}
+
+tcu::TestStatus ExternalMemoryHostBaseTestInstance::iterate (void)
+{
+       deUint32                        hostPointerMemoryTypeBits;
+       deUint32                        memoryTypeIndexToTest;
+
+       //realocate to meet requirements for host memory alignment
+       m_hostMemoryAlloc                       = deAlignedRealloc(m_hostMemoryAlloc, (size_t)m_minImportedHostPointerAlignment, (size_t)m_minImportedHostPointerAlignment);
+       m_allocationSize                        = m_minImportedHostPointerAlignment;
+
+       //check if reallocation is successfull
+       if (!m_hostMemoryAlloc)
+               TCU_FAIL("Failed to reallocate memory block.");
+
+       DE_ASSERT(deIsAlignedPtr(m_hostMemoryAlloc, (deUintptr)m_minImportedHostPointerAlignment));
+
+       //find the usable memory type index
+       hostPointerMemoryTypeBits       = getHostPointerMemoryTypeBits(m_hostMemoryAlloc);
+       if (findMemoryTypeIndexToTest(hostPointerMemoryTypeBits, &memoryTypeIndexToTest))
+               m_deviceMemoryAllocatedFromHostPointer = allocateMemoryFromHostPointer(memoryTypeIndexToTest);
+       else
+               return tcu::TestStatus::fail("Fail");
+
+       return tcu::TestStatus::pass("Pass");
+}
+
+ExternalMemoryHostRenderImageTestInstance::ExternalMemoryHostRenderImageTestInstance (Context& context, TestParams testParams)
+               : ExternalMemoryHostBaseTestInstance    (context, 1)
+               , m_testParams                                                  (testParams)
+{
+}
+
+tcu::TestStatus ExternalMemoryHostRenderImageTestInstance::iterate ()
+{
+       VkClearColorValue                                       clearColorBlue                                  = { { 0.0f, 0.0f, 1.0f, 1.0f } };
+       const deUint32                                          queueFamilyIndex                                = m_context.getUniversalQueueFamilyIndex();
+       deUint32                                                        hostPointerMemoryTypeBits;
+       deUint32                                                        memoryTypeIndexToTest;
+       VkMemoryRequirements                            imageMemoryRequirements;
+
+       m_image                                                         = createImage(VK_IMAGE_TILING_OPTIMAL);
+
+       //check memory requirements and reallocate memory if needed
+       imageMemoryRequirements                         = getImageMemoryRequirements(m_vkd, m_device, *m_image);
+
+       if (m_testParams.m_useOffset == false)
+       {
+               VkDeviceSize requiredSize = imageMemoryRequirements.size;
+               if (requiredSize > m_allocationSize)
+               {
+                       //calculate new size, this must me a multiple of minImportedHostPointerAlignment
+                       VkDeviceSize newHostAllocationSize      = VkDeviceSize(deCeilFloatToInt32((float(requiredSize) / float(m_minImportedHostPointerAlignment))) * m_minImportedHostPointerAlignment);
+
+                       m_log   << tcu::TestLog::Message << "Realloc needed (required size: "  << requiredSize <<  "). " << "New host allocation size: " << newHostAllocationSize << ")."
+                                       << tcu::TestLog::EndMessage;
+                       //realocate
+                       m_hostMemoryAlloc                                       = deAlignedRealloc(m_hostMemoryAlloc, (size_t)newHostAllocationSize, (size_t)m_minImportedHostPointerAlignment);
+                       m_allocationSize                                        = newHostAllocationSize;
+               }
+       }
+
+       if (m_testParams.m_useOffset == true)
+       {
+               VkDeviceSize requiredSize = imageMemoryRequirements.size + imageMemoryRequirements.alignment;
+               if (requiredSize > m_allocationSize)
+               {
+                       VkDeviceSize newHostAllocationSize      = VkDeviceSize(deCeilFloatToInt32((float(requiredSize) / float(m_minImportedHostPointerAlignment))) * m_minImportedHostPointerAlignment);
+
+                       m_log   << tcu::TestLog::Message << "Realloc needed (required size: " << requiredSize << "). " << "New host allocation size: " << newHostAllocationSize << ")."
+                                       << tcu::TestLog::EndMessage;
+                       m_hostMemoryAlloc                                       = deAlignedRealloc(m_hostMemoryAlloc, (size_t)newHostAllocationSize, (size_t)m_minImportedHostPointerAlignment);
+                       m_allocationSize                                        = newHostAllocationSize;
+               }
+       }
+       //check if reallocation is successfull
+       if (!m_hostMemoryAlloc)
+               TCU_FAIL("Failed to reallocate memory block.");
+
+       DE_ASSERT(deIsAlignedPtr(m_hostMemoryAlloc, (deUintptr)m_minImportedHostPointerAlignment));
+
+       //find the usable memory type index
+       hostPointerMemoryTypeBits                       = getHostPointerMemoryTypeBits(m_hostMemoryAlloc);
+       if (findMemoryTypeIndexToTest(hostPointerMemoryTypeBits, &memoryTypeIndexToTest))
+               m_deviceMemoryAllocatedFromHostPointer  = allocateMemoryFromHostPointer(memoryTypeIndexToTest);
+       else
+               return tcu::TestStatus::fail("Fail");
+
+       VK_CHECK(m_vkd.bindImageMemory(m_device, *m_image, *m_deviceMemoryAllocatedFromHostPointer, (m_testParams.m_useOffset ? imageMemoryRequirements.alignment : 0)));
+
+       m_imageView                                                             = createImageView();
+       m_renderPass                                                    = createRenderPass();
+       m_framebuffer                                                   = createFramebuffer();
+       m_vertexBuffer                                                  = createBindMemoryInitializeVertexBuffer();
+       m_resultBuffer                                                  = createBindMemoryResultBuffer();
+
+       vk::DescriptorSetLayoutBuilder                  builder;
+
+       builder.addSingleBinding(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, VK_SHADER_STAGE_ALL);
+
+       m_descriptorSetLayout                                   = builder.build(m_vkd, m_device, (vk::VkDescriptorSetLayoutCreateFlags)0);
+
+       m_descriptorPool                                                = DescriptorPoolBuilder().addType(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER)
+                                                                                                                                        .build(m_vkd, m_device, vk::VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, 1u);
+
+       m_pipelineLayout                                                = createPipelineLayout();
+       m_descriptorSet                                                 = createAndUpdateDescriptorSet();
+
+       m_vertexShaderModule                                    = createShaderModule(m_vkd, m_device, m_context.getBinaryCollection().get("position_only.vert"), 0);
+       m_fragmentShaderModule                                  = createShaderModule(m_vkd, m_device, m_context.getBinaryCollection().get("only_color_out.frag"), 0);
+
+
+       m_pipeline                                                              = createPipeline();
+
+       m_cmdPool                                                               = createCommandPool(m_vkd, m_device, VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, queueFamilyIndex);
+       m_cmdBuffer                                                             = allocateCommandBuffer(m_vkd, m_device, *m_cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
+
+
+       beginCommandBuffer(m_vkd, *m_cmdBuffer);
+
+       clear(clearColorBlue);
+       draw();
+       copyResultImagetoBuffer();
+
+       endCommandBuffer(m_vkd, *m_cmdBuffer);
+
+       submitCommandsAndWait(m_vkd, m_device, m_queue, *m_cmdBuffer);
+
+       tcu::ConstPixelBufferAccess                             result(mapVkFormat(m_testParams.m_format), tcu::IVec3(100,100,1), m_resultBufferAllocation->getHostPtr());
+
+       std::vector<float>                                              referenceData(40000, 0);
+       tcu::PixelBufferAccess                                  reference(mapVkFormat(m_testParams.m_format), tcu::IVec3(100, 100, 1), referenceData.data());
+
+       prepareReferenceImage(reference);
+
+       if (!tcu::floatThresholdCompare(m_context.getTestContext().getLog(), "Comparison", "Comparison", reference, result, tcu::Vec4(0.01f), tcu::COMPARE_LOG_ON_ERROR))
+               return tcu::TestStatus::fail("Fail");
+
+       return tcu::TestStatus::pass("Pass");
+}
+
+Move<VkImage>  ExternalMemoryHostRenderImageTestInstance::createImage (VkImageTiling tiling)
+{
+       const VkImageCreateInfo                 imageCreateInfo =
+       {
+               VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,                                    // VkStructureType                      sType
+               DE_NULL,                                                                                                // const void*                          pNext
+               DE_NULL,                                                                                                // VkImageCreateFlags           flags
+               VK_IMAGE_TYPE_2D,                                                                               // VkImageType                          imageType
+               m_testParams.m_format,                                                                  // VkFormat                                     format
+               { 100, 100, 1 },                                                                                // VkExtent3D                           extent
+               1,                                                                                                              // deUint32                                     mipLevels
+               1,                                                                                                              // deUint32                                     arrayLayers
+               VK_SAMPLE_COUNT_1_BIT,                                                                  // VkSampleCountFlagBits        samples
+               tiling,                                                                                                 // VkImageTiling                        tiling
+               VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
+               VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
+               VK_IMAGE_USAGE_TRANSFER_DST_BIT,                                                // VkImageUsageFlags            usage
+               VK_SHARING_MODE_EXCLUSIVE,                                                              // VkSharingMode                        sharingMode
+               0,                                                                                                              // deUint32                                     queueFamilyIndexCount
+               DE_NULL,                                                                                                // const deUint32*                      pQueueFamilyIndices
+               VK_IMAGE_LAYOUT_UNDEFINED,                                                              // VkImageLayout                        initialLayout
+       };
+
+       return vk::createImage(m_vkd, m_device, &imageCreateInfo, DE_NULL);
+}
+
+Move<VkFramebuffer>  ExternalMemoryHostRenderImageTestInstance::createFramebuffer ()
+{
+       const VkFramebufferCreateInfo framebufferCreateInfo =
+       {
+               VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO,                      // VkStructureType                              sType
+               DE_NULL,                                                                                        // const void*                                  pNext
+               (VkFramebufferCreateFlags)0,
+               *m_renderPass,                                                                          // VkRenderPass                                 renderPass
+               1,                                                                                                      // deUint32                                             attachmentCount
+               &m_imageView.get(),                                                                     // const VkImageView*                   pAttachments
+               100,                                                                                            // deUint32                                             width
+               100,                                                                                            // deUint32                                             height
+               1                                                                                                       // deUint32                                             layers
+       };
+       return vk::createFramebuffer(m_vkd, m_device, &framebufferCreateInfo);
+}
+
+Move<VkImageView>  ExternalMemoryHostRenderImageTestInstance::createImageView ()
+{
+       const VkImageViewCreateInfo             imageViewCreateInfo =
+       {
+               VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,                                                                                                                               // VkStructureType                      sType
+               DE_NULL,                                                                                                                                                                                                // const void*                          pNext
+               0,                                                                                                                                                                                                              // VkImageViewCreateFlags       flags
+               *m_image,                                                                                                                                                                                               // VkImage                                      image
+               VK_IMAGE_VIEW_TYPE_2D,                                                                                                                                                                  // VkImageViewType                      viewType
+               m_testParams.m_format,                                                                                                                                                                  // VkFormat                                     format
+               { VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A},              // VkComponentMapping           components
+               { VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1 }                                                                                                                               // VkImageSubresourceRange      subresourceRange
+       };
+       return vk::createImageView(m_vkd, m_device, &imageViewCreateInfo);
+}
+
+Move<VkBuffer>  ExternalMemoryHostRenderImageTestInstance::createBindMemoryInitializeVertexBuffer ()
+{
+       Move<VkBuffer>                                          buffer;
+       float                                                           triangleData[]                                  = { -1.0f,  -1.0f, 0.0f, 1.0f,
+                                                                                                                                                   -1.0f,   1.0f, 0.0f, 1.0f,
+                                                                                                                                                        0.0f,   1.0f, 0.0f, 1.0f,
+                                                                                                                                                        0.0f,  -1.0f, 0.0f, 1.0f };
+       const VkBufferCreateInfo                        vertexBufferCreateInfo =
+       {
+               VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,   // VkStructureType              sType
+               DE_NULL,                                                                // const void*                  pNext
+               0,                                                                              // VkBufferCreateFlags  flag
+               sizeof(triangleData),                                   // VkDeviceSize                 size
+               VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,             // VkBufferUsageFlags   usage
+               VK_SHARING_MODE_EXCLUSIVE,                              // VkSharingMode                sharingMode
+               0,                                                                              // deUint32                             queueFamilyCount
+               DE_NULL                                                                 // const deUint32*              pQueueFamilyIndices
+       };
+       buffer                                                                                                                          = vk::createBuffer(m_vkd, m_device, &vertexBufferCreateInfo, DE_NULL);
+       const VkMemoryRequirements                      bufferMemoryRequirements                = getBufferMemoryRequirements(m_vkd, m_device, *buffer);
+                                                                               m_vertexBufferAllocation                = m_allocator.allocate(bufferMemoryRequirements, MemoryRequirement::HostVisible);
+
+       VK_CHECK(m_vkd.bindBufferMemory(m_device, *buffer, m_vertexBufferAllocation->getMemory(), m_vertexBufferAllocation->getOffset()));
+
+       void* const                                                     mapPtr                                                  = m_vertexBufferAllocation->getHostPtr();
+
+       deMemcpy(mapPtr, triangleData, sizeof(triangleData));
+       flushMappedMemoryRange(m_vkd, m_device, m_vertexBufferAllocation->getMemory(), m_vertexBufferAllocation->getOffset(), sizeof(triangleData));
+
+       return buffer;
+}
+
+Move<VkBuffer>  ExternalMemoryHostRenderImageTestInstance::createBindMemoryResultBuffer ()
+{
+       Move<VkBuffer>                                          buffer;
+       VkDeviceSize                                            size                                            = 10000 * vk::mapVkFormat(m_testParams.m_format).getPixelSize();
+
+       const VkBufferCreateInfo                        resultBufferCreateInfo =
+       {
+               VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,                                           // VkStructureType              sType
+               DE_NULL,                                                                                                        // const void*                  pNext
+               0,                                                                                                                      // VkBufferCreateFlags  flags
+               size,                                                                                                           // VkDeviceSize                 size
+               VK_BUFFER_USAGE_TRANSFER_SRC_BIT |
+               VK_BUFFER_USAGE_TRANSFER_DST_BIT,                                                       // VkBufferUsageFlags   usage
+               VK_SHARING_MODE_EXCLUSIVE,                                                                      // VkSharingMode                sharingMode
+               0,                                                                                                                      // deUint32                             queueFamilyCount
+               DE_NULL                                                                                                         // const deUint32*              pQueueFamilyIndices
+       };
+       buffer                                                                                                                  = vk::createBuffer(m_vkd, m_device, &resultBufferCreateInfo, DE_NULL);
+
+       const VkMemoryRequirements                      bufferMemoryRequirements        = getBufferMemoryRequirements(m_vkd, m_device, *buffer);
+       m_resultBufferAllocation                                                                            = m_allocator.allocate(bufferMemoryRequirements, MemoryRequirement::HostVisible);
+
+       VK_CHECK(m_vkd.bindBufferMemory(m_device, *buffer, m_resultBufferAllocation->getMemory(), m_resultBufferAllocation->getOffset()));
+
+       return buffer;
+}
+
+Move<VkDescriptorSet>  ExternalMemoryHostRenderImageTestInstance::createAndUpdateDescriptorSet ()
+{
+       Move<VkDescriptorSet>                           descriptorSet;
+       VkDescriptorBufferInfo                          descriptorInfo;
+
+       const VkDescriptorSetAllocateInfo       allocInfo =
+       {
+               VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO, // VkStructureType                             sType
+               DE_NULL,                                                                                // const void*                                 pNext
+               *m_descriptorPool,                                                              // VkDescriptorPool                            descriptorPool
+               1u,                                                                                             // deUint32                                    setLayoutCount
+               &(m_descriptorSetLayout.get())                                  // const VkDescriptorSetLayout*                pSetLayouts
+       };
+
+       descriptorSet                                           = allocateDescriptorSet(m_vkd, m_device, &allocInfo);
+       descriptorInfo                                          = makeDescriptorBufferInfo(*m_vertexBuffer, (VkDeviceSize)0u, sizeof(float) * 16);
+
+       DescriptorSetUpdateBuilder()
+               .writeSingle(*descriptorSet, DescriptorSetUpdateBuilder::Location::binding(0u), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, &descriptorInfo)
+               .update(m_vkd, m_device);
+
+       return descriptorSet;
+}
+
+Move<VkPipelineLayout> ExternalMemoryHostRenderImageTestInstance::createPipelineLayout ()
+{
+       const VkPipelineLayoutCreateInfo        pipelineLayoutParams =
+       {
+               VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,  // VkStructureType                              sType
+               DE_NULL,                                                                                // const void*                                  pNext
+               (VkPipelineLayoutCreateFlags)0,                                 // VkPipelineLayoutCreateFlags  flags
+               1u,                                                                                             // deUint32                                             descriptorSetCount
+               &(m_descriptorSetLayout.get()),                                 // const VkDescriptorSetLayout* pSetLayouts
+               0u,                                                                                             // deUint32                                             pushConstantRangeCount
+               DE_NULL                                                                                 // const VkPushConstantRange*   pPushConstantRanges
+       };
+
+       return vk::createPipelineLayout(m_vkd, m_device, &pipelineLayoutParams);
+}
+
+Move<VkPipeline> ExternalMemoryHostRenderImageTestInstance::createPipeline ()
+{
+       Move<VkPipeline>                                                                pipeline;
+       const std::vector<VkViewport>                                   viewports(1, makeViewport(tcu::UVec2(100,100)));
+       const std::vector<VkRect2D>                                             scissors(1, makeRect2D(tcu::UVec2(100, 100)));
+       const VkPrimitiveTopology                                               topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN;
+       const VkPipelineVertexInputStateCreateInfo              vertexInputStateParams =
+       {
+               VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,      // VkStructureType                                                              sType
+               DE_NULL,                                                                                                        // const void*                                                                  pNext
+               0u,                                                                                                                     // vkPipelineVertexInputStateCreateFlags                flags
+               0u,                                                                                                                     // deUint32                                                                             bindingCount
+               DE_NULL,                                                                                                        // const VkVertexInputBindingDescription*               pVertexBindingDescriptions
+               0u,                                                                                                                     // deUint32                                                                             attributeCount
+               DE_NULL,                                                                                                        // const VkVertexInputAttributeDescription*             pVertexAttributeDescriptions
+       };
+
+       return      makeGraphicsPipeline(       m_vkd,                                          // const DeviceInterface&                       vk
+                                                                               m_device,                                       // const VkDevice                               device
+                                                                               *m_pipelineLayout,                      // const VkPipelineLayout                       pipelineLayout
+                                                                               *m_vertexShaderModule,          // const VkShaderModule                         vertexShaderModule
+                                                                               DE_NULL,                                        // const VkShaderModule                         tessellationControlShaderModule
+                                                                               DE_NULL,                                        // const VkShaderModule                         tessellationEvalShaderModule
+                                                                               DE_NULL,                                        // const VkShaderModule                         geometryShaderModule
+                                                                               *m_fragmentShaderModule,        // const VkShaderModule                         fragmentShaderModule
+                                                                               *m_renderPass,                          // const VkRenderPass                           renderPass
+                                                                               viewports,                                      // const std::vector<VkViewport>&               viewports
+                                                                               scissors,                                       // const std::vector<VkRect2D>&                 scissors
+                                                                               topology,                                       // const VkPrimitiveTopology                    topology
+                                                                               0u,                                                     // const deUint32                               subpass
+                                                                               0u,                                                     // const deUint32                               patchControlPoints
+                                                                               &vertexInputStateParams);       // const VkPipelineVertexInputStateCreateInfo*  vertexInputStateCreateInfo
+}
+
+void ExternalMemoryHostRenderImageTestInstance::clear (VkClearColorValue color)
+{
+       const struct VkImageSubresourceRange    subRangeColor   =
+       {
+               VK_IMAGE_ASPECT_COLOR_BIT,  // VkImageAspectFlags  aspectMask
+               0u,                         // deUint32            baseMipLevel
+               1u,                         // deUint32            mipLevels
+               0u,                         // deUint32            baseArrayLayer
+               1u,                         // deUint32            arraySize
+       };
+       const VkImageMemoryBarrier                              imageBarrier    =
+       {
+               VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                 // VkStructureType                      sType
+               DE_NULL,                                                                                // const void*                          pNext
+               0u,                                                                                             // VkAccessFlags                        srcAccessMask
+               VK_ACCESS_TRANSFER_WRITE_BIT,                                   // VkAccessFlags                        dstAccessMask
+               VK_IMAGE_LAYOUT_UNDEFINED,                                              // VkImageLayout                        oldLayout
+               VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,                   // VkImageLayout                        newLayout
+               VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     srcQueueFamilyIndex
+               VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     dstQueueFamilyIndex
+               *m_image,                                                                               // VkImage                                      image
+               subRangeColor                                                                   // VkImageSubresourceRange      subresourceRange
+       };
+
+       m_vkd.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, DE_FALSE, 0u, DE_NULL, 0u, DE_NULL, 1u, &imageBarrier);
+       m_vkd.cmdClearColorImage(*m_cmdBuffer, *m_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &color, 1, &subRangeColor);
+}
+
+void ExternalMemoryHostRenderImageTestInstance::draw ()
+{
+       const struct VkImageSubresourceRange    subRangeColor =
+       {
+               VK_IMAGE_ASPECT_COLOR_BIT,  // VkImageAspectFlags  aspectMask
+               0u,                         // deUint32            baseMipLevel
+               1u,                         // deUint32            mipLevels
+               0u,                         // deUint32            baseArrayLayer
+               1u,                         // deUint32            arraySize
+       };
+       const VkImageMemoryBarrier                              imageBarrier =
+       {
+               VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                 // VkStructureType                      sType
+               DE_NULL,                                                                                // const void*                          pNext
+               VK_ACCESS_TRANSFER_WRITE_BIT,                                   // VkAccessFlags                        srcAccessMask
+               VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,                   // VkAccessFlags                        dstAccessMask
+               VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,                   // VkImageLayout                        oldLayout
+               VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,               // VkImageLayout                        newLayout
+               VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     srcQueueFamilyIndex
+               VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     dstQueueFamilyIndex
+               *m_image,                                                                               // VkImage                                      image
+               subRangeColor                                                                   // VkImageSubresourceRange      subresourceRange
+       };
+       m_vkd.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, DE_FALSE, 0u, DE_NULL, 0u, DE_NULL, 1u, &imageBarrier);
+
+       beginRenderPass(m_vkd, *m_cmdBuffer, *m_renderPass, *m_framebuffer, makeRect2D(0, 0, 75, 100), tcu::Vec4(1.0f, 0.0f, 0.0f, 1.0f));
+       m_vkd.cmdBindPipeline(*m_cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, *m_pipeline);
+       m_vkd.cmdBindDescriptorSets(*m_cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, *m_pipelineLayout, 0, 1, &(*m_descriptorSet), 0, DE_NULL);
+       m_vkd.cmdDraw(*m_cmdBuffer, 4, 1, 0, 0);
+       endRenderPass(m_vkd, *m_cmdBuffer);
+}
+
+void ExternalMemoryHostRenderImageTestInstance::copyResultImagetoBuffer ()
+{
+       const struct VkImageSubresourceRange subRangeColor =
+       {
+               VK_IMAGE_ASPECT_COLOR_BIT,  // VkImageAspectFlags  aspectMask
+               0u,                         // deUint32            baseMipLevel
+               1u,                         // deUint32            mipLevels
+               0u,                         // deUint32            baseArrayLayer
+               1u,                         // deUint32            arraySize
+       };
+       const VkImageMemoryBarrier                      imageBarrier =
+       {
+               VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                 // VkStructureType                      sType
+               DE_NULL,                                                                                // const void*                          pNext
+               VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,                   // VkAccessFlags                        srcAccessMask
+               VK_ACCESS_TRANSFER_READ_BIT,                                    // VkAccessFlags                        dstAccessMask
+               VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,               // VkImageLayout                        oldLayout
+               VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,                   // VkImageLayout                        newLayout
+               VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     srcQueueFamilyIndex
+               VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     dstQueueFamilyIndex
+               *m_image,                                                                               // VkImage                                      image
+               subRangeColor                                                                   // VkImageSubresourceRange      subresourceRange
+       };
+       m_vkd.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, DE_FALSE, 0u, DE_NULL, 0u, DE_NULL, 1u, &imageBarrier);
+
+       const VkBufferImageCopy                         region_all =
+       {
+               0,                                                                                              // VkDeviceSize                                 bufferOffset
+               0,                                                                                              // deUint32                                             bufferRowLength
+               0,                                                                                              // deUint32                                             bufferImageHeight
+               { vk::VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1 },             // VkImageSubresourceLayers             imageSubresource
+               { 0, 0, 0 },                                                                    // VkOffset3D                                   imageOffset
+               { 100, 100, 1 } };                                                              // VkExtent3D                                   imageExtent
+
+       m_vkd.cmdCopyImageToBuffer(*m_cmdBuffer, *m_image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, *m_resultBuffer, 1, &region_all);
+}
+
+void ExternalMemoryHostRenderImageTestInstance::prepareReferenceImage (tcu::PixelBufferAccess& reference)
+{
+       for (int w=0; w < 100; w++)
+               for (int h = 0; h < 100; h++)
+               {
+                       if (w < 50)                                     reference.setPixel(tcu::Vec4(0, 1, 0, 1), w, h);
+                       if ((w >= 50) && (w < 75))      reference.setPixel(tcu::Vec4(1, 0, 0, 1), w, h);
+                       if (w >=75)                                     reference.setPixel(tcu::Vec4(0, 0, 1, 1), w, h);
+               }
+}
+
+Move<VkRenderPass> ExternalMemoryHostRenderImageTestInstance::createRenderPass ()
+{
+       const VkAttachmentDescription                   colorAttachmentDescription =
+       {
+               (VkAttachmentDescriptionFlags)0,                        // VkAttachmentDescriptionFlags    flags
+               m_testParams.m_format,                                          // VkFormat                        format
+               VK_SAMPLE_COUNT_1_BIT,                                          // VkSampleCountFlagBits           samples
+               VK_ATTACHMENT_LOAD_OP_CLEAR,                            // VkAttachmentLoadOp              loadOp
+               VK_ATTACHMENT_STORE_OP_STORE,                           // VkAttachmentStoreOp             storeOp
+               VK_ATTACHMENT_LOAD_OP_DONT_CARE,                        // VkAttachmentLoadOp              stencilLoadOp
+               VK_ATTACHMENT_STORE_OP_DONT_CARE,                       // VkAttachmentStoreOp             stencilStoreOp
+               VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,       // VkImageLayout                   initialLayout
+               VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL        // VkImageLayout                   finalLayout
+       };
+
+       std::vector<VkAttachmentDescription>    attachmentDescriptions;
+       attachmentDescriptions.push_back(colorAttachmentDescription);
+
+       const VkAttachmentReference                             colorAttachmentRef =
+       {
+               0u,                                                                                     // deUint32         attachment
+               VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL        // VkImageLayout    layout
+       };
+
+       const VkSubpassDescription                              subpassDescription =
+       {
+               (VkSubpassDescriptionFlags)0,                           // VkSubpassDescriptionFlags       flags
+               VK_PIPELINE_BIND_POINT_GRAPHICS,                        // VkPipelineBindPoint             pipelineBindPoint
+               0u,                                                                                     // deUint32                        inputAttachmentCount
+               DE_NULL,                                                                        // const VkAttachmentReference*    pInputAttachments
+               1u,                                                                                     // deUint32                        colorAttachmentCount
+               &colorAttachmentRef,                                            // const VkAttachmentReference*    pColorAttachments
+               DE_NULL,                                                                        // const VkAttachmentReference*    pResolveAttachments
+               DE_NULL,                                                                        // const VkAttachmentReference*    pDepthStencilAttachment
+               0u,                                                                                     // deUint32                        preserveAttachmentCount
+               DE_NULL                                                                         // const deUint32*                 pPreserveAttachments
+       };
+
+       const VkRenderPassCreateInfo                    renderPassInfo =
+       {
+               VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,      // VkStructureType                   sType
+               DE_NULL,                                                                        // const void*                       pNext
+               (VkRenderPassCreateFlags)0,                                     // VkRenderPassCreateFlags           flags
+               (deUint32)attachmentDescriptions.size(),        // deUint32                          attachmentCount
+               &attachmentDescriptions[0],                                     // const VkAttachmentDescription*    pAttachments
+               1u,                                                                                     // deUint32                          subpassCount
+               &subpassDescription,                                            // const VkSubpassDescription*       pSubpasses
+               0u,                                                                                     // deUint32                          dependencyCount
+               DE_NULL                                                                         // const VkSubpassDependency*        pDependencies
+       };
+
+       return vk::createRenderPass(m_vkd, m_device, &renderPassInfo);
+}
+
+ExternalMemoryHostSynchronizationTestInstance::ExternalMemoryHostSynchronizationTestInstance (Context& context, TestParams testParams)
+       : ExternalMemoryHostRenderImageTestInstance (context, testParams)
+{
+}
+
+tcu::TestStatus ExternalMemoryHostSynchronizationTestInstance::iterate ()
+{
+       DE_ASSERT(m_testParams.m_format == VK_FORMAT_R8G8B8A8_UNORM);
+
+       const deUint32                                                  queueFamilyIndex                                                        = m_context.getUniversalQueueFamilyIndex();
+       const VkDeviceSize                                              dataBufferSize                                                          = 10000 * vk::mapVkFormat(m_testParams.m_format).getPixelSize();
+       void*                                                                   pointerReturnedByMapMemory;
+       deUint32                                                                hostPointerMemoryTypeBits;
+       deUint32                                                                memoryTypeIndexToTest;
+       VkMemoryRequirements                                    bufferMemoryRequirements;
+
+       m_dataBuffer                                                    = createDataBuffer();
+
+       //check memory requirements
+       bufferMemoryRequirements                                = getBufferMemoryRequirements(m_vkd, m_device, *m_dataBuffer);
+       VkDeviceSize requiredSize                               = bufferMemoryRequirements.size;
+       //reallocate memory if needed
+       if (requiredSize > m_allocationSize)
+       {
+               VkDeviceSize newHostAllocationSize      = VkDeviceSize(deCeilFloatToInt32((float(requiredSize) / float(m_minImportedHostPointerAlignment))) * m_minImportedHostPointerAlignment);
+
+               m_log << tcu::TestLog::Message << "Realloc needed (required size: " << requiredSize << "). "
+                       << "New host allocation size: " << newHostAllocationSize << ")." << tcu::TestLog::EndMessage;
+
+               m_hostMemoryAlloc                                       = deAlignedRealloc(m_hostMemoryAlloc, (size_t)newHostAllocationSize, (size_t)m_minImportedHostPointerAlignment);
+               m_allocationSize                                        = newHostAllocationSize;
+       }
+
+       //check if reallocation is successfull
+       if (!m_hostMemoryAlloc)
+               TCU_FAIL("Failed to reallocate memory block.");
+
+       DE_ASSERT(deIsAlignedPtr(m_hostMemoryAlloc, (deUintptr)m_minImportedHostPointerAlignment));
+
+       //find the usable memory type index
+       hostPointerMemoryTypeBits                               = getHostPointerMemoryTypeBits(m_hostMemoryAlloc);
+       if (findMemoryTypeIndexToTest(hostPointerMemoryTypeBits, &memoryTypeIndexToTest))
+               m_deviceMemoryAllocatedFromHostPointer = allocateMemoryFromHostPointer(memoryTypeIndexToTest);
+       else
+               return tcu::TestStatus::fail("Fail");
+
+       VK_CHECK(m_vkd.bindBufferMemory(m_device, *m_dataBuffer, *m_deviceMemoryAllocatedFromHostPointer, 0));
+
+       m_resultBuffer                                                  = createBindMemoryResultBuffer();
+       m_cmdPool                                                               = createCommandPool(m_vkd, m_device, VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, queueFamilyIndex);
+       m_cmdBuffer                                                             = allocateCommandBuffer(m_vkd, m_device, *m_cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
+       m_cmdBufferCopy                                                 = allocateCommandBuffer(m_vkd, m_device, *m_cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
+
+       m_event                                                                 = createEvent(m_vkd, m_device);
+       m_fence_1                                                               = createFence(m_vkd, m_device);
+       m_fence_2                                                               = createFence(m_vkd, m_device);
+
+       //record first command buffer
+       beginCommandBuffer(m_vkd, *m_cmdBuffer);
+       fillBuffer();
+       prepareBufferForHostAccess();
+       endCommandBuffer(m_vkd, *m_cmdBuffer);
+
+       //record second command buffer
+       beginCommandBuffer(m_vkd, *m_cmdBufferCopy);
+       copyResultBuffertoBuffer();
+       endCommandBuffer(m_vkd, *m_cmdBufferCopy);
+
+       submitCommands(*m_cmdBuffer, *m_fence_1);
+       submitCommands(*m_cmdBufferCopy, *m_fence_2);
+
+       //wait for fence_1 and modify image on host
+       VK_CHECK(m_vkd.waitForFences(m_device, 1u, &m_fence_1.get(), DE_TRUE, ~0ull));
+       pointerReturnedByMapMemory                              = mapMemory(m_vkd, m_device, *m_deviceMemoryAllocatedFromHostPointer, 0, dataBufferSize, 0);
+       invalidateMappedMemoryRange(m_vkd, m_device, *m_deviceMemoryAllocatedFromHostPointer, 0, dataBufferSize);
+       tcu::PixelBufferAccess bufferSurface(mapVkFormat(m_testParams.m_format), 100, 100, 1, (100 * vk::mapVkFormat(m_testParams.m_format).getPixelSize()), 0, m_hostMemoryAlloc);
+       prepareReferenceImage(bufferSurface);
+       flushMappedMemoryRange(m_vkd, m_device, *m_deviceMemoryAllocatedFromHostPointer, 0, dataBufferSize);
+       //compare memory pointed by both pointers
+       if (deMemCmp(m_hostMemoryAlloc, pointerReturnedByMapMemory, (size_t)dataBufferSize) != 0)
+               TCU_FAIL("Failed memcmp check.");
+       m_vkd.unmapMemory(m_device, *m_deviceMemoryAllocatedFromHostPointer);
+       VK_CHECK(m_vkd.setEvent(m_device, *m_event));
+
+       //wait for fence_2 before checking result
+       VK_CHECK(m_vkd.waitForFences(m_device, 1u, &m_fence_2.get(), DE_TRUE, ~0ull));
+
+       void * bufferDataPointer                                = static_cast<char*>(m_resultBufferAllocation->getHostPtr()) + m_resultBufferAllocation->getOffset();
+       tcu::ConstPixelBufferAccess                             result(mapVkFormat(m_testParams.m_format), tcu::IVec3(100, 100, 1), bufferDataPointer);
+
+       std::vector<float>                                              referenceData((unsigned int)dataBufferSize, 0);
+       tcu::PixelBufferAccess                                  reference(mapVkFormat(m_testParams.m_format), tcu::IVec3(100, 100, 1), referenceData.data());
+
+       prepareReferenceImage(reference);
+
+       if (!tcu::floatThresholdCompare(m_context.getTestContext().getLog(), "Comparison", "Comparison", reference, result, tcu::Vec4(0.01f), tcu::COMPARE_LOG_ON_ERROR))
+               return tcu::TestStatus::fail("Fail");
+
+       return tcu::TestStatus::pass("Pass");
+}
+
+void ExternalMemoryHostSynchronizationTestInstance::prepareBufferForHostAccess ()
+{
+       VkDeviceSize                                    size                                                            = 10000 * vk::mapVkFormat(m_testParams.m_format).getPixelSize();
+       const VkBufferMemoryBarrier             bufferBarrier =
+       {
+               VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER,        // VkStructureType      sType;
+               DE_NULL,                                                                        // const void*          pNext;
+               VK_ACCESS_TRANSFER_WRITE_BIT,                           // VkAccessFlags        srcAccessMask;
+               VK_ACCESS_HOST_WRITE_BIT,                                       // VkAccessFlags        dstAccessMask;
+               VK_QUEUE_FAMILY_IGNORED,                                        // deUint32                     srcQueueFamilyIndex;
+               VK_QUEUE_FAMILY_IGNORED,                                        // deUint32                     dstQueueFamilyIndex;
+               *m_dataBuffer,                                                          // VkBuffer                     buffer;
+               0u,                                                                                     // VkDeviceSize         offset;
+               size                                                                            // VkDeviceSize         size;
+       };
+
+       m_vkd.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_HOST_BIT, DE_FALSE, 0u, DE_NULL, 1u, &bufferBarrier, 0u, DE_NULL);
+}
+
+void ExternalMemoryHostSynchronizationTestInstance::copyResultBuffertoBuffer ()
+{
+       VkDeviceSize                                    size                                                            = 10000 * vk::mapVkFormat(m_testParams.m_format).getPixelSize();
+       const VkBufferMemoryBarrier             bufferBarrier =
+       {
+               VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER,        // VkStructureType      sType;
+               DE_NULL,                                                                        // const void*          pNext;
+               VK_ACCESS_HOST_WRITE_BIT,                                       // VkAccessFlags        srcAccessMask;
+               VK_ACCESS_TRANSFER_READ_BIT,                            // VkAccessFlags        dstAccessMask;
+               VK_QUEUE_FAMILY_IGNORED,                                        // deUint32                     srcQueueFamilyIndex;
+               VK_QUEUE_FAMILY_IGNORED,                                        // deUint32                     dstQueueFamilyIndex;
+               *m_dataBuffer,                                                          // VkBuffer                     buffer;
+               0u,                                                                                     // VkDeviceSize         offset;
+               size                                                                            // VkDeviceSize         size;
+       };
+
+       const VkBufferCopy                              region_all =
+       {
+               0,              //VkDeviceSize srcOffset;
+               0,              //VkDeviceSize dstOffset;
+               size    //VkDeviceSize size;
+       };
+
+       m_vkd.cmdWaitEvents(*m_cmdBufferCopy, 1, &m_event.get(), VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, DE_NULL, 1, &bufferBarrier, 0, DE_NULL);
+       m_vkd.cmdCopyBuffer(*m_cmdBufferCopy, *m_dataBuffer, *m_resultBuffer, 1, &region_all);
+}
+
+void ExternalMemoryHostSynchronizationTestInstance::submitCommands (VkCommandBuffer commandBuffer, VkFence fence)
+{
+       const VkSubmitInfo              submitInfo =
+       {
+               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                          // VkStructureType                              sType
+               DE_NULL,                                                                                        // const void*                                  pNext
+               0u,                                                                                                     // deUint32                                             waitSemaphoreCount
+               DE_NULL,                                                                                        // const VkSemaphore*                   pWaitSemaphores
+               (const VkPipelineStageFlags*)DE_NULL,                           // const VkPipelineStageFlags*  pWaitDstStageMask
+               1u,                                                                                                     // deUint32                                             commandBufferCount
+               &commandBuffer,                                                                         // const VkCommandBuffer*               pCommandBuffers
+               0u,                                                                                                     // deUint32                                             signalSemaphoreCount
+               DE_NULL,                                                                                        // const VkSemaphore*                   pSignalSemaphores
+       };
+
+       VK_CHECK(m_vkd.queueSubmit(m_queue, 1u, &submitInfo, fence));
+}
+
+Move<VkBuffer> ExternalMemoryHostSynchronizationTestInstance::createDataBuffer ()
+{
+       VkDeviceSize                                    size                                                            = 10000 * vk::mapVkFormat(m_testParams.m_format).getPixelSize();
+       const VkBufferCreateInfo                dataBufferCreateInfo =
+       {
+               VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,   // VkStructureType              sType
+               DE_NULL,                                                                // const void*                  pNext
+               0,                                                                              // VkBufferCreateFlags  flag
+               size,                                                                   // VkDeviceSize                 size
+               VK_BUFFER_USAGE_TRANSFER_DST_BIT |
+               VK_BUFFER_USAGE_TRANSFER_SRC_BIT,               // VkBufferUsageFlags   usage
+               VK_SHARING_MODE_EXCLUSIVE,                              // VkSharingMode                sharingMode
+               0,                                                                              // deUint32                             queueFamilyCount
+               DE_NULL                                                                 // const deUint32*              pQueueFamilyIndices
+       };
+       return vk::createBuffer(m_vkd, m_device, &dataBufferCreateInfo, DE_NULL);
+}
+
+void ExternalMemoryHostSynchronizationTestInstance::fillBuffer ()
+{
+       VkDeviceSize                                    size                                                            = 10000 * vk::mapVkFormat(m_testParams.m_format).getPixelSize();
+       const VkBufferMemoryBarrier             bufferBarrier =
+       {
+               VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER,        // VkStructureType      sType;
+               DE_NULL,                                                                        // const void*          pNext;
+               0u,                                                                                     // VkAccessFlags        srcAccessMask;
+               VK_ACCESS_TRANSFER_WRITE_BIT,                           // VkAccessFlags        dstAccessMask;
+               VK_QUEUE_FAMILY_IGNORED,                                        // deUint32                     srcQueueFamilyIndex;
+               VK_QUEUE_FAMILY_IGNORED,                                        // deUint32                     dstQueueFamilyIndex;
+               *m_dataBuffer,                                                          // VkBuffer                     buffer;
+               0u,                                                                                     // VkDeviceSize         offset;
+               size                                                                            // VkDeviceSize         size;
+       };
+
+       m_vkd.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, DE_FALSE, 0u, DE_NULL, 1u, &bufferBarrier, 0u, DE_NULL);
+       m_vkd.cmdFillBuffer(*m_cmdBuffer, *m_dataBuffer, 0, size, 0xFFFFFFFF);
+}
+
+struct AddPrograms
+{
+       void init (vk::SourceCollections& sources, TestParams testParams) const
+       {
+                       //unused parameter
+                       DE_UNREF(testParams);
+
+                       const char* const vertexShader =
+                       "#version 430\n"
+
+                       "layout(std430, binding = 0) buffer BufferPos {\n"
+                       "vec4 p[100];\n"
+                       "} pos;\n"
+
+                       "out gl_PerVertex{\n"
+                       "vec4 gl_Position;\n"
+                       "};\n"
+
+                       "void main() {\n"
+                       "gl_Position = pos.p[gl_VertexIndex];\n"
+                       "}\n";
+
+               sources.glslSources.add("position_only.vert")
+                       << glu::VertexSource(vertexShader);
+
+               const char* const fragmentShader =
+                       "#version 430\n"
+
+                       "layout(location = 0) out vec4 my_FragColor;\n"
+
+                       "void main() {\n"
+                       "my_FragColor = vec4(0,1,0,1);\n"
+                       "}\n";
+
+               sources.glslSources.add("only_color_out.frag")
+                       << glu::FragmentSource(fragmentShader);
+       }
+};
+
+} // unnamed namespace
+
+tcu::TestCaseGroup* createMemoryExternalMemoryHostTests (tcu::TestContext& testCtx)
+{
+       de::MovePtr<tcu::TestCaseGroup> group(new tcu::TestCaseGroup(testCtx, "external_memory_host", "VK_EXT_external_memory_host extension tests."));
+       de::MovePtr<tcu::TestCaseGroup> simpleAllocation(new tcu::TestCaseGroup(testCtx, "simple_allocation", "simple allocation tests."));
+       de::MovePtr<tcu::TestCaseGroup> bind_image_memory_and_render(new tcu::TestCaseGroup(testCtx, "bind_image_memory_and_render", "render tests."));
+       de::MovePtr<tcu::TestCaseGroup> with_zero_offset(new tcu::TestCaseGroup(testCtx, "with_zero_offset", "bind object with zero offset specified"));
+       de::MovePtr<tcu::TestCaseGroup> with_non_zero_offset(new tcu::TestCaseGroup(testCtx, "with_non_zero_offset", "bind object with zero offset specified"));
+       de::MovePtr<tcu::TestCaseGroup> synchronization(new tcu::TestCaseGroup(testCtx, "synchronization", "synchronization tests."));
+
+       //test cases:
+       simpleAllocation->addChild(new InstanceFactory1<ExternalMemoryHostBaseTestInstance, VkDeviceSize> (testCtx, tcu::NODETYPE_SELF_VALIDATE, "minImportedHostPointerAlignment_x1",
+                                                                                                                                                                                                         "allocate minImportedHostPointerAlignment multiplied by 1", 1));
+       simpleAllocation->addChild(new InstanceFactory1<ExternalMemoryHostBaseTestInstance, VkDeviceSize> (testCtx, tcu::NODETYPE_SELF_VALIDATE, "minImportedHostPointerAlignment_x3",
+                                                                                                                                                                                                         "allocate minImportedHostPointerAlignment multiplied by 3", 3));
+       group ->addChild(simpleAllocation.release());
+
+       const VkFormat testFormats[] = {
+               VK_FORMAT_R8G8B8A8_UNORM,
+               VK_FORMAT_R16G16B16A16_UNORM,
+               VK_FORMAT_R16G16B16A16_SFLOAT,
+               VK_FORMAT_R32G32B32A32_SFLOAT
+       };
+
+       const std::string testNames[] = {
+               "r8g8b8a8_unorm",
+               "r16g16b16a16_unorm",
+               "r16g16b16a16_sfloat",
+               "r32g32b32a32_sfloat"
+       };
+
+       for (size_t formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(testFormats); formatNdx++)
+       {
+               std::string testName = testNames[formatNdx];
+               with_zero_offset->addChild(new InstanceFactory1<ExternalMemoryHostRenderImageTestInstance, TestParams, AddPrograms>     (testCtx, tcu::NODETYPE_SELF_VALIDATE,
+                                                                                                                                                                                                                                                       testName, testName, AddPrograms(),
+                                                                                                                                                                                                                                                       TestParams(testFormats[formatNdx])));
+       }
+       bind_image_memory_and_render->addChild(with_zero_offset.release());
+
+       for (size_t formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(testFormats); formatNdx++)
+       {
+               std::string testName = testNames[formatNdx];
+               with_non_zero_offset->addChild(new InstanceFactory1<ExternalMemoryHostRenderImageTestInstance, TestParams, AddPrograms> (testCtx, tcu::NODETYPE_SELF_VALIDATE,
+                                                                                                                                                                                                                                                               testName, testName, AddPrograms(),
+                                                                                                                                                                                                                                                               TestParams(testFormats[formatNdx], true)));
+       }
+       bind_image_memory_and_render->addChild(with_non_zero_offset.release());
+
+       group->addChild(bind_image_memory_and_render.release());
+
+       synchronization->addChild(new InstanceFactory1<ExternalMemoryHostSynchronizationTestInstance, TestParams, AddPrograms>  (testCtx, tcu::NODETYPE_SELF_VALIDATE,
+                                                                                                                                                                                                                                                       "synchronization", "synchronization", AddPrograms(),
+                                                                                                                                                                                                                                                       TestParams(testFormats[0], true)));
+       group->addChild(synchronization.release());
+       return group.release();
+}
+
+} // memory
+} // vkt
diff --git a/external/vulkancts/modules/vulkan/memory/vktMemoryExternalMemoryHostTests.hpp b/external/vulkancts/modules/vulkan/memory/vktMemoryExternalMemoryHostTests.hpp
new file mode 100644 (file)
index 0000000..cac4d3f
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef _VKTMEMORYEXTERNALMEMORYHOSTTESTS_HPP
+#define _VKTMEMORYEXTERNALMEMORYHOSTTESTS_HPP
+/*------------------------------------------------------------------------
+* Vulkan Conformance Tests
+* ------------------------
+*
+* Copyright (c) 2018 The Khronos Group Inc.
+* Copyright (c) 2018 Intel Corporation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*//*!
+* \file
+* \brief VK_EXT_external_memory_host extension tests.
+*//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "tcuTestCase.hpp"
+
+namespace vkt
+{
+namespace memory
+{
+
+tcu::TestCaseGroup* createMemoryExternalMemoryHostTests(tcu::TestContext& testCtx);
+
+} // memory
+} // vkt
+
+#endif // _VKTMEMORYEXTERNALMEMORYHOSTTESTS_HPP
index d06258e25f983a99da8c416db38852e222b25ed5..c678decef3515320fa021357cb783b837889ac4a 100644 (file)
@@ -28,6 +28,7 @@
 #include "vktMemoryPipelineBarrierTests.hpp"
 #include "vktMemoryRequirementsTests.hpp"
 #include "vktMemoryBindingTests.hpp"
+#include "vktMemoryExternalMemoryHostTests.hpp"
 #include "vktTestGroupUtil.hpp"
 
 namespace vkt
@@ -42,12 +43,13 @@ void createChildren (tcu::TestCaseGroup* memoryTests)
 {
        tcu::TestContext&       testCtx         = memoryTests->getTestContext();
 
-       memoryTests->addChild(createAllocationTests                             (testCtx));
-       memoryTests->addChild(createDeviceGroupAllocationTests  (testCtx));
-       memoryTests->addChild(createMappingTests                                (testCtx));
-       memoryTests->addChild(createPipelineBarrierTests                (testCtx));
-       memoryTests->addChild(createRequirementsTests                   (testCtx));
-       memoryTests->addChild(createMemoryBindingTests                  (testCtx));
+       memoryTests->addChild(createAllocationTests                                     (testCtx));
+       memoryTests->addChild(createDeviceGroupAllocationTests          (testCtx));
+       memoryTests->addChild(createMappingTests                                        (testCtx));
+       memoryTests->addChild(createPipelineBarrierTests                        (testCtx));
+       memoryTests->addChild(createRequirementsTests                           (testCtx));
+       memoryTests->addChild(createMemoryBindingTests                          (testCtx));
+       memoryTests->addChild(createMemoryExternalMemoryHostTests       (testCtx));
 }
 
 } // anonymous
index 311276ede49232a537caa97a487c368448b31011..6c339b07a795371a1a563cbc91e3b4acdf21034f 100644 (file)
@@ -83831,6 +83831,17 @@ dEQP-VK.memory.binding.aliasing.suballocated.image_33_257
 dEQP-VK.memory.binding.aliasing.suballocated.image_257_8
 dEQP-VK.memory.binding.aliasing.suballocated.image_257_33
 dEQP-VK.memory.binding.aliasing.suballocated.image_257_257
+dEQP-VK.memory.external_memory_host.simple_allocation.minImportedHostPointerAlignment_x1
+dEQP-VK.memory.external_memory_host.simple_allocation.minImportedHostPointerAlignment_x3
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_zero_offset.r8g8b8a8_unorm
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_zero_offset.r16g16b16a16_unorm
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_zero_offset.r16g16b16a16_sfloat
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_zero_offset.r32g32b32a32_sfloat
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_non_zero_offset.r8g8b8a8_unorm
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_non_zero_offset.r16g16b16a16_unorm
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_non_zero_offset.r16g16b16a16_sfloat
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_non_zero_offset.r32g32b32a32_sfloat
+dEQP-VK.memory.external_memory_host.synchronization.synchronization
 dEQP-VK.pipeline.stencil.format.s8_uint.states.fail_keep.pass_keep.dfail_keep.comp_never
 dEQP-VK.pipeline.stencil.format.s8_uint.states.fail_keep.pass_keep.dfail_keep.comp_less
 dEQP-VK.pipeline.stencil.format.s8_uint.states.fail_keep.pass_keep.dfail_keep.comp_equal
index a6bf2ebb2353fb577be360345c74efb26b928aa3..8c56d9549ad2f2d63d08ded7c192e92412e37c04 100644 (file)
@@ -83831,6 +83831,17 @@ dEQP-VK.memory.binding.aliasing.suballocated.image_33_257
 dEQP-VK.memory.binding.aliasing.suballocated.image_257_8
 dEQP-VK.memory.binding.aliasing.suballocated.image_257_33
 dEQP-VK.memory.binding.aliasing.suballocated.image_257_257
+dEQP-VK.memory.external_memory_host.simple_allocation.minImportedHostPointerAlignment_x1
+dEQP-VK.memory.external_memory_host.simple_allocation.minImportedHostPointerAlignment_x3
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_zero_offset.r8g8b8a8_unorm
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_zero_offset.r16g16b16a16_unorm
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_zero_offset.r16g16b16a16_sfloat
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_zero_offset.r32g32b32a32_sfloat
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_non_zero_offset.r8g8b8a8_unorm
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_non_zero_offset.r16g16b16a16_unorm
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_non_zero_offset.r16g16b16a16_sfloat
+dEQP-VK.memory.external_memory_host.bind_image_memory_and_render.with_non_zero_offset.r32g32b32a32_sfloat
+dEQP-VK.memory.external_memory_host.synchronization.synchronization
 dEQP-VK.pipeline.stencil.format.s8_uint.states.fail_keep.pass_keep.dfail_keep.comp_never
 dEQP-VK.pipeline.stencil.format.s8_uint.states.fail_keep.pass_keep.dfail_keep.comp_less
 dEQP-VK.pipeline.stencil.format.s8_uint.states.fail_keep.pass_keep.dfail_keep.comp_equal
index 660cfe170f274a720af9e8079b5126566db801df..2fdb71d30142980c1426997308b7fddfb8e9d08b 100755 (executable)
@@ -388,9 +388,12 @@ typedef enum VkStructureType {
     VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT = 1000190000,
     VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT = 1000190001,
     VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT = 1000190002,
+    VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT = 1000178000,
+    VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT = 1000178001,
+    VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT = 1000178002,
     VK_STRUCTURE_TYPE_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO,
-    VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO,
-    VK_STRUCTURE_TYPE_RANGE_SIZE = (VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1),
+    VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT,
+    VK_STRUCTURE_TYPE_RANGE_SIZE = (VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1),
     VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
 } VkStructureType;
 
@@ -3638,6 +3641,8 @@ typedef enum VkExternalMemoryHandleTypeFlagBits {
     VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT = 0x00000010,
     VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT = 0x00000020,
     VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT = 0x00000040,
+    VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT = 0x00000080,
+    VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT = 0x00000100,
     VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID = 0x00000400,
     VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
 } VkExternalMemoryHandleTypeFlagBits;
@@ -7699,6 +7704,34 @@ typedef struct VkExternalFormatANDROID {
     uint64_t           externalFormat;
 } VkExternalFormatANDROID;
 
+typedef struct VkImportMemoryHostPointerInfoEXT {
+    VkStructureType                       sType;
+    const void*                           pNext;
+    VkExternalMemoryHandleTypeFlagBits    handleType;
+    void*                                 pHostPointer;
+} VkImportMemoryHostPointerInfoEXT;
+
+typedef struct VkMemoryHostPointerPropertiesEXT {
+    VkStructureType    sType;
+    void*              pNext;
+    uint32_t           memoryTypeBits;
+} VkMemoryHostPointerPropertiesEXT;
+
+typedef struct VkPhysicalDeviceExternalMemoryHostPropertiesEXT {
+    VkStructureType    sType;
+    void*              pNext;
+    VkDeviceSize       minImportedHostPointerAlignment;
+} VkPhysicalDeviceExternalMemoryHostPropertiesEXT;
+
+typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryHostPointerPropertiesEXT)(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, const void* pHostPointer, VkMemoryHostPointerPropertiesEXT* pMemoryHostPointerProperties);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryHostPointerPropertiesEXT(
+    VkDevice                                    device,
+    VkExternalMemoryHandleTypeFlagBits          handleType,
+    const void*                                 pHostPointer,
+    VkMemoryHostPointerPropertiesEXT*           pMemoryHostPointerProperties);
+#endif
 
 typedef VkResult (VKAPI_PTR *PFN_vkGetAndroidHardwareBufferPropertiesANDROID)(VkDevice device, const struct AHardwareBuffer* buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties);
 typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryAndroidHardwareBufferANDROID)(VkDevice device, const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo, struct AHardwareBuffer** pBuffer);