From b61fc2025246c4a88212f4f97895b47ad82a138d Mon Sep 17 00:00:00 2001 From: Maciej Jesionowski Date: Mon, 7 Nov 2016 16:18:58 +0100 Subject: [PATCH] Add test: sparse buffer usage Test UBO, SSBO, VB, IB, InB with sparse buffers using: - sparse binding - sparse residency - sparse aliasing - residencyNonResidentStrict (with UBOs) New tests: - dEQP-VK.sparse_resources.buffer.ubo.* - dEQP-VK.sparse_resources.buffer.vertex_buffer.* - dEQP-VK.sparse_resources.buffer.index_buffer.* - dEQP-VK.sparse_resources.buffer.indirect_buffer.* Renamed tests: in dEQP-VK.sparse_resources: - .buffer_sparse_binding.* -> .buffer.transfer.sparse_binding.* - .buffer_sparse_residency.* -> .buffer.ssbo.sparse_residency.* - .buffer_sparse_memory_aliasing.* -> .buffer.ssbo.sparse_binding_aliased.* Issue: #401 Change-Id: Iba583a16eba0b688849175813a86d44c9b038f0d --- android/cts/master/vk-master.txt | 53 +- android/cts/nyc/src/vk-master.txt | 36 +- android/cts/nyc/vk-master.txt | 36 +- .../vulkan/sparse_resources/CMakeLists.txt | 2 + ...vktSparseResourcesBufferMemoryAliasing.cpp | 18 +- ...vktSparseResourcesBufferMemoryAliasing.hpp | 2 +- .../vktSparseResourcesBufferSparseBinding.cpp | 18 +- .../vktSparseResourcesBufferSparseBinding.hpp | 2 +- ...ktSparseResourcesBufferSparseResidency.cpp | 18 +- ...ktSparseResourcesBufferSparseResidency.hpp | 2 +- .../vktSparseResourcesBufferTests.cpp | 1618 +++++++++++++++++ .../vktSparseResourcesBufferTests.hpp | 39 + .../vktSparseResourcesTests.cpp | 8 +- .../vktSparseResourcesTestsUtil.cpp | 39 +- .../vktSparseResourcesTestsUtil.hpp | 27 +- .../vulkancts/mustpass/1.0.1/src/master.txt | 36 +- .../vulkancts/mustpass/1.0.1/vk-default.txt | 36 +- .../vulkancts/mustpass/1.0.2/vk-default.txt | 53 +- 18 files changed, 1885 insertions(+), 158 deletions(-) create mode 100644 external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferTests.cpp create mode 100644 external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferTests.hpp diff --git a/android/cts/master/vk-master.txt b/android/cts/master/vk-master.txt index b3653c687..65ba872f7 100644 --- a/android/cts/master/vk-master.txt +++ b/android/cts/master/vk-master.txt @@ -132284,12 +132284,41 @@ dEQP-VK.synchronization.op.multi_queue.semaphore.write_indirect_buffer_dispatch_ dEQP-VK.synchronization.op.multi_queue.semaphore.write_indirect_buffer_dispatch_read_indirect_buffer_dispatch.indirect_buffer_concurrent dEQP-VK.synchronization.internally_synchronized_objects.pipeline_cache_compute dEQP-VK.synchronization.internally_synchronized_objects.pipeline_cache_graphics -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_10 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_12 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_16 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_17 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_20 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_10 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_12 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_16 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_17 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_20 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_10 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_12 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_16 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_17 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_20 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_10 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_12 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_16 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_17 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_20 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.ubo.sparse_binding +dEQP-VK.sparse_resources.buffer.ubo.sparse_binding_aliased +dEQP-VK.sparse_resources.buffer.ubo.sparse_residency +dEQP-VK.sparse_resources.buffer.ubo.sparse_residency_aliased +dEQP-VK.sparse_resources.buffer.ubo.sparse_residency_non_resident_strict +dEQP-VK.sparse_resources.buffer.vertex_buffer.sparse_binding +dEQP-VK.sparse_resources.buffer.vertex_buffer.sparse_binding_aliased +dEQP-VK.sparse_resources.buffer.vertex_buffer.sparse_residency +dEQP-VK.sparse_resources.buffer.vertex_buffer.sparse_residency_aliased +dEQP-VK.sparse_resources.buffer.index_buffer.sparse_binding +dEQP-VK.sparse_resources.buffer.index_buffer.sparse_binding_aliased +dEQP-VK.sparse_resources.buffer.index_buffer.sparse_residency +dEQP-VK.sparse_resources.buffer.index_buffer.sparse_residency_aliased +dEQP-VK.sparse_resources.buffer.indirect_buffer.sparse_binding +dEQP-VK.sparse_resources.buffer.indirect_buffer.sparse_binding_aliased +dEQP-VK.sparse_resources.buffer.indirect_buffer.sparse_residency +dEQP-VK.sparse_resources.buffer.indirect_buffer.sparse_residency_aliased dEQP-VK.sparse_resources.image_sparse_binding.1d.r32i.512_1_1 dEQP-VK.sparse_resources.image_sparse_binding.1d.r32i.1024_1_1 dEQP-VK.sparse_resources.image_sparse_binding.1d.r32i.11_1_1 @@ -132416,12 +132445,6 @@ dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba16ui.137_137_3 dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba8ui.256_256_6 dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba8ui.128_128_8 dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba8ui.137_137_3 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_10 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_12 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_16 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_17 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_20 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_24 dEQP-VK.sparse_resources.image_sparse_residency.2d.r32i.512_256_1 dEQP-VK.sparse_resources.image_sparse_residency.2d.r32i.1024_128_1 dEQP-VK.sparse_resources.image_sparse_residency.2d.r32i.11_137_1 @@ -132647,12 +132670,6 @@ dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba16ui.11_137_3 dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba8ui.256_256_16 dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba8ui.1024_128_8 dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba8ui.11_137_3 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_10 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_12 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_16 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_17 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_20 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_24 dEQP-VK.sparse_resources.image_sparse_memory_aliasing.2d.r32i.512_256_1 dEQP-VK.sparse_resources.image_sparse_memory_aliasing.2d.r32i.128_128_1 dEQP-VK.sparse_resources.image_sparse_memory_aliasing.2d.r32i.503_137_1 diff --git a/android/cts/nyc/src/vk-master.txt b/android/cts/nyc/src/vk-master.txt index 66e1f45d9..fc5076cd0 100644 --- a/android/cts/nyc/src/vk-master.txt +++ b/android/cts/nyc/src/vk-master.txt @@ -81671,12 +81671,24 @@ dEQP-VK.wsi.android.swapchain.modify.resize dEQP-VK.synchronization.smoke.fences dEQP-VK.synchronization.smoke.semaphores dEQP-VK.synchronization.smoke.events -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_10 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_12 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_16 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_17 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_20 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_10 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_12 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_16 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_17 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_20 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_10 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_12 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_16 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_17 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_20 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_10 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_12 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_16 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_17 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_20 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_24 dEQP-VK.sparse_resources.image_sparse_binding.1d.r32i.512_1_1 dEQP-VK.sparse_resources.image_sparse_binding.1d.r32i.1024_1_1 dEQP-VK.sparse_resources.image_sparse_binding.1d.r32i.11_1_1 @@ -81803,12 +81815,6 @@ dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba16ui.137_137_3 dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba8ui.256_256_6 dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba8ui.128_128_8 dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba8ui.137_137_3 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_10 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_12 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_16 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_17 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_20 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_24 dEQP-VK.sparse_resources.image_sparse_residency.2d.r32i.512_256_1 dEQP-VK.sparse_resources.image_sparse_residency.2d.r32i.1024_128_1 dEQP-VK.sparse_resources.image_sparse_residency.2d.r32i.11_137_1 @@ -82034,12 +82040,6 @@ dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba16ui.11_137_3 dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba8ui.256_256_16 dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba8ui.1024_128_8 dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba8ui.11_137_3 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_10 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_12 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_16 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_17 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_20 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_24 dEQP-VK.fragment_operations.early_fragment.no_early_fragment_tests_depth dEQP-VK.fragment_operations.early_fragment.no_early_fragment_tests_stencil dEQP-VK.fragment_operations.early_fragment.early_fragment_tests_depth diff --git a/android/cts/nyc/vk-master.txt b/android/cts/nyc/vk-master.txt index bb51c26eb..aba32b152 100644 --- a/android/cts/nyc/vk-master.txt +++ b/android/cts/nyc/vk-master.txt @@ -81671,12 +81671,24 @@ dEQP-VK.wsi.android.swapchain.modify.resize dEQP-VK.synchronization.smoke.fences dEQP-VK.synchronization.smoke.semaphores dEQP-VK.synchronization.smoke.events -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_10 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_12 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_16 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_17 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_20 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_10 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_12 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_16 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_17 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_20 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_10 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_12 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_16 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_17 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_20 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_10 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_12 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_16 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_17 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_20 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_24 dEQP-VK.sparse_resources.image_sparse_binding.1d.r32i.512_1_1 dEQP-VK.sparse_resources.image_sparse_binding.1d.r32i.1024_1_1 dEQP-VK.sparse_resources.image_sparse_binding.1d.r32i.11_1_1 @@ -81803,12 +81815,6 @@ dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba16ui.137_137_3 dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba8ui.256_256_6 dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba8ui.128_128_8 dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba8ui.137_137_3 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_10 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_12 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_16 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_17 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_20 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_24 dEQP-VK.sparse_resources.image_sparse_residency.2d.r32i.512_256_1 dEQP-VK.sparse_resources.image_sparse_residency.2d.r32i.1024_128_1 dEQP-VK.sparse_resources.image_sparse_residency.2d.r32i.11_137_1 @@ -82034,12 +82040,6 @@ dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba16ui.11_137_3 dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba8ui.256_256_16 dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba8ui.1024_128_8 dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba8ui.11_137_3 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_10 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_12 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_16 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_17 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_20 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_24 dEQP-VK.fragment_operations.early_fragment.no_early_fragment_tests_depth dEQP-VK.fragment_operations.early_fragment.no_early_fragment_tests_stencil dEQP-VK.fragment_operations.early_fragment.early_fragment_tests_depth diff --git a/external/vulkancts/modules/vulkan/sparse_resources/CMakeLists.txt b/external/vulkancts/modules/vulkan/sparse_resources/CMakeLists.txt index 4da15e5ed..3bf9eed0c 100644 --- a/external/vulkancts/modules/vulkan/sparse_resources/CMakeLists.txt +++ b/external/vulkancts/modules/vulkan/sparse_resources/CMakeLists.txt @@ -9,6 +9,8 @@ set(DEQP_VK_SPARSE_RESOURCES_SRCS vktSparseResourcesBufferSparseBinding.hpp vktSparseResourcesBufferSparseResidency.cpp vktSparseResourcesBufferSparseResidency.hpp + vktSparseResourcesBufferTests.cpp + vktSparseResourcesBufferTests.hpp vktSparseResourcesImageMemoryAliasing.cpp vktSparseResourcesImageMemoryAliasing.hpp vktSparseResourcesImageSparseBinding.cpp diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferMemoryAliasing.cpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferMemoryAliasing.cpp index 3bf11553f..72f43f84f 100644 --- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferMemoryAliasing.cpp +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferMemoryAliasing.cpp @@ -400,18 +400,14 @@ TestInstance* BufferSparseMemoryAliasingCase::createInstance (Context& context) } // anonymous ns -tcu::TestCaseGroup* createBufferSparseMemoryAliasingTests (tcu::TestContext& testCtx) +void addBufferSparseMemoryAliasingTests(tcu::TestCaseGroup* group) { - de::MovePtr testGroup(new tcu::TestCaseGroup(testCtx, "buffer_sparse_memory_aliasing", "Sparse Buffer Memory Aliasing")); - - testGroup->addChild(new BufferSparseMemoryAliasingCase(testCtx, "buffer_size_2_10", "", 1 << 10, glu::GLSL_VERSION_440)); - testGroup->addChild(new BufferSparseMemoryAliasingCase(testCtx, "buffer_size_2_12", "", 1 << 12, glu::GLSL_VERSION_440)); - testGroup->addChild(new BufferSparseMemoryAliasingCase(testCtx, "buffer_size_2_16", "", 1 << 16, glu::GLSL_VERSION_440)); - testGroup->addChild(new BufferSparseMemoryAliasingCase(testCtx, "buffer_size_2_17", "", 1 << 17, glu::GLSL_VERSION_440)); - testGroup->addChild(new BufferSparseMemoryAliasingCase(testCtx, "buffer_size_2_20", "", 1 << 20, glu::GLSL_VERSION_440)); - testGroup->addChild(new BufferSparseMemoryAliasingCase(testCtx, "buffer_size_2_24", "", 1 << 24, glu::GLSL_VERSION_440)); - - return testGroup.release(); + group->addChild(new BufferSparseMemoryAliasingCase(group->getTestContext(), "buffer_size_2_10", "", 1 << 10, glu::GLSL_VERSION_440)); + group->addChild(new BufferSparseMemoryAliasingCase(group->getTestContext(), "buffer_size_2_12", "", 1 << 12, glu::GLSL_VERSION_440)); + group->addChild(new BufferSparseMemoryAliasingCase(group->getTestContext(), "buffer_size_2_16", "", 1 << 16, glu::GLSL_VERSION_440)); + group->addChild(new BufferSparseMemoryAliasingCase(group->getTestContext(), "buffer_size_2_17", "", 1 << 17, glu::GLSL_VERSION_440)); + group->addChild(new BufferSparseMemoryAliasingCase(group->getTestContext(), "buffer_size_2_20", "", 1 << 20, glu::GLSL_VERSION_440)); + group->addChild(new BufferSparseMemoryAliasingCase(group->getTestContext(), "buffer_size_2_24", "", 1 << 24, glu::GLSL_VERSION_440)); } } // sparse diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferMemoryAliasing.hpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferMemoryAliasing.hpp index 0fa70bf31..f71408871 100644 --- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferMemoryAliasing.hpp +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferMemoryAliasing.hpp @@ -31,7 +31,7 @@ namespace vkt namespace sparse { -tcu::TestCaseGroup* createBufferSparseMemoryAliasingTests(tcu::TestContext& testCtx); +void addBufferSparseMemoryAliasingTests(tcu::TestCaseGroup* group); } // sparse } // vkt diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferSparseBinding.cpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferSparseBinding.cpp index acded247d..2bd5f787b 100644 --- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferSparseBinding.cpp +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferSparseBinding.cpp @@ -293,18 +293,14 @@ TestInstance* BufferSparseBindingCase::createInstance (Context& context) const } // anonymous ns -tcu::TestCaseGroup* createBufferSparseBindingTests (tcu::TestContext& testCtx) +void addBufferSparseBindingTests (tcu::TestCaseGroup* group) { - de::MovePtr testGroup(new tcu::TestCaseGroup(testCtx, "buffer_sparse_binding", "Buffer Sparse Binding")); - - testGroup->addChild(new BufferSparseBindingCase(testCtx, "buffer_size_2_10", "", 1 << 10)); - testGroup->addChild(new BufferSparseBindingCase(testCtx, "buffer_size_2_12", "", 1 << 12)); - testGroup->addChild(new BufferSparseBindingCase(testCtx, "buffer_size_2_16", "", 1 << 16)); - testGroup->addChild(new BufferSparseBindingCase(testCtx, "buffer_size_2_17", "", 1 << 17)); - testGroup->addChild(new BufferSparseBindingCase(testCtx, "buffer_size_2_20", "", 1 << 20)); - testGroup->addChild(new BufferSparseBindingCase(testCtx, "buffer_size_2_24", "", 1 << 24)); - - return testGroup.release(); + group->addChild(new BufferSparseBindingCase(group->getTestContext(), "buffer_size_2_10", "", 1 << 10)); + group->addChild(new BufferSparseBindingCase(group->getTestContext(), "buffer_size_2_12", "", 1 << 12)); + group->addChild(new BufferSparseBindingCase(group->getTestContext(), "buffer_size_2_16", "", 1 << 16)); + group->addChild(new BufferSparseBindingCase(group->getTestContext(), "buffer_size_2_17", "", 1 << 17)); + group->addChild(new BufferSparseBindingCase(group->getTestContext(), "buffer_size_2_20", "", 1 << 20)); + group->addChild(new BufferSparseBindingCase(group->getTestContext(), "buffer_size_2_24", "", 1 << 24)); } } // sparse diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferSparseBinding.hpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferSparseBinding.hpp index 523de15b4..3a048d6c8 100644 --- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferSparseBinding.hpp +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferSparseBinding.hpp @@ -31,7 +31,7 @@ namespace vkt namespace sparse { -tcu::TestCaseGroup* createBufferSparseBindingTests (tcu::TestContext& testCtx); +void addBufferSparseBindingTests (tcu::TestCaseGroup* group); } // sparse } // vkt diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferSparseResidency.cpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferSparseResidency.cpp index db831e553..de49a701b 100644 --- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferSparseResidency.cpp +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferSparseResidency.cpp @@ -383,18 +383,14 @@ TestInstance* BufferSparseResidencyCase::createInstance (Context& context) const } // anonymous ns -tcu::TestCaseGroup* createBufferSparseResidencyTests (tcu::TestContext& testCtx) +void addBufferSparseResidencyTests(tcu::TestCaseGroup* group) { - de::MovePtr testGroup(new tcu::TestCaseGroup(testCtx, "buffer_sparse_residency", "Buffer Sparse Residency")); - - testGroup->addChild(new BufferSparseResidencyCase(testCtx, "buffer_size_2_10", "", 1 << 10, glu::GLSL_VERSION_440)); - testGroup->addChild(new BufferSparseResidencyCase(testCtx, "buffer_size_2_12", "", 1 << 12, glu::GLSL_VERSION_440)); - testGroup->addChild(new BufferSparseResidencyCase(testCtx, "buffer_size_2_16", "", 1 << 16, glu::GLSL_VERSION_440)); - testGroup->addChild(new BufferSparseResidencyCase(testCtx, "buffer_size_2_17", "", 1 << 17, glu::GLSL_VERSION_440)); - testGroup->addChild(new BufferSparseResidencyCase(testCtx, "buffer_size_2_20", "", 1 << 20, glu::GLSL_VERSION_440)); - testGroup->addChild(new BufferSparseResidencyCase(testCtx, "buffer_size_2_24", "", 1 << 24, glu::GLSL_VERSION_440)); - - return testGroup.release(); + group->addChild(new BufferSparseResidencyCase(group->getTestContext(), "buffer_size_2_10", "", 1 << 10, glu::GLSL_VERSION_440)); + group->addChild(new BufferSparseResidencyCase(group->getTestContext(), "buffer_size_2_12", "", 1 << 12, glu::GLSL_VERSION_440)); + group->addChild(new BufferSparseResidencyCase(group->getTestContext(), "buffer_size_2_16", "", 1 << 16, glu::GLSL_VERSION_440)); + group->addChild(new BufferSparseResidencyCase(group->getTestContext(), "buffer_size_2_17", "", 1 << 17, glu::GLSL_VERSION_440)); + group->addChild(new BufferSparseResidencyCase(group->getTestContext(), "buffer_size_2_20", "", 1 << 20, glu::GLSL_VERSION_440)); + group->addChild(new BufferSparseResidencyCase(group->getTestContext(), "buffer_size_2_24", "", 1 << 24, glu::GLSL_VERSION_440)); } } // sparse diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferSparseResidency.hpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferSparseResidency.hpp index 238a1f9f6..54fae2dd8 100644 --- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferSparseResidency.hpp +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferSparseResidency.hpp @@ -31,7 +31,7 @@ namespace vkt namespace sparse { -tcu::TestCaseGroup* createBufferSparseResidencyTests(tcu::TestContext& testCtx); +void addBufferSparseResidencyTests(tcu::TestCaseGroup* group); } // sparse } // vkt diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferTests.cpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferTests.cpp new file mode 100644 index 000000000..1f271a7e9 --- /dev/null +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferTests.cpp @@ -0,0 +1,1618 @@ +/*------------------------------------------------------------------------ + * Vulkan Conformance Tests + * ------------------------ + * + * Copyright (c) 2016 The Khronos Group Inc. + * + * 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 Sparse buffer tests + *//*--------------------------------------------------------------------*/ + +#include "vktSparseResourcesBufferTests.hpp" +#include "vktTestCaseUtil.hpp" +#include "vktTestGroupUtil.hpp" +#include "vktSparseResourcesTestsUtil.hpp" +#include "vktSparseResourcesBase.hpp" +#include "vktSparseResourcesBufferSparseBinding.hpp" +#include "vktSparseResourcesBufferSparseResidency.hpp" +#include "vktSparseResourcesBufferMemoryAliasing.hpp" + +#include "vkRef.hpp" +#include "vkRefUtil.hpp" +#include "vkPlatform.hpp" +#include "vkPrograms.hpp" +#include "vkMemUtil.hpp" +#include "vkBuilderUtil.hpp" +#include "vkQueryUtil.hpp" +#include "vkTypeUtil.hpp" + +#include "deUniquePtr.hpp" +#include "deSharedPtr.hpp" +#include "deMath.h" + +#include +#include +#include + +using namespace vk; +using de::MovePtr; +using de::UniquePtr; +using de::SharedPtr; +using tcu::Vec4; +using tcu::IVec2; +using tcu::IVec4; + +namespace vkt +{ +namespace sparse +{ +namespace +{ + +typedef SharedPtr > AllocationSp; + +enum +{ + RENDER_SIZE = 128, //!< framebuffer size in pixels + GRID_SIZE = RENDER_SIZE / 8, //!< number of grid tiles in a row +}; + +enum TestFlagBits +{ + // sparseBinding is implied + TEST_FLAG_ALIASED = 1u << 0, //!< sparseResidencyAliased + TEST_FLAG_RESIDENCY = 1u << 1, //!< sparseResidencyBuffer + TEST_FLAG_NON_RESIDENT_STRICT = 1u << 2, //!< residencyNonResidentStrict +}; +typedef deUint32 TestFlags; + +//! SparseAllocationBuilder output. Owns the allocated memory. +struct SparseAllocation +{ + deUint32 numResourceChunks; + VkDeviceSize resourceSize; //!< buffer size in bytes + std::vector allocations; //!< actual allocated memory + std::vector memoryBinds; //!< memory binds backing the resource +}; + +//! Utility to lay out memory allocations for a sparse buffer, including holes and aliased regions. +//! Will allocate memory upon building. +class SparseAllocationBuilder +{ +public: + SparseAllocationBuilder (void); + + // \note "chunk" is the smallest (due to alignment) bindable amount of memory + + SparseAllocationBuilder& addMemoryHole (const deUint32 numChunks = 1u); + SparseAllocationBuilder& addResourceHole (const deUint32 numChunks = 1u); + SparseAllocationBuilder& addMemoryBind (const deUint32 numChunks = 1u); + SparseAllocationBuilder& addAliasedMemoryBind (const deUint32 allocationNdx, const deUint32 chunkOffset, const deUint32 numChunks = 1u); + SparseAllocationBuilder& addMemoryAllocation (void); + + MovePtr build (const DeviceInterface& vk, + const VkDevice device, + Allocator& allocator, + VkBufferCreateInfo referenceCreateInfo, //!< buffer size is ignored in this info + const VkDeviceSize minChunkSize = 0ull) const; //!< make sure chunks are at least this big + +private: + struct MemoryBind + { + deUint32 allocationNdx; + deUint32 resourceChunkNdx; + deUint32 memoryChunkNdx; + deUint32 numChunks; + }; + + deUint32 m_allocationNdx; + deUint32 m_resourceChunkNdx; + deUint32 m_memoryChunkNdx; + std::vector m_memoryBinds; + std::vector m_chunksPerAllocation; + +}; + +SparseAllocationBuilder::SparseAllocationBuilder (void) + : m_allocationNdx (0) + , m_resourceChunkNdx (0) + , m_memoryChunkNdx (0) +{ + m_chunksPerAllocation.push_back(0); +} + +SparseAllocationBuilder& SparseAllocationBuilder::addMemoryHole (const deUint32 numChunks) +{ + m_memoryChunkNdx += numChunks; + m_chunksPerAllocation[m_allocationNdx] += numChunks; + + return *this; +} + +SparseAllocationBuilder& SparseAllocationBuilder::addResourceHole (const deUint32 numChunks) +{ + m_resourceChunkNdx += numChunks; + + return *this; +} + +SparseAllocationBuilder& SparseAllocationBuilder::addMemoryAllocation (void) +{ + DE_ASSERT(m_memoryChunkNdx != 0); // doesn't make sense to have an empty allocation + + m_allocationNdx += 1; + m_memoryChunkNdx = 0; + m_chunksPerAllocation.push_back(0); + + return *this; +} + +SparseAllocationBuilder& SparseAllocationBuilder::addMemoryBind (const deUint32 numChunks) +{ + const MemoryBind memoryBind = + { + m_allocationNdx, + m_resourceChunkNdx, + m_memoryChunkNdx, + numChunks + }; + m_memoryBinds.push_back(memoryBind); + + m_resourceChunkNdx += numChunks; + m_memoryChunkNdx += numChunks; + m_chunksPerAllocation[m_allocationNdx] += numChunks; + + return *this; +} + +SparseAllocationBuilder& SparseAllocationBuilder::addAliasedMemoryBind (const deUint32 allocationNdx, const deUint32 chunkOffset, const deUint32 numChunks) +{ + DE_ASSERT(allocationNdx <= m_allocationNdx); + + const MemoryBind memoryBind = + { + allocationNdx, + m_resourceChunkNdx, + chunkOffset, + numChunks + }; + m_memoryBinds.push_back(memoryBind); + + m_resourceChunkNdx += numChunks; + + return *this; +} + +inline VkMemoryRequirements requirementsWithSize (VkMemoryRequirements requirements, const VkDeviceSize size) +{ + requirements.size = size; + return requirements; +} + +inline VkDeviceSize alignSize (const VkDeviceSize val, const VkDeviceSize align) +{ + DE_ASSERT(deIsPowerOfTwo64(align)); + return (val + align - 1) & ~(align - 1); +} + +MovePtr SparseAllocationBuilder::build (const DeviceInterface& vk, + const VkDevice device, + Allocator& allocator, + VkBufferCreateInfo referenceCreateInfo, + const VkDeviceSize minChunkSize) const +{ + + MovePtr sparseAllocation (new SparseAllocation()); + + referenceCreateInfo.size = sizeof(deUint32); + const Unique refBuffer (createBuffer(vk, device, &referenceCreateInfo)); + const VkMemoryRequirements memoryRequirements = getBufferMemoryRequirements(vk, device, *refBuffer); + const VkDeviceSize chunkSize = std::max(memoryRequirements.alignment, alignSize(minChunkSize, memoryRequirements.alignment)); + + for (std::vector::const_iterator numChunksIter = m_chunksPerAllocation.begin(); numChunksIter != m_chunksPerAllocation.end(); ++numChunksIter) + { + sparseAllocation->allocations.push_back(makeDeSharedPtr( + allocator.allocate(requirementsWithSize(memoryRequirements, *numChunksIter * chunkSize), MemoryRequirement::Any))); + } + + for (std::vector::const_iterator memBindIter = m_memoryBinds.begin(); memBindIter != m_memoryBinds.end(); ++memBindIter) + { + const Allocation& alloc = **sparseAllocation->allocations[memBindIter->allocationNdx]; + const VkSparseMemoryBind bind = + { + memBindIter->resourceChunkNdx * chunkSize, // VkDeviceSize resourceOffset; + memBindIter->numChunks * chunkSize, // VkDeviceSize size; + alloc.getMemory(), // VkDeviceMemory memory; + alloc.getOffset() + memBindIter->memoryChunkNdx * chunkSize, // VkDeviceSize memoryOffset; + (VkSparseMemoryBindFlags)0, // VkSparseMemoryBindFlags flags; + }; + sparseAllocation->memoryBinds.push_back(bind); + referenceCreateInfo.size = std::max(referenceCreateInfo.size, bind.resourceOffset + bind.size); + } + + sparseAllocation->resourceSize = referenceCreateInfo.size; + sparseAllocation->numResourceChunks = m_resourceChunkNdx; + + return sparseAllocation; +} + +VkImageCreateInfo makeImageCreateInfo (const VkFormat format, const IVec2& size, const VkImageUsageFlags usage) +{ + const VkImageCreateInfo imageParams = + { + VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkImageCreateFlags)0, // VkImageCreateFlags flags; + VK_IMAGE_TYPE_2D, // VkImageType imageType; + format, // VkFormat format; + makeExtent3D(size.x(), size.y(), 1), // VkExtent3D extent; + 1u, // deUint32 mipLevels; + 1u, // deUint32 arrayLayers; + VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples; + VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling; + usage, // VkImageUsageFlags usage; + VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode; + 0u, // deUint32 queueFamilyIndexCount; + DE_NULL, // const deUint32* pQueueFamilyIndices; + VK_IMAGE_LAYOUT_UNDEFINED, // VkImageLayout initialLayout; + }; + return imageParams; +} + +Move makeRenderPass (const DeviceInterface& vk, + const VkDevice device, + const VkFormat colorFormat) +{ + const VkAttachmentDescription colorAttachmentDescription = + { + (VkAttachmentDescriptionFlags)0, // VkAttachmentDescriptionFlags flags; + colorFormat, // 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_UNDEFINED, // VkImageLayout initialLayout; + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // VkImageLayout finalLayout; + }; + + 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; + 1u, // deUint32 attachmentCount; + &colorAttachmentDescription, // const VkAttachmentDescription* pAttachments; + 1u, // deUint32 subpassCount; + &subpassDescription, // const VkSubpassDescription* pSubpasses; + 0u, // deUint32 dependencyCount; + DE_NULL // const VkSubpassDependency* pDependencies; + }; + + return createRenderPass(vk, device, &renderPassInfo); +} + +Move makeGraphicsPipeline (const DeviceInterface& vk, + const VkDevice device, + const VkPipelineLayout pipelineLayout, + const VkRenderPass renderPass, + const IVec2 renderSize, + const VkPrimitiveTopology topology, + const deUint32 stageCount, + const VkPipelineShaderStageCreateInfo* pStages) +{ + const VkVertexInputBindingDescription vertexInputBindingDescription = + { + 0u, // uint32_t binding; + sizeof(Vec4), // uint32_t stride; + VK_VERTEX_INPUT_RATE_VERTEX, // VkVertexInputRate inputRate; + }; + + const VkVertexInputAttributeDescription vertexInputAttributeDescription = + { + 0u, // uint32_t location; + 0u, // uint32_t binding; + VK_FORMAT_R32G32B32A32_SFLOAT, // VkFormat format; + 0u, // uint32_t offset; + }; + + const VkPipelineVertexInputStateCreateInfo vertexInputStateInfo = + { + VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkPipelineVertexInputStateCreateFlags)0, // VkPipelineVertexInputStateCreateFlags flags; + 1u, // uint32_t vertexBindingDescriptionCount; + &vertexInputBindingDescription, // const VkVertexInputBindingDescription* pVertexBindingDescriptions; + 1u, // uint32_t vertexAttributeDescriptionCount; + &vertexInputAttributeDescription, // const VkVertexInputAttributeDescription* pVertexAttributeDescriptions; + }; + + const VkPipelineInputAssemblyStateCreateInfo pipelineInputAssemblyStateInfo = + { + VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkPipelineInputAssemblyStateCreateFlags)0, // VkPipelineInputAssemblyStateCreateFlags flags; + topology, // VkPrimitiveTopology topology; + VK_FALSE, // VkBool32 primitiveRestartEnable; + }; + + const VkViewport viewport = makeViewport( + 0.0f, 0.0f, + static_cast(renderSize.x()), static_cast(renderSize.y()), + 0.0f, 1.0f); + + const VkRect2D scissor = { + makeOffset2D(0, 0), + makeExtent2D(static_cast(renderSize.x()), static_cast(renderSize.y())), + }; + + const VkPipelineViewportStateCreateInfo pipelineViewportStateInfo = + { + VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkPipelineViewportStateCreateFlags)0, // VkPipelineViewportStateCreateFlags flags; + 1u, // uint32_t viewportCount; + &viewport, // const VkViewport* pViewports; + 1u, // uint32_t scissorCount; + &scissor, // const VkRect2D* pScissors; + }; + + const VkPipelineRasterizationStateCreateInfo pipelineRasterizationStateInfo = + { + VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkPipelineRasterizationStateCreateFlags)0, // VkPipelineRasterizationStateCreateFlags flags; + VK_FALSE, // VkBool32 depthClampEnable; + VK_FALSE, // VkBool32 rasterizerDiscardEnable; + VK_POLYGON_MODE_FILL, // VkPolygonMode polygonMode; + VK_CULL_MODE_NONE, // VkCullModeFlags cullMode; + VK_FRONT_FACE_COUNTER_CLOCKWISE, // VkFrontFace frontFace; + VK_FALSE, // VkBool32 depthBiasEnable; + 0.0f, // float depthBiasConstantFactor; + 0.0f, // float depthBiasClamp; + 0.0f, // float depthBiasSlopeFactor; + 1.0f, // float lineWidth; + }; + + const VkPipelineMultisampleStateCreateInfo pipelineMultisampleStateInfo = + { + VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkPipelineMultisampleStateCreateFlags)0, // VkPipelineMultisampleStateCreateFlags flags; + VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits rasterizationSamples; + VK_FALSE, // VkBool32 sampleShadingEnable; + 0.0f, // float minSampleShading; + DE_NULL, // const VkSampleMask* pSampleMask; + VK_FALSE, // VkBool32 alphaToCoverageEnable; + VK_FALSE // VkBool32 alphaToOneEnable; + }; + + const VkStencilOpState stencilOpState = makeStencilOpState( + VK_STENCIL_OP_KEEP, // stencil fail + VK_STENCIL_OP_KEEP, // depth & stencil pass + VK_STENCIL_OP_KEEP, // depth only fail + VK_COMPARE_OP_ALWAYS, // compare op + 0u, // compare mask + 0u, // write mask + 0u); // reference + + VkPipelineDepthStencilStateCreateInfo pipelineDepthStencilStateInfo = + { + VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkPipelineDepthStencilStateCreateFlags)0, // VkPipelineDepthStencilStateCreateFlags flags; + VK_FALSE, // VkBool32 depthTestEnable; + VK_FALSE, // VkBool32 depthWriteEnable; + VK_COMPARE_OP_LESS, // VkCompareOp depthCompareOp; + VK_FALSE, // VkBool32 depthBoundsTestEnable; + VK_FALSE, // VkBool32 stencilTestEnable; + stencilOpState, // VkStencilOpState front; + stencilOpState, // VkStencilOpState back; + 0.0f, // float minDepthBounds; + 1.0f, // float maxDepthBounds; + }; + + const VkColorComponentFlags colorComponentsAll = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT; + const VkPipelineColorBlendAttachmentState pipelineColorBlendAttachmentState = + { + VK_FALSE, // VkBool32 blendEnable; + VK_BLEND_FACTOR_ONE, // VkBlendFactor srcColorBlendFactor; + VK_BLEND_FACTOR_ZERO, // VkBlendFactor dstColorBlendFactor; + VK_BLEND_OP_ADD, // VkBlendOp colorBlendOp; + VK_BLEND_FACTOR_ONE, // VkBlendFactor srcAlphaBlendFactor; + VK_BLEND_FACTOR_ZERO, // VkBlendFactor dstAlphaBlendFactor; + VK_BLEND_OP_ADD, // VkBlendOp alphaBlendOp; + colorComponentsAll, // VkColorComponentFlags colorWriteMask; + }; + + const VkPipelineColorBlendStateCreateInfo pipelineColorBlendStateInfo = + { + VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkPipelineColorBlendStateCreateFlags)0, // VkPipelineColorBlendStateCreateFlags flags; + VK_FALSE, // VkBool32 logicOpEnable; + VK_LOGIC_OP_COPY, // VkLogicOp logicOp; + 1u, // deUint32 attachmentCount; + &pipelineColorBlendAttachmentState, // const VkPipelineColorBlendAttachmentState* pAttachments; + { 0.0f, 0.0f, 0.0f, 0.0f }, // float blendConstants[4]; + }; + + const VkGraphicsPipelineCreateInfo graphicsPipelineInfo = + { + VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkPipelineCreateFlags)0, // VkPipelineCreateFlags flags; + stageCount, // deUint32 stageCount; + pStages, // const VkPipelineShaderStageCreateInfo* pStages; + &vertexInputStateInfo, // const VkPipelineVertexInputStateCreateInfo* pVertexInputState; + &pipelineInputAssemblyStateInfo, // const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState; + DE_NULL, // const VkPipelineTessellationStateCreateInfo* pTessellationState; + &pipelineViewportStateInfo, // const VkPipelineViewportStateCreateInfo* pViewportState; + &pipelineRasterizationStateInfo, // const VkPipelineRasterizationStateCreateInfo* pRasterizationState; + &pipelineMultisampleStateInfo, // const VkPipelineMultisampleStateCreateInfo* pMultisampleState; + &pipelineDepthStencilStateInfo, // const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState; + &pipelineColorBlendStateInfo, // const VkPipelineColorBlendStateCreateInfo* pColorBlendState; + DE_NULL, // const VkPipelineDynamicStateCreateInfo* pDynamicState; + pipelineLayout, // VkPipelineLayout layout; + renderPass, // VkRenderPass renderPass; + 0u, // deUint32 subpass; + DE_NULL, // VkPipeline basePipelineHandle; + 0, // deInt32 basePipelineIndex; + }; + + return createGraphicsPipeline(vk, device, DE_NULL, &graphicsPipelineInfo); +} + +//! Return true if there are any red (or all zero) pixels in the image +bool imageHasErrorPixels (const tcu::ConstPixelBufferAccess image) +{ + const Vec4 errorColor = Vec4(1.0f, 0.0f, 0.0f, 1.0f); + const Vec4 blankColor = Vec4(); + + for (int y = 0; y < image.getHeight(); ++y) + for (int x = 0; x < image.getWidth(); ++x) + { + const Vec4 color = image.getPixel(x, y); + if (color == errorColor || color == blankColor) + return true; + } + + return false; +} + +class Renderer +{ +public: + typedef std::map SpecializationMap; + + //! Use the delegate to bind descriptor sets, vertex buffers, etc. and make a draw call + struct Delegate + { + virtual ~Delegate (void) {} + virtual void rendererDraw (const VkPipelineLayout pipelineLayout, const VkCommandBuffer cmdBuffer) const = 0; + }; + + Renderer (const DeviceInterface& vk, + const VkDevice device, + Allocator& allocator, + const deUint32 queueFamilyIndex, + const VkDescriptorSetLayout descriptorSetLayout, //!< may be NULL, if no descriptors are used + ProgramCollection& binaryCollection, + const std::string& vertexName, + const std::string& fragmentName, + const VkBuffer colorBuffer, + const IVec2& renderSize, + const VkFormat colorFormat, + const Vec4& clearColor, + const VkPrimitiveTopology topology, + SpecializationMap specMap = SpecializationMap()) + : m_colorBuffer (colorBuffer) + , m_renderSize (renderSize) + , m_colorFormat (colorFormat) + , m_colorSubresourceRange (makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u)) + , m_clearColor (clearColor) + , m_topology (topology) + , m_descriptorSetLayout (descriptorSetLayout) + { + m_colorImage = makeImage (vk, device, makeImageCreateInfo(m_colorFormat, m_renderSize, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT)); + m_colorImageAlloc = bindImage (vk, device, allocator, *m_colorImage, MemoryRequirement::Any); + m_colorAttachment = makeImageView (vk, device, *m_colorImage, VK_IMAGE_VIEW_TYPE_2D, m_colorFormat, m_colorSubresourceRange); + + m_vertexModule = createShaderModule (vk, device, binaryCollection.get(vertexName), 0u); + m_fragmentModule = createShaderModule (vk, device, binaryCollection.get(fragmentName), 0u); + + const VkPipelineShaderStageCreateInfo pShaderStages[] = + { + { + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkPipelineShaderStageCreateFlags)0, // VkPipelineShaderStageCreateFlags flags; + VK_SHADER_STAGE_VERTEX_BIT, // VkShaderStageFlagBits stage; + *m_vertexModule, // VkShaderModule module; + "main", // const char* pName; + specMap[VK_SHADER_STAGE_VERTEX_BIT], // const VkSpecializationInfo* pSpecializationInfo; + }, + { + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkPipelineShaderStageCreateFlags)0, // VkPipelineShaderStageCreateFlags flags; + VK_SHADER_STAGE_FRAGMENT_BIT, // VkShaderStageFlagBits stage; + *m_fragmentModule, // VkShaderModule module; + "main", // const char* pName; + specMap[VK_SHADER_STAGE_FRAGMENT_BIT], // const VkSpecializationInfo* pSpecializationInfo; + } + }; + + m_renderPass = makeRenderPass (vk, device, m_colorFormat); + m_framebuffer = makeFramebuffer (vk, device, *m_renderPass, 1u, &m_colorAttachment.get(), + static_cast(m_renderSize.x()), static_cast(m_renderSize.y())); + m_pipelineLayout = makePipelineLayout (vk, device, m_descriptorSetLayout); + m_pipeline = makeGraphicsPipeline (vk, device, *m_pipelineLayout, *m_renderPass, m_renderSize, m_topology, DE_LENGTH_OF_ARRAY(pShaderStages), pShaderStages); + m_cmdPool = makeCommandPool (vk, device, queueFamilyIndex); + m_cmdBuffer = makeCommandBuffer (vk, device, *m_cmdPool); + } + + void draw (const DeviceInterface& vk, + const VkDevice device, + const VkQueue queue, + const Delegate& drawDelegate) const + { + beginCommandBuffer(vk, *m_cmdBuffer); + + const VkClearValue clearValue = makeClearValueColor(m_clearColor); + const VkRect2D renderArea = + { + makeOffset2D(0, 0), + makeExtent2D(m_renderSize.x(), m_renderSize.y()), + }; + const VkRenderPassBeginInfo renderPassBeginInfo = + { + VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + *m_renderPass, // VkRenderPass renderPass; + *m_framebuffer, // VkFramebuffer framebuffer; + renderArea, // VkRect2D renderArea; + 1u, // uint32_t clearValueCount; + &clearValue, // const VkClearValue* pClearValues; + }; + vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE); + + vk.cmdBindPipeline(*m_cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, *m_pipeline); + drawDelegate.rendererDraw(*m_pipelineLayout, *m_cmdBuffer); + + vk.cmdEndRenderPass(*m_cmdBuffer); + + // Prepare color image for copy + { + const VkImageMemoryBarrier barriers[] = + { + { + VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // VkStructureType sType; + DE_NULL, // const void* pNext; + VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, // VkAccessFlags outputMask; + VK_ACCESS_TRANSFER_READ_BIT, // VkAccessFlags inputMask; + 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 destQueueFamilyIndex; + *m_colorImage, // VkImage image; + m_colorSubresourceRange, // VkImageSubresourceRange subresourceRange; + }, + }; + + vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0u, + 0u, DE_NULL, 0u, DE_NULL, DE_LENGTH_OF_ARRAY(barriers), barriers); + } + // Color image -> host buffer + { + const VkBufferImageCopy region = + { + 0ull, // VkDeviceSize bufferOffset; + 0u, // uint32_t bufferRowLength; + 0u, // uint32_t bufferImageHeight; + makeImageSubresourceLayers(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 0u, 1u), // VkImageSubresourceLayers imageSubresource; + makeOffset3D(0, 0, 0), // VkOffset3D imageOffset; + makeExtent3D(m_renderSize.x(), m_renderSize.y(), 1u), // VkExtent3D imageExtent; + }; + + vk.cmdCopyImageToBuffer(*m_cmdBuffer, *m_colorImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, m_colorBuffer, 1u, ®ion); + } + // Buffer write barrier + { + const VkBufferMemoryBarrier barriers[] = + { + { + VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, // VkStructureType sType; + DE_NULL, // const void* pNext; + VK_ACCESS_TRANSFER_WRITE_BIT, // VkAccessFlags srcAccessMask; + VK_ACCESS_HOST_READ_BIT, // VkAccessFlags dstAccessMask; + VK_QUEUE_FAMILY_IGNORED, // uint32_t srcQueueFamilyIndex; + VK_QUEUE_FAMILY_IGNORED, // uint32_t dstQueueFamilyIndex; + m_colorBuffer, // VkBuffer buffer; + 0ull, // VkDeviceSize offset; + VK_WHOLE_SIZE, // VkDeviceSize size; + }, + }; + + vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_HOST_BIT, 0u, + 0u, DE_NULL, DE_LENGTH_OF_ARRAY(barriers), barriers, DE_NULL, 0u); + } + + VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer)); + submitCommandsAndWait(vk, device, queue, *m_cmdBuffer); + } + +private: + const VkBuffer m_colorBuffer; + const IVec2 m_renderSize; + const VkFormat m_colorFormat; + const VkImageSubresourceRange m_colorSubresourceRange; + const Vec4 m_clearColor; + const VkPrimitiveTopology m_topology; + const VkDescriptorSetLayout m_descriptorSetLayout; + + Move m_colorImage; + MovePtr m_colorImageAlloc; + Move m_colorAttachment; + Move m_vertexModule; + Move m_fragmentModule; + Move m_renderPass; + Move m_framebuffer; + Move m_pipelineLayout; + Move m_pipeline; + Move m_cmdPool; + Move m_cmdBuffer; + + // "deleted" + Renderer (const Renderer&); + Renderer& operator= (const Renderer&); +}; + +void bindSparseBuffer (const DeviceInterface& vk, const VkDevice device, const VkQueue sparseQueue, const VkBuffer buffer, const SparseAllocation& sparseAllocation) +{ + const VkSparseBufferMemoryBindInfo sparseBufferMemoryBindInfo = + { + buffer, // VkBuffer buffer; + static_cast(sparseAllocation.memoryBinds.size()), // uint32_t bindCount; + &sparseAllocation.memoryBinds[0], // const VkSparseMemoryBind* pBinds; + }; + + const VkBindSparseInfo bindInfo = + { + VK_STRUCTURE_TYPE_BIND_SPARSE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + 0u, // uint32_t waitSemaphoreCount; + DE_NULL, // const VkSemaphore* pWaitSemaphores; + 1u, // uint32_t bufferBindCount; + &sparseBufferMemoryBindInfo, // const VkSparseBufferMemoryBindInfo* pBufferBinds; + 0u, // uint32_t imageOpaqueBindCount; + DE_NULL, // const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds; + 0u, // uint32_t imageBindCount; + DE_NULL, // const VkSparseImageMemoryBindInfo* pImageBinds; + 0u, // uint32_t signalSemaphoreCount; + DE_NULL, // const VkSemaphore* pSignalSemaphores; + }; + + const Unique fence(makeFence(vk, device)); + + VK_CHECK(vk.queueBindSparse(sparseQueue, 1u, &bindInfo, *fence)); + VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), VK_TRUE, ~0ull)); +} + +class SparseBufferTestInstance : public SparseResourcesBaseInstance, Renderer::Delegate +{ +public: + SparseBufferTestInstance (Context& context, const TestFlags flags) + : SparseResourcesBaseInstance (context) + , m_aliased ((flags & TEST_FLAG_ALIASED) != 0) + , m_residency ((flags & TEST_FLAG_RESIDENCY) != 0) + , m_nonResidentStrict ((flags & TEST_FLAG_NON_RESIDENT_STRICT) != 0) + , m_deviceProperties (getPhysicalDeviceProperties(m_context.getInstanceInterface(), m_context.getPhysicalDevice())) + , m_renderSize (RENDER_SIZE, RENDER_SIZE) + , m_colorFormat (VK_FORMAT_R8G8B8A8_UNORM) + , m_colorBufferSize (m_renderSize.x() * m_renderSize.y() * tcu::getPixelSize(mapVkFormat(m_colorFormat))) + { + const DeviceInterface& vk = m_context.getDeviceInterface(); + const VkPhysicalDeviceFeatures features = getPhysicalDeviceFeatures(m_context.getInstanceInterface(), m_context.getPhysicalDevice()); + + if (!features.sparseBinding) + TCU_THROW(NotSupportedError, "Missing feature: sparseBinding"); + + if (m_residency && !features.sparseResidencyBuffer) + TCU_THROW(NotSupportedError, "Missing feature: sparseResidencyBuffer"); + + if (m_aliased && !features.sparseResidencyAliased) + TCU_THROW(NotSupportedError, "Missing feature: sparseResidencyAliased"); + + if (m_nonResidentStrict && !m_deviceProperties.sparseProperties.residencyNonResidentStrict) + TCU_THROW(NotSupportedError, "Missing sparse property: residencyNonResidentStrict"); + + { + QueueRequirementsVec requirements; + requirements.push_back(QueueRequirements(VK_QUEUE_SPARSE_BINDING_BIT, 1u)); + requirements.push_back(QueueRequirements(VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT, 1u)); + + createDeviceSupportingQueues(requirements); + } + + m_sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0u); + m_universalQueue = getQueue(VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT, 0u); + + m_sharedQueueFamilyIndices[0] = m_sparseQueue.queueFamilyIndex; + m_sharedQueueFamilyIndices[1] = m_universalQueue.queueFamilyIndex; + + m_colorBuffer = makeBuffer(vk, getDevice(), makeBufferCreateInfo(m_colorBufferSize, VK_BUFFER_USAGE_TRANSFER_DST_BIT)); + m_colorBufferAlloc = bindBuffer(vk, getDevice(), getAllocator(), *m_colorBuffer, MemoryRequirement::HostVisible); + + deMemset(m_colorBufferAlloc->getHostPtr(), 0, static_cast(m_colorBufferSize)); + flushMappedMemoryRange(vk, getDevice(), m_colorBufferAlloc->getMemory(), m_colorBufferAlloc->getOffset(), m_colorBufferSize); + } + +protected: + VkBufferCreateInfo getSparseBufferCreateInfo (const VkBufferUsageFlags usage) const + { + VkBufferCreateFlags flags = VK_BUFFER_CREATE_SPARSE_BINDING_BIT; + if (m_residency) + flags |= VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT; + if (m_aliased) + flags |= VK_BUFFER_CREATE_SPARSE_ALIASED_BIT; + + VkBufferCreateInfo referenceBufferCreateInfo = + { + VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + flags, // VkBufferCreateFlags flags; + 0u, // override later // VkDeviceSize size; + VK_BUFFER_USAGE_TRANSFER_DST_BIT | usage, // VkBufferUsageFlags usage; + VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode; + 0u, // uint32_t queueFamilyIndexCount; + DE_NULL, // const uint32_t* pQueueFamilyIndices; + }; + + if (m_sparseQueue.queueFamilyIndex != m_universalQueue.queueFamilyIndex) + { + referenceBufferCreateInfo.sharingMode = VK_SHARING_MODE_CONCURRENT; + referenceBufferCreateInfo.queueFamilyIndexCount = DE_LENGTH_OF_ARRAY(m_sharedQueueFamilyIndices); + referenceBufferCreateInfo.pQueueFamilyIndices = m_sharedQueueFamilyIndices; + } + + return referenceBufferCreateInfo; + } + + void draw (const VkPrimitiveTopology topology, + const VkDescriptorSetLayout descriptorSetLayout = DE_NULL, + Renderer::SpecializationMap specMap = Renderer::SpecializationMap()) + { + const UniquePtr renderer(new Renderer( + m_context.getDeviceInterface(), getDevice(), getAllocator(), m_universalQueue.queueFamilyIndex, descriptorSetLayout, + m_context.getBinaryCollection(), "vert", "frag", *m_colorBuffer, m_renderSize, m_colorFormat, Vec4(1.0f, 0.0f, 0.0f, 1.0f), topology, specMap)); + + renderer->draw(m_context.getDeviceInterface(), getDevice(), m_universalQueue.queueHandle, *this); + } + + tcu::TestStatus verifyDrawResult (void) const + { + invalidateMappedMemoryRange(m_context.getDeviceInterface(), getDevice(), m_colorBufferAlloc->getMemory(), 0ull, m_colorBufferSize); + + const tcu::ConstPixelBufferAccess resultImage (mapVkFormat(m_colorFormat), m_renderSize.x(), m_renderSize.y(), 1u, m_colorBufferAlloc->getHostPtr()); + + m_context.getTestContext().getLog() + << tcu::LogImageSet("Result", "Result") << tcu::LogImage("color0", "", resultImage) << tcu::TestLog::EndImageSet; + + if (imageHasErrorPixels(resultImage)) + return tcu::TestStatus::fail("Some buffer values were incorrect"); + else + return tcu::TestStatus::pass("Pass"); + } + + const bool m_aliased; + const bool m_residency; + const bool m_nonResidentStrict; + const VkPhysicalDeviceProperties m_deviceProperties; + + Queue m_sparseQueue; + Queue m_universalQueue; + +private: + const IVec2 m_renderSize; + const VkFormat m_colorFormat; + const VkDeviceSize m_colorBufferSize; + + Move m_colorBuffer; + MovePtr m_colorBufferAlloc; + + deUint32 m_sharedQueueFamilyIndices[2]; +}; + +void initProgramsDrawWithUBO (vk::SourceCollections& programCollection, const TestFlags flags) +{ + // Vertex shader + { + std::ostringstream src; + src << glu::getGLSLVersionDeclaration(glu::GLSL_VERSION_450) << "\n" + << "\n" + << "layout(location = 0) in vec4 in_position;\n" + << "\n" + << "out gl_PerVertex {\n" + << " vec4 gl_Position;\n" + << "};\n" + << "\n" + << "void main(void)\n" + << "{\n" + << " gl_Position = in_position;\n" + << "}\n"; + + programCollection.glslSources.add("vert") << glu::VertexSource(src.str()); + } + + // Fragment shader + { + const bool aliased = (flags & TEST_FLAG_ALIASED) != 0; + const bool residency = (flags & TEST_FLAG_RESIDENCY) != 0; + const bool nonResidentStrict = (flags & TEST_FLAG_NON_RESIDENT_STRICT) != 0; + const std::string valueExpr = (aliased ? "ivec4(3*(ndx % nonAliasedSize) ^ 127, 0, 0, 0)" : "ivec4(3*ndx ^ 127, 0, 0, 0)"); + + std::ostringstream src; + src << glu::getGLSLVersionDeclaration(glu::GLSL_VERSION_450) << "\n" + << "\n" + << "layout(location = 0) out vec4 o_color;\n" + << "\n" + << "layout(constant_id = 1) const int dataSize = 1;\n" + << "layout(constant_id = 2) const int chunkSize = 1;\n" + << "\n" + << "layout(set = 0, binding = 0, std140) uniform SparseBuffer {\n" + << " ivec4 data[dataSize];\n" + << "} ubo;\n" + << "\n" + << "void main(void)\n" + << "{\n" + << " const int fragNdx = int(gl_FragCoord.x) + " << RENDER_SIZE << " * int(gl_FragCoord.y);\n" + << " const int pageSize = " << RENDER_SIZE << " * " << RENDER_SIZE << ";\n" + << " const int numChunks = dataSize / chunkSize;\n"; + + if (aliased) + src << " const int nonAliasedSize = (numChunks > 1 ? dataSize - chunkSize : dataSize);\n"; + + src << " bool ok = true;\n" + << "\n" + << " for (int ndx = fragNdx; ndx < dataSize; ndx += pageSize)\n" + << " {\n"; + + if (residency && nonResidentStrict) + { + src << " if (ndx >= chunkSize && ndx < 2*chunkSize)\n" + << " ok = ok && (ubo.data[ndx] == ivec4(0));\n" + << " else\n" + << " ok = ok && (ubo.data[ndx] == " + valueExpr + ");\n"; + } + else if (residency) + { + src << " if (ndx >= chunkSize && ndx < 2*chunkSize)\n" + << " continue;\n" + << " ok = ok && (ubo.data[ndx] == " << valueExpr << ");\n"; + } + else + src << " ok = ok && (ubo.data[ndx] == " << valueExpr << ");\n"; + + src << " }\n" + << "\n" + << " if (ok)\n" + << " o_color = vec4(0.0, 1.0, 0.0, 1.0);\n" + << " else\n" + << " o_color = vec4(1.0, 0.0, 0.0, 1.0);\n" + << "}\n"; + + programCollection.glslSources.add("frag") << glu::FragmentSource(src.str()); + } +} + +//! Sparse buffer backing a UBO +class UBOTestInstance : public SparseBufferTestInstance +{ +public: + UBOTestInstance (Context& context, const TestFlags flags) + : SparseBufferTestInstance (context, flags) + { + } + + void rendererDraw (const VkPipelineLayout pipelineLayout, const VkCommandBuffer cmdBuffer) const + { + const DeviceInterface& vk = m_context.getDeviceInterface(); + const VkDeviceSize vertexOffset = 0ull; + + vk.cmdBindVertexBuffers (cmdBuffer, 0u, 1u, &m_vertexBuffer.get(), &vertexOffset); + vk.cmdBindDescriptorSets(cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0u, 1u, &m_descriptorSet.get(), 0u, DE_NULL); + vk.cmdDraw (cmdBuffer, 4u, 1u, 0u, 0u); + } + + tcu::TestStatus iterate (void) + { + const DeviceInterface& vk = m_context.getDeviceInterface(); + MovePtr sparseAllocation; + Move sparseBuffer; + Move sparseBufferAliased; + + // Set up the sparse buffer + { + VkBufferCreateInfo referenceBufferCreateInfo = getSparseBufferCreateInfo(VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT); + const VkDeviceSize minChunkSize = 512u; // make sure the smallest allocation is at least this big + deUint32 numMaxChunks = 0u; + + // Check how many chunks we can allocate given the alignment and size requirements of UBOs + { + const UniquePtr minAllocation(SparseAllocationBuilder() + .addMemoryBind() + .build(vk, getDevice(), getAllocator(), referenceBufferCreateInfo, minChunkSize)); + + if (minAllocation->resourceSize > m_deviceProperties.limits.maxUniformBufferRange) + return tcu::TestStatus::fail("The smallest sparse UBO size exceeds maxUniformBufferRange limit"); + + numMaxChunks = static_cast(m_deviceProperties.limits.maxUniformBufferRange / minAllocation->resourceSize); + } + + if (numMaxChunks < 4) + { + sparseAllocation = SparseAllocationBuilder() + .addMemoryBind() + .build(vk, getDevice(), getAllocator(), referenceBufferCreateInfo, minChunkSize); + } + else + { + // Try to use a non-trivial memory allocation scheme to make it different from a non-sparse binding + SparseAllocationBuilder builder; + builder.addMemoryBind(); + + if (m_residency) + builder.addResourceHole(); + + builder + .addMemoryAllocation() + .addMemoryHole() + .addMemoryBind(); + + if (m_aliased) + builder.addAliasedMemoryBind(0u, 0u); + + sparseAllocation = builder.build(vk, getDevice(), getAllocator(), referenceBufferCreateInfo, minChunkSize); + DE_ASSERT(sparseAllocation->resourceSize <= m_deviceProperties.limits.maxUniformBufferRange); + } + + // Create the buffer + referenceBufferCreateInfo.size = sparseAllocation->resourceSize; + sparseBuffer = makeBuffer(vk, getDevice(), referenceBufferCreateInfo); + bindSparseBuffer(vk, getDevice(), m_sparseQueue.queueHandle, *sparseBuffer, *sparseAllocation); + + if (m_aliased) + { + sparseBufferAliased = makeBuffer(vk, getDevice(), referenceBufferCreateInfo); + bindSparseBuffer(vk, getDevice(), m_sparseQueue.queueHandle, *sparseBufferAliased, *sparseAllocation); + } + } + + // Set uniform data + { + const bool hasAliasedChunk = (m_aliased && sparseAllocation->memoryBinds.size() > 1u); + const VkDeviceSize chunkSize = sparseAllocation->resourceSize / sparseAllocation->numResourceChunks; + const VkDeviceSize stagingBufferSize = sparseAllocation->resourceSize - (hasAliasedChunk ? chunkSize : 0); + const deUint32 numBufferEntries = static_cast(stagingBufferSize / sizeof(IVec4)); + + const Unique stagingBuffer (makeBuffer(vk, getDevice(), makeBufferCreateInfo(stagingBufferSize, VK_BUFFER_USAGE_TRANSFER_SRC_BIT))); + const UniquePtr stagingBufferAlloc (bindBuffer(vk, getDevice(), getAllocator(), *stagingBuffer, MemoryRequirement::HostVisible)); + + { + // If aliased chunk is used, the staging buffer is smaller than the sparse buffer and we don't overwrite the last chunk + IVec4* const pData = static_cast(stagingBufferAlloc->getHostPtr()); + for (deUint32 i = 0; i < numBufferEntries; ++i) + pData[i] = IVec4(3*i ^ 127, 0, 0, 0); + + flushMappedMemoryRange(vk, getDevice(), stagingBufferAlloc->getMemory(), stagingBufferAlloc->getOffset(), stagingBufferSize); + + const VkBufferCopy copyRegion = + { + 0ull, // VkDeviceSize srcOffset; + 0ull, // VkDeviceSize dstOffset; + stagingBufferSize, // VkDeviceSize size; + }; + + const Unique cmdPool (makeCommandPool (vk, getDevice(), m_universalQueue.queueFamilyIndex)); + const Unique cmdBuffer (makeCommandBuffer (vk, getDevice(), *cmdPool)); + + beginCommandBuffer (vk, *cmdBuffer); + vk.cmdCopyBuffer (*cmdBuffer, *stagingBuffer, *sparseBuffer, 1u, ©Region); + endCommandBuffer (vk, *cmdBuffer); + + submitCommandsAndWait(vk, getDevice(), m_universalQueue.queueHandle, *cmdBuffer); + // Once the fence is signaled, the write is also available to the aliasing buffer. + } + } + + // Descriptor sets + { + m_descriptorSetLayout = DescriptorSetLayoutBuilder() + .addSingleBinding(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_SHADER_STAGE_FRAGMENT_BIT) + .build(vk, getDevice()); + + m_descriptorPool = DescriptorPoolBuilder() + .addType(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) + .build(vk, getDevice(), VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, 1u); + + m_descriptorSet = makeDescriptorSet(vk, getDevice(), *m_descriptorPool, *m_descriptorSetLayout); + + const VkBuffer buffer = (m_aliased ? *sparseBufferAliased : *sparseBuffer); + const VkDescriptorBufferInfo sparseBufferInfo = makeDescriptorBufferInfo(buffer, 0ull, sparseAllocation->resourceSize); + + DescriptorSetUpdateBuilder() + .writeSingle(*m_descriptorSet, DescriptorSetUpdateBuilder::Location::binding(0u), VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, &sparseBufferInfo) + .update(vk, getDevice()); + } + + // Vertex data + { + const Vec4 vertexData[] = + { + Vec4(-1.0f, -1.0f, 0.0f, 1.0f), + Vec4(-1.0f, 1.0f, 0.0f, 1.0f), + Vec4( 1.0f, -1.0f, 0.0f, 1.0f), + Vec4( 1.0f, 1.0f, 0.0f, 1.0f), + }; + + const VkDeviceSize vertexBufferSize = sizeof(vertexData); + + m_vertexBuffer = makeBuffer(vk, getDevice(), makeBufferCreateInfo(vertexBufferSize, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT)); + m_vertexBufferAlloc = bindBuffer(vk, getDevice(), getAllocator(), *m_vertexBuffer, MemoryRequirement::HostVisible); + + deMemcpy(m_vertexBufferAlloc->getHostPtr(), &vertexData[0], vertexBufferSize); + flushMappedMemoryRange(vk, getDevice(), m_vertexBufferAlloc->getMemory(), m_vertexBufferAlloc->getOffset(), vertexBufferSize); + } + + // Draw + { + std::vector specializationData; + { + const deUint32 numBufferEntries = static_cast(sparseAllocation->resourceSize / sizeof(IVec4)); + const deUint32 numEntriesPerChunk = numBufferEntries / sparseAllocation->numResourceChunks; + + specializationData.push_back(numBufferEntries); + specializationData.push_back(numEntriesPerChunk); + } + + const VkSpecializationMapEntry specMapEntries[] = + { + { + 1u, // uint32_t constantID; + 0u, // uint32_t offset; + sizeof(deInt32), // size_t size; + }, + { + 2u, // uint32_t constantID; + sizeof(deInt32), // uint32_t offset; + sizeof(deInt32), // size_t size; + }, + }; + + const VkSpecializationInfo specInfo = + { + DE_LENGTH_OF_ARRAY(specMapEntries), // uint32_t mapEntryCount; + specMapEntries, // const VkSpecializationMapEntry* pMapEntries; + sizeInBytes(specializationData), // size_t dataSize; + getDataOrNullptr(specializationData), // const void* pData; + }; + + Renderer::SpecializationMap specMap; + specMap[VK_SHADER_STAGE_FRAGMENT_BIT] = &specInfo; + + draw(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP, *m_descriptorSetLayout, specMap); + } + + return verifyDrawResult(); + } + +private: + Move m_vertexBuffer; + MovePtr m_vertexBufferAlloc; + + Move m_descriptorSetLayout; + Move m_descriptorPool; + Move m_descriptorSet; +}; + +void initProgramsDrawGrid (vk::SourceCollections& programCollection, const TestFlags flags) +{ + DE_UNREF(flags); + + // Vertex shader + { + std::ostringstream src; + src << glu::getGLSLVersionDeclaration(glu::GLSL_VERSION_450) << "\n" + << "\n" + << "layout(location = 0) in vec4 in_position;\n" + << "layout(location = 0) out int out_ndx;\n" + << "\n" + << "out gl_PerVertex {\n" + << " vec4 gl_Position;\n" + << "};\n" + << "\n" + << "void main(void)\n" + << "{\n" + << " gl_Position = in_position;\n" + << " out_ndx = gl_VertexIndex;\n" + << "}\n"; + + programCollection.glslSources.add("vert") << glu::VertexSource(src.str()); + } + + // Fragment shader + { + std::ostringstream src; + src << glu::getGLSLVersionDeclaration(glu::GLSL_VERSION_450) << "\n" + << "\n" + << "layout(location = 0) flat in int in_ndx;\n" + << "layout(location = 0) out vec4 o_color;\n" + << "\n" + << "void main(void)\n" + << "{\n" + << " if (in_ndx % 2 == 0)\n" + << " o_color = vec4(vec3(1.0), 1.0);\n" + << " else\n" + << " o_color = vec4(vec3(0.75), 1.0);\n" + << "}\n"; + + programCollection.glslSources.add("frag") << glu::FragmentSource(src.str()); + } +} + +//! Generate vertex positions for a grid of tiles composed of two triangles each (6 vertices) +void generateGrid (void* pRawData, const float step, const float ox, const float oy, const deUint32 numX, const deUint32 numY, const float z = 0.0f) +{ + typedef Vec4 (*TilePtr)[6]; + + TilePtr const pData = static_cast(pRawData); + { + for (deUint32 iy = 0; iy < numY; ++iy) + for (deUint32 ix = 0; ix < numX; ++ix) + { + const deUint32 ndx = ix + numX * iy; + const float x = ox + step * static_cast(ix); + const float y = oy + step * static_cast(iy); + + pData[ndx][0] = Vec4(x + step, y, z, 1.0f); + pData[ndx][1] = Vec4(x, y, z, 1.0f); + pData[ndx][2] = Vec4(x, y + step, z, 1.0f); + + pData[ndx][3] = Vec4(x, y + step, z, 1.0f); + pData[ndx][4] = Vec4(x + step, y + step, z, 1.0f); + pData[ndx][5] = Vec4(x + step, y, z, 1.0f); + } + } +} + +//! Base test for a sparse buffer backing a vertex/index buffer +class DrawGridTestInstance : public SparseBufferTestInstance +{ +public: + DrawGridTestInstance (Context& context, const TestFlags flags, const VkBufferUsageFlags usage, const VkDeviceSize minChunkSize) + : SparseBufferTestInstance (context, flags) + { + const DeviceInterface& vk = m_context.getDeviceInterface(); + VkBufferCreateInfo referenceBufferCreateInfo = getSparseBufferCreateInfo(usage); + + { + // Allocate two chunks, each covering half of the viewport + SparseAllocationBuilder builder; + builder.addMemoryBind(); + + if (m_residency) + builder.addResourceHole(); + + builder + .addMemoryAllocation() + .addMemoryHole() + .addMemoryBind(); + + if (m_aliased) + builder.addAliasedMemoryBind(0u, 0u); + + m_sparseAllocation = builder.build(vk, getDevice(), getAllocator(), referenceBufferCreateInfo, minChunkSize); + } + + // Create the buffer + referenceBufferCreateInfo.size = m_sparseAllocation->resourceSize; + m_sparseBuffer = makeBuffer(vk, getDevice(), referenceBufferCreateInfo); + + // Bind the memory + bindSparseBuffer(vk, getDevice(), m_sparseQueue.queueHandle, *m_sparseBuffer, *m_sparseAllocation); + + m_perDrawBufferOffset = m_sparseAllocation->resourceSize / m_sparseAllocation->numResourceChunks; + m_stagingBufferSize = 2 * m_perDrawBufferOffset; + m_stagingBuffer = makeBuffer(vk, getDevice(), makeBufferCreateInfo(m_stagingBufferSize, VK_BUFFER_USAGE_TRANSFER_SRC_BIT)); + m_stagingBufferAlloc = bindBuffer(vk, getDevice(), getAllocator(), *m_stagingBuffer, MemoryRequirement::HostVisible); + } + + tcu::TestStatus iterate (void) + { + initializeBuffers(); + + const DeviceInterface& vk = m_context.getDeviceInterface(); + + // Upload to the sparse buffer + { + flushMappedMemoryRange(vk, getDevice(), m_stagingBufferAlloc->getMemory(), m_stagingBufferAlloc->getOffset(), m_stagingBufferSize); + + VkDeviceSize firstChunkOffset = 0ull; + VkDeviceSize secondChunkOffset = m_perDrawBufferOffset; + + if (m_residency) + secondChunkOffset += m_perDrawBufferOffset; + + if (m_aliased) + firstChunkOffset = secondChunkOffset + m_perDrawBufferOffset; + + const VkBufferCopy copyRegions[] = + { + { + 0ull, // VkDeviceSize srcOffset; + firstChunkOffset, // VkDeviceSize dstOffset; + m_perDrawBufferOffset, // VkDeviceSize size; + }, + { + m_perDrawBufferOffset, // VkDeviceSize srcOffset; + secondChunkOffset, // VkDeviceSize dstOffset; + m_perDrawBufferOffset, // VkDeviceSize size; + }, + }; + + const Unique cmdPool (makeCommandPool (vk, getDevice(), m_universalQueue.queueFamilyIndex)); + const Unique cmdBuffer (makeCommandBuffer (vk, getDevice(), *cmdPool)); + + beginCommandBuffer (vk, *cmdBuffer); + vk.cmdCopyBuffer (*cmdBuffer, *m_stagingBuffer, *m_sparseBuffer, DE_LENGTH_OF_ARRAY(copyRegions), copyRegions); + endCommandBuffer (vk, *cmdBuffer); + + submitCommandsAndWait(vk, getDevice(), m_universalQueue.queueHandle, *cmdBuffer); + } + + draw(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST); + + return verifyDrawResult(); + } + +protected: + virtual void initializeBuffers (void) = 0; + + VkDeviceSize m_perDrawBufferOffset; + + VkDeviceSize m_stagingBufferSize; + Move m_stagingBuffer; + MovePtr m_stagingBufferAlloc; + + MovePtr m_sparseAllocation; + Move m_sparseBuffer; +}; + +//! Sparse buffer backing a vertex input buffer +class VertexBufferTestInstance : public DrawGridTestInstance +{ +public: + VertexBufferTestInstance (Context& context, const TestFlags flags) + : DrawGridTestInstance (context, + flags, + VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, + GRID_SIZE * GRID_SIZE * 6 * sizeof(Vec4)) + { + } + + void rendererDraw (const VkPipelineLayout pipelineLayout, const VkCommandBuffer cmdBuffer) const + { + DE_UNREF(pipelineLayout); + + m_context.getTestContext().getLog() + << tcu::TestLog::Message << "Drawing a grid of triangles backed by a sparse vertex buffer. There should be no red pixels visible." << tcu::TestLog::EndMessage; + + const DeviceInterface& vk = m_context.getDeviceInterface(); + const deUint32 vertexCount = 6 * (GRID_SIZE * GRID_SIZE) / 2; + VkDeviceSize vertexOffset = 0ull; + + vk.cmdBindVertexBuffers (cmdBuffer, 0u, 1u, &m_sparseBuffer.get(), &vertexOffset); + vk.cmdDraw (cmdBuffer, vertexCount, 1u, 0u, 0u); + + vertexOffset += m_perDrawBufferOffset * (m_residency ? 2 : 1); + + vk.cmdBindVertexBuffers (cmdBuffer, 0u, 1u, &m_sparseBuffer.get(), &vertexOffset); + vk.cmdDraw (cmdBuffer, vertexCount, 1u, 0u, 0u); + } + + void initializeBuffers (void) + { + deUint8* pData = static_cast(m_stagingBufferAlloc->getHostPtr()); + const float step = 2.0f / static_cast(GRID_SIZE); + + // Prepare data for two draw calls + generateGrid(pData, step, -1.0f, -1.0f, GRID_SIZE, GRID_SIZE/2); + generateGrid(pData + m_perDrawBufferOffset, step, -1.0f, 0.0f, GRID_SIZE, GRID_SIZE/2); + } +}; + +//! Sparse buffer backing an index buffer +class IndexBufferTestInstance : public DrawGridTestInstance +{ +public: + IndexBufferTestInstance (Context& context, const TestFlags flags) + : DrawGridTestInstance (context, + flags, + VK_BUFFER_USAGE_INDEX_BUFFER_BIT, + GRID_SIZE * GRID_SIZE * 6 * sizeof(deUint32)) + , m_halfVertexCount (6 * (GRID_SIZE * GRID_SIZE) / 2) + { + } + + void rendererDraw (const VkPipelineLayout pipelineLayout, const VkCommandBuffer cmdBuffer) const + { + DE_UNREF(pipelineLayout); + + m_context.getTestContext().getLog() + << tcu::TestLog::Message << "Drawing a grid of triangles from a sparse index buffer. There should be no red pixels visible." << tcu::TestLog::EndMessage; + + const DeviceInterface& vk = m_context.getDeviceInterface(); + const VkDeviceSize vertexOffset = 0ull; + VkDeviceSize indexOffset = 0ull; + + vk.cmdBindVertexBuffers (cmdBuffer, 0u, 1u, &m_vertexBuffer.get(), &vertexOffset); + + vk.cmdBindIndexBuffer (cmdBuffer, *m_sparseBuffer, indexOffset, VK_INDEX_TYPE_UINT32); + vk.cmdDrawIndexed (cmdBuffer, m_halfVertexCount, 1u, 0u, 0, 0u); + + indexOffset += m_perDrawBufferOffset * (m_residency ? 2 : 1); + + vk.cmdBindIndexBuffer (cmdBuffer, *m_sparseBuffer, indexOffset, VK_INDEX_TYPE_UINT32); + vk.cmdDrawIndexed (cmdBuffer, m_halfVertexCount, 1u, 0u, 0, 0u); + } + + void initializeBuffers (void) + { + // Vertex buffer + const DeviceInterface& vk = m_context.getDeviceInterface(); + const VkDeviceSize vertexBufferSize = 2 * m_halfVertexCount * sizeof(Vec4); + m_vertexBuffer = makeBuffer(vk, getDevice(), makeBufferCreateInfo(vertexBufferSize, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT)); + m_vertexBufferAlloc = bindBuffer(vk, getDevice(), getAllocator(), *m_vertexBuffer, MemoryRequirement::HostVisible); + + { + const float step = 2.0f / static_cast(GRID_SIZE); + + generateGrid(m_vertexBufferAlloc->getHostPtr(), step, -1.0f, -1.0f, GRID_SIZE, GRID_SIZE); + + flushMappedMemoryRange(vk, getDevice(), m_vertexBufferAlloc->getMemory(), m_vertexBufferAlloc->getOffset(), vertexBufferSize); + } + + // Sparse index buffer + for (deUint32 chunkNdx = 0u; chunkNdx < 2; ++chunkNdx) + { + deUint8* const pData = static_cast(m_stagingBufferAlloc->getHostPtr()) + chunkNdx * m_perDrawBufferOffset; + deUint32* const pIndexData = reinterpret_cast(pData); + const deUint32 ndxBase = chunkNdx * m_halfVertexCount; + + for (deUint32 i = 0u; i < m_halfVertexCount; ++i) + pIndexData[i] = ndxBase + i; + } + } + +private: + const deUint32 m_halfVertexCount; + Move m_vertexBuffer; + MovePtr m_vertexBufferAlloc; +}; + +//! Draw from a sparse indirect buffer +class IndirectBufferTestInstance : public DrawGridTestInstance +{ +public: + IndirectBufferTestInstance (Context& context, const TestFlags flags) + : DrawGridTestInstance (context, + flags, + VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT, + sizeof(VkDrawIndirectCommand)) + { + } + + void rendererDraw (const VkPipelineLayout pipelineLayout, const VkCommandBuffer cmdBuffer) const + { + DE_UNREF(pipelineLayout); + + m_context.getTestContext().getLog() + << tcu::TestLog::Message << "Drawing two triangles covering the whole viewport. There should be no red pixels visible." << tcu::TestLog::EndMessage; + + const DeviceInterface& vk = m_context.getDeviceInterface(); + const VkDeviceSize vertexOffset = 0ull; + VkDeviceSize indirectOffset = 0ull; + + vk.cmdBindVertexBuffers (cmdBuffer, 0u, 1u, &m_vertexBuffer.get(), &vertexOffset); + vk.cmdDrawIndirect (cmdBuffer, *m_sparseBuffer, indirectOffset, 1u, 0u); + + indirectOffset += m_perDrawBufferOffset * (m_residency ? 2 : 1); + + vk.cmdDrawIndirect (cmdBuffer, *m_sparseBuffer, indirectOffset, 1u, 0u); + } + + void initializeBuffers (void) + { + // Vertex buffer + const DeviceInterface& vk = m_context.getDeviceInterface(); + const VkDeviceSize vertexBufferSize = 2 * 3 * sizeof(Vec4); + m_vertexBuffer = makeBuffer(vk, getDevice(), makeBufferCreateInfo(vertexBufferSize, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT)); + m_vertexBufferAlloc = bindBuffer(vk, getDevice(), getAllocator(), *m_vertexBuffer, MemoryRequirement::HostVisible); + + { + generateGrid(m_vertexBufferAlloc->getHostPtr(), 2.0f, -1.0f, -1.0f, 1, 1); + flushMappedMemoryRange(vk, getDevice(), m_vertexBufferAlloc->getMemory(), m_vertexBufferAlloc->getOffset(), vertexBufferSize); + } + + // Indirect buffer + for (deUint32 chunkNdx = 0u; chunkNdx < 2; ++chunkNdx) + { + deUint8* const pData = static_cast(m_stagingBufferAlloc->getHostPtr()) + chunkNdx * m_perDrawBufferOffset; + VkDrawIndirectCommand* const pCmdData = reinterpret_cast(pData); + + pCmdData->firstVertex = 3u * chunkNdx; + pCmdData->firstInstance = 0u; + pCmdData->vertexCount = 3u; + pCmdData->instanceCount = 1u; + } + } + +private: + Move m_vertexBuffer; + MovePtr m_vertexBufferAlloc; +}; + +//! Similar to the class in vktTestCaseUtil.hpp, but uses Arg0 directly rather than through a InstanceFunction1 +template +class FunctionProgramsSimple1 +{ +public: + typedef void (*Function) (vk::SourceCollections& dst, Arg0 arg0); + FunctionProgramsSimple1 (Function func) : m_func(func) {} + void init (vk::SourceCollections& dst, const Arg0& arg0) const { m_func(dst, arg0); } + +private: + const Function m_func; +}; + +//! Convenience function to create a TestCase based on a freestanding initPrograms and a TestInstance implementation +template +TestCase* createTestInstanceWithPrograms (tcu::TestContext& testCtx, + const std::string& name, + const std::string& desc, + typename FunctionProgramsSimple1::Function initPrograms, + Arg0 arg0) +{ + return new InstanceFactory1 >( + testCtx, tcu::NODETYPE_SELF_VALIDATE, name, desc, FunctionProgramsSimple1(initPrograms), arg0); +} + +void populateTestGroup (tcu::TestCaseGroup* parentGroup) +{ + const struct + { + std::string name; + TestFlags flags; + } groups[] = + { + { "sparse_binding", 0u }, + { "sparse_binding_aliased", TEST_FLAG_ALIASED, }, + { "sparse_residency", TEST_FLAG_RESIDENCY, }, + { "sparse_residency_aliased", TEST_FLAG_RESIDENCY | TEST_FLAG_ALIASED, }, + { "sparse_residency_non_resident_strict", TEST_FLAG_RESIDENCY | TEST_FLAG_NON_RESIDENT_STRICT, }, + }; + + const int numGroupsIncludingNonResidentStrict = DE_LENGTH_OF_ARRAY(groups); + const int numGroupsDefaultList = numGroupsIncludingNonResidentStrict - 1; + + // Transfer + { + MovePtr group(new tcu::TestCaseGroup(parentGroup->getTestContext(), "transfer", "")); + { + MovePtr subGroup(new tcu::TestCaseGroup(parentGroup->getTestContext(), "sparse_binding", "")); + addBufferSparseBindingTests(subGroup.get()); + group->addChild(subGroup.release()); + } + parentGroup->addChild(group.release()); + } + + // SSBO + { + MovePtr group(new tcu::TestCaseGroup(parentGroup->getTestContext(), "ssbo", "")); + { + MovePtr subGroup(new tcu::TestCaseGroup(parentGroup->getTestContext(), "sparse_binding_aliased", "")); + addBufferSparseMemoryAliasingTests(subGroup.get()); + group->addChild(subGroup.release()); + } + { + MovePtr subGroup(new tcu::TestCaseGroup(parentGroup->getTestContext(), "sparse_residency", "")); + addBufferSparseResidencyTests(subGroup.get()); + group->addChild(subGroup.release()); + } + parentGroup->addChild(group.release()); + } + + // UBO + { + MovePtr group(new tcu::TestCaseGroup(parentGroup->getTestContext(), "ubo", "")); + + for (int groupNdx = 0u; groupNdx < numGroupsIncludingNonResidentStrict; ++groupNdx) + group->addChild(createTestInstanceWithPrograms(group->getTestContext(), groups[groupNdx].name.c_str(), "", initProgramsDrawWithUBO, groups[groupNdx].flags)); + + parentGroup->addChild(group.release()); + } + + // Vertex buffer + { + MovePtr group(new tcu::TestCaseGroup(parentGroup->getTestContext(), "vertex_buffer", "")); + + for (int groupNdx = 0u; groupNdx < numGroupsDefaultList; ++groupNdx) + group->addChild(createTestInstanceWithPrograms(group->getTestContext(), groups[groupNdx].name.c_str(), "", initProgramsDrawGrid, groups[groupNdx].flags)); + + parentGroup->addChild(group.release()); + } + + // Index buffer + { + MovePtr group(new tcu::TestCaseGroup(parentGroup->getTestContext(), "index_buffer", "")); + + for (int groupNdx = 0u; groupNdx < numGroupsDefaultList; ++groupNdx) + group->addChild(createTestInstanceWithPrograms(group->getTestContext(), groups[groupNdx].name.c_str(), "", initProgramsDrawGrid, groups[groupNdx].flags)); + + parentGroup->addChild(group.release()); + } + + // Indirect buffer + { + MovePtr group(new tcu::TestCaseGroup(parentGroup->getTestContext(), "indirect_buffer", "")); + + for (int groupNdx = 0u; groupNdx < numGroupsDefaultList; ++groupNdx) + group->addChild(createTestInstanceWithPrograms(group->getTestContext(), groups[groupNdx].name.c_str(), "", initProgramsDrawGrid, groups[groupNdx].flags)); + + parentGroup->addChild(group.release()); + } +} + +} // anonymous ns + +tcu::TestCaseGroup* createSparseBufferTests (tcu::TestContext& testCtx) +{ + return createTestGroup(testCtx, "buffer", "Sparse buffer usage tests", populateTestGroup); +} + +} // sparse +} // vkt diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferTests.hpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferTests.hpp new file mode 100644 index 000000000..2443c06fa --- /dev/null +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferTests.hpp @@ -0,0 +1,39 @@ +#ifndef _VKTSPARSERESOURCESBUFFERTESTS_HPP +#define _VKTSPARSERESOURCESBUFFERTESTS_HPP +/*------------------------------------------------------------------------ + * Vulkan Conformance Tests + * ------------------------ + * + * Copyright (c) 2016 The Khronos Group Inc. + * + * 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 Sparse buffer tests + *//*--------------------------------------------------------------------*/ + +#include "tcuDefs.hpp" +#include "vktTestCase.hpp" + +namespace vkt +{ +namespace sparse +{ + +tcu::TestCaseGroup* createSparseBufferTests (tcu::TestContext& testCtx); + +} // sparse +} // vkt + +#endif // _VKTSPARSERESOURCESBUFFERTESTS_HPP diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesTests.cpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesTests.cpp index 44b8f6826..ad9e7c704 100644 --- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesTests.cpp +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesTests.cpp @@ -22,15 +22,13 @@ *//*--------------------------------------------------------------------*/ #include "vktSparseResourcesTests.hpp" -#include "vktSparseResourcesBufferSparseBinding.hpp" #include "vktSparseResourcesImageSparseBinding.hpp" -#include "vktSparseResourcesBufferSparseResidency.hpp" #include "vktSparseResourcesImageSparseResidency.hpp" #include "vktSparseResourcesMipmapSparseResidency.hpp" -#include "vktSparseResourcesBufferMemoryAliasing.hpp" #include "vktSparseResourcesImageMemoryAliasing.hpp" #include "vktSparseResourcesShaderIntrinsics.hpp" #include "vktSparseResourcesQueueBindSparseTests.hpp" +#include "vktSparseResourcesBufferTests.hpp" #include "deUniquePtr.hpp" namespace vkt @@ -42,12 +40,10 @@ tcu::TestCaseGroup* createTests (tcu::TestContext& testCtx) { de::MovePtr sparseTests (new tcu::TestCaseGroup(testCtx, "sparse_resources", "Sparse Resources Tests")); - sparseTests->addChild(createBufferSparseBindingTests (testCtx)); + sparseTests->addChild(createSparseBufferTests (testCtx)); sparseTests->addChild(createImageSparseBindingTests (testCtx)); - sparseTests->addChild(createBufferSparseResidencyTests (testCtx)); sparseTests->addChild(createImageSparseResidencyTests (testCtx)); sparseTests->addChild(createMipmapSparseResidencyTests (testCtx)); - sparseTests->addChild(createBufferSparseMemoryAliasingTests (testCtx)); sparseTests->addChild(createImageSparseMemoryAliasingTests (testCtx)); sparseTests->addChild(createSparseResourcesShaderIntrinsicsTests(testCtx)); sparseTests->addChild(createQueueBindSparseTests (testCtx)); diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesTestsUtil.cpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesTestsUtil.cpp index ec1f3017f..108600acf 100644 --- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesTestsUtil.cpp +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesTestsUtil.cpp @@ -280,13 +280,13 @@ Move makePipelineLayout (const DeviceInterface& vk, { const VkPipelineLayoutCreateInfo pipelineLayoutParams = { - VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, // VkStructureType sType; - DE_NULL, // const void* pNext; - 0u, // VkPipelineLayoutCreateFlags flags; - 1u, // deUint32 setLayoutCount; - &descriptorSetLayout, // const VkDescriptorSetLayout* pSetLayouts; - 0u, // deUint32 pushConstantRangeCount; - DE_NULL, // const VkPushConstantRange* pPushConstantRanges; + VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + 0u, // VkPipelineLayoutCreateFlags flags; + (descriptorSetLayout != DE_NULL ? 1u : 0u), // deUint32 setLayoutCount; + (descriptorSetLayout != DE_NULL ? &descriptorSetLayout : DE_NULL), // const VkDescriptorSetLayout* pSetLayouts; + 0u, // deUint32 pushConstantRangeCount; + DE_NULL, // const VkPushConstantRange* pPushConstantRanges; }; return createPipelineLayout(vk, device, &pipelineLayoutParams); } @@ -400,6 +400,31 @@ Move makeFence (const DeviceInterface& vk, const VkDevice device, const return createFence(vk, device, &fenceCreateInfo); } +Move makeFramebuffer (const DeviceInterface& vk, + const VkDevice device, + const VkRenderPass renderPass, + const deUint32 attachmentCount, + const VkImageView* pAttachments, + const deUint32 width, + const deUint32 height, + const deUint32 layers) +{ + const VkFramebufferCreateInfo framebufferInfo = + { + VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkFramebufferCreateFlags)0, // VkFramebufferCreateFlags flags; + renderPass, // VkRenderPass renderPass; + attachmentCount, // uint32_t attachmentCount; + pAttachments, // const VkImageView* pAttachments; + width, // uint32_t width; + height, // uint32_t height; + layers, // uint32_t layers; + }; + + return createFramebuffer(vk, device, &framebufferInfo); +} + VkBufferMemoryBarrier makeBufferMemoryBarrier (const VkAccessFlags srcAccessMask, const VkAccessFlags dstAccessMask, const VkBuffer buffer, diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesTestsUtil.hpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesTestsUtil.hpp index 7dad5e2df..c04e8dae8 100644 --- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesTestsUtil.hpp +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesTestsUtil.hpp @@ -148,7 +148,7 @@ vk::Move makeCommandBuffer (const vk::DeviceInterface& vk::Move makePipelineLayout (const vk::DeviceInterface& vk, const vk::VkDevice device, - const vk::VkDescriptorSetLayout descriptorSetLayout); + const vk::VkDescriptorSetLayout descriptorSetLayout = DE_NULL); vk::Move makeComputePipeline (const vk::DeviceInterface& vk, const vk::VkDevice device, @@ -182,6 +182,15 @@ vk::Move makeFence (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkFenceCreateFlags flags = 0u); +vk::Move makeFramebuffer (const vk::DeviceInterface& vk, + const vk::VkDevice device, + const vk::VkRenderPass renderPass, + const deUint32 attachmentCount, + const vk::VkImageView* pAttachments, + const deUint32 width, + const deUint32 height, + const deUint32 layers = 1u); + de::MovePtr bindImage (const vk::DeviceInterface& vk, const vk::VkDevice device, vk::Allocator& allocator, @@ -291,12 +300,28 @@ bool checkImageFormatFeatureSupport (const vk::InstanceInterface& instan deUint32 getSparseAspectRequirementsIndex (const std::vector& requirements, const vk::VkImageAspectFlags aspectFlags); +inline vk::Move makeBuffer (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkBufferCreateInfo& createInfo) +{ + return createBuffer(vk, device, &createInfo); +} + +inline vk::Move makeImage (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkImageCreateInfo& createInfo) +{ + return createImage(vk, device, &createInfo); +} + template inline de::SharedPtr > makeVkSharedPtr (vk::Move vkMove) { return de::SharedPtr >(new vk::Unique(vkMove)); } +template +inline de::SharedPtr > makeDeSharedPtr (de::MovePtr deMove) +{ + return de::SharedPtr >(new de::UniquePtr(deMove)); +} + template inline std::size_t sizeInBytes (const std::vector& vec) { diff --git a/external/vulkancts/mustpass/1.0.1/src/master.txt b/external/vulkancts/mustpass/1.0.1/src/master.txt index ecc4bef13..759a25567 100644 --- a/external/vulkancts/mustpass/1.0.1/src/master.txt +++ b/external/vulkancts/mustpass/1.0.1/src/master.txt @@ -106490,12 +106490,24 @@ dEQP-VK.synchronization.op.multi_queue.semaphore.write_indirect_buffer_dispatch_ dEQP-VK.synchronization.op.multi_queue.semaphore.write_indirect_buffer_dispatch_read_indirect_buffer_dispatch.indirect_buffer_concurrent dEQP-VK.synchronization.internally_synchronized_objects.pipeline_cache_compute dEQP-VK.synchronization.internally_synchronized_objects.pipeline_cache_graphics -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_10 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_12 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_16 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_17 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_20 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_10 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_12 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_16 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_17 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_20 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_10 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_12 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_16 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_17 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_20 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_10 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_12 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_16 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_17 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_20 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_24 dEQP-VK.sparse_resources.image_sparse_binding.1d.r32i.512_1_1 dEQP-VK.sparse_resources.image_sparse_binding.1d.r32i.1024_1_1 dEQP-VK.sparse_resources.image_sparse_binding.1d.r32i.11_1_1 @@ -106622,12 +106634,6 @@ dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba16ui.137_137_3 dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba8ui.256_256_6 dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba8ui.128_128_8 dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba8ui.137_137_3 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_10 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_12 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_16 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_17 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_20 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_24 dEQP-VK.sparse_resources.image_sparse_residency.2d.r32i.512_256_1 dEQP-VK.sparse_resources.image_sparse_residency.2d.r32i.1024_128_1 dEQP-VK.sparse_resources.image_sparse_residency.2d.r32i.11_137_1 @@ -106853,12 +106859,6 @@ dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba16ui.11_137_3 dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba8ui.256_256_16 dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba8ui.1024_128_8 dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba8ui.11_137_3 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_10 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_12 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_16 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_17 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_20 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_24 dEQP-VK.sparse_resources.image_sparse_memory_aliasing.2d.r32i.512_256_1 dEQP-VK.sparse_resources.image_sparse_memory_aliasing.2d.r32i.128_128_1 dEQP-VK.sparse_resources.image_sparse_memory_aliasing.2d.r32i.503_137_1 diff --git a/external/vulkancts/mustpass/1.0.1/vk-default.txt b/external/vulkancts/mustpass/1.0.1/vk-default.txt index ecc4bef13..759a25567 100644 --- a/external/vulkancts/mustpass/1.0.1/vk-default.txt +++ b/external/vulkancts/mustpass/1.0.1/vk-default.txt @@ -106490,12 +106490,24 @@ dEQP-VK.synchronization.op.multi_queue.semaphore.write_indirect_buffer_dispatch_ dEQP-VK.synchronization.op.multi_queue.semaphore.write_indirect_buffer_dispatch_read_indirect_buffer_dispatch.indirect_buffer_concurrent dEQP-VK.synchronization.internally_synchronized_objects.pipeline_cache_compute dEQP-VK.synchronization.internally_synchronized_objects.pipeline_cache_graphics -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_10 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_12 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_16 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_17 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_20 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_10 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_12 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_16 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_17 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_20 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_10 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_12 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_16 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_17 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_20 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_10 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_12 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_16 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_17 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_20 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_24 dEQP-VK.sparse_resources.image_sparse_binding.1d.r32i.512_1_1 dEQP-VK.sparse_resources.image_sparse_binding.1d.r32i.1024_1_1 dEQP-VK.sparse_resources.image_sparse_binding.1d.r32i.11_1_1 @@ -106622,12 +106634,6 @@ dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba16ui.137_137_3 dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba8ui.256_256_6 dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba8ui.128_128_8 dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba8ui.137_137_3 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_10 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_12 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_16 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_17 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_20 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_24 dEQP-VK.sparse_resources.image_sparse_residency.2d.r32i.512_256_1 dEQP-VK.sparse_resources.image_sparse_residency.2d.r32i.1024_128_1 dEQP-VK.sparse_resources.image_sparse_residency.2d.r32i.11_137_1 @@ -106853,12 +106859,6 @@ dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba16ui.11_137_3 dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba8ui.256_256_16 dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba8ui.1024_128_8 dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba8ui.11_137_3 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_10 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_12 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_16 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_17 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_20 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_24 dEQP-VK.sparse_resources.image_sparse_memory_aliasing.2d.r32i.512_256_1 dEQP-VK.sparse_resources.image_sparse_memory_aliasing.2d.r32i.128_128_1 dEQP-VK.sparse_resources.image_sparse_memory_aliasing.2d.r32i.503_137_1 diff --git a/external/vulkancts/mustpass/1.0.2/vk-default.txt b/external/vulkancts/mustpass/1.0.2/vk-default.txt index 98fa36ccc..ab1f1031c 100644 --- a/external/vulkancts/mustpass/1.0.2/vk-default.txt +++ b/external/vulkancts/mustpass/1.0.2/vk-default.txt @@ -126928,12 +126928,41 @@ dEQP-VK.synchronization.op.multi_queue.semaphore.write_indirect_buffer_dispatch_ dEQP-VK.synchronization.op.multi_queue.semaphore.write_indirect_buffer_dispatch_read_indirect_buffer_dispatch.indirect_buffer_concurrent dEQP-VK.synchronization.internally_synchronized_objects.pipeline_cache_compute dEQP-VK.synchronization.internally_synchronized_objects.pipeline_cache_graphics -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_10 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_12 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_16 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_17 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_20 -dEQP-VK.sparse_resources.buffer_sparse_binding.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_10 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_12 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_16 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_17 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_20 +dEQP-VK.sparse_resources.buffer.transfer.sparse_binding.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_10 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_12 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_16 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_17 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_20 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_binding_aliased.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_10 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_12 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_16 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_17 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_20 +dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_24 +dEQP-VK.sparse_resources.buffer.ubo.sparse_binding +dEQP-VK.sparse_resources.buffer.ubo.sparse_binding_aliased +dEQP-VK.sparse_resources.buffer.ubo.sparse_residency +dEQP-VK.sparse_resources.buffer.ubo.sparse_residency_aliased +dEQP-VK.sparse_resources.buffer.ubo.sparse_residency_non_resident_strict +dEQP-VK.sparse_resources.buffer.vertex_buffer.sparse_binding +dEQP-VK.sparse_resources.buffer.vertex_buffer.sparse_binding_aliased +dEQP-VK.sparse_resources.buffer.vertex_buffer.sparse_residency +dEQP-VK.sparse_resources.buffer.vertex_buffer.sparse_residency_aliased +dEQP-VK.sparse_resources.buffer.index_buffer.sparse_binding +dEQP-VK.sparse_resources.buffer.index_buffer.sparse_binding_aliased +dEQP-VK.sparse_resources.buffer.index_buffer.sparse_residency +dEQP-VK.sparse_resources.buffer.index_buffer.sparse_residency_aliased +dEQP-VK.sparse_resources.buffer.indirect_buffer.sparse_binding +dEQP-VK.sparse_resources.buffer.indirect_buffer.sparse_binding_aliased +dEQP-VK.sparse_resources.buffer.indirect_buffer.sparse_residency +dEQP-VK.sparse_resources.buffer.indirect_buffer.sparse_residency_aliased dEQP-VK.sparse_resources.image_sparse_binding.1d.r32i.512_1_1 dEQP-VK.sparse_resources.image_sparse_binding.1d.r32i.1024_1_1 dEQP-VK.sparse_resources.image_sparse_binding.1d.r32i.11_1_1 @@ -127060,12 +127089,6 @@ dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba16ui.137_137_3 dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba8ui.256_256_6 dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba8ui.128_128_8 dEQP-VK.sparse_resources.image_sparse_binding.cube_array.rgba8ui.137_137_3 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_10 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_12 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_16 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_17 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_20 -dEQP-VK.sparse_resources.buffer_sparse_residency.buffer_size_2_24 dEQP-VK.sparse_resources.image_sparse_residency.2d.r32i.512_256_1 dEQP-VK.sparse_resources.image_sparse_residency.2d.r32i.1024_128_1 dEQP-VK.sparse_resources.image_sparse_residency.2d.r32i.11_137_1 @@ -127291,12 +127314,6 @@ dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba16ui.11_137_3 dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba8ui.256_256_16 dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba8ui.1024_128_8 dEQP-VK.sparse_resources.mipmap_sparse_residency.3d.rgba8ui.11_137_3 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_10 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_12 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_16 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_17 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_20 -dEQP-VK.sparse_resources.buffer_sparse_memory_aliasing.buffer_size_2_24 dEQP-VK.sparse_resources.image_sparse_memory_aliasing.2d.r32i.512_256_1 dEQP-VK.sparse_resources.image_sparse_memory_aliasing.2d.r32i.128_128_1 dEQP-VK.sparse_resources.image_sparse_memory_aliasing.2d.r32i.503_137_1 -- 2.34.1