+#else
+ const vk::VkFormatProperties formatProperties (vk::getPhysicalDeviceFormatProperties(context.getInstanceInterface(),
+ context.getPhysicalDevice(),
+ m_format));
+ const vk::VkFormatProperties imageFormatProperties (vk::getPhysicalDeviceFormatProperties(context.getInstanceInterface(),
+ context.getPhysicalDevice(),
+ m_imageFormat));
+
+ const auto tilingFeatures = (m_tiling == vk::VK_IMAGE_TILING_OPTIMAL) ? formatProperties.optimalTilingFeatures : formatProperties.linearTilingFeatures;
+ const auto imageTilingFeatures = (m_tiling == vk::VK_IMAGE_TILING_OPTIMAL) ? imageFormatProperties.optimalTilingFeatures : imageFormatProperties.linearTilingFeatures;
+
+ if (m_imageLoadStoreLodAMD)
+ context.requireDeviceFunctionality("VK_AMD_shader_image_load_store_lod");
+
+ if (!m_bufferLoadUniform && !m_declareImageFormatInShader)
+ context.requireDeviceCoreFeature(DEVICE_CORE_FEATURE_SHADER_STORAGE_IMAGE_READ_WITHOUT_FORMAT);
+
+ if (m_texture.type() == IMAGE_TYPE_CUBE_ARRAY)
+ context.requireDeviceCoreFeature(DEVICE_CORE_FEATURE_IMAGE_CUBE_ARRAY);
+
+ if ((m_texture.type() != IMAGE_TYPE_BUFFER) && !(tilingFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT))
+ TCU_THROW(NotSupportedError, "Format not supported for storage images");
+
+ if ((m_texture.type() != IMAGE_TYPE_BUFFER) && !(imageTilingFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT))
+ TCU_THROW(NotSupportedError, "Format not supported for storage images");
+
+ if (m_texture.type() == IMAGE_TYPE_BUFFER && !(formatProperties.bufferFeatures & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT))
+ TCU_THROW(NotSupportedError, "Format not supported for storage texel buffers");
+
+ if ((m_texture.type() != IMAGE_TYPE_BUFFER) && !(imageTilingFeatures))
+ TCU_THROW(NotSupportedError, "Underlying format not supported at all for images");
+
+ if ((m_texture.type() == IMAGE_TYPE_BUFFER) && !(imageFormatProperties.bufferFeatures))
+ TCU_THROW(NotSupportedError, "Underlying format not supported at all for buffers");
+
+ if (formatHasThreeComponents(m_format))
+ {
+ // When the source buffer is three-component, the destination buffer is single-component.
+ VkFormat dstFormat = getSingleComponentFormat(m_format);
+ const vk::VkFormatProperties dstFormatProperties (vk::getPhysicalDeviceFormatProperties(context.getInstanceInterface(),
+ context.getPhysicalDevice(),
+ dstFormat));
+
+ if (m_texture.type() == IMAGE_TYPE_BUFFER && !(dstFormatProperties.bufferFeatures & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT))
+ TCU_THROW(NotSupportedError, "Format not supported for storage texel buffers");
+ }
+ else
+ if (m_texture.type() == IMAGE_TYPE_BUFFER && !(formatProperties.bufferFeatures & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT))
+ TCU_THROW(NotSupportedError, "Format not supported for storage texel buffers");
+
+ if (m_bufferLoadUniform && m_texture.type() == IMAGE_TYPE_BUFFER && !(formatProperties.bufferFeatures & VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT))
+ TCU_THROW(NotSupportedError, "Format not supported for uniform texel buffers");
+#endif // CTS_USES_VULKANSC
+ const auto& vki = context.getInstanceInterface();
+ const auto physicalDevice = context.getPhysicalDevice();
+
+ VkImageFormatProperties vkImageFormatProperties;
+ const auto result = vki.getPhysicalDeviceImageFormatProperties(physicalDevice, m_imageFormat, mapImageType(m_texture.type()), m_tiling, VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT, 0, &vkImageFormatProperties);
+ if (result != VK_SUCCESS) {
+ if (result == VK_ERROR_FORMAT_NOT_SUPPORTED)
+ TCU_THROW(NotSupportedError, "Format unsupported for tiling");
+ else
+ TCU_FAIL("vkGetPhysicalDeviceImageFormatProperties returned unexpected error");
+ }
+
+ if (vkImageFormatProperties.maxArrayLayers < (uint32_t)m_texture.numLayers()) {
+ TCU_THROW(NotSupportedError, "This format and tiling combination does not support this number of aray layers");
+ }
+
+ if (vkImageFormatProperties.maxMipLevels < (uint32_t)m_texture.numMipmapLevels()) {
+ TCU_THROW(NotSupportedError, "This format and tiling combination does not support this number of miplevels");
+ }