#include "tcuTextureUtil.hpp"
#include "tcuVectorType.hpp"
#include "tcuVectorUtil.hpp"
+#include "tcuTestLog.hpp"
#include "tcuTexLookupVerifier.hpp"
#include "vkImageUtil.hpp"
#include "vktTestGroupUtil.hpp"
#include "vkTypeUtil.hpp"
+#include <set>
+
namespace vkt
{
MIRROR_MODE_LAST
};
-}
-
-using namespace vk;
+enum AllocationKind
+{
+ ALLOCATION_KIND_SUBALLOCATED,
+ ALLOCATION_KIND_DEDICATED,
+};
-namespace
+template <typename Type>
+class BinaryCompare
{
+public:
+ bool operator() (const Type& a, const Type& b) const
+ {
+ return deMemCmp(&a, &b, sizeof(Type)) < 0;
+ }
+};
+
+typedef std::set<vk::VkFormat, BinaryCompare<vk::VkFormat> > FormatSet;
+
+FormatSet dedicatedAllocationImageToImageFormatsToTestSet;
+FormatSet dedicatedAllocationBlittingFormatsToTestSet;
+
+using namespace vk;
VkImageAspectFlags getAspectFlags (tcu::TextureFormat format)
{
VkFilter filter;
VkSampleCountFlagBits samples;
};
+
+ AllocationKind allocationKind;
};
+de::MovePtr<Allocation> allocateBuffer (const InstanceInterface& vki,
+ const DeviceInterface& vkd,
+ const VkPhysicalDevice& physDevice,
+ const VkDevice device,
+ const VkBuffer& buffer,
+ const MemoryRequirement requirement,
+ Allocator& allocator,
+ AllocationKind allocationKind)
+{
+ switch (allocationKind)
+ {
+ case ALLOCATION_KIND_SUBALLOCATED:
+ {
+ const VkMemoryRequirements memoryRequirements = getBufferMemoryRequirements(vkd, device, buffer);
+
+ return allocator.allocate(memoryRequirements, requirement);
+ }
+
+ case ALLOCATION_KIND_DEDICATED:
+ {
+ return allocateDedicated(vki, vkd, physDevice, device, buffer, requirement);
+ }
+
+ default:
+ {
+ TCU_THROW(InternalError, "Invalid allocation kind");
+ }
+ }
+}
+
+de::MovePtr<Allocation> allocateImage (const InstanceInterface& vki,
+ const DeviceInterface& vkd,
+ const VkPhysicalDevice& physDevice,
+ const VkDevice device,
+ const VkImage& image,
+ const MemoryRequirement requirement,
+ Allocator& allocator,
+ AllocationKind allocationKind)
+{
+ switch (allocationKind)
+ {
+ case ALLOCATION_KIND_SUBALLOCATED:
+ {
+ const VkMemoryRequirements memoryRequirements = getImageMemoryRequirements(vkd, device, image);
+
+ return allocator.allocate(memoryRequirements, requirement);
+ }
+
+ case ALLOCATION_KIND_DEDICATED:
+ {
+ return allocateDedicated(vki, vkd, physDevice, device, image, requirement);
+ }
+
+ default:
+ {
+ TCU_THROW(InternalError, "Invalid allocation kind");
+ }
+ }
+}
+
+
inline deUint32 getArraySize(const ImageParms& parms)
{
return (parms.imageType == VK_IMAGE_TYPE_2D) ? parms.extent.depth : 1u;
const VkDevice vkDevice = context.getDevice();
const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
+ if (m_params.allocationKind == ALLOCATION_KIND_DEDICATED)
+ {
+ const std::string extensionName("VK_KHR_dedicated_allocation");
+
+ if (!de::contains(context.getDeviceExtensions().begin(), context.getDeviceExtensions().end(), extensionName))
+ TCU_THROW(NotSupportedError, std::string(extensionName + " is not supported").c_str());
+ }
+
// Create command pool
m_cmdPool = createCommandPool(vk, vkDevice, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, queueFamilyIndex);
case FILL_MODE_RED:
if (tcu::isCombinedDepthStencilType(buffer.getFormat().type))
{
- buffer.setPixDepth(redColor[x % 4], x, y, z);
+ buffer.setPixDepth(redColor[0], x, y, z);
if (tcu::hasStencilComponent(buffer.getFormat().order))
- buffer.setPixStencil(255 * (int)redColor[y % 4], x, y, z);
+ buffer.setPixStencil((int)redColor[3], x, y, z);
}
else
buffer.setPixel(redColor, x, y, z);
void CopiesAndBlittingTestInstance::uploadImageAspect (const tcu::ConstPixelBufferAccess& imageAccess, const VkImage& image, const ImageParms& parms)
{
+ const InstanceInterface& vki = m_context.getInstanceInterface();
const DeviceInterface& vk = m_context.getDeviceInterface();
+ const VkPhysicalDevice vkPhysDevice = m_context.getPhysicalDevice();
const VkDevice vkDevice = m_context.getDevice();
const VkQueue queue = m_context.getUniversalQueue();
const deUint32 queueFamilyIndex = m_context.getUniversalQueueFamilyIndex();
};
buffer = createBuffer(vk, vkDevice, &bufferParams);
- bufferAlloc = memAlloc.allocate(getBufferMemoryRequirements(vk, vkDevice, *buffer), MemoryRequirement::HostVisible);
+ bufferAlloc = allocateBuffer(vki, vk, vkPhysDevice, vkDevice, *buffer, MemoryRequirement::HostVisible, memAlloc, m_params.allocationKind);
VK_CHECK(vk.bindBufferMemory(vkDevice, *buffer, bufferAlloc->getMemory(), bufferAlloc->getOffset()));
}
const tcu::PixelBufferAccess& dst,
const ImageParms& imageParms)
{
+ const InstanceInterface& vki = m_context.getInstanceInterface();
const DeviceInterface& vk = m_context.getDeviceInterface();
+ const VkPhysicalDevice physDevice = m_context.getPhysicalDevice();
const VkDevice device = m_context.getDevice();
const VkQueue queue = m_context.getUniversalQueue();
Allocator& allocator = m_context.getDefaultAllocator();
};
buffer = createBuffer(vk, device, &bufferParams);
- bufferAlloc = allocator.allocate(getBufferMemoryRequirements(vk, device, *buffer), MemoryRequirement::HostVisible);
+ bufferAlloc = allocateBuffer(vki, vk, physDevice, device, *buffer, MemoryRequirement::HostVisible, allocator, m_params.allocationKind);
VK_CHECK(vk.bindBufferMemory(device, *buffer, bufferAlloc->getMemory(), bufferAlloc->getOffset()));
deMemset(bufferAlloc->getHostPtr(), 0, static_cast<size_t>(pixelDataSize));
CopyImageToImage::CopyImageToImage (Context& context, TestParams params)
: CopiesAndBlittingTestInstance(context, params)
{
+ const InstanceInterface& vki = context.getInstanceInterface();
const DeviceInterface& vk = context.getDeviceInterface();
+ const VkPhysicalDevice vkPhysDevice = context.getPhysicalDevice();
const VkDevice vkDevice = context.getDevice();
const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
Allocator& memAlloc = context.getDefaultAllocator();
};
m_source = createImage(vk, vkDevice, &sourceImageParams);
- m_sourceImageAlloc = memAlloc.allocate(getImageMemoryRequirements(vk, vkDevice, *m_source), MemoryRequirement::Any);
+ m_sourceImageAlloc = allocateImage(vki, vk, vkPhysDevice, vkDevice, *m_source, MemoryRequirement::Any, memAlloc, m_params.allocationKind);
VK_CHECK(vk.bindImageMemory(vkDevice, *m_source, m_sourceImageAlloc->getMemory(), m_sourceImageAlloc->getOffset()));
}
};
m_destination = createImage(vk, vkDevice, &destinationImageParams);
- m_destinationImageAlloc = memAlloc.allocate(getImageMemoryRequirements(vk, vkDevice, *m_destination), MemoryRequirement::Any);
+ m_destinationImageAlloc = allocateImage(vki, vk, vkPhysDevice, vkDevice, *m_destination, MemoryRequirement::Any, memAlloc, m_params.allocationKind);
VK_CHECK(vk.bindImageMemory(vkDevice, *m_destination, m_destinationImageAlloc->getMemory(), m_destinationImageAlloc->getOffset()));
}
}
if (!tcu::floatThresholdCompare(m_context.getTestContext().getLog(), "Compare", "Result comparison", m_expectedTextureLevel->getAccess(), result, fThreshold, tcu::COMPARE_LOG_RESULT))
return tcu::TestStatus::fail("CopiesAndBlitting test");
}
+ else if (isSnormFormat(mapTextureFormat(result.getFormat())))
+ {
+ // There may be an ambiguity between two possible binary representations of 1.0.
+ // Get rid of that by expanding the data to floats and re-normalizing again.
+
+ tcu::TextureLevel resultSnorm (result.getFormat(), result.getWidth(), result.getHeight(), result.getDepth());
+ {
+ tcu::TextureLevel resultFloat (tcu::TextureFormat(resultSnorm.getFormat().order, tcu::TextureFormat::FLOAT), resultSnorm.getWidth(), resultSnorm.getHeight(), resultSnorm.getDepth());
+
+ tcu::copy(resultFloat.getAccess(), result);
+ tcu::copy(resultSnorm, resultFloat.getAccess());
+ }
+
+ tcu::TextureLevel expectedSnorm (m_expectedTextureLevel->getFormat(), m_expectedTextureLevel->getWidth(), m_expectedTextureLevel->getHeight(), m_expectedTextureLevel->getDepth());
+
+ {
+ tcu::TextureLevel expectedFloat (tcu::TextureFormat(expectedSnorm.getFormat().order, tcu::TextureFormat::FLOAT), expectedSnorm.getWidth(), expectedSnorm.getHeight(), expectedSnorm.getDepth());
+
+ tcu::copy(expectedFloat.getAccess(), m_expectedTextureLevel->getAccess());
+ tcu::copy(expectedSnorm, expectedFloat.getAccess());
+ }
+
+ if (!tcu::intThresholdCompare(m_context.getTestContext().getLog(), "Compare", "Result comparison", expectedSnorm.getAccess(), resultSnorm.getAccess(), uThreshold, tcu::COMPARE_LOG_RESULT))
+ return tcu::TestStatus::fail("CopiesAndBlitting test");
+ }
else
{
if (!tcu::intThresholdCompare(m_context.getTestContext().getLog(), "Compare", "Result comparison", m_expectedTextureLevel->getAccess(), result, uThreshold, tcu::COMPARE_LOG_RESULT))
CopyBufferToBuffer::CopyBufferToBuffer (Context& context, TestParams params)
: CopiesAndBlittingTestInstance (context, params)
{
+ const InstanceInterface& vki = context.getInstanceInterface();
const DeviceInterface& vk = context.getDeviceInterface();
+ const VkPhysicalDevice vkPhysDevice = context.getPhysicalDevice();
const VkDevice vkDevice = context.getDevice();
const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
Allocator& memAlloc = context.getDefaultAllocator();
};
m_source = createBuffer(vk, vkDevice, &sourceBufferParams);
- m_sourceBufferAlloc = memAlloc.allocate(getBufferMemoryRequirements(vk, vkDevice, *m_source), MemoryRequirement::HostVisible);
+ m_sourceBufferAlloc = allocateBuffer(vki, vk, vkPhysDevice, vkDevice, *m_source, MemoryRequirement::HostVisible, memAlloc, m_params.allocationKind);
VK_CHECK(vk.bindBufferMemory(vkDevice, *m_source, m_sourceBufferAlloc->getMemory(), m_sourceBufferAlloc->getOffset()));
}
};
m_destination = createBuffer(vk, vkDevice, &destinationBufferParams);
- m_destinationBufferAlloc = memAlloc.allocate(getBufferMemoryRequirements(vk, vkDevice, *m_destination), MemoryRequirement::HostVisible);
+ m_destinationBufferAlloc = allocateBuffer(vki, vk, vkPhysDevice, vkDevice, *m_destination, MemoryRequirement::HostVisible, memAlloc, m_params.allocationKind);
VK_CHECK(vk.bindBufferMemory(vkDevice, *m_destination, m_destinationBufferAlloc->getMemory(), m_destinationBufferAlloc->getOffset()));
}
}
, m_textureFormat(mapVkFormat(testParams.src.image.format))
, m_bufferSize(m_params.dst.buffer.size * tcu::getPixelSize(m_textureFormat))
{
+ const InstanceInterface& vki = context.getInstanceInterface();
const DeviceInterface& vk = context.getDeviceInterface();
+ const VkPhysicalDevice vkPhysDevice = context.getPhysicalDevice();
const VkDevice vkDevice = context.getDevice();
const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
Allocator& memAlloc = context.getDefaultAllocator();
};
m_source = createImage(vk, vkDevice, &sourceImageParams);
- m_sourceImageAlloc = memAlloc.allocate(getImageMemoryRequirements(vk, vkDevice, *m_source), MemoryRequirement::Any);
+ m_sourceImageAlloc = allocateImage(vki, vk, vkPhysDevice, vkDevice, *m_source, MemoryRequirement::Any, memAlloc, m_params.allocationKind);
VK_CHECK(vk.bindImageMemory(vkDevice, *m_source, m_sourceImageAlloc->getMemory(), m_sourceImageAlloc->getOffset()));
}
};
m_destination = createBuffer(vk, vkDevice, &destinationBufferParams);
- m_destinationBufferAlloc = memAlloc.allocate(getBufferMemoryRequirements(vk, vkDevice, *m_destination), MemoryRequirement::HostVisible);
+ m_destinationBufferAlloc = allocateBuffer(vki, vk, vkPhysDevice, vkDevice, *m_destination, MemoryRequirement::HostVisible, memAlloc, m_params.allocationKind);
VK_CHECK(vk.bindBufferMemory(vkDevice, *m_destination, m_destinationBufferAlloc->getMemory(), m_destinationBufferAlloc->getOffset()));
}
}
, m_textureFormat(mapVkFormat(testParams.dst.image.format))
, m_bufferSize(m_params.src.buffer.size * tcu::getPixelSize(m_textureFormat))
{
+ const InstanceInterface& vki = context.getInstanceInterface();
const DeviceInterface& vk = context.getDeviceInterface();
+ const VkPhysicalDevice vkPhysDevice = context.getPhysicalDevice();
const VkDevice vkDevice = context.getDevice();
const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
Allocator& memAlloc = context.getDefaultAllocator();
};
m_source = createBuffer(vk, vkDevice, &sourceBufferParams);
- m_sourceBufferAlloc = memAlloc.allocate(getBufferMemoryRequirements(vk, vkDevice, *m_source), MemoryRequirement::HostVisible);
+ m_sourceBufferAlloc = allocateBuffer(vki, vk, vkPhysDevice, vkDevice, *m_source, MemoryRequirement::HostVisible, memAlloc, m_params.allocationKind);
VK_CHECK(vk.bindBufferMemory(vkDevice, *m_source, m_sourceBufferAlloc->getMemory(), m_sourceBufferAlloc->getOffset()));
}
};
m_destination = createImage(vk, vkDevice, &destinationImageParams);
- m_destinationImageAlloc = memAlloc.allocate(getImageMemoryRequirements(vk, vkDevice, *m_destination), MemoryRequirement::Any);
+ m_destinationImageAlloc = allocateImage(vki, vk, vkPhysDevice, vkDevice, *m_destination, MemoryRequirement::Any, memAlloc, m_params.allocationKind);
VK_CHECK(vk.bindImageMemory(vkDevice, *m_destination, m_destinationImageAlloc->getMemory(), m_destinationImageAlloc->getOffset()));
}
}
BlittingImages::BlittingImages (Context& context, TestParams params)
: CopiesAndBlittingTestInstance(context, params)
{
+ const InstanceInterface& vki = context.getInstanceInterface();
const DeviceInterface& vk = context.getDeviceInterface();
+ const VkPhysicalDevice vkPhysDevice = context.getPhysicalDevice();
const VkDevice vkDevice = context.getDevice();
const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
Allocator& memAlloc = context.getDefaultAllocator();
};
m_source = createImage(vk, vkDevice, &sourceImageParams);
- m_sourceImageAlloc = memAlloc.allocate(getImageMemoryRequirements(vk, vkDevice, *m_source), MemoryRequirement::Any);
+ m_sourceImageAlloc = allocateImage(vki, vk, vkPhysDevice, vkDevice, *m_source, MemoryRequirement::Any, memAlloc, m_params.allocationKind);
VK_CHECK(vk.bindImageMemory(vkDevice, *m_source, m_sourceImageAlloc->getMemory(), m_sourceImageAlloc->getOffset()));
}
};
m_destination = createImage(vk, vkDevice, &destinationImageParams);
- m_destinationImageAlloc = memAlloc.allocate(getImageMemoryRequirements(vk, vkDevice, *m_destination), MemoryRequirement::Any);
+ m_destinationImageAlloc = allocateImage(vki, vk, vkPhysDevice, vkDevice, *m_destination, MemoryRequirement::Any, memAlloc, m_params.allocationKind);
VK_CHECK(vk.bindImageMemory(vkDevice, *m_destination, m_destinationImageAlloc->getMemory(), m_destinationImageAlloc->getOffset()));
}
}
VK_CHECK(vk.beginCommandBuffer(*m_cmdBuffer, &cmdBufferBeginInfo));
vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 0, (const VkBufferMemoryBarrier*)DE_NULL, 1, &srcImageBarrier);
+ vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 0, (const VkBufferMemoryBarrier*)DE_NULL, 1, &dstImageBarrier);
vk.cmdBlitImage(*m_cmdBuffer, m_source.get(), m_params.src.image.operationLayout, m_destination.get(), m_params.dst.image.operationLayout, (deUint32)m_params.regions.size(), ®ions[0], m_params.filter);
- vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 0, (const VkBufferMemoryBarrier*)DE_NULL, 1, &dstImageBarrier);
VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
submitCommandsAndWait(vk, vkDevice, queue, *m_cmdBuffer);
if (!(context.getDeviceProperties().limits.framebufferColorSampleCounts & rasterizationSamples))
throw tcu::NotSupportedError("Unsupported number of rasterization samples");
+ const InstanceInterface& vki = context.getInstanceInterface();
const DeviceInterface& vk = context.getDeviceInterface();
+ const VkPhysicalDevice vkPhysDevice = context.getPhysicalDevice();
const VkDevice vkDevice = context.getDevice();
const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
Allocator& memAlloc = m_context.getDefaultAllocator();
m_multisampledImage = createImage(vk, vkDevice, &colorImageParams);
// Allocate and bind color image memory.
- m_multisampledImageAlloc = memAlloc.allocate(getImageMemoryRequirements(vk, vkDevice, *m_multisampledImage), MemoryRequirement::Any);
+ m_multisampledImageAlloc = allocateImage(vki, vk, vkPhysDevice, vkDevice, *m_multisampledImage, MemoryRequirement::Any, memAlloc, m_params.allocationKind);
VK_CHECK(vk.bindImageMemory(vkDevice, *m_multisampledImage, m_multisampledImageAlloc->getMemory(), m_multisampledImageAlloc->getOffset()));
switch (m_options)
colorImageParams.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
m_multisampledCopyImage = createImage(vk, vkDevice, &colorImageParams);
// Allocate and bind color image memory.
- m_multisampledCopyImageAlloc = memAlloc.allocate(getImageMemoryRequirements(vk, vkDevice, *m_multisampledCopyImage), MemoryRequirement::Any);
+ m_multisampledCopyImageAlloc = allocateImage(vki, vk, vkPhysDevice, vkDevice, *m_multisampledCopyImage, MemoryRequirement::Any, memAlloc, m_params.allocationKind);
VK_CHECK(vk.bindImageMemory(vkDevice, *m_multisampledCopyImage, m_multisampledCopyImageAlloc->getMemory(), m_multisampledCopyImageAlloc->getOffset()));
break;
}
colorImageParams.arrayLayers = getArraySize(m_params.dst.image);
m_multisampledCopyImage = createImage(vk, vkDevice, &colorImageParams);
// Allocate and bind color image memory.
- m_multisampledCopyImageAlloc = memAlloc.allocate(getImageMemoryRequirements(vk, vkDevice, *m_multisampledCopyImage), MemoryRequirement::Any);
+ m_multisampledCopyImageAlloc = allocateImage(vki, vk, vkPhysDevice, vkDevice, *m_multisampledCopyImage, MemoryRequirement::Any, memAlloc, m_params.allocationKind);
VK_CHECK(vk.bindImageMemory(vkDevice, *m_multisampledCopyImage, m_multisampledCopyImageAlloc->getMemory(), m_multisampledCopyImageAlloc->getOffset()));
break;
}
};
m_destination = createImage(vk, vkDevice, &destinationImageParams);
- m_destinationImageAlloc = memAlloc.allocate(getImageMemoryRequirements(vk, vkDevice, *m_destination), MemoryRequirement::Any);
+ m_destinationImageAlloc = allocateImage(vki, vk, vkPhysDevice, vkDevice, *m_destination, MemoryRequirement::Any, memAlloc, m_params.allocationKind);
VK_CHECK(vk.bindImageMemory(vkDevice, *m_destination, m_destinationImageAlloc->getMemory(), m_destinationImageAlloc->getOffset()));
}
};
vertexBuffer = createBuffer(vk, vkDevice, &vertexBufferParams);
- vertexBufferAlloc = memAlloc.allocate(getBufferMemoryRequirements(vk, vkDevice, *vertexBuffer), MemoryRequirement::HostVisible);
-
+ vertexBufferAlloc = allocateBuffer(vki, vk, vkPhysDevice, vkDevice, *vertexBuffer, MemoryRequirement::HostVisible, memAlloc, m_params.allocationKind);
VK_CHECK(vk.bindBufferMemory(vkDevice, *vertexBuffer, vertexBufferAlloc->getMemory(), vertexBufferAlloc->getOffset()));
// Load vertices into vertex buffer.
const tcu::TextureFormat dstTcuFormat = mapVkFormat(m_params.dst.image.format);
// upload the destination image
- m_destinationTextureLevel = de::MovePtr<tcu::TextureLevel>(new tcu::TextureLevel(dstTcuFormat,
- (int)m_params.dst.image.extent.width,
- (int)m_params.dst.image.extent.height,
- (int)m_params.dst.image.extent.depth));
- generateBuffer(m_destinationTextureLevel->getAccess(), m_params.dst.image.extent.width, m_params.dst.image.extent.height, m_params.dst.image.extent.depth);
- uploadImage(m_destinationTextureLevel->getAccess(), m_destination.get(), m_params.dst.image);
+ m_destinationTextureLevel = de::MovePtr<tcu::TextureLevel>(new tcu::TextureLevel(dstTcuFormat,
+ (int)m_params.dst.image.extent.width,
+ (int)m_params.dst.image.extent.height,
+ (int)m_params.dst.image.extent.depth));
+ generateBuffer(m_destinationTextureLevel->getAccess(), m_params.dst.image.extent.width, m_params.dst.image.extent.height, m_params.dst.image.extent.depth);
+ uploadImage(m_destinationTextureLevel->getAccess(), m_destination.get(), m_params.dst.image);
- m_sourceTextureLevel = de::MovePtr<tcu::TextureLevel>(new tcu::TextureLevel(srcTcuFormat,
- (int)m_params.src.image.extent.width,
- (int)m_params.src.image.extent.height,
- (int)m_params.dst.image.extent.depth));
+ m_sourceTextureLevel = de::MovePtr<tcu::TextureLevel>(new tcu::TextureLevel(srcTcuFormat,
+ (int)m_params.src.image.extent.width,
+ (int)m_params.src.image.extent.height,
+ (int)m_params.dst.image.extent.depth));
- generateBuffer(m_sourceTextureLevel->getAccess(), m_params.src.image.extent.width, m_params.src.image.extent.height, m_params.dst.image.extent.depth, FILL_MODE_MULTISAMPLE);
- generateExpectedResult();
+ generateBuffer(m_sourceTextureLevel->getAccess(), m_params.src.image.extent.width, m_params.src.image.extent.height, m_params.dst.image.extent.depth, FILL_MODE_MULTISAMPLE);
+ generateExpectedResult();
switch (m_options)
{
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 oldLayout;
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, // VkImageLayout newLayout;
VK_QUEUE_FAMILY_IGNORED, // deUint32 srcQueueFamilyIndex;
VK_QUEUE_FAMILY_IGNORED, // deUint32 dstQueueFamilyIndex;
const VkImageMemoryBarrier imageBarriers[] =
{
- //// source image
+ // source image
{
VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // VkStructureType sType;
DE_NULL, // const void* pNext;
1u, // uint32_t layerCount;
};
-void addImageToImageSimpleTests (tcu::TestCaseGroup* group)
+void addImageToImageSimpleTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
tcu::TestContext& testCtx = group->getTestContext();
params.dst.image.format = VK_FORMAT_R8G8B8A8_UINT;
params.dst.image.extent = defaultExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
{
const VkImageCopy testCopy =
params.dst.image.format = VK_FORMAT_R32_UINT;
params.dst.image.extent = defaultExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
{
const VkImageCopy testCopy =
params.dst.image.format = VK_FORMAT_R8G8B8A8_UINT;
params.dst.image.extent = defaultExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
{
const VkImageCopy testCopy =
params.dst.image.format = VK_FORMAT_D32_SFLOAT;
params.dst.image.extent = defaultExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
{
const VkImageSubresourceLayers sourceLayer =
params.dst.image.format = VK_FORMAT_S8_UINT;
params.dst.image.extent = defaultExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
{
const VkImageSubresourceLayers sourceLayer =
getImageLayoutCaseName(params.dst.image.operationLayout);
const std::string description = "From layout " + getImageLayoutCaseName(params.src.image.operationLayout) +
" to " + getImageLayoutCaseName(params.dst.image.operationLayout);
-
group->addChild(new CopyImageToImageTestCase(group->getTestContext(), testName, description, params));
}
}
}
+bool isAllowedImageToImageAllFormatsColorSrcFormatTests(CopyColorTestParams& testParams)
+{
+ bool result = true;
+
+ if (testParams.params.allocationKind == ALLOCATION_KIND_DEDICATED)
+ {
+ DE_ASSERT(!dedicatedAllocationImageToImageFormatsToTestSet.empty());
+
+ result =
+ de::contains(dedicatedAllocationImageToImageFormatsToTestSet, testParams.params.dst.image.format) ||
+ de::contains(dedicatedAllocationImageToImageFormatsToTestSet, testParams.params.src.image.format);
+ }
+
+ return result;
+}
+
void addImageToImageAllFormatsColorSrcFormatTests (tcu::TestCaseGroup* group, CopyColorTestParams testParams)
{
for (int dstFormatIndex = 0; testParams.compatibleFormats[dstFormatIndex] != VK_FORMAT_UNDEFINED; ++dstFormatIndex)
if (!isSupportedByFramework(testParams.params.dst.image.format))
continue;
+ if (!isAllowedImageToImageAllFormatsColorSrcFormatTests(testParams))
+ continue;
+
const std::string description = "Copy to destination format " + getFormatCaseName(testParams.params.dst.image.format);
addTestGroup(group, getFormatCaseName(testParams.params.dst.image.format), description, addImageToImageAllFormatsColorSrcFormatDstFormatTests, testParams.params);
}
compatibleFormats256Bit,
};
-void addImageToImageAllFormatsColorTests (tcu::TestCaseGroup* group)
+const VkFormat dedicatedAllocationImageToImageFormatsToTest[] =
+{
+ // From compatibleFormats8Bit
+ VK_FORMAT_R4G4_UNORM_PACK8,
+ VK_FORMAT_R8_SRGB,
+
+ // From compatibleFormats16Bit
+ VK_FORMAT_R4G4B4A4_UNORM_PACK16,
+ VK_FORMAT_R16_SFLOAT,
+
+ // From compatibleFormats24Bit
+ VK_FORMAT_R8G8B8_UNORM,
+ VK_FORMAT_B8G8R8_SRGB,
+
+ // From compatibleFormats32Bit
+ VK_FORMAT_R8G8B8A8_UNORM,
+ VK_FORMAT_R32_SFLOAT,
+
+ // From compatibleFormats48Bit
+ VK_FORMAT_R16G16B16_UNORM,
+ VK_FORMAT_R16G16B16_SFLOAT,
+
+ // From compatibleFormats64Bit
+ VK_FORMAT_R16G16B16A16_UNORM,
+ VK_FORMAT_R64_SFLOAT,
+
+ // From compatibleFormats96Bit
+ VK_FORMAT_R32G32B32_UINT,
+ VK_FORMAT_R32G32B32_SFLOAT,
+
+ // From compatibleFormats128Bit
+ VK_FORMAT_R32G32B32A32_UINT,
+ VK_FORMAT_R64G64_SFLOAT,
+
+ // From compatibleFormats192Bit
+ VK_FORMAT_R64G64B64_UINT,
+ VK_FORMAT_R64G64B64_SFLOAT,
+
+ // From compatibleFormats256Bit
+ VK_FORMAT_R64G64B64A64_UINT,
+ VK_FORMAT_R64G64B64A64_SFLOAT,
+};
+
+void addImageToImageAllFormatsColorTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
TestParams params;
params.src.image.imageType = VK_IMAGE_TYPE_2D;
params.src.image.extent = defaultExtent;
params.dst.image.imageType = VK_IMAGE_TYPE_2D;
params.dst.image.extent = defaultExtent;
+ params.allocationKind = allocationKind;
for (deInt32 i = 0; i < defaultSize; i += defaultFourthSize)
{
params.regions.push_back(imageCopy);
}
+ if (allocationKind == ALLOCATION_KIND_DEDICATED)
+ {
+ const int numOfColorImageFormatsToTestFilter = DE_LENGTH_OF_ARRAY(colorImageFormatsToTest);
+ for (int compatibleFormatsIndex = 0; compatibleFormatsIndex < numOfColorImageFormatsToTestFilter; ++compatibleFormatsIndex)
+ dedicatedAllocationImageToImageFormatsToTestSet.insert(dedicatedAllocationImageToImageFormatsToTest[compatibleFormatsIndex]);
+ }
+
const int numOfColorImageFormatsToTest = DE_LENGTH_OF_ARRAY(colorImageFormatsToTest);
for (int compatibleFormatsIndex = 0; compatibleFormatsIndex < numOfColorImageFormatsToTest; ++compatibleFormatsIndex)
{
continue;
CopyColorTestParams testParams;
- testParams.params = params;
- testParams.compatibleFormats = compatibleFormats;
+ testParams.params = params;
+ testParams.compatibleFormats = compatibleFormats;
const std::string description = "Copy from source format " + getFormatCaseName(params.src.image.format);
addTestGroup(group, getFormatCaseName(params.src.image.format), description, addImageToImageAllFormatsColorSrcFormatTests, testParams);
}
}
-void addImageToImageAllFormatsDepthStencilTests (tcu::TestCaseGroup* group)
+void addImageToImageAllFormatsDepthStencilTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
const VkFormat depthAndStencilFormats[] =
{
params.dst.image.extent = defaultExtent;
params.src.image.format = depthAndStencilFormats[compatibleFormatsIndex];
params.dst.image.format = params.src.image.format;
+ params.allocationKind = allocationKind;
const VkImageSubresourceLayers defaultDepthSourceLayer = { VK_IMAGE_ASPECT_DEPTH_BIT, 0u, 0u, 1u };
const VkImageSubresourceLayers defaultStencilSourceLayer = { VK_IMAGE_ASPECT_STENCIL_BIT, 0u, 0u, 1u };
}
}
-void addImageToImageAllFormatsTests (tcu::TestCaseGroup* group)
+void addImageToImageAllFormatsTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
- addTestGroup(group, "color", "Copy image to image with color formats", addImageToImageAllFormatsColorTests);
- addTestGroup(group, "depth_stencil", "Copy image to image with depth/stencil formats", addImageToImageAllFormatsDepthStencilTests);
+ addTestGroup(group, "color", "Copy image to image with color formats", addImageToImageAllFormatsColorTests, allocationKind);
+ addTestGroup(group, "depth_stencil", "Copy image to image with depth/stencil formats", addImageToImageAllFormatsDepthStencilTests, allocationKind);
}
-void addImageToImage3dImagesTests (tcu::TestCaseGroup* group)
+void addImageToImage3dImagesTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
tcu::TestContext& testCtx = group->getTestContext();
params3DTo2D.dst.image.extent = defaultHalfExtent;
params3DTo2D.dst.image.extent.depth = slicesLayers;
params3DTo2D.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params3DTo2D.allocationKind = allocationKind;
for (deUint32 slicesLayersNdx = 0; slicesLayersNdx < slicesLayers; ++slicesLayersNdx)
{
params2DTo3D.dst.image.extent = defaultHalfExtent;
params2DTo3D.dst.image.extent.depth = slicesLayers;
params2DTo3D.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params2DTo3D.allocationKind = allocationKind;
for (deUint32 slicesLayersNdx = 0; slicesLayersNdx < slicesLayers; ++slicesLayersNdx)
{
params3DTo2D.dst.image.extent = defaultHalfExtent;
params3DTo2D.dst.image.extent.depth = slicesLayers;
params3DTo2D.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params3DTo2D.allocationKind = allocationKind;
+ for (deUint32 slicesLayersNdx = 0; slicesLayersNdx < slicesLayers; ++slicesLayersNdx)
{
const VkImageSubresourceLayers sourceLayer =
{
params2DTo3D.dst.image.extent = defaultHalfExtent;
params2DTo3D.dst.image.extent.depth = slicesLayers;
params2DTo3D.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params2DTo3D.allocationKind = allocationKind;
{
const VkImageSubresourceLayers sourceLayer =
params3DTo2D.dst.image.extent = defaultHalfExtent;
params3DTo2D.dst.image.extent.depth = slicesLayers;
params3DTo2D.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params3DTo2D.allocationKind = allocationKind;
const deUint32 regionWidth = defaultHalfExtent.width / slicesLayers -1;
const deUint32 regionHeight = defaultHalfExtent.height / slicesLayers -1 ;
params2DTo3D.dst.image.extent = defaultHalfExtent;
params2DTo3D.dst.image.extent.depth = slicesLayers;
params2DTo3D.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params2DTo3D.allocationKind = allocationKind;
const deUint32 regionWidth = defaultHalfExtent.width / slicesLayers -1;
const deUint32 regionHeight = defaultHalfExtent.height / slicesLayers -1 ;
}
}
-void addImageToImageTests (tcu::TestCaseGroup* group)
+void addImageToImageTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
- addTestGroup(group, "simple_tests", "Copy from image to image simple tests", addImageToImageSimpleTests);
- addTestGroup(group, "all_formats", "Copy from image to image with all compatible formats", addImageToImageAllFormatsTests);
- addTestGroup(group, "3d_images", "Coping operations on 3d images", addImageToImage3dImagesTests);
+ addTestGroup(group, "simple_tests", "Copy from image to image simple tests", addImageToImageSimpleTests, allocationKind);
+ addTestGroup(group, "all_formats", "Copy from image to image with all compatible formats", addImageToImageAllFormatsTests, allocationKind);
+ addTestGroup(group, "3d_images", "Coping operations on 3d images", addImageToImage3dImagesTests, allocationKind);
}
-void addImageToBufferTests (tcu::TestCaseGroup* group)
+void addImageToBufferTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
tcu::TestContext& testCtx = group->getTestContext();
params.src.image.extent = defaultExtent;
params.src.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
params.dst.buffer.size = defaultSize * defaultSize;
+ params.allocationKind = allocationKind;
const VkBufferImageCopy bufferImageCopy =
{
params.src.image.extent = defaultExtent;
params.src.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
params.dst.buffer.size = defaultSize * defaultSize;
+ params.allocationKind = allocationKind;
const VkBufferImageCopy bufferImageCopy =
{
params.src.image.extent = defaultExtent;
params.src.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
params.dst.buffer.size = defaultSize * defaultSize;
+ params.allocationKind = allocationKind;
const int pixelSize = tcu::getPixelSize(mapVkFormat(params.src.image.format));
const VkDeviceSize bufferSize = pixelSize * params.dst.buffer.size;
}
}
-void addBufferToImageTests (tcu::TestCaseGroup* group)
+void addBufferToImageTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
tcu::TestContext& testCtx = group->getTestContext();
params.dst.image.format = VK_FORMAT_R8G8B8A8_UINT;
params.dst.image.extent = defaultExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
const VkBufferImageCopy bufferImageCopy =
{
params.dst.image.format = VK_FORMAT_R8G8B8A8_UNORM;
params.dst.image.extent = defaultExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
CopyRegion region;
deUint32 divisor = 1;
params.dst.image.format = VK_FORMAT_R8G8B8A8_UNORM;
params.dst.image.extent = defaultExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
const VkBufferImageCopy bufferImageCopy =
{
}
}
-void addBufferToBufferTests (tcu::TestCaseGroup* group)
+void addBufferToBufferTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
tcu::TestContext& testCtx = group->getTestContext();
TestParams params;
params.src.buffer.size = defaultSize;
params.dst.buffer.size = defaultSize;
+ params.allocationKind = allocationKind;
const VkBufferCopy bufferCopy =
{
group->addChild(new BufferToBufferTestCase(testCtx, "whole", "Whole buffer", params));
}
+ // Filter is VK_FILTER_NEAREST.
{
TestParams params;
params.src.buffer.size = defaultFourthSize;
params.dst.buffer.size = defaultFourthSize;
+ params.allocationKind = allocationKind;
const VkBufferCopy bufferCopy =
{
TestParams params;
params.src.buffer.size = size;
params.dst.buffer.size = size * (size + 1);
+ params.allocationKind = allocationKind;
// Copy region with size 1..size
for (unsigned int i = 1; i <= size; i++)
}
}
-void addBlittingImageSimpleWholeTests (tcu::TestCaseGroup* group)
+void addBlittingImageSimpleWholeTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
tcu::TestContext& testCtx = group->getTestContext();
TestParams params;
params.dst.image.imageType = VK_IMAGE_TYPE_2D;
params.dst.image.extent = defaultExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
{
const VkImageBlit imageBlit =
}
}
-void addBlittingImageSimpleMirrorXYTests (tcu::TestCaseGroup* group)
+void addBlittingImageSimpleMirrorXYTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
tcu::TestContext& testCtx = group->getTestContext();
TestParams params;
params.dst.image.imageType = VK_IMAGE_TYPE_2D;
params.dst.image.extent = defaultExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
{
const VkImageBlit imageBlit =
}
}
-void addBlittingImageSimpleMirrorXTests (tcu::TestCaseGroup* group)
+void addBlittingImageSimpleMirrorXTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
tcu::TestContext& testCtx = group->getTestContext();
TestParams params;
params.dst.image.imageType = VK_IMAGE_TYPE_2D;
params.dst.image.extent = defaultExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
{
const VkImageBlit imageBlit =
}
}
-void addBlittingImageSimpleMirrorYTests (tcu::TestCaseGroup* group)
+void addBlittingImageSimpleMirrorYTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
tcu::TestContext& testCtx = group->getTestContext();
TestParams params;
params.dst.image.imageType = VK_IMAGE_TYPE_2D;
params.dst.image.extent = defaultExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
{
const VkImageBlit imageBlit =
}
}
-void addBlittingImageSimpleMirrorSubregionsTests (tcu::TestCaseGroup* group)
+void addBlittingImageSimpleMirrorSubregionsTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
tcu::TestContext& testCtx = group->getTestContext();
TestParams params;
params.dst.image.imageType = VK_IMAGE_TYPE_2D;
params.dst.image.extent = defaultExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
// No mirroring.
{
{defaultSize, 0, 1}
} // VkOffset3D dstOffset[2];
};
-
CopyRegion region;
region.imageBlit = imageBlit;
params.regions.push_back(region);
}
}
-void addBlittingImageSimpleScalingWhole1Tests (tcu::TestCaseGroup* group)
+void addBlittingImageSimpleScalingWhole1Tests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
tcu::TestContext& testCtx = group->getTestContext();
TestParams params;
params.dst.image.imageType = VK_IMAGE_TYPE_2D;
params.dst.image.extent = defaultHalfExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
{
const VkImageBlit imageBlit =
}
}
-void addBlittingImageSimpleScalingWhole2Tests (tcu::TestCaseGroup* group)
+void addBlittingImageSimpleScalingWhole2Tests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
tcu::TestContext& testCtx = group->getTestContext();
TestParams params;
params.dst.image.imageType = VK_IMAGE_TYPE_2D;
params.dst.image.extent = defaultExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
{
const VkImageBlit imageBlit =
}
}
-void addBlittingImageSimpleScalingAndOffsetTests (tcu::TestCaseGroup* group)
+void addBlittingImageSimpleScalingAndOffsetTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
tcu::TestContext& testCtx = group->getTestContext();
TestParams params;
params.dst.image.imageType = VK_IMAGE_TYPE_2D;
params.dst.image.extent = defaultExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
{
const VkImageBlit imageBlit =
}
}
-void addBlittingImageSimpleWithoutScalingPartialTests (tcu::TestCaseGroup* group)
+void addBlittingImageSimpleWithoutScalingPartialTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
tcu::TestContext& testCtx = group->getTestContext();
TestParams params;
params.dst.image.imageType = VK_IMAGE_TYPE_2D;
params.dst.image.extent = defaultExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
{
CopyRegion region;
}
}
-void addBlittingImageSimpleTests (tcu::TestCaseGroup* group)
-{
- addTestGroup(group, "whole", "Blit without scaling (whole)", addBlittingImageSimpleWholeTests);
- addTestGroup(group, "mirror_xy", "Flipping x and y coordinates (whole)", addBlittingImageSimpleMirrorXYTests);
- addTestGroup(group, "mirror_x", "Flipping x coordinates (whole)", addBlittingImageSimpleMirrorXTests);
- addTestGroup(group, "mirror_y", "Flipping y coordinates (whole)", addBlittingImageSimpleMirrorYTests);
- addTestGroup(group, "mirror_subregions", "Mirroring subregions in image (no flip, y flip, x flip, xy flip)", addBlittingImageSimpleMirrorSubregionsTests);
- addTestGroup(group, "scaling_whole1", "Blit with scaling (whole, src extent bigger)", addBlittingImageSimpleScalingWhole1Tests);
- addTestGroup(group, "scaling_whole2", "Blit with scaling (whole, dst extent bigger)", addBlittingImageSimpleScalingWhole2Tests);
- addTestGroup(group, "scaling_and_offset", "Blit with scaling and offset (whole, dst extent bigger)", addBlittingImageSimpleScalingAndOffsetTests);
- addTestGroup(group, "without_scaling_partial", "Blit without scaling (partial)", addBlittingImageSimpleWithoutScalingPartialTests);
+void addBlittingImageSimpleTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
+{
+ addTestGroup(group, "whole", "Blit without scaling (whole)", addBlittingImageSimpleWholeTests, allocationKind);
+ addTestGroup(group, "mirror_xy", "Flipping x and y coordinates (whole)", addBlittingImageSimpleMirrorXYTests, allocationKind);
+ addTestGroup(group, "mirror_x", "Flipping x coordinates (whole)", addBlittingImageSimpleMirrorXTests, allocationKind);
+ addTestGroup(group, "mirror_y", "Flipping y coordinates (whole)", addBlittingImageSimpleMirrorYTests, allocationKind);
+ addTestGroup(group, "mirror_subregions", "Mirroring subregions in image (no flip, y flip, x flip, xy flip)", addBlittingImageSimpleMirrorSubregionsTests, allocationKind);
+ addTestGroup(group, "scaling_whole1", "Blit with scaling (whole, src extent bigger)", addBlittingImageSimpleScalingWhole1Tests, allocationKind);
+ addTestGroup(group, "scaling_whole2", "Blit with scaling (whole, dst extent bigger)", addBlittingImageSimpleScalingWhole2Tests, allocationKind);
+ addTestGroup(group, "scaling_and_offset", "Blit with scaling and offset (whole, dst extent bigger)", addBlittingImageSimpleScalingAndOffsetTests, allocationKind);
+ addTestGroup(group, "without_scaling_partial", "Blit without scaling (partial)", addBlittingImageSimpleWithoutScalingPartialTests, allocationKind);
}
+
struct BlitColorTestParams
{
TestParams params;
bool onlyNearest;
};
+bool isAllowedBlittingAllFormatsColorSrcFormatTests(const BlitColorTestParams& testParams)
+{
+ bool result = true;
+
+ if (testParams.params.allocationKind == ALLOCATION_KIND_DEDICATED)
+ {
+ DE_ASSERT(!dedicatedAllocationBlittingFormatsToTestSet.empty());
+
+ result =
+ de::contains(dedicatedAllocationBlittingFormatsToTestSet, testParams.params.dst.image.format) ||
+ de::contains(dedicatedAllocationBlittingFormatsToTestSet, testParams.params.src.image.format);
+ }
+
+ return result;
+}
+
+
void addBlittingImageAllFormatsColorSrcFormatDstFormatTests (tcu::TestCaseGroup* group, BlitColorTestParams testParams)
{
tcu::TestContext& testCtx = group->getTestContext();
if (!isSupportedByFramework(testParams.params.dst.image.format))
continue;
+ if (!isAllowedBlittingAllFormatsColorSrcFormatTests(testParams))
+ continue;
+
const std::string description = "Blit destination format " + getFormatCaseName(testParams.params.dst.image.format);
addTestGroup(group, getFormatCaseName(testParams.params.dst.image.format), description, addBlittingImageAllFormatsColorSrcFormatDstFormatTests, testParams);
}
VK_FORMAT_R64G64_SFLOAT,
VK_FORMAT_R64G64B64_SFLOAT,
VK_FORMAT_R64G64B64A64_SFLOAT,
- VK_FORMAT_B10G11R11_UFLOAT_PACK32,
- VK_FORMAT_E5B9G9R9_UFLOAT_PACK32,
+// VK_FORMAT_B10G11R11_UFLOAT_PACK32,
+// VK_FORMAT_E5B9G9R9_UFLOAT_PACK32,
// VK_FORMAT_BC1_RGB_UNORM_BLOCK,
// VK_FORMAT_BC1_RGBA_UNORM_BLOCK,
// VK_FORMAT_BC2_UNORM_BLOCK,
VK_FORMAT_UNDEFINED
};
-void addBlittingImageAllFormatsColorTests (tcu::TestCaseGroup* group)
+const VkFormat dedicatedAllocationBlittingFormatsToTest[] =
+{
+ // compatibleFormatsUInts
+ VK_FORMAT_R8_UINT,
+ VK_FORMAT_R64G64B64A64_UINT,
+
+ // compatibleFormatsSInts
+ VK_FORMAT_R8_SINT,
+ VK_FORMAT_R64G64B64A64_SINT,
+
+ // compatibleFormatsFloats
+ VK_FORMAT_R4G4_UNORM_PACK8,
+ VK_FORMAT_E5B9G9R9_UFLOAT_PACK32,
+
+ // compatibleFormatsSrgb
+ VK_FORMAT_R8_SRGB,
+ VK_FORMAT_A8B8G8R8_SRGB_PACK32,
+};
+
+void addBlittingImageAllFormatsColorTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
const struct {
const VkFormat* compatibleFormats;
params.src.image.extent = defaultExtent;
params.dst.image.imageType = VK_IMAGE_TYPE_2D;
params.dst.image.extent = defaultExtent;
+ params.allocationKind = allocationKind;
CopyRegion region;
for (int i = 0, j = 1; (i + defaultFourthSize / j < defaultSize) && (defaultFourthSize > j); i += defaultFourthSize / j++)
params.regions.push_back(region);
}
+ if (allocationKind == ALLOCATION_KIND_DEDICATED)
+ {
+ const int numOfColorImageFormatsToTestFilter = DE_LENGTH_OF_ARRAY(dedicatedAllocationBlittingFormatsToTest);
+ for (int compatibleFormatsIndex = 0; compatibleFormatsIndex < numOfColorImageFormatsToTestFilter; ++compatibleFormatsIndex)
+ dedicatedAllocationBlittingFormatsToTestSet.insert(dedicatedAllocationBlittingFormatsToTest[compatibleFormatsIndex]);
+ }
+
for (int compatibleFormatsIndex = 0; compatibleFormatsIndex < numOfColorImageFormatsToTest; ++compatibleFormatsIndex)
{
const VkFormat* compatibleFormats = colorImageFormatsToTestBlit[compatibleFormatsIndex].compatibleFormats;
}
}
-void addBlittingImageAllFormatsDepthStencilTests (tcu::TestCaseGroup* group)
+void addBlittingImageAllFormatsDepthStencilTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
const VkFormat depthAndStencilFormats[] =
{
params.dst.image.extent = defaultExtent;
params.dst.image.imageType = VK_IMAGE_TYPE_2D;
params.dst.image.format = params.src.image.format;
+ params.allocationKind = allocationKind;
CopyRegion region;
for (int i = 0, j = 1; (i + defaultFourthSize / j < defaultSize) && (defaultFourthSize > j); i += defaultFourthSize / j++)
}
}
-void addBlittingImageAllFormatsTests (tcu::TestCaseGroup* group)
+void addBlittingImageAllFormatsTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
- addTestGroup(group, "color", "Blitting image with color formats", addBlittingImageAllFormatsColorTests);
- addTestGroup(group, "depth_stencil", "Blitting image with depth/stencil formats", addBlittingImageAllFormatsDepthStencilTests);
+ addTestGroup(group, "color", "Blitting image with color formats", addBlittingImageAllFormatsColorTests, allocationKind);
+ addTestGroup(group, "depth_stencil", "Blitting image with depth/stencil formats", addBlittingImageAllFormatsDepthStencilTests, allocationKind);
}
-void addBlittingImageTests (tcu::TestCaseGroup* group)
+void addBlittingImageTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
- addTestGroup(group, "simple_tests", "Blitting image simple tests", addBlittingImageSimpleTests);
- addTestGroup(group, "all_formats", "Blitting image with all compatible formats", addBlittingImageAllFormatsTests);
+ addTestGroup(group, "simple_tests", "Blitting image simple tests", addBlittingImageSimpleTests, allocationKind);
+ addTestGroup(group, "all_formats", "Blitting image with all compatible formats", addBlittingImageAllFormatsTests, allocationKind);
}
const VkSampleCountFlagBits samples[] =
};
const VkExtent3D resolveExtent = {256u, 256u, 1};
-void addResolveImageWholeTests (tcu::TestCaseGroup* group)
+void addResolveImageWholeTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
TestParams params;
params.src.image.imageType = VK_IMAGE_TYPE_2D;
params.dst.image.format = VK_FORMAT_R8G8B8A8_UNORM;
params.dst.image.extent = resolveExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
{
const VkImageSubresourceLayers sourceLayer =
}
}
-void addResolveImagePartialTests (tcu::TestCaseGroup* group)
+void addResolveImagePartialTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
TestParams params;
params.src.image.imageType = VK_IMAGE_TYPE_2D;
params.dst.image.format = VK_FORMAT_R8G8B8A8_UNORM;
params.dst.image.extent = resolveExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
{
const VkImageSubresourceLayers sourceLayer =
}
}
-void addResolveImageWithRegionsTests (tcu::TestCaseGroup* group)
+void addResolveImageWithRegionsTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
TestParams params;
params.src.image.imageType = VK_IMAGE_TYPE_2D;
params.dst.image.format = VK_FORMAT_R8G8B8A8_UNORM;
params.dst.image.extent = resolveExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
{
const VkImageSubresourceLayers sourceLayer =
}
}
-void addResolveImageWholeCopyBeforeResolvingTests (tcu::TestCaseGroup* group)
+void addResolveImageWholeCopyBeforeResolvingTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
TestParams params;
params.src.image.imageType = VK_IMAGE_TYPE_2D;
params.dst.image.format = VK_FORMAT_R8G8B8A8_UNORM;
params.dst.image.extent = defaultExtent;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
{
const VkImageSubresourceLayers sourceLayer =
}
}
-void addResolveImageWholeArrayImageTests (tcu::TestCaseGroup* group)
+void addResolveImageWholeArrayImageTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
TestParams params;
params.src.image.imageType = VK_IMAGE_TYPE_2D;
params.dst.image.extent = defaultExtent;
params.dst.image.extent.depth = 5u;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
for (deUint32 layerNdx=0; layerNdx < params.dst.image.extent.depth; ++layerNdx)
{
}
}
-void addResolveImageDiffImageSizeTests (tcu::TestCaseGroup* group)
+void addResolveImageDiffImageSizeTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
{
tcu::TestContext& testCtx = group->getTestContext();
TestParams params;
params.dst.image.imageType = VK_IMAGE_TYPE_2D;
params.dst.image.format = VK_FORMAT_R8G8B8A8_UNORM;
params.dst.image.operationLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ params.allocationKind = allocationKind;
{
const VkImageSubresourceLayers sourceLayer =
}
}
-void addResolveImageTests (tcu::TestCaseGroup* group)
+void addResolveImageTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
+{
+ addTestGroup(group, "whole", "Resolve from image to image (whole)", addResolveImageWholeTests, allocationKind);
+ addTestGroup(group, "partial", "Resolve from image to image (partial)", addResolveImagePartialTests, allocationKind);
+ addTestGroup(group, "with_regions", "Resolve from image to image (with regions)", addResolveImageWithRegionsTests, allocationKind);
+ addTestGroup(group, "whole_copy_before_resolving", "Resolve from image to image (whole copy before resolving)", addResolveImageWholeCopyBeforeResolvingTests, allocationKind);
+ addTestGroup(group, "whole_array_image", "Resolve from image to image (whole array image)", addResolveImageWholeArrayImageTests, allocationKind);
+ addTestGroup(group, "diff_image_size", "Resolve from image to image of different size", addResolveImageDiffImageSizeTests, allocationKind);
+}
+
+void addCopiesAndBlittingTests (tcu::TestCaseGroup* group, AllocationKind allocationKind)
+{
+ addTestGroup(group, "image_to_image", "Copy from image to image", addImageToImageTests, allocationKind);
+ addTestGroup(group, "image_to_buffer", "Copy from image to buffer", addImageToBufferTests, allocationKind);
+ addTestGroup(group, "buffer_to_image", "Copy from buffer to image", addBufferToImageTests, allocationKind);
+ addTestGroup(group, "buffer_to_buffer", "Copy from buffer to buffer", addBufferToBufferTests, allocationKind);
+ addTestGroup(group, "blit_image", "Blitting image", addBlittingImageTests, allocationKind);
+ addTestGroup(group, "resolve_image", "Resolve image", addResolveImageTests, allocationKind);
+}
+
+void addCoreCopiesAndBlittingTests (tcu::TestCaseGroup* group)
+{
+ addCopiesAndBlittingTests(group, ALLOCATION_KIND_SUBALLOCATED);
+}
+
+void addDedicatedAllocationCopiesAndBlittingTests (tcu::TestCaseGroup* group)
{
- addTestGroup(group, "whole", "Resolve from image to image (whole)", addResolveImageWholeTests);
- addTestGroup(group, "partial", "Resolve from image to image (partial)", addResolveImagePartialTests);
- addTestGroup(group, "with_regions", "Resolve from image to image (with regions)", addResolveImageWithRegionsTests);
- addTestGroup(group, "whole_copy_before_resolving", "Resolve from image to image (whole copy before resolving)", addResolveImageWholeCopyBeforeResolvingTests);
- addTestGroup(group, "whole_array_image", "Resolve from image to image (whole array image)", addResolveImageWholeArrayImageTests);
- addTestGroup(group, "diff_image_size", "Resolve from image to image of different size", addResolveImageDiffImageSizeTests);
+ addCopiesAndBlittingTests(group, ALLOCATION_KIND_DEDICATED);
}
} // anonymous
{
de::MovePtr<tcu::TestCaseGroup> copiesAndBlittingTests(new tcu::TestCaseGroup(testCtx, "copy_and_blit", "Copies And Blitting Tests"));
- addTestGroup(copiesAndBlittingTests.get(), "image_to_image", "Copy from image to image", addImageToImageTests);
- addTestGroup(copiesAndBlittingTests.get(), "image_to_buffer", "Copy from image to buffer", addImageToBufferTests);
- addTestGroup(copiesAndBlittingTests.get(), "buffer_to_image", "Copy from buffer to image", addBufferToImageTests);
- addTestGroup(copiesAndBlittingTests.get(), "buffer_to_buffer", "Copy from buffer to buffer", addBufferToBufferTests);
- addTestGroup(copiesAndBlittingTests.get(), "blit_image", "Blitting image", addBlittingImageTests);
- addTestGroup(copiesAndBlittingTests.get(), "resolve_image", "Resolve image", addResolveImageTests);
+ copiesAndBlittingTests->addChild(createTestGroup(testCtx, "core", "Core Copies And Blitting Tests", addCoreCopiesAndBlittingTests));
+ copiesAndBlittingTests->addChild(createTestGroup(testCtx, "dedicated_allocation", "Copies And Blitting Tests For Dedicated Memory Allocation", addDedicatedAllocationCopiesAndBlittingTests));
return copiesAndBlittingTests.release();
}