}
}
+bool isYCbCr420Format (VkFormat format)
+{
+ switch (format)
+ {
+ case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR:
+ case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR:
+ case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR:
+ case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR:
+ case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR:
+ case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR:
+ case VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR:
+ case VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+bool isYCbCr422Format (VkFormat format)
+{
+ switch (format)
+ {
+ case VK_FORMAT_G8B8G8R8_422_UNORM_KHR:
+ case VK_FORMAT_B8G8R8G8_422_UNORM_KHR:
+ case VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR:
+ case VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR:
+ case VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR:
+ case VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR:
+ case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR:
+ case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR:
+ case VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR:
+ case VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR:
+ case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR:
+ case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR:
+ case VK_FORMAT_G16B16G16R16_422_UNORM_KHR:
+ case VK_FORMAT_B16G16R16G16_422_UNORM_KHR:
+ case VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR:
+ case VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
const PlanarFormatDescription& getYCbCrPlanarFormatDescription (VkFormat format)
{
using tcu::TextureFormat;
VkImageAspectFlagBits getPlaneAspect (deUint32 planeNdx);
deUint32 getAspectPlaneNdx (VkImageAspectFlagBits planeAspect);
bool isChromaSubsampled (VkFormat format);
+bool isYCbCr422Format (VkFormat format);
+bool isYCbCr420Format (VkFormat format);
tcu::PixelBufferAccess getChannelAccess (const PlanarFormatDescription& formatInfo,
const tcu::UVec2& size,
#include "vkQueryUtil.hpp"
#include "vkMemUtil.hpp"
#include "vkRefUtil.hpp"
+#include "vkImageUtil.hpp"
namespace vkt
m_dedicated = dedicated && deRandom_getBool(&random);
// If linear formats are supported, pick it randomly
m_linear = (linearformats.size() > 0) && deRandom_getBool(&random);
- // Random small size for causing potential alignment issues
- m_size = tcu::IVec2(deRandom_getUint32(&random) % 16 + 3,
- deRandom_getUint32(&random) % 16 + 3);
- // Pick random memory type from the supported set
- m_memoryType = memoryTypes[deRandom_getUint32(&random) % memoryTypes.size()];
if (m_linear)
m_colorFormat = (VkFormat)linearformats[deRandom_getUint32(&random) % linearformats.size()];
else
m_colorFormat = (VkFormat)optimalformats[deRandom_getUint32(&random) % optimalformats.size()];
+
+ int widthAlignment = (isYCbCr420Format(m_colorFormat) || isYCbCr422Format(m_colorFormat)) ? 2 : 1;
+ int heightAlignment = isYCbCr420Format(m_colorFormat) ? 2 : 1;
+
+ // Random small size for causing potential alignment issues
+ m_size = tcu::IVec2((deRandom_getUint32(&random) % 16 + 3) & ~(widthAlignment - 1),
+ (deRandom_getUint32(&random) % 16 + 3) & ~(heightAlignment - 1));
+ // Pick random memory type from the supported set
+ m_memoryType = memoryTypes[deRandom_getUint32(&random) % memoryTypes.size()];
}
ImageAllocator::~ImageAllocator ()