}
}
-tcu::TestStatus testOverlyLargeBuffer(Context& context, deUint64 bufferSize)
+struct LargeBufferParameters
+{
+ deUint64 bufferSize;
+ bool useMaxBufferSize;
+ VkBufferCreateFlags flags;
+};
+
+tcu::TestStatus testLargeBuffer(Context& context, LargeBufferParameters params)
{
const DeviceInterface& vk = context.getDeviceInterface();
const VkDevice vkDevice = context.getDevice();
const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
VkBuffer rawBuffer = DE_NULL;
+ if (params.useMaxBufferSize)
+ params.bufferSize = context.getMaintenance4Properties().maxBufferSize;
+
VkBufferCreateInfo bufferParams =
{
VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // VkStructureType sType;
DE_NULL, // const void* pNext;
- 0u, // VkBufferCreateFlags flags;
- bufferSize, // VkDeviceSize size;
+ params.flags, // VkBufferCreateFlags flags;
+ params.bufferSize, // VkDeviceSize size;
VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, // VkBufferUsageFlags usage;
VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode;
1u, // uint32_t queueFamilyIndexCount;
vk.getBufferMemoryRequirements(vkDevice, rawBuffer, &memoryRequirements);
vk.destroyBuffer(vkDevice, rawBuffer, DE_NULL);
- if (memoryRequirements.size >= bufferSize)
+ if (memoryRequirements.size >= params.bufferSize)
return tcu::TestStatus::pass("Pass");
return tcu::TestStatus::fail("Fail");
}
return tcu::TestStatus::fail("Fail");
}
+void checkMaintenance4Support(Context& context, LargeBufferParameters params)
+{
+ context.requireDeviceFunctionality("VK_KHR_maintenance4");
+
+ const VkPhysicalDeviceFeatures& physicalDeviceFeatures = getPhysicalDeviceFeatures(context.getInstanceInterface(), context.getPhysicalDevice());
+ if ((params.flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) && !physicalDeviceFeatures.sparseBinding)
+ TCU_THROW(NotSupportedError, "Sparse bindings feature is not supported");
+}
+
} // anonymous
tcu::TestCaseGroup* createBufferTests (tcu::TestContext& testCtx)
{
de::MovePtr<tcu::TestCaseGroup> basicTests(new tcu::TestCaseGroup(testCtx, "basic", "Basic buffer tests."));
- addFunctionCase(basicTests.get(), "size_max_uint64", "Creating a ULLONG_MAX buffer and verify that it either succeeds or returns one of the allowed errors.", testOverlyLargeBuffer, std::numeric_limits<deUint64>::max());
+ addFunctionCase(basicTests.get(), "max_size", "Creating buffer using maxBufferSize limit.",
+ checkMaintenance4Support, testLargeBuffer, LargeBufferParameters
+ {
+ 0u,
+ true,
+ 0u
+ });
+ addFunctionCase(basicTests.get(), "max_size_sparse", "Creating sparse buffer using maxBufferSize limit.",
+ checkMaintenance4Support, testLargeBuffer, LargeBufferParameters
+ {
+ 0u,
+ true,
+ VK_BUFFER_CREATE_SPARSE_BINDING_BIT
+ });
+ addFunctionCase(basicTests.get(), "size_max_uint64", "Creating a ULLONG_MAX buffer and verify that it either succeeds or returns one of the allowed errors.",
+ testLargeBuffer, LargeBufferParameters
+ {
+ std::numeric_limits<deUint64>::max(),
+ false,
+ 0u
+ });
buffersTests->addChild(basicTests.release());
}