From 3d5feb1af52b74d7a61372300ed3d5f7f6e6644b Mon Sep 17 00:00:00 2001 From: AWoloszyn Date: Fri, 9 Sep 2022 15:27:07 -0400 Subject: [PATCH] Removed all of the GAPID tests. These are irritating to maintain and no longer provide any benefit. --- CMakeLists.txt | 19 +- gapid_tests/CMakeLists.txt | 31 - gapid_tests/README.md | 33 - .../BeginAndEndCommandBuffer_test.py | 113 ---- .../CMakeLists.txt | 20 - .../BeginAndEndCommandBuffer_test/README.md | 91 --- .../BeginAndEndCommandBuffer_test/main.cpp | 72 --- .../BeginAndEndQuery_test.py | 56 -- .../BeginAndEndQuery_test/CMakeLists.txt | 22 - .../BeginAndEndQuery_test/README.md | 53 -- .../BeginAndEndQuery_test/main.cpp | 336 ---------- .../BeginAndEndRenderPass_test.py | 105 ---- .../BeginAndEndRenderPass_test/CMakeLists.txt | 20 - .../BeginAndEndRenderPass_test/README.md | 74 --- .../BeginAndEndRenderPass_test/main.cpp | 206 ------ .../BufferImageCopy_test.py | 110 ---- .../BufferImageCopy_test/CMakeLists.txt | 20 - .../BufferImageCopy_test/README.md | 65 -- .../BufferImageCopy_test/main.cpp | 182 ------ .../command_buffer_tests/CMakeLists.txt | 32 - .../CMakeLists.txt | 22 - .../DispatchAndDispatchIndirect_test.py | 38 -- .../README.md | 71 --- .../DispatchAndDispatchIndirect_test/main.cpp | 192 ------ .../DrawCommands_test/CMakeLists.txt | 22 - .../DrawCommands_test/DrawCommands_test.py | 70 --- .../DrawCommands_test/README.md | 116 ---- .../DrawCommands_test/main.cpp | 349 ----------- .../QueueSubmitAndWait_test/CMakeLists.txt | 20 - .../QueueSubmitAndWait_test.py | 153 ----- .../QueueSubmitAndWait_test/README.md | 51 -- .../QueueSubmitAndWait_test/main.cpp | 133 ---- gapid_tests/command_buffer_tests/README.md | 38 -- .../SetDepthBias_test/CMakeLists.txt | 22 - .../SetDepthBias_test/README.md | 23 - .../SetDepthBias_test/SetDepthBias_test.py | 58 -- .../SetDepthBias_test/main.cpp | 170 ----- .../CMakeLists.txt | 31 - .../README.md | 28 - .../SetViewportScissorAndBindPipeline_test.py | 59 -- .../main.cpp | 163 ----- .../wide_lines.cpp | 151 ----- .../SetStencilMask_test/CMakeLists.txt | 22 - .../SetStencilMask_test/README.md | 33 - .../SetStencilMask_test.py | 68 -- .../SetStencilMask_test/main.cpp | 150 ----- .../CMakeLists.txt | 22 - .../README.md | 46 -- .../SetViewportScissorAndBindPipeline_test.py | 91 --- .../main.cpp | 141 ----- .../CMakeLists.txt | 20 - .../vkCmdBindDescriptorSets_test/README.md | 41 -- .../vkCmdBindDescriptorSets_test/main.cpp | 76 --- .../vkCmdBindDescriptorSets_test.py | 42 -- .../vkCmdBindIndexBuffer_test/CMakeLists.txt | 20 - .../vkCmdBindIndexBuffer_test/README.md | 19 - .../vkCmdBindIndexBuffer_test/main.cpp | 197 ------ .../vkCmdBindIndexBuffer_test.py | 48 -- .../CMakeLists.txt | 20 - .../vkCmdBindVertexBuffers_test/README.md | 50 -- .../vkCmdBindVertexBuffers_test/main.cpp | 117 ---- .../vkCmdBindVertexBuffers_test.py | 74 --- .../vkCmdBlitImage_test/CMakeLists.txt | 20 - .../vkCmdBlitImage_test/README.md | 76 --- .../vkCmdBlitImage_test/main.cpp | 218 ------- .../vkCmdBlitImage_test.py | 87 --- .../vkCmdClearAttachments_test/CMakeLists.txt | 20 - .../vkCmdClearAttachments_test/README.md | 59 -- .../vkCmdClearAttachments_test/main.cpp | 165 ----- .../vkCmdClearAttachments_test.py | 73 --- .../vkCmdClearColorImage_test/CMakeLists.txt | 20 - .../vkCmdClearColorImage_test/README.md | 61 -- .../vkCmdClearColorImage_test/main.cpp | 122 ---- .../vkCmdClearColorImage_test.py | 61 -- .../CMakeLists.txt | 20 - .../README.md | 63 -- .../vkCmdClearDepthStencilImage_test/main.cpp | 136 ---- .../vkCmdClearDepthStencilImage_test.py | 63 -- .../vkCmdCopyImage_test/CMakeLists.txt | 20 - .../vkCmdCopyImage_test/README.md | 107 ---- .../vkCmdCopyImage_test/main.cpp | 347 ----------- .../vkCmdCopyImage_test.py | 126 ---- .../CMakeLists.txt | 22 - .../vkCmdCopyQueryPoolResults_test/README.md | 72 --- .../vkCmdCopyQueryPoolResults_test/main.cpp | 499 --------------- .../vkCmdResetQueryPool_test.py | 73 --- .../vkCmdExecuteCommands_test/CMakeLists.txt | 20 - .../vkCmdExecuteCommands_test/README.md | 87 --- .../vkCmdExecuteCommands_test/main.cpp | 130 ---- .../vkCmdExecuteCommands.py | 25 - .../vkCmdFillBuffer_test/CMakeLists.txt | 20 - .../vkCmdFillBuffer_test/README.md | 34 - .../vkCmdFillBuffer_test/main.cpp | 157 ----- .../vkCmdFillBuffer_test.py | 48 -- .../vkCmdNextSubpass_test/CMakeLists.txt | 30 - .../vkCmdNextSubpass_test/README.md | 22 - .../hardcode_full_screen_quad.vert | 30 - .../vkCmdNextSubpass_test/main.cpp | 434 ------------- .../only_red_channel.frag | 25 - .../vkCmdNextSubpass_test.py | 24 - .../vkCmdPushConstants_test/CMakeLists.txt | 22 - .../vkCmdPushConstants_test/README.md | 32 - .../vkCmdPushConstants_test/main.cpp | 83 --- .../vkCmdPushConstants.py | 39 -- .../vkCmdResetQueryPool_test/CMakeLists.txt | 20 - .../vkCmdResetQueryPool_test/README.md | 25 - .../vkCmdResetQueryPool_test/main.cpp | 87 --- .../vkCmdResetQueryPool_test.py | 44 -- .../vkCmdResolveImage_test/CMakeLists.txt | 20 - .../vkCmdResolveImage_test/README.md | 96 --- .../vkCmdResolveImage_test/main.cpp | 140 ----- .../vkCmdResolveImage_test.py | 80 --- .../vkCmdSetDepthBounds_test/CMakeLists.txt | 22 - .../vkCmdSetDepthBounds_test/README.md | 25 - .../vkCmdSetDepthBounds_test/main.cpp | 141 ----- .../vkCmdSetDepthBounds_test.py | 36 -- .../CMakeLists.txt | 22 - .../vkCmdSetStencilReference_test/README.md | 23 - .../vkCmdSetStencilReference_test/main.cpp | 135 ---- .../vkCmdSetStencilReference.py | 42 -- .../vkCmdUpdateBuffer_test/CMakeLists.txt | 20 - .../vkCmdUpdateBuffer_test/README.md | 40 -- .../vkCmdUpdateBuffer_test/main.cpp | 112 ---- .../vkCmdUpdateBuffer_test.py | 33 - .../vkCmdWriteTimestamp_test/CMakeLists.txt | 22 - .../vkCmdWriteTimestamp_test/README.md | 31 - .../vkCmdWriteTimestamp_test/main.cpp | 321 ---------- .../vkCmdWriteTimestamp_test.py | 64 -- .../vkQueuePresentKHR_test/CMakeLists.txt | 20 - .../vkQueuePresentKHR_test/README.md | 64 -- .../vkQueuePresentKHR_test/main.cpp | 134 ---- .../vkQueuePresentKHR_test.py | 54 -- .../vkTrimCommandPool_test/CMakeLists.txt | 20 - .../vkTrimCommandPool_test/README.md | 9 - .../vkTrimCommandPool_test/main.cpp | 39 -- .../vkTrimCommandPool.py | 30 - gapid_tests/extension_tests/CMakeLists.txt | 1 - gapid_tests/extension_tests/README.md | 6 - .../CMakeLists.txt | 26 - .../VK_NV_dedicated_allocation_test/README.md | 53 -- .../VK_NV_dedicated_allocation_test.py | 256 -------- .../VK_NV_dedicated_allocation_test/main.cpp | 134 ---- .../main_no_dedicated.cpp | 124 ---- .../initialization_tests/CMakeLists.txt | 2 - gapid_tests/initialization_tests/README.md | 8 - .../vkCreateDevice/CMakeLists.txt | 20 - .../vkCreateDevice/README.md | 106 ---- .../vkCreateDevice/main.cpp | 69 --- .../vkCreateDevice/vkCreateDevice_test.py | 132 ---- .../vkCreateInstance/CMakeLists.txt | 26 - .../vkCreateInstance/README.md | 52 -- .../vkCreateInstance/non_null_create_info.cpp | 52 -- .../vkCreateInstance/null_create_info.cpp | 45 -- .../vkCreateInstance_tests.py | 77 --- .../null_destruction_tests/CMakeLists.txt | 1 - gapid_tests/null_destruction_tests/README.md | 5 - .../vkDestroyNullHandles/CMakeLists.txt | 20 - .../vkDestroyNullHandles/main.cpp | 124 ---- .../vkDestroyNullHandles_tests.py | 127 ---- .../resource_acquisition_tests/CMakeLists.txt | 8 - .../resource_acquisition_tests/README.md | 15 - .../vkAcquireNextImageKHR_test/CMakeLists.txt | 20 - .../vkAcquireNextImageKHR_test/README.md | 31 - .../vkAcquireNextImageKHR_test/main.cpp | 74 --- .../vkAcquireNextImageKHR_test.py | 38 -- .../vkGetDeviceQueue/CMakeLists.txt | 20 - .../vkGetDeviceQueue/README.md | 23 - .../vkGetDeviceQueue/main.cpp | 38 -- .../vkGetDeviceQueue/vkGetDeviceQueue_test.py | 44 -- .../CMakeLists.txt | 20 - .../README.md | 49 -- .../main.cpp | 84 --- ...vkGetImageSparseMemoryRequirements_test.py | 64 -- .../CMakeLists.txt | 20 - .../README.md | 18 - .../vkGetImageSubresourceLayout_test/main.cpp | 164 ----- .../vkGetImageSubresourceLayout.py | 59 -- .../CMakeLists.txt | 22 - .../vkGetPipelineCacheData_test/README.md | 55 -- .../vkGetPipelineCacheData_test/main.cpp | 375 ----------- .../vkGetPipelineCacheData_test.py | 98 --- .../vkGetQueryPoolResults_test/CMakeLists.txt | 22 - .../vkGetQueryPoolResults_test/README.md | 96 --- .../vkGetQueryPoolResults_test/main.cpp | 450 -------------- .../vkGetQueryPoolResults_test.py | 107 ---- .../CMakeLists.txt | 22 - .../vkGetRenderAreaGranularity_test/README.md | 28 - .../vkGetRenderAreaGranularity_test/main.cpp | 111 ---- .../vkGetRenderAreaGranularity_test.py | 35 -- .../CMakeLists.txt | 20 - .../vkGetSwapchainImagesKHR_test/README.md | 21 - .../vkGetSwapchainImagesKHR_test/main.cpp | 59 -- .../vkGetSwapchainImagesKHR_test.py | 60 -- .../resource_binding_tests/CMakeLists.txt | 16 - gapid_tests/resource_binding_tests/README.md | 8 - .../CMakeLists.txt | 20 - .../vkUpdateDescriptorSets_test/README.md | 156 ----- .../vkUpdateDescriptorSets_test/main.cpp | 271 -------- .../vkUpdateDescriptorSets_test.py | 306 --------- .../AllocateFreeDescriptorSets_test.py | 190 ------ .../CMakeLists.txt | 20 - .../AllocateFreeDescriptorSets_test/README.md | 67 -- .../AllocateFreeDescriptorSets_test/main.cpp | 88 --- .../AllocateResetFreeCommandBuffer.py | 100 --- .../CMakeLists.txt | 20 - .../AllocateResetFreeCommandBuffer/README.md | 38 -- .../AllocateResetFreeCommandBuffer/main.cpp | 84 --- .../BindMapUnmapBuffer_test.py | 51 -- .../BindMapUnmapBuffer_test/CMakeLists.txt | 20 - .../BindMapUnmapBuffer_test/README.md | 51 -- .../BindMapUnmapBuffer_test/main.cpp | 89 --- .../BufferCreationMemory_test.py | 86 --- .../BufferCreationMemory_test/CMakeLists.txt | 20 - .../BufferCreationMemory_test/README.md | 59 -- .../BufferCreationMemory_test/main.cpp | 63 -- .../resource_creation_tests/CMakeLists.txt | 40 -- .../CMakeLists.txt | 20 - .../CreateDestroyBufferView_test.py | 112 ---- .../CreateDestroyBufferView_test/README.md | 70 --- .../CreateDestroyBufferView_test/main.cpp | 107 ---- .../CMakeLists.txt | 20 - .../CreateDestroyDescriptorSetLayout_test.py | 245 -------- .../README.md | 81 --- .../main.cpp | 129 ---- .../CMakeLists.txt | 20 - .../CreateDestroyImageView_test.py | 140 ----- .../CreateDestroyImageView_test/README.md | 98 --- .../CreateDestroyImageView_test/main.cpp | 93 --- .../CreateDestroyImage_test/CMakeLists.txt | 20 - .../CreateDestroyImage_test.py | 307 --------- .../CreateDestroyImage_test/README.md | 83 --- .../CreateDestroyImage_test/main.cpp | 238 ------- .../CMakeLists.txt | 26 - .../CreateDestroyQueryPool_test.py | 160 ----- .../CreateDestroyQueryPool_test/README.md | 54 -- .../CreateDestroyQueryPool_test/main.cpp | 68 -- .../pipeline_statistic.cpp | 62 -- .../CreateDestroySampler_test/CMakeLists.txt | 26 - .../CreateDestroySampler_test.py | 157 ----- .../CreateDestroySampler_test/README.md | 140 ----- .../CreateDestroySampler_test/main.cpp | 62 -- .../unnormalized.cpp | 71 --- .../CMakeLists.txt | 20 - .../CreateResetDestroyCommandPool_test.py | 208 ------- .../README.md | 45 -- .../main.cpp | 98 --- .../CMakeLists.txt | 20 - .../CreateResetDestroyDescriptorSet_test.py | 160 ----- .../README.md | 75 --- .../main.cpp | 84 --- .../CMakeLists.txt | 21 - .../FlushAndInvalidateRanges_test.py | 238 ------- .../FlushAndInvalidateRanges_test/README.md | 53 -- .../FlushAndInvalidateRanges_test/main.cpp | 325 ---------- .../ImageMemory_test/CMakeLists.txt | 20 - .../ImageMemory_test/ImageMemory_test.py | 90 --- .../ImageMemory_test/README.md | 53 -- .../ImageMemory_test/main.cpp | 92 --- .../PipelineCache_test/CMakeLists.txt | 20 - .../PipelineCache_test/PipelineCache_test.py | 104 ---- .../PipelineCache_test/README.md | 50 -- .../PipelineCache_test/main.cpp | 81 --- gapid_tests/resource_creation_tests/README.md | 30 - .../SurfaceCreation_test/CMakeLists.txt | 20 - .../SurfaceCreation_test/README.md | 38 -- .../SurfaceCreation_test/main.cpp | 70 --- .../vkCreateSurface_test.py | 77 --- .../CMakeLists.txt | 20 - .../SyncCreationDestruction_test/README.md | 35 -- .../SyncCreationDestruction_test/main.cpp | 41 -- .../vkCreateSemaphore_test.py | 62 -- .../CMakeLists.txt | 22 - .../vkCreateComputePipelines_test/README.md | 73 --- .../vkCreateComputePipelines_test/main.cpp | 276 --------- .../vkCreateComputePipelines_test.py | 78 --- .../vkCreateFramebuffer_test/CMakeLists.txt | 20 - .../vkCreateFramebuffer_test/README.md | 46 -- .../vkCreateFramebuffer_test/main.cpp | 142 ----- .../vkCreateFramebuffer_test.py | 67 -- .../CMakeLists.txt | 24 - .../vkCreateGraphicsPipelines_test/README.md | 337 ---------- .../vkCreateGraphicsPipelines_test/main.cpp | 307 --------- .../simple_vertex_fragment.md | 10 - .../vkCreateGraphicsPipelines_test.py | 495 --------------- .../CMakeLists.txt | 20 - .../vkCreatePipelineLayout_test/README.md | 52 -- .../vkCreatePipelineLayout_test/main.cpp | 104 ---- .../vkCreatePipelineLayout_test.py | 174 ------ .../vkCreateRenderPass_test/CMakeLists.txt | 20 - .../vkCreateRenderPass_test/README.md | 141 ----- .../vkCreateRenderPass_test/main.cpp | 130 ---- .../vkCreateRenderPass_test.py | 164 ----- .../vkCreateShaderModule_test/CMakeLists.txt | 22 - .../vkCreateShaderModule_test/README.md | 37 -- .../vkCreateShaderModule_test/main.cpp | 56 -- .../vkCreateShaderModule_test.py | 53 -- .../vkCreateSwapchainKHR_test/CMakeLists.txt | 20 - .../vkCreateSwapchainKHR_test/README.md | 85 --- .../vkCreateSwapchainKHR_test/main.cpp | 122 ---- .../vkCreateSwapchainKHR_test.py | 68 -- .../synchronization_tests/CMakeLists.txt | 4 - .../Event_test/CMakeLists.txt | 20 - .../Event_test/Event_test.py | 394 ------------ .../Event_test/README.md | 136 ---- .../synchronization_tests/Event_test/main.cpp | 388 ------------ .../Fence_test/CMakeLists.txt | 20 - .../Fence_test/Fence_test.py | 98 --- .../Fence_test/README.md | 51 -- .../synchronization_tests/Fence_test/main.cpp | 72 --- gapid_tests/synchronization_tests/README.md | 7 - .../vkCmdPipelineBarrier_test/CMakeLists.txt | 20 - .../vkCmdPipelineBarrier_test/README.md | 80 --- .../vkCmdPipelineBarrier_test/main.cpp | 87 --- .../vkCmdPipelineBarrier_test.py | 108 ---- .../vkDeviceWaitIdle_test/CMakeLists.txt | 20 - .../vkDeviceWaitIdle_test/README.md | 15 - .../vkDeviceWaitIdle_test/main.cpp | 54 -- .../vkDeviceWaitIdle_test.py | 25 - gapid_tests/traits_query_tests/CMakeLists.txt | 8 - .../CMakeLists.txt | 20 - .../EnumerateLayersAndExtensions.py | 95 --- .../EnumerateLayersAndExtensions/README.md | 43 -- .../EnumerateLayersAndExtensions/main.cpp | 157 ----- .../CMakeLists.txt | 20 - .../PhysicalDeviceImageFormatTraits_test.py | 125 ---- .../PhysicalDeviceImageFormatTraits/README.md | 79 --- .../PhysicalDeviceImageFormatTraits/main.cpp | 96 --- .../CMakeLists.txt | 20 - .../PhysicalDeviceSurface_tests.py | 185 ------ .../PhysicalDeviceSurface_tests/README.md | 96 --- .../PhysicalDeviceSurface_tests/main.cpp | 129 ---- .../PhysicalDeviceTraits/CMakeLists.txt | 20 - .../PhysicalDeviceTraits_test.py | 175 ------ .../PhysicalDeviceTraits/README.md | 248 -------- .../PhysicalDeviceTraits/main.cpp | 81 --- .../PresentationSupport/CMakeLists.txt | 20 - .../PhysicalDevicePresentationSupport_test.py | 77 --- .../PresentationSupport/README.md | 37 -- .../PresentationSupport/main.cpp | 74 --- gapid_tests/traits_query_tests/README.md | 14 - .../vkEnumeratePhysicalDevices/CMakeLists.txt | 20 - .../vkEnumeratePhysicalDevices/README.md | 15 - .../vkEnumeratePhysicalDevices/main.cpp | 64 -- .../vkEnumeratePhysicalDevices_test.py | 88 --- .../CMakeLists.txt | 20 - .../vkGetPDQueueFamilyProperties/README.md | 27 - .../vkGetPDQueueFamilyProperties/main.cpp | 120 ---- .../vkGetPDQueueFamilyProperties_test.py | 174 ------ .../CMakeLists.txt | 20 - .../README.md | 26 - .../main.cpp | 58 -- ...kGetPhysicalDeviceFormatProperties_test.py | 77 --- tools/gapid_trace_replay_tests.py | 277 --------- tools/gapit_test_framework.py | 586 ------------------ tools/gapit_tester.py | 113 ---- tools/gapit_trace_reader.py | 554 ----------------- 356 files changed, 8 insertions(+), 30072 deletions(-) delete mode 100644 gapid_tests/CMakeLists.txt delete mode 100644 gapid_tests/README.md delete mode 100644 gapid_tests/command_buffer_tests/BeginAndEndCommandBuffer_test/BeginAndEndCommandBuffer_test.py delete mode 100644 gapid_tests/command_buffer_tests/BeginAndEndCommandBuffer_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/BeginAndEndCommandBuffer_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/BeginAndEndCommandBuffer_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/BeginAndEndQuery_test/BeginAndEndQuery_test.py delete mode 100644 gapid_tests/command_buffer_tests/BeginAndEndQuery_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/BeginAndEndQuery_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/BeginAndEndQuery_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/BeginAndEndRenderPass_test/BeginAndEndRenderPass_test.py delete mode 100644 gapid_tests/command_buffer_tests/BeginAndEndRenderPass_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/BeginAndEndRenderPass_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/BeginAndEndRenderPass_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/BufferImageCopy_test/BufferImageCopy_test.py delete mode 100644 gapid_tests/command_buffer_tests/BufferImageCopy_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/BufferImageCopy_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/BufferImageCopy_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/DispatchAndDispatchIndirect_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/DispatchAndDispatchIndirect_test/DispatchAndDispatchIndirect_test.py delete mode 100644 gapid_tests/command_buffer_tests/DispatchAndDispatchIndirect_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/DispatchAndDispatchIndirect_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/DrawCommands_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/DrawCommands_test/DrawCommands_test.py delete mode 100644 gapid_tests/command_buffer_tests/DrawCommands_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/DrawCommands_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/QueueSubmitAndWait_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/QueueSubmitAndWait_test/QueueSubmitAndWait_test.py delete mode 100644 gapid_tests/command_buffer_tests/QueueSubmitAndWait_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/QueueSubmitAndWait_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/README.md delete mode 100644 gapid_tests/command_buffer_tests/SetDepthBias_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/SetDepthBias_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/SetDepthBias_test/SetDepthBias_test.py delete mode 100644 gapid_tests/command_buffer_tests/SetDepthBias_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/SetViewportScissorAndBindPipeline_test.py delete mode 100644 gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/wide_lines.cpp delete mode 100644 gapid_tests/command_buffer_tests/SetStencilMask_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/SetStencilMask_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/SetStencilMask_test/SetStencilMask_test.py delete mode 100644 gapid_tests/command_buffer_tests/SetStencilMask_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/SetViewportScissorAndBindPipeline_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/SetViewportScissorAndBindPipeline_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/SetViewportScissorAndBindPipeline_test/SetViewportScissorAndBindPipeline_test.py delete mode 100644 gapid_tests/command_buffer_tests/SetViewportScissorAndBindPipeline_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdBindDescriptorSets_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdBindDescriptorSets_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdBindDescriptorSets_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdBindDescriptorSets_test/vkCmdBindDescriptorSets_test.py delete mode 100644 gapid_tests/command_buffer_tests/vkCmdBindIndexBuffer_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdBindIndexBuffer_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdBindIndexBuffer_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdBindIndexBuffer_test/vkCmdBindIndexBuffer_test.py delete mode 100644 gapid_tests/command_buffer_tests/vkCmdBindVertexBuffers_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdBindVertexBuffers_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdBindVertexBuffers_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdBindVertexBuffers_test/vkCmdBindVertexBuffers_test.py delete mode 100644 gapid_tests/command_buffer_tests/vkCmdBlitImage_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdBlitImage_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdBlitImage_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdBlitImage_test/vkCmdBlitImage_test.py delete mode 100644 gapid_tests/command_buffer_tests/vkCmdClearAttachments_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdClearAttachments_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdClearAttachments_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdClearAttachments_test/vkCmdClearAttachments_test.py delete mode 100644 gapid_tests/command_buffer_tests/vkCmdClearColorImage_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdClearColorImage_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdClearColorImage_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdClearColorImage_test/vkCmdClearColorImage_test.py delete mode 100644 gapid_tests/command_buffer_tests/vkCmdClearDepthStencilImage_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdClearDepthStencilImage_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdClearDepthStencilImage_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdClearDepthStencilImage_test/vkCmdClearDepthStencilImage_test.py delete mode 100644 gapid_tests/command_buffer_tests/vkCmdCopyImage_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdCopyImage_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdCopyImage_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdCopyImage_test/vkCmdCopyImage_test.py delete mode 100644 gapid_tests/command_buffer_tests/vkCmdCopyQueryPoolResults_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdCopyQueryPoolResults_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdCopyQueryPoolResults_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdCopyQueryPoolResults_test/vkCmdResetQueryPool_test.py delete mode 100644 gapid_tests/command_buffer_tests/vkCmdExecuteCommands_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdExecuteCommands_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdExecuteCommands_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdExecuteCommands_test/vkCmdExecuteCommands.py delete mode 100644 gapid_tests/command_buffer_tests/vkCmdFillBuffer_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdFillBuffer_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdFillBuffer_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdFillBuffer_test/vkCmdFillBuffer_test.py delete mode 100644 gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/hardcode_full_screen_quad.vert delete mode 100644 gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/only_red_channel.frag delete mode 100644 gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/vkCmdNextSubpass_test.py delete mode 100644 gapid_tests/command_buffer_tests/vkCmdPushConstants_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdPushConstants_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdPushConstants_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdPushConstants_test/vkCmdPushConstants.py delete mode 100644 gapid_tests/command_buffer_tests/vkCmdResetQueryPool_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdResetQueryPool_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdResetQueryPool_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdResetQueryPool_test/vkCmdResetQueryPool_test.py delete mode 100644 gapid_tests/command_buffer_tests/vkCmdResolveImage_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdResolveImage_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdResolveImage_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdResolveImage_test/vkCmdResolveImage_test.py delete mode 100644 gapid_tests/command_buffer_tests/vkCmdSetDepthBounds_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdSetDepthBounds_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdSetDepthBounds_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdSetDepthBounds_test/vkCmdSetDepthBounds_test.py delete mode 100644 gapid_tests/command_buffer_tests/vkCmdSetStencilReference_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdSetStencilReference_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdSetStencilReference_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdSetStencilReference_test/vkCmdSetStencilReference.py delete mode 100644 gapid_tests/command_buffer_tests/vkCmdUpdateBuffer_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdUpdateBuffer_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdUpdateBuffer_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdUpdateBuffer_test/vkCmdUpdateBuffer_test.py delete mode 100644 gapid_tests/command_buffer_tests/vkCmdWriteTimestamp_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkCmdWriteTimestamp_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkCmdWriteTimestamp_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkCmdWriteTimestamp_test/vkCmdWriteTimestamp_test.py delete mode 100644 gapid_tests/command_buffer_tests/vkQueuePresentKHR_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkQueuePresentKHR_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkQueuePresentKHR_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkQueuePresentKHR_test/vkQueuePresentKHR_test.py delete mode 100644 gapid_tests/command_buffer_tests/vkTrimCommandPool_test/CMakeLists.txt delete mode 100644 gapid_tests/command_buffer_tests/vkTrimCommandPool_test/README.md delete mode 100644 gapid_tests/command_buffer_tests/vkTrimCommandPool_test/main.cpp delete mode 100644 gapid_tests/command_buffer_tests/vkTrimCommandPool_test/vkTrimCommandPool.py delete mode 100644 gapid_tests/extension_tests/CMakeLists.txt delete mode 100644 gapid_tests/extension_tests/README.md delete mode 100644 gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/CMakeLists.txt delete mode 100644 gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/README.md delete mode 100644 gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/VK_NV_dedicated_allocation_test.py delete mode 100644 gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/main.cpp delete mode 100644 gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/main_no_dedicated.cpp delete mode 100644 gapid_tests/initialization_tests/CMakeLists.txt delete mode 100644 gapid_tests/initialization_tests/README.md delete mode 100644 gapid_tests/initialization_tests/vkCreateDevice/CMakeLists.txt delete mode 100644 gapid_tests/initialization_tests/vkCreateDevice/README.md delete mode 100644 gapid_tests/initialization_tests/vkCreateDevice/main.cpp delete mode 100644 gapid_tests/initialization_tests/vkCreateDevice/vkCreateDevice_test.py delete mode 100644 gapid_tests/initialization_tests/vkCreateInstance/CMakeLists.txt delete mode 100644 gapid_tests/initialization_tests/vkCreateInstance/README.md delete mode 100644 gapid_tests/initialization_tests/vkCreateInstance/non_null_create_info.cpp delete mode 100644 gapid_tests/initialization_tests/vkCreateInstance/null_create_info.cpp delete mode 100644 gapid_tests/initialization_tests/vkCreateInstance/vkCreateInstance_tests.py delete mode 100644 gapid_tests/null_destruction_tests/CMakeLists.txt delete mode 100644 gapid_tests/null_destruction_tests/README.md delete mode 100644 gapid_tests/null_destruction_tests/vkDestroyNullHandles/CMakeLists.txt delete mode 100644 gapid_tests/null_destruction_tests/vkDestroyNullHandles/main.cpp delete mode 100644 gapid_tests/null_destruction_tests/vkDestroyNullHandles/vkDestroyNullHandles_tests.py delete mode 100644 gapid_tests/resource_acquisition_tests/CMakeLists.txt delete mode 100644 gapid_tests/resource_acquisition_tests/README.md delete mode 100644 gapid_tests/resource_acquisition_tests/vkAcquireNextImageKHR_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_acquisition_tests/vkAcquireNextImageKHR_test/README.md delete mode 100644 gapid_tests/resource_acquisition_tests/vkAcquireNextImageKHR_test/main.cpp delete mode 100644 gapid_tests/resource_acquisition_tests/vkAcquireNextImageKHR_test/vkAcquireNextImageKHR_test.py delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetDeviceQueue/CMakeLists.txt delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetDeviceQueue/README.md delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetDeviceQueue/main.cpp delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetDeviceQueue/vkGetDeviceQueue_test.py delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetImageSparseMemoryRequirements_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetImageSparseMemoryRequirements_test/README.md delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetImageSparseMemoryRequirements_test/main.cpp delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetImageSparseMemoryRequirements_test/vkGetImageSparseMemoryRequirements_test.py delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetImageSubresourceLayout_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetImageSubresourceLayout_test/README.md delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetImageSubresourceLayout_test/main.cpp delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetImageSubresourceLayout_test/vkGetImageSubresourceLayout.py delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetPipelineCacheData_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetPipelineCacheData_test/README.md delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetPipelineCacheData_test/main.cpp delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetPipelineCacheData_test/vkGetPipelineCacheData_test.py delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetQueryPoolResults_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetQueryPoolResults_test/README.md delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetQueryPoolResults_test/main.cpp delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetQueryPoolResults_test/vkGetQueryPoolResults_test.py delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetRenderAreaGranularity_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetRenderAreaGranularity_test/README.md delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetRenderAreaGranularity_test/main.cpp delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetRenderAreaGranularity_test/vkGetRenderAreaGranularity_test.py delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetSwapchainImagesKHR_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetSwapchainImagesKHR_test/README.md delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetSwapchainImagesKHR_test/main.cpp delete mode 100644 gapid_tests/resource_acquisition_tests/vkGetSwapchainImagesKHR_test/vkGetSwapchainImagesKHR_test.py delete mode 100644 gapid_tests/resource_binding_tests/CMakeLists.txt delete mode 100644 gapid_tests/resource_binding_tests/README.md delete mode 100644 gapid_tests/resource_binding_tests/vkUpdateDescriptorSets_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_binding_tests/vkUpdateDescriptorSets_test/README.md delete mode 100644 gapid_tests/resource_binding_tests/vkUpdateDescriptorSets_test/main.cpp delete mode 100644 gapid_tests/resource_binding_tests/vkUpdateDescriptorSets_test/vkUpdateDescriptorSets_test.py delete mode 100644 gapid_tests/resource_creation_tests/AllocateFreeDescriptorSets_test/AllocateFreeDescriptorSets_test.py delete mode 100644 gapid_tests/resource_creation_tests/AllocateFreeDescriptorSets_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/AllocateFreeDescriptorSets_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/AllocateFreeDescriptorSets_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/AllocateResetFreeCommandBuffer/AllocateResetFreeCommandBuffer.py delete mode 100644 gapid_tests/resource_creation_tests/AllocateResetFreeCommandBuffer/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/AllocateResetFreeCommandBuffer/README.md delete mode 100644 gapid_tests/resource_creation_tests/AllocateResetFreeCommandBuffer/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/BindMapUnmapBuffer_test/BindMapUnmapBuffer_test.py delete mode 100644 gapid_tests/resource_creation_tests/BindMapUnmapBuffer_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/BindMapUnmapBuffer_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/BindMapUnmapBuffer_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/BufferCreationMemory_test/BufferCreationMemory_test.py delete mode 100644 gapid_tests/resource_creation_tests/BufferCreationMemory_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/BufferCreationMemory_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/BufferCreationMemory_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyBufferView_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyBufferView_test/CreateDestroyBufferView_test.py delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyBufferView_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyBufferView_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyDescriptorSetLayout_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyDescriptorSetLayout_test/CreateDestroyDescriptorSetLayout_test.py delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyDescriptorSetLayout_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyDescriptorSetLayout_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyImageView_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyImageView_test/CreateDestroyImageView_test.py delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyImageView_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyImageView_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyImage_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyImage_test/CreateDestroyImage_test.py delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyImage_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyImage_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/CreateDestroyQueryPool_test.py delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/pipeline_statistic.cpp delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroySampler_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroySampler_test/CreateDestroySampler_test.py delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroySampler_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroySampler_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/CreateDestroySampler_test/unnormalized.cpp delete mode 100644 gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/CreateResetDestroyCommandPool_test.py delete mode 100644 gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/CreateResetDestroyDescriptorPool_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/CreateResetDestroyDescriptorPool_test/CreateResetDestroyDescriptorSet_test.py delete mode 100644 gapid_tests/resource_creation_tests/CreateResetDestroyDescriptorPool_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/CreateResetDestroyDescriptorPool_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/FlushAndInvalidateRanges_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/FlushAndInvalidateRanges_test/FlushAndInvalidateRanges_test.py delete mode 100644 gapid_tests/resource_creation_tests/FlushAndInvalidateRanges_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/FlushAndInvalidateRanges_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/ImageMemory_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/ImageMemory_test/ImageMemory_test.py delete mode 100644 gapid_tests/resource_creation_tests/ImageMemory_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/ImageMemory_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/PipelineCache_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/PipelineCache_test/PipelineCache_test.py delete mode 100644 gapid_tests/resource_creation_tests/PipelineCache_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/PipelineCache_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/README.md delete mode 100644 gapid_tests/resource_creation_tests/SurfaceCreation_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/SurfaceCreation_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/SurfaceCreation_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/SurfaceCreation_test/vkCreateSurface_test.py delete mode 100644 gapid_tests/resource_creation_tests/SyncCreationDestruction_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/SyncCreationDestruction_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/SyncCreationDestruction_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/SyncCreationDestruction_test/vkCreateSemaphore_test.py delete mode 100644 gapid_tests/resource_creation_tests/vkCreateComputePipelines_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/vkCreateComputePipelines_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/vkCreateComputePipelines_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/vkCreateComputePipelines_test/vkCreateComputePipelines_test.py delete mode 100644 gapid_tests/resource_creation_tests/vkCreateFramebuffer_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/vkCreateFramebuffer_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/vkCreateFramebuffer_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/vkCreateFramebuffer_test/vkCreateFramebuffer_test.py delete mode 100644 gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/simple_vertex_fragment.md delete mode 100644 gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/vkCreateGraphicsPipelines_test.py delete mode 100644 gapid_tests/resource_creation_tests/vkCreatePipelineLayout_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/vkCreatePipelineLayout_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/vkCreatePipelineLayout_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/vkCreatePipelineLayout_test/vkCreatePipelineLayout_test.py delete mode 100644 gapid_tests/resource_creation_tests/vkCreateRenderPass_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/vkCreateRenderPass_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/vkCreateRenderPass_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/vkCreateRenderPass_test/vkCreateRenderPass_test.py delete mode 100644 gapid_tests/resource_creation_tests/vkCreateShaderModule_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/vkCreateShaderModule_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/vkCreateShaderModule_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/vkCreateShaderModule_test/vkCreateShaderModule_test.py delete mode 100644 gapid_tests/resource_creation_tests/vkCreateSwapchainKHR_test/CMakeLists.txt delete mode 100644 gapid_tests/resource_creation_tests/vkCreateSwapchainKHR_test/README.md delete mode 100644 gapid_tests/resource_creation_tests/vkCreateSwapchainKHR_test/main.cpp delete mode 100644 gapid_tests/resource_creation_tests/vkCreateSwapchainKHR_test/vkCreateSwapchainKHR_test.py delete mode 100644 gapid_tests/synchronization_tests/CMakeLists.txt delete mode 100644 gapid_tests/synchronization_tests/Event_test/CMakeLists.txt delete mode 100644 gapid_tests/synchronization_tests/Event_test/Event_test.py delete mode 100644 gapid_tests/synchronization_tests/Event_test/README.md delete mode 100644 gapid_tests/synchronization_tests/Event_test/main.cpp delete mode 100644 gapid_tests/synchronization_tests/Fence_test/CMakeLists.txt delete mode 100644 gapid_tests/synchronization_tests/Fence_test/Fence_test.py delete mode 100644 gapid_tests/synchronization_tests/Fence_test/README.md delete mode 100644 gapid_tests/synchronization_tests/Fence_test/main.cpp delete mode 100644 gapid_tests/synchronization_tests/README.md delete mode 100644 gapid_tests/synchronization_tests/vkCmdPipelineBarrier_test/CMakeLists.txt delete mode 100644 gapid_tests/synchronization_tests/vkCmdPipelineBarrier_test/README.md delete mode 100644 gapid_tests/synchronization_tests/vkCmdPipelineBarrier_test/main.cpp delete mode 100644 gapid_tests/synchronization_tests/vkCmdPipelineBarrier_test/vkCmdPipelineBarrier_test.py delete mode 100644 gapid_tests/synchronization_tests/vkDeviceWaitIdle_test/CMakeLists.txt delete mode 100644 gapid_tests/synchronization_tests/vkDeviceWaitIdle_test/README.md delete mode 100644 gapid_tests/synchronization_tests/vkDeviceWaitIdle_test/main.cpp delete mode 100644 gapid_tests/synchronization_tests/vkDeviceWaitIdle_test/vkDeviceWaitIdle_test.py delete mode 100644 gapid_tests/traits_query_tests/CMakeLists.txt delete mode 100644 gapid_tests/traits_query_tests/EnumerateLayersAndExtensions/CMakeLists.txt delete mode 100644 gapid_tests/traits_query_tests/EnumerateLayersAndExtensions/EnumerateLayersAndExtensions.py delete mode 100644 gapid_tests/traits_query_tests/EnumerateLayersAndExtensions/README.md delete mode 100644 gapid_tests/traits_query_tests/EnumerateLayersAndExtensions/main.cpp delete mode 100644 gapid_tests/traits_query_tests/PhysicalDeviceImageFormatTraits/CMakeLists.txt delete mode 100644 gapid_tests/traits_query_tests/PhysicalDeviceImageFormatTraits/PhysicalDeviceImageFormatTraits_test.py delete mode 100644 gapid_tests/traits_query_tests/PhysicalDeviceImageFormatTraits/README.md delete mode 100644 gapid_tests/traits_query_tests/PhysicalDeviceImageFormatTraits/main.cpp delete mode 100644 gapid_tests/traits_query_tests/PhysicalDeviceSurface_tests/CMakeLists.txt delete mode 100644 gapid_tests/traits_query_tests/PhysicalDeviceSurface_tests/PhysicalDeviceSurface_tests.py delete mode 100644 gapid_tests/traits_query_tests/PhysicalDeviceSurface_tests/README.md delete mode 100644 gapid_tests/traits_query_tests/PhysicalDeviceSurface_tests/main.cpp delete mode 100644 gapid_tests/traits_query_tests/PhysicalDeviceTraits/CMakeLists.txt delete mode 100644 gapid_tests/traits_query_tests/PhysicalDeviceTraits/PhysicalDeviceTraits_test.py delete mode 100644 gapid_tests/traits_query_tests/PhysicalDeviceTraits/README.md delete mode 100644 gapid_tests/traits_query_tests/PhysicalDeviceTraits/main.cpp delete mode 100644 gapid_tests/traits_query_tests/PresentationSupport/CMakeLists.txt delete mode 100644 gapid_tests/traits_query_tests/PresentationSupport/PhysicalDevicePresentationSupport_test.py delete mode 100644 gapid_tests/traits_query_tests/PresentationSupport/README.md delete mode 100644 gapid_tests/traits_query_tests/PresentationSupport/main.cpp delete mode 100644 gapid_tests/traits_query_tests/README.md delete mode 100644 gapid_tests/traits_query_tests/vkEnumeratePhysicalDevices/CMakeLists.txt delete mode 100644 gapid_tests/traits_query_tests/vkEnumeratePhysicalDevices/README.md delete mode 100644 gapid_tests/traits_query_tests/vkEnumeratePhysicalDevices/main.cpp delete mode 100644 gapid_tests/traits_query_tests/vkEnumeratePhysicalDevices/vkEnumeratePhysicalDevices_test.py delete mode 100644 gapid_tests/traits_query_tests/vkGetPDQueueFamilyProperties/CMakeLists.txt delete mode 100644 gapid_tests/traits_query_tests/vkGetPDQueueFamilyProperties/README.md delete mode 100644 gapid_tests/traits_query_tests/vkGetPDQueueFamilyProperties/main.cpp delete mode 100644 gapid_tests/traits_query_tests/vkGetPDQueueFamilyProperties/vkGetPDQueueFamilyProperties_test.py delete mode 100644 gapid_tests/traits_query_tests/vkGetPhysicalDeviceFormatProperties/CMakeLists.txt delete mode 100644 gapid_tests/traits_query_tests/vkGetPhysicalDeviceFormatProperties/README.md delete mode 100644 gapid_tests/traits_query_tests/vkGetPhysicalDeviceFormatProperties/main.cpp delete mode 100644 gapid_tests/traits_query_tests/vkGetPhysicalDeviceFormatProperties/vkGetPhysicalDeviceFormatProperties_test.py delete mode 100755 tools/gapid_trace_replay_tests.py delete mode 100755 tools/gapit_test_framework.py delete mode 100755 tools/gapit_tester.py delete mode 100755 tools/gapit_trace_reader.py diff --git a/CMakeLists.txt b/CMakeLists.txt index d6c99be7..04983d6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ # 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 +# 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, @@ -15,27 +15,28 @@ cmake_minimum_required(VERSION 3.1) -if (NOT BUILD_APKS) -project(VulkanTestApplications) +if(NOT BUILD_APKS) + project(VulkanTestApplications) else() -project(VulkanTestApplications LANGUAGES) + project(VulkanTestApplications LANGUAGES) endif() include(cmake/setup.cmake) -if (NOT BUILD_APKS) +if(NOT BUILD_APKS) set(mathfu_build_benchmarks OFF CACHE BOOL "") set(mathfu_build_tests OFF CACHE BOOL "") add_vulkan_subdirectory(third_party/mathfu) - if (NOT MSVC) + + if(NOT MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions") else() add_definitions(-DNOMINMAX -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS) + # TODO(awoloszyn): Figure out why std::vector is throwing up with .back() add_definitions(/wd4146) endif() - set(VULKAN_INCLUDE_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/third_party/Vulkan-Headers/include/vulkan" "${CMAKE_CURRENT_SOURCE_DIR}/third_party/Vulkan-Headers/include") @@ -58,9 +59,5 @@ add_vulkan_subdirectory(standard_models) # Support Images add_vulkan_subdirectory(standard_images) -# All of the support code has to go above here, below here should come all of -# the actual tests. -add_vulkan_subdirectory(gapid_tests) - # Sample Applications and Sandbox add_vulkan_subdirectory(application_sandbox) diff --git a/gapid_tests/CMakeLists.txt b/gapid_tests/CMakeLists.txt deleted file mode 100644 index a4ac8540..00000000 --- a/gapid_tests/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_custom_target(GAPID_TESTS) - -function(add_gapid_test name) - add_vulkan_executable(${name} ${ARGN}) - add_dependencies(GAPID_TESTS ${name}) -endfunction() - -add_vulkan_subdirectory(command_buffer_tests) -add_vulkan_subdirectory(extension_tests) -add_vulkan_subdirectory(initialization_tests) -add_vulkan_subdirectory(null_destruction_tests) -add_vulkan_subdirectory(resource_acquisition_tests) -add_vulkan_subdirectory(resource_binding_tests) -add_vulkan_subdirectory(resource_creation_tests) -add_vulkan_subdirectory(synchronization_tests) -add_vulkan_subdirectory(traits_query_tests) \ No newline at end of file diff --git a/gapid_tests/README.md b/gapid_tests/README.md deleted file mode 100644 index e2d20699..00000000 --- a/gapid_tests/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# GAPID Tests - -This is a set of test applications, and associated python files. The purpose -of these tests is to validate that the correct information is being -recorded during a trace using [GAPID](https://github.com/google/gapid). - -Each test contains a set of `.cpp` files. These consitute the actual -application. Each test also contains one or more associated python files. -The python files define expectations for the contents of the traces. - -The test flow from `tools/gapit_test_framework.py` is as follows: - -1. Each apk under test will be installed on an Android device. -2. For each test in the associated python file, the trace will be parsed, -and expectations checked. -3. If any expectations are not met, the test will fail. -4. The next test will be run. - -These tests are explicitly to make sure that a trace file contains the -data that is required. They do not however make sure that replay -functions. - -Example: how to run the "passthrough.mid_execution" test on the host: - -``` -$ # Make sure to have downloaded GAPID, and have the "gapit" tool in your path -$ which gapit -/home/user/gapid/gapit -$ cd path/to/vulkan_test_applications -$ # We assume here that there is a host-build done under ./build/ -$ cd tools -$ ./gapid_trace_replay_tests.py --host --test-dir ../build/bin/ --include passthrough.mid_execution -``` diff --git a/gapid_tests/command_buffer_tests/BeginAndEndCommandBuffer_test/BeginAndEndCommandBuffer_test.py b/gapid_tests/command_buffer_tests/BeginAndEndCommandBuffer_test/BeginAndEndCommandBuffer_test.py deleted file mode 100644 index 712dc840..00000000 --- a/gapid_tests/command_buffer_tests/BeginAndEndCommandBuffer_test/BeginAndEndCommandBuffer_test.py +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest -from vulkan_constants import * - - -@gapit_test("BeginAndEndCommandBuffer_test") -class NullInheritanceInfoTest(GapitTest): - - def expect(self): - """Expect that the pInheritanceInfo is null for the first - vkBeginCommandBuffer""" - architecture = self.architecture - - begin_command_buffer = require(self.next_call_of( - "vkBeginCommandBuffer")) - command_buffer_value = begin_command_buffer.int_commandBuffer - require_not_equal(command_buffer_value, 0) - - # The command buffer begin info struct should start with correct - # sType value. - begin_info_stype_memory = require(begin_command_buffer.get_read_data( - begin_command_buffer.hex_pBeginInfo, architecture.int_integerSize)) - require_equal( - little_endian_bytes_to_int(begin_info_stype_memory), - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO) - - # The inheritance info pointer should be a nullptr. - inheritance_info_pointer_memory = require( - begin_command_buffer.get_read_data( - begin_command_buffer.hex_pBeginInfo + - architecture.int_pointerSize * 3, - architecture.int_pointerSize)) - require_equal( - little_endian_bytes_to_int(inheritance_info_pointer_memory), 0) - - # vkEndCommandBuffer() returns correctly - end_command_buffer = require(self.next_call_of("vkEndCommandBuffer")) - require_equal(end_command_buffer.int_commandBuffer, - command_buffer_value) - require_equal(VK_SUCCESS, int(end_command_buffer.return_val)) - - -@gapit_test("BeginAndEndCommandBuffer_test") -class NonNullInheritanceInfoTest(GapitTest): - - def expect(self): - """Expect that the pInheritanceInfo is not null for the second - vkBeginCommandBuffer, and that it contains some of the expected data.""" - architecture = self.architecture - - begin_command_buffer = require(self.nth_call_of("vkBeginCommandBuffer", - 2)) - command_buffer_value = begin_command_buffer.int_commandBuffer - require_not_equal(command_buffer_value, 0) - - # The command buffer begin info struct should start with correct sType - # value. - begin_info_stype_memory = require(begin_command_buffer.get_read_data( - begin_command_buffer.hex_pBeginInfo, architecture.int_integerSize)) - require_equal( - little_endian_bytes_to_int(begin_info_stype_memory), - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO) - - # The inheritance info pointer should not be a nullptr. - inheritance_info_pointer_memory = require( - begin_command_buffer.get_read_data( - begin_command_buffer.hex_pBeginInfo + - architecture.int_pointerSize * 3, - architecture.int_pointerSize)) - inheritance_info_addr = little_endian_bytes_to_int( - inheritance_info_pointer_memory) - require_not_equal(inheritance_info_addr, 0) - - # The inheritance info struct should start with correct sType value. - inheritance_info_stype_memory = require( - begin_command_buffer.get_read_data(inheritance_info_addr, - architecture.int_integerSize)) - require_equal( - little_endian_bytes_to_int(inheritance_info_stype_memory), - VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO) - - # The last field of inheritance info struct: pipelineStatistics should - # have value 0. - # TODO(qining): Add tests for other fields. - inheritance_info_pipeline_statistics_memory = require( - begin_command_buffer.get_read_data( - inheritance_info_addr + architecture.int_pointerSize * 2 + - NON_DISPATCHABLE_HANDLE_SIZE * 3 + architecture.int_integerSize - * 2, architecture.int_integerSize)) - require_equal( - little_endian_bytes_to_int( - inheritance_info_pipeline_statistics_memory), 0) - - # vkEndCommandBuffer() returns correctly - end_command_buffer = require(self.next_call_of("vkEndCommandBuffer")) - require_equal(end_command_buffer.int_commandBuffer, - command_buffer_value) - require_equal(VK_SUCCESS, int(end_command_buffer.return_val)) diff --git a/gapid_tests/command_buffer_tests/BeginAndEndCommandBuffer_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/BeginAndEndCommandBuffer_test/CMakeLists.txt deleted file mode 100644 index d76b4360..00000000 --- a/gapid_tests/command_buffer_tests/BeginAndEndCommandBuffer_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(BeginAndEndCommandBuffer_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/BeginAndEndCommandBuffer_test/README.md b/gapid_tests/command_buffer_tests/BeginAndEndCommandBuffer_test/README.md deleted file mode 100644 index 0e95dd11..00000000 --- a/gapid_tests/command_buffer_tests/BeginAndEndCommandBuffer_test/README.md +++ /dev/null @@ -1,91 +0,0 @@ -# vkBeginCommandBuffer / vkEndCommandBuffer - -## Signatures -```c++ -VkResult vkBeginCommandBuffer( - VkCommandBuffer commandBuffer, - const VkCommandBufferBeginInfo* pBeginInfo); - -VkResult vkEndCommandBuffer( - VkCommandBuffer commandBuffer); -``` - -According to the Vulkan spec: -- vkBeginCommandBuffer - - `commandBuffer` **must** not be in the recording state - - `commandBuffer` **must** not currently be pending execution - - `pBeginInfo` **must** be a pointer to a valid `VkCommandBufferBeginInfo` - structure - - If `commandBuffer` was allocated from a `VkCommandPool` which did not - have the `VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT` flag set, - commandBuffer **must** be in the initial state - - If `commandBuffer` is a secondary command buffer, the `pInheritanceInfo` - member of `pBeginInfo` **must** be a valid - `VkCommandBufferInheritanceInfo` structure - - If `commandBuffer` is a secondary command buffer and either the - `occlusionQueryEnable` member of the `pInheritanceInfo` member of - `pBeginInfo` is `VK_FALSE`, or the precise occlusion queries feature is - not enabled, the `queryFlags` member of the `pInheritanceInfo` member - `pBeginInfo` **must** not contain `VK_QUERY_CONTROL_PRECISE_BIT` -- vkEndCommandBuffer - - `commandBuffer` must be a valid `VkCommandBuffer` in recording state. - -## VkCommandBufferBeginInfo -```c++ -typedef struct VkCommandBufferBeginInfo{ - VkStructureType sType; - const void* pNext; - VkCommandBufferUsageFlags flags; - const VkCommandBufferInheritanceInfo* pInheritanceInfo; -} VkInstanceCreateInfo; -``` - -According to the Vulkan spec: -- VkCommandBufferBeginInfo - - `sType` **must** be `VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO` - - `pNext` **must** be `NULL` - - `flags` is a bitmask which **must** be a valid combination of - `VkCommandBufferUsageFlagBits` values - - If `flags` contains `VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT`, - the `renderPass` member of `pInheritanceInfo` **must** be a valid - `VkRenderPass`, the `subpass` member of `pInheritanceInfo` **must** be - a valid subpass index within the `renderPass` member of - `pInheritanceInfo` and the `framebuffer` member of `pInheritanceInfo` - must be either `VK_NULL_HANDLE` or a valid `VkFramebuffer` that is - compatible with the `renderPass` member of `pInheritanceInfo` - -## VkCommandBufferInheritanceInfo -```c++ -typedef struct VkCommandBufferInheritanceInfo { - VkStructureType sType; - const void* pNext; - VkRenderPass renderPass; - uint32_t subpass; - VkFramebuffer framebuffer; - VkBool32 occlusionQueryEnable; - VkQueryControlFlags queryFlags; - VkQueryPipelineStatisticFlags pipelineStatistics; -} VkCommandBufferInheritanceInfo; -``` - -According to the Vulkan spec: -- VkCommandBufferInheritanceInfo - - `sType` **must** be `VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO` - - `pNext` **must** be `NULL` - - Valid handles of `framebuffer` and `renderPass` **must** have been created, - allocated or retrieved from the same `VkDevice` - - If the `inherited queries` feature is not enabled, `occlusionQueryEnable` - **must** be `VK_FALSE` - - If the `inherited queries` feature is enabled, `queryFlags` **must** be a - valid combination of `VKQueryControlFlagBits` values - - If the `pipeline statistics queries` feature is not enabled, - `pipelineStatistics` **must** be 0 - -These tests should test the following cases: -- [x] `pInheritanceInfo` Null or not -- [ ] `flags` 0 or valid combinations -- [ ] `renderPass` `VK_NULL_HANDLE` or valid handle -- [ ] `framebuffer` `VK_NULL_HANDLE` or valid handle -- [ ] `subpass` 0 or valid number -- [ ] `occlusionQueryEnable` true or false -- [x] `vkEndCommandBuffer()` with a valid `VkCommandBuffer` in recording state. diff --git a/gapid_tests/command_buffer_tests/BeginAndEndCommandBuffer_test/main.cpp b/gapid_tests/command_buffer_tests/BeginAndEndCommandBuffer_test/main.cpp deleted file mode 100644 index 7e4e23e0..00000000 --- a/gapid_tests/command_buffer_tests/BeginAndEndCommandBuffer_test/main.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_wrapper/command_buffer_wrapper.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateEmptyInstance(data->allocator(), &wrapper)); - vulkan::VkDevice device( - vulkan::CreateDefaultDevice(data->allocator(), instance)); - vulkan::VkCommandPool pool( - vulkan::CreateDefaultCommandPool(data->allocator(), device, false)); - vulkan::VkCommandBuffer command_buffer = - vulkan::CreateDefaultCommandBuffer(&pool, &device); - - { - // Test a nullptr pInheritanceInfo - VkCommandBufferBeginInfo info{ - /* sType = */ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* pInheritanceInfo = */ nullptr, - }; - command_buffer->vkBeginCommandBuffer(command_buffer, &info); - command_buffer->vkEndCommandBuffer(command_buffer); - } - - { - // Test a non-nullptr pInheritanceInfo - VkCommandBufferInheritanceInfo hinfo{ - /* sType = */ VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, - /* pNext = */ nullptr, - /* renderPass = */ VK_NULL_HANDLE, - /* subpass = */ 0, - /* framebuffer = */ VK_NULL_HANDLE, - /* occlusionQueryEnable = */ VK_FALSE, - /* queryFlags = */ 0, - /* pipelineStatistics = */ 0, - }; - VkCommandBufferBeginInfo info{ - /* sType = */ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* pInheritanceInfo = */ &hinfo, - }; - command_buffer->vkBeginCommandBuffer(command_buffer, &info); - command_buffer->vkEndCommandBuffer(command_buffer); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/BeginAndEndQuery_test/BeginAndEndQuery_test.py b/gapid_tests/command_buffer_tests/BeginAndEndQuery_test/BeginAndEndQuery_test.py deleted file mode 100644 index 45afccbc..00000000 --- a/gapid_tests/command_buffer_tests/BeginAndEndQuery_test/BeginAndEndQuery_test.py +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, GapitTest -from gapit_test_framework import require, require_equal, require_not_equal -from vulkan_constants import * - - -@gapit_test("BeginAndEndQuery_test") -class QueryWithPreciseBit(GapitTest): - - def expect(self): - begin_query = require( - self.nth_call_of("vkCmdBeginQuery", 1)) - end_query = require( - self.nth_call_of("vkCmdEndQuery", 1)) - - cmd_buf = begin_query.int_commandBuffer - require_not_equal(0, cmd_buf) - query_pool = begin_query.int_queryPool - require_not_equal(0, query_pool) - require_equal(0, begin_query.int_query) - require_equal(VK_QUERY_CONTROL_PRECISE_BIT, begin_query.int_flags) - - require_equal(cmd_buf, end_query.int_commandBuffer) - require_equal(query_pool, end_query.int_queryPool) - require_equal(0, end_query.int_query) - - -@gapit_test("BeginAndEndQuery_test") -class QueryWithoutPreciseBit(GapitTest): - - def expect(self): - begin_query = require( - self.nth_call_of("vkCmdBeginQuery", 2)) - end_query = require( - self.nth_call_of("vkCmdEndQuery", 2)) - - cmd_buf = begin_query.int_commandBuffer - require_not_equal(0, cmd_buf) - query_pool = begin_query.int_queryPool - require_not_equal(0, query_pool) - require_equal(1, begin_query.int_query) - require_equal(0, begin_query.int_flags) - - require_equal(cmd_buf, end_query.int_commandBuffer) - require_equal(query_pool, end_query.int_queryPool) - require_equal(1, end_query.int_query) diff --git a/gapid_tests/command_buffer_tests/BeginAndEndQuery_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/BeginAndEndQuery_test/CMakeLists.txt deleted file mode 100644 index e8aec854..00000000 --- a/gapid_tests/command_buffer_tests/BeginAndEndQuery_test/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(BeginAndEndQuery_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) diff --git a/gapid_tests/command_buffer_tests/BeginAndEndQuery_test/README.md b/gapid_tests/command_buffer_tests/BeginAndEndQuery_test/README.md deleted file mode 100644 index fe59069d..00000000 --- a/gapid_tests/command_buffer_tests/BeginAndEndQuery_test/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# vkCmdBeginQuery / vkCmdEndQuery - -## Signatures -```c++ -void vkCmdBeginQuery( - VkCommandBuffer commandBuffer, - VkQueryPool queryPool, - uint32_t query, - VkQueryControlFlags flags); - -void vkCmdEndQuery( - VkCommandBuffer commandBuffer, - VkQueryPool queryPool, - uint32_t query); -``` - -# VkQueryControlFlagBits -```c++ -typedef enum VkQueryControlFlagBits { - VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001, -} VkQueryControlFlagBits; -``` - -According to the Vulkan spec: -- `vkCmdBeginQuery` - - `query` **must** be less than the number of queries in `queryPool` - - The query identified by `queryPool` and `query` **must** currently **not** - be active - - The query identified by `queryPool` and `query` **must** be unavailable - - If the precise occlusion queries feature is not enabled, or the `queryType` - used to create `queryPool` was not `VK_QUERY_TYPE_OCCLUSION`, `flags` **must - not** contain `VK_QUERY_CONTROL_PRECISE_BIT` - - `query` **must** have been created with a `queryType` that differs from - that of any other queries that ahve been made *active*, and are currently - still active within `commandBuffer` - - If the `queryType` used to create `queryPool` was `VK_QUERY_TYPE_OCCLUSION`, - the `VkCommandPool` that `commandBuffer` was allocated from **must** support - graphics operations - - If the `queryType` used to create `queryPool` was - `VK_QUERY_TYPE_PIPELINE_STATISTICS` and any of the `pipelineStatistics` - indicate graphics operations, the `VkCommandPool` that `commandBuffer` was - allocated from **must** support graphics operations - - If the `queryType` used to create `queryPool` was - `VK_QUERY_TYPE_PIPELINE_STATISTICS` and any of the `pipelineStatistics` - indicate compute operations, the `VkCommandPool` that `commandBuffer` was - allocated from **must** support compute operations -- `vkCmdEndQuery` - - `commandBuffer` **must** be in the recording state - - `query` **must** be less than the number of queries in `queryPool` - -These tests should test the following cases: -- [x] `queryPool` and `query` of valid values -- [x] `flags` with `VK_QUERY_CONTROL_PRECISE_BIT` set diff --git a/gapid_tests/command_buffer_tests/BeginAndEndQuery_test/main.cpp b/gapid_tests/command_buffer_tests/BeginAndEndQuery_test/main.cpp deleted file mode 100644 index f69b88d8..00000000 --- a/gapid_tests/command_buffer_tests/BeginAndEndQuery_test/main.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -uint32_t fragment_shader[] = -#include "hardcode_pos_triangle.frag.spv" - ; - -uint32_t vertex_shader[] = -#include "hardcode_pos_triangle.vert.spv" - ; - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - vulkan::VkDevice& device = app.device(); - - { - // Create render pass. - - VkAttachmentReference color_attachment = { - 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - vulkan::VkRenderPass render_pass = app.CreateRenderPass( - {{ - 0, // flags - app.swapchain().format(), // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // finalLayout - }}, // AttachmentDescriptions - {{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment, // colorAttachment - nullptr, // pResolveAttachments - nullptr, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }}, // SubpassDescriptions - {} // SubpassDependencies - ); - - // Create shader modules. - - vulkan::VkShaderModule vertex_shader_module = - app.CreateShaderModule(vertex_shader); - vulkan::VkShaderModule fragment_shader_module = - app.CreateShaderModule(fragment_shader); - VkPipelineShaderStageCreateInfo shader_stage_create_infos[2] = { - { - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_SHADER_STAGE_VERTEX_BIT, // stage - vertex_shader_module, // module - "main", // pName - nullptr // pSpecializationInfo - }, - { - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_SHADER_STAGE_FRAGMENT_BIT, // stage - fragment_shader_module, // module - "main", // pName - nullptr // pSpecializationInfo - }}; - - // Specify vertex input state. - - VkPipelineVertexInputStateCreateInfo vertex_input_state = { - VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 0, // vertexBindingDescriptionCount - nullptr, // pVertexBindingDescriptions - 0, // vertexAttributeDescriptionCount - nullptr, // pVertexAttributeDescriptions - }; - - // Other fixed function stage configuration. - - VkPipelineInputAssemblyStateCreateInfo input_assembly_state = { - VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, // topology - VK_FALSE // primitiveRestartEnable - }; - - VkViewport viewport = { - 0.0f, // x - 0.0f, // y - static_cast(app.swapchain().width()), // width - static_cast(app.swapchain().height()), // height - 0.0f, // minDepth - 1.0f, // maxDepth - }; - - VkRect2D scissor = {{ - 0, // offset.x - 0, // offset.y - }, - { - app.swapchain().width(), // extent.width - app.swapchain().height() // extent.height - }}; - - VkPipelineViewportStateCreateInfo viewport_state = { - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 1, // viewportCount - &viewport, // pViewports - 1, // scissorCount - &scissor, // pScissors - }; - - VkPipelineRasterizationStateCreateInfo rasterization_state = { - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_FALSE, // depthClampEnable - VK_FALSE, // rasterizerDiscardEnable - VK_POLYGON_MODE_FILL, // polygonMode - VK_CULL_MODE_BACK_BIT, // cullMode - VK_FRONT_FACE_CLOCKWISE, // frontFace - VK_FALSE, // depthBiasEnable - 0.0f, // depthBiasConstantFactor - 0.0f, // depthBiasClamp - 0.0f, // depthBiasSlopeFactor - 1.0f, // lineWidth - }; - - VkPipelineMultisampleStateCreateInfo multisample_state = { - VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_SAMPLE_COUNT_1_BIT, // rasterizationSamples - VK_FALSE, // sampleShadingEnable - 0, // minSampleShading - 0, // pSampleMask - VK_FALSE, // alphaToCoverageEnable - VK_FALSE, // alphaToOneEnable - }; - - VkPipelineColorBlendAttachmentState color_blend_attachment_state = { - VK_FALSE, // blendEnable - VK_BLEND_FACTOR_ZERO, // srcColorBlendFactor - VK_BLEND_FACTOR_ONE, // dstColorBlendFactor - VK_BLEND_OP_ADD, // colorBlendOp - VK_BLEND_FACTOR_ZERO, // srcAlphaBlendFactor - VK_BLEND_FACTOR_ONE, // dstAlphaBlendFactor - VK_BLEND_OP_ADD, // alphaBlendOp - (VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | - VK_COLOR_COMPONENT_B_BIT | - VK_COLOR_COMPONENT_A_BIT), // colorWriteMask - }; - - VkPipelineColorBlendStateCreateInfo color_blend_state = { - VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_FALSE, // logicOpEnable - VK_LOGIC_OP_CLEAR, // logicOp - 1, // attachmentCount - &color_blend_attachment_state, // pAttachments - {1.0f, 1.0f, 1.0f, 1.0f} // blendConstants - }; - - vulkan::PipelineLayout pipeline_layout(app.CreatePipelineLayout({{}})); - - // Create the graphics pipeline. - - VkGraphicsPipelineCreateInfo create_info = { - VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 2, // stageCount - shader_stage_create_infos, // pStages - &vertex_input_state, // pVertexInputState - &input_assembly_state, // pInputAssemblyState - nullptr, // pTessellationState - &viewport_state, // pViewportState - &rasterization_state, // pRasterizationState - &multisample_state, // pMultisampleState - nullptr, // pDepthStencilState - &color_blend_state, // pColorBlendState - nullptr, // pDynamicState - pipeline_layout, // layout - render_pass, // renderPass - 0, // subpass - VK_NULL_HANDLE, // basePipelineHandle - 0 // basePipelineIndex - }; - - VkPipeline raw_pipeline; - LOG_EXPECT( - ==, data->logger(), - device->vkCreateGraphicsPipelines(device, app.pipeline_cache(), 1, - &create_info, nullptr, &raw_pipeline), - VK_SUCCESS); - vulkan::VkPipeline pipeline(raw_pipeline, nullptr, &device); - - // Create image view. - - VkImageViewCreateInfo image_view_create_info{ - VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - app.swapchain_images().front(), // image - VK_IMAGE_VIEW_TYPE_2D, // viewType - app.swapchain().format(), // format - { - VK_COMPONENT_SWIZZLE_IDENTITY, // components.r - VK_COMPONENT_SWIZZLE_IDENTITY, // components.g - VK_COMPONENT_SWIZZLE_IDENTITY, // components.b - VK_COMPONENT_SWIZZLE_IDENTITY, // components.a - }, - { - VK_IMAGE_ASPECT_COLOR_BIT, // subresourceRange.aspectMask - 0, // subresourceRange.baseMipLevel - 1, // subresourceRange.levelCount - 0, // subresourceRange.baseArrayLayer - 1, // subresourceRange.layerCount - }, - }; - ::VkImageView raw_image_view; - LOG_EXPECT( - ==, data->logger(), - app.device()->vkCreateImageView(app.device(), &image_view_create_info, - nullptr, &raw_image_view), - VK_SUCCESS); - vulkan::VkImageView image_view(raw_image_view, nullptr, &app.device()); - - // Create framebuffer - - VkFramebufferCreateInfo framebuffer_create_info{ - VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - render_pass, // renderPass - 1, // attachmentCount - &raw_image_view, // attachments - app.swapchain().width(), // width - app.swapchain().height(), // height - 1 // layers - }; - ::VkFramebuffer raw_framebuffer; - app.device()->vkCreateFramebuffer(app.device(), &framebuffer_create_info, - nullptr, &raw_framebuffer); - vulkan::VkFramebuffer framebuffer(raw_framebuffer, nullptr, &app.device()); - - // Create query pool. - vulkan::VkQueryPool query_pool = vulkan::CreateQueryPool( - &app.device(), {VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, nullptr, 0, - VK_QUERY_TYPE_OCCLUSION, 2, 0}); - - // Create command buffer. - vulkan::VkCommandBuffer command_buffer = app.GetCommandBuffer(); - VkCommandBufferBeginInfo command_buffer_begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType - nullptr, // pNext - 0, // flags - nullptr, // pInheritanceInfo - }; - command_buffer->vkBeginCommandBuffer(command_buffer, - &command_buffer_begin_info); - VkRenderPassBeginInfo render_pass_begin_info{ - VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, // sType - nullptr, // pNext - render_pass, // renderPass - framebuffer, // framebuffer - { - {0, // renderArea.offset.x - 0}, // renderArea.offset.y - {app.swapchain().width(), // renderArea.extent.width - app.swapchain().height()}, // renderArea.extent.height - }, - 0, // clearValueCount - nullptr, // pClearValues - }; - - command_buffer->vkCmdResetQueryPool(command_buffer, query_pool, 0, 2); - // Begin a query with precise bit set - command_buffer->vkCmdBeginQuery(command_buffer, query_pool, 0, - VK_QUERY_CONTROL_PRECISE_BIT); - // Begin a query with precise bit not set - command_buffer->vkCmdBeginQuery(command_buffer, query_pool, 1, 0); - - command_buffer->vkCmdBeginRenderPass( - command_buffer, &render_pass_begin_info, VK_SUBPASS_CONTENTS_INLINE); - command_buffer->vkCmdBindPipeline( - command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, raw_pipeline); - command_buffer->vkCmdDraw(command_buffer, 3, 1, 0, 0); - command_buffer->vkCmdEndRenderPass(command_buffer); - - // End the two queries - command_buffer->vkCmdEndQuery(command_buffer, query_pool, 0); - command_buffer->vkCmdEndQuery(command_buffer, query_pool, 1); - - command_buffer->vkEndCommandBuffer(command_buffer); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/BeginAndEndRenderPass_test/BeginAndEndRenderPass_test.py b/gapid_tests/command_buffer_tests/BeginAndEndRenderPass_test/BeginAndEndRenderPass_test.py deleted file mode 100644 index 3f4cbecc..00000000 --- a/gapid_tests/command_buffer_tests/BeginAndEndRenderPass_test/BeginAndEndRenderPass_test.py +++ /dev/null @@ -1,105 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal -from gapit_test_framework import GapitTest, get_read_offset_function -from vulkan_constants import VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO -from struct_offsets import VulkanStruct, ARRAY, FLOAT, UINT32_T, POINTER, HANDLE - -RENDER_PASS_BEGIN_INFO = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("renderPass", HANDLE), - ("framebuffer", HANDLE), - ("renderArea_offset_x", UINT32_T), - ("renderArea_offset_y", UINT32_T), - ("renderArea_extent_width", UINT32_T), - ("renderArea_extent_height", UINT32_T), - ("clearValueCount", UINT32_T), - ("pClearValues", POINTER), -] - -CLEAR_COLOR_UNORM_VALUE = [ - ("color_float32", ARRAY, 4, UINT32_T), -] - -CLEAR_DEPTH_STENCIL_VALUE = [ - ("depthStencil_depth", FLOAT), - ("depthStencil_stencil", UINT32_T), -] - - -@gapit_test("BeginAndEndRenderPass_test") -class BeginRenderPassWithoutAttachment(GapitTest): - - def expect(self): - """Expect the vkCmdBeginRenderPass() is called and successfully. The - RenderPassBeginInfo does not contain any ClearValues""" - architecture = self.architecture - - begin_render_pass = require( - self.nth_call_of("vkCmdBeginRenderPass", 1)) - require_not_equal(0, begin_render_pass.int_commandBuffer) - - begin_render_pass_info = VulkanStruct( - architecture, RENDER_PASS_BEGIN_INFO, get_read_offset_function( - begin_render_pass, begin_render_pass.hex_pRenderPassBegin)) - - require_equal(VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, - begin_render_pass_info.sType) - require_equal(0, begin_render_pass_info.pNext) - require_not_equal(0, begin_render_pass_info.renderPass) - require_not_equal(0, begin_render_pass_info.framebuffer) - require_equal(5, begin_render_pass_info.renderArea_offset_x) - require_equal(5, begin_render_pass_info.renderArea_offset_y) - require_equal(32, begin_render_pass_info.renderArea_extent_width) - require_equal(32, begin_render_pass_info.renderArea_extent_height) - require_equal(0, begin_render_pass_info.clearValueCount) - require_equal(0, begin_render_pass_info.pClearValues) - - end_render_pass = require(self.next_call_of("vkCmdEndRenderPass")) - require_equal(begin_render_pass.int_commandBuffer, - end_render_pass.int_commandBuffer) - - -@gapit_test("BeginAndEndRenderPass_test") -class BeginColorAttachmentRenderPass(GapitTest): - - def expect(self): - """Expect the vkCmdBeginRenderPass() is called successfully and the - RenderPassBeginInfo should contain a pointer of one ClearValue""" - architecture = self.architecture - - begin_render_pass = require( - self.nth_call_of("vkCmdBeginRenderPass", 2)) - require_not_equal(0, begin_render_pass.int_commandBuffer) - - begin_render_pass_info = VulkanStruct( - architecture, RENDER_PASS_BEGIN_INFO, get_read_offset_function( - begin_render_pass, begin_render_pass.hex_pRenderPassBegin)) - - require_equal(VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, - begin_render_pass_info.sType) - require_equal(0, begin_render_pass_info.pNext) - require_not_equal(0, begin_render_pass_info.renderPass) - require_not_equal(0, begin_render_pass_info.framebuffer) - require_equal(0, begin_render_pass_info.renderArea_offset_x) - require_equal(0, begin_render_pass_info.renderArea_offset_y) - require_equal(0, begin_render_pass_info.clearValueCount) - require_equal(0, begin_render_pass_info.pClearValues) - - end_render_pass = require(self.next_call_of("vkCmdEndRenderPass")) - require_equal(begin_render_pass.int_commandBuffer, - end_render_pass.int_commandBuffer) diff --git a/gapid_tests/command_buffer_tests/BeginAndEndRenderPass_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/BeginAndEndRenderPass_test/CMakeLists.txt deleted file mode 100644 index 17bbb6e2..00000000 --- a/gapid_tests/command_buffer_tests/BeginAndEndRenderPass_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(BeginAndEndRenderPass_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/BeginAndEndRenderPass_test/README.md b/gapid_tests/command_buffer_tests/BeginAndEndRenderPass_test/README.md deleted file mode 100644 index 74df957d..00000000 --- a/gapid_tests/command_buffer_tests/BeginAndEndRenderPass_test/README.md +++ /dev/null @@ -1,74 +0,0 @@ -# vkCmdBeginRenderPass / vkCmdEndRenderPass - -## Signatures -```c++ -void vkCmdBeginRenderPass( - VkCommandBuffer commandBuffer, - const VkRenderPassBeginInfo* pRenderPassBegin, - VkSubpassContents contents); - -void vkCmdEndRenderPass( - VkCommandBuffer commandBuffer); -``` - -According to the Vulkan spec: -- vkCmdBeginRenderPass - - `commandBuffer` **must** be a valid **primary** `VkCommandBuffer` handle - - `pRenderPassBegin` **must** be a pointer to a valid `VkRenderPassBeginInfo` - structure - - `contents` **must** be one of the values: `VK_SUBPASS_CONTENTS_INLINE` - and `VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS` -- vkCmdEndRenderPass - - `commandBuffer` **must** be a valid primary `VkCommandBuffer` in recording - state - - The `VkCommandPool` that `commandBuffer` was allcoated from **must** support - graphics operations - - This command **must** only be called inside of a render pass instance - - The current subpass index **must** be equal to the number of subpasses in - the render pass minus one - -## VkRenderPassBeginInfo -```c++ -typedef struct VkRenderPassBeginInfo { - VkStructureType sType; - const void* pNext; - VkRenderPass renderPass; - VkFramebuffer framebuffer; - VkRect2D renderArea; - uint32_t clearValueCount; - const VkClearValue* pClearValues; -} VkRenderPassBeginInfo; -``` - -According to the Vulkan spec: -- VkCommandBufferBeginInfo - - `sType` **must** be `VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO` - - `pNext` **must** be `NULL` - - `renderPass` **must** be a valid `VkRenderPass` handle - - `framebuffer` **must** be a valid `VkFramebuffer` handle - - If `clearValueCount` is not 0, `pClearValues` must be a pointer to an array - of `clearValueCount` valid `VkClearValue` unions - - Both of `framebuffer` and `renderPass` **must** have been created, - allocated, or retrieved from the same `VkDevice` - - `clearValueCount` **must** be greater than the largest attachment index in - `renderPass` that specifies a `loadOp` (or `stencilLoadOp`, if the attachment - has a depth/stencil format) of `VK_ATTACHMENT_LOAD_OP_CLEAR` - -These tests should test the following cases: -- `contents` of valid values - - [x] `VK_SUBPASS_CONTENTS_INLINE` - - [ ] `VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS` -- `renderPass` of a valid handle - - [x] None attachments - - [x] Color attachments - - [ ] Depth attachments -- `framebuffer` of a valid handle - - [x] None attachments - - [ ] Color and depth attachments -- [x] `renderArea` of different offsets and extents -- `clearValueCount` 0 or valid number - - [x] 0 value `clearValueCount` - - [x] `clearValueCount` is not 0, `pClearValues` should have corresponding - clear values -- [x] `vkCmdEndRenderPass()` with a recording state primary `VkCommandBuffer` -handle. diff --git a/gapid_tests/command_buffer_tests/BeginAndEndRenderPass_test/main.cpp b/gapid_tests/command_buffer_tests/BeginAndEndRenderPass_test/main.cpp deleted file mode 100644 index a945dfaa..00000000 --- a/gapid_tests/command_buffer_tests/BeginAndEndRenderPass_test/main.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/vulkan_application.h" -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication application(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - { - // 1. Render pass and framebuffer without attachments or dependencies. The - // render pass begin info has render area with x/y offsets of value 5 and - // width/height of value 32. - // Create render pass without any attachments, still needs a subpass here. - vulkan::VkRenderPass render_pass = application.CreateRenderPass( - {}, - {{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 0, // colorAttachmentCount - nullptr, // pColorAttachments - nullptr, // pResolveAttachments - nullptr, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }}, // subpass - {}); - - // Create a framebuffer without any attachments - VkFramebufferCreateInfo framebuffer_create_info{ - VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - render_pass, // renderPass - 0, // attachmentCount - nullptr, // attachments - application.swapchain().width(), // width - application.swapchain().height(), // height - 1 // layers - }; - ::VkFramebuffer raw_framebuffer; - application.device()->vkCreateFramebuffer(application.device(), - &framebuffer_create_info, nullptr, - &raw_framebuffer); - vulkan::VkFramebuffer framebuffer(raw_framebuffer, nullptr, - &application.device()); - vulkan::VkCommandBuffer command_buffer = application.GetCommandBuffer(); - VkCommandBufferBeginInfo command_buffer_begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType - nullptr, // pNext - 0, // flags - nullptr, // pInheritanceInfo - }; - command_buffer->vkBeginCommandBuffer(command_buffer, - &command_buffer_begin_info); - VkRenderPassBeginInfo render_pass_begin_info{ - VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, // sType - nullptr, // pNext - render_pass, // renderPass - framebuffer, // framebuffer - { - 5, // renderArea.offset.x - 5, // renderArea.offset.y - 32, // renderArea.extent.width - 32, // renderArea.extent.height - }, - 0, // clearValueCount - nullptr, // pClearValues - }; - command_buffer->vkCmdBeginRenderPass( - command_buffer, &render_pass_begin_info, VK_SUBPASS_CONTENTS_INLINE); - command_buffer->vkCmdEndRenderPass(command_buffer); - command_buffer->vkEndCommandBuffer(command_buffer); - } - - { - // 2. Render pass and framebuffer one color attachments, one subpasses - // and no dependencies. - // Create render pass - VkAttachmentReference color_attachment_reference{ - 0, // attachment - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // layout - }; - vulkan::VkRenderPass render_pass = application.CreateRenderPass( - {{ - 0, // flags - application.swapchain().format(), // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, // initialLayout - VK_IMAGE_LAYOUT_PRESENT_SRC_KHR // finalLayout - }}, - {{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment_reference, // pColorAttachments - nullptr, // pResolveAttachments - nullptr, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }}, - {}); - - // Create image view - VkImageViewCreateInfo image_view_create_info{ - VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - application.swapchain_images().front(), // image - VK_IMAGE_VIEW_TYPE_2D, // viewType - application.swapchain().format(), // format - { - VK_COMPONENT_SWIZZLE_IDENTITY, // components.r - VK_COMPONENT_SWIZZLE_IDENTITY, // components.g - VK_COMPONENT_SWIZZLE_IDENTITY, // components.b - VK_COMPONENT_SWIZZLE_IDENTITY, // components.a - }, - { - VK_IMAGE_ASPECT_COLOR_BIT, // subresourceRange.aspectMask - 0, // subresourceRange.baseMipLevel - 1, // subresourceRange.levelCount - 0, // subresourceRange.baseArrayLayer - 1, // subresourceRange.layerCount - }, - }; - ::VkImageView raw_image_view; - LOG_EXPECT(==, data->logger(), - application.device()->vkCreateImageView( - application.device(), &image_view_create_info, nullptr, - &raw_image_view), - VK_SUCCESS); - vulkan::VkImageView image_view(raw_image_view, nullptr, - &application.device()); - - // Create framebuffer - VkFramebufferCreateInfo framebuffer_create_info{ - VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - render_pass, // renderPass - 1, // attachmentCount - &raw_image_view, // attachments - application.swapchain().width(), // width - application.swapchain().height(), // height - 1 // layers - }; - ::VkFramebuffer raw_framebuffer; - application.device()->vkCreateFramebuffer(application.device(), - &framebuffer_create_info, nullptr, - &raw_framebuffer); - vulkan::VkFramebuffer framebuffer(raw_framebuffer, nullptr, - &application.device()); - vulkan::VkCommandBuffer command_buffer = application.GetCommandBuffer(); - VkCommandBufferBeginInfo command_buffer_begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType - nullptr, // pNext - 0, // flags - nullptr, // pInheritanceInfo - }; - command_buffer->vkBeginCommandBuffer(command_buffer, - &command_buffer_begin_info); - VkRenderPassBeginInfo render_pass_begin_info{ - VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, // sType - nullptr, // pNext - render_pass, // renderPass - framebuffer, // framebuffer - { - 0, // renderArea.offset.x - 0, // renderArea.offset.y - application.swapchain().width(), // renderArea.extent.width - application.swapchain().height(), // renderArea.extent.height - }, - 0, // clearValueCount - nullptr, // pClearValues - }; - command_buffer->vkCmdBeginRenderPass( - command_buffer, &render_pass_begin_info, VK_SUBPASS_CONTENTS_INLINE); - command_buffer->vkCmdEndRenderPass(command_buffer); - command_buffer->vkEndCommandBuffer(command_buffer); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/BufferImageCopy_test/BufferImageCopy_test.py b/gapid_tests/command_buffer_tests/BufferImageCopy_test/BufferImageCopy_test.py deleted file mode 100644 index d27c59c1..00000000 --- a/gapid_tests/command_buffer_tests/BufferImageCopy_test/BufferImageCopy_test.py +++ /dev/null @@ -1,110 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -import gapit_test_framework -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY, DEVICE_SIZE, INT32_T -from vulkan_constants import * - -BUFFER_IMAGE_COPY = [ - ("bufferOffset", DEVICE_SIZE), - ("bufferRowLength", UINT32_T), - ("bufferImageHeight", UINT32_T), - ("imageSubresource_aspectMask", UINT32_T), - ("imageSubresource_mipLevel", UINT32_T), - ("imageSubresource_baseArrayLayer", UINT32_T), - ("imageSubresource_layerCount", UINT32_T), - ("imageOffset_x", INT32_T), - ("imageOffset_y", INT32_T), - ("imageOffset_z", INT32_T), - ("imageExtent_width", UINT32_T), - ("imageExtent_height", UINT32_T), - ("imageExtent_depth", UINT32_T) -] - - -@gapit_test("BufferImageCopy_test") -class CopyImageToBuffer(GapitTest): - - def expect(self): - """Check the arguments to vkCmdCopyImageToBuffer""" - architecture = self.architecture - copy_image_to_buffer = require( - self.nth_call_of("vkCmdCopyImageToBuffer", 1)) - - require_not_equal(0, copy_image_to_buffer.int_commandBuffer) - require_not_equal(0, copy_image_to_buffer.int_srcImage) - require_equal(VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, - copy_image_to_buffer.int_srcImageLayout) - require_not_equal(0, copy_image_to_buffer.int_dstBuffer) - require_equal(1, copy_image_to_buffer.int_regionCount) - require_not_equal(0, copy_image_to_buffer.hex_pRegions) - - buffer_image_copy = VulkanStruct( - architecture, BUFFER_IMAGE_COPY, - get_read_offset_function(copy_image_to_buffer, - copy_image_to_buffer.hex_pRegions)) - - require_equal(0, buffer_image_copy.bufferOffset) - require_equal(0, buffer_image_copy.bufferRowLength) - require_equal(0, buffer_image_copy.bufferImageHeight) - require_equal(VK_IMAGE_ASPECT_COLOR_BIT, - buffer_image_copy.imageSubresource_aspectMask) - require_equal(0, buffer_image_copy.imageSubresource_mipLevel) - require_equal(0, buffer_image_copy.imageSubresource_baseArrayLayer) - require_equal(1, buffer_image_copy.imageSubresource_layerCount) - require_equal(0, buffer_image_copy.imageOffset_x) - require_equal(0, buffer_image_copy.imageOffset_y) - require_equal(0, buffer_image_copy.imageOffset_z) - require_equal(32, buffer_image_copy.imageExtent_width) - require_equal(32, buffer_image_copy.imageExtent_height) - require_equal(1, buffer_image_copy.imageExtent_depth) - - -@gapit_test("BufferImageCopy_test") -class CopyBufferToImage(GapitTest): - - def expect(self): - """Check the arguments to vkCmdCopyBufferToImage""" - architecture = self.architecture - copy_buffer_to_image = require( - self.nth_call_of("vkCmdCopyBufferToImage", 1)) - - require_not_equal(0, copy_buffer_to_image.int_commandBuffer) - require_not_equal(0, copy_buffer_to_image.int_srcBuffer) - require_not_equal(0, copy_buffer_to_image.int_dstImage) - require_equal(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - copy_buffer_to_image.int_dstImageLayout) - require_equal(1, copy_buffer_to_image.int_regionCount) - require_not_equal(0, copy_buffer_to_image.hex_pRegions) - - buffer_image_copy = VulkanStruct( - architecture, BUFFER_IMAGE_COPY, - get_read_offset_function(copy_buffer_to_image, - copy_buffer_to_image.hex_pRegions)) - - require_equal(0, buffer_image_copy.bufferOffset) - require_equal(0, buffer_image_copy.bufferRowLength) - require_equal(0, buffer_image_copy.bufferImageHeight) - require_equal(VK_IMAGE_ASPECT_COLOR_BIT, - buffer_image_copy.imageSubresource_aspectMask) - require_equal(0, buffer_image_copy.imageSubresource_mipLevel) - require_equal(0, buffer_image_copy.imageSubresource_baseArrayLayer) - require_equal(1, buffer_image_copy.imageSubresource_layerCount) - require_equal(0, buffer_image_copy.imageOffset_x) - require_equal(0, buffer_image_copy.imageOffset_y) - require_equal(0, buffer_image_copy.imageOffset_z) - require_equal(32, buffer_image_copy.imageExtent_width) - require_equal(32, buffer_image_copy.imageExtent_height) - require_equal(1, buffer_image_copy.imageExtent_depth) diff --git a/gapid_tests/command_buffer_tests/BufferImageCopy_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/BufferImageCopy_test/CMakeLists.txt deleted file mode 100644 index 707702a2..00000000 --- a/gapid_tests/command_buffer_tests/BufferImageCopy_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(BufferImageCopy_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/BufferImageCopy_test/README.md b/gapid_tests/command_buffer_tests/BufferImageCopy_test/README.md deleted file mode 100644 index 0f6efba4..00000000 --- a/gapid_tests/command_buffer_tests/BufferImageCopy_test/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# vkCmdCopyBufferToImage / vkCmdCopyImageToBuffer - -## Signatures -```c++ -void vkCmdCopyBufferToImage( - VkCommandBuffer commandBuffer, - VkBuffer srcBuffer, - VkImage dstImage, - VkImageLayout dstImageLayout, - uint32_t regionCount, - const VkBufferImageCopy* pRegions); - -void vkCmdCopyImageToBuffer( - VkCommandBuffer commandBuffer, - VkImage srcImage, - VkImageLayout srcImageLayout, - VkBuffer dstBuffer, - uint32_t regionCount, - const VkBufferImageCopy* pRegions); -``` - -# VkBufferImageCopy -```c++ -typedef struct VkBufferImageCopy { - VkDeviceSize bufferOffset; - uint32_t bufferRowLength; - uint32_t bufferImageHeight; - VkImageSubresourceLayers imageSubresource; - VkOffset3D imageOffset; - VkExtent3D imageExtent; -} VkBufferImageCopy; -``` - -According to the Vulkan spec: -- `dstImageLayout` **must** be `VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL` or - `VK_IMAGE_LAYOUT_GENERAL` -- `srcImageLayout` **must** be `VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL` or - `VK_IMAGE_LAYOUT_GENERAL` -- `regionCount` **must** be >= 1 -- `bufferOffset` **must** be a multiple of 4 -- `bufferOffset` **must** be a multiple of the claling command's VkImage - parameter's texel size -- `bufferRowLength` **must** be 0 or >= imageExtent.width -- `bufferImageHeight` **must** be 0 or >= imageExtent.height -- `imageOffset` must be >= `0, 0, 0` -- `imageOffset` + `imageExtent` must be within the image - - -These tests should test the following cases: -- [x] `dstImageLayout` == `VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL` -- [ ] `dstImageLayout` == `VK_IMAGE_LAYOUT_GENERAL` -- [x] `srcImageLayout` == `VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL` -- [ ] `srcImageLayout` == `VK_IMAGE_LAYOUT_GENERAL` -- [x] `regionCount` == 1 -- [ ] `regionCount` > 1 -- [x] `bufferOffset` == 0 -- [ ] `bufferOffset` > 0 -- [x] `bufferRowLength` == 0 -- [ ] `bufferRowLength` > 0 -- [x] `bufferImageHeight` == 0 -- [ ] `bufferImageHeight` > 0 -- [x] `imageOffset` == 0 -- [ ] `imageOffset` > 0 -- [x] `imageExtent` == image size -- [ ] `imageExtent` < image size \ No newline at end of file diff --git a/gapid_tests/command_buffer_tests/BufferImageCopy_test/main.cpp b/gapid_tests/command_buffer_tests/BufferImageCopy_test/main.cpp deleted file mode 100644 index 560b4f87..00000000 --- a/gapid_tests/command_buffer_tests/BufferImageCopy_test/main.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/vulkan_application.h" -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication application(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions() - .SetHostBufferSize(1024 * 100) - .SetDeviceImageSize(1024 * 100) - .SetCoherentBufferSize(1024 * 100)); - VkImageCreateInfo image_create_info{ - /* sType = */ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* imageType = */ VK_IMAGE_TYPE_2D, - /* format = */ VK_FORMAT_R8G8B8A8_UNORM, - /* extent = */ - { - /* width = */ 32, - /* height = */ 32, - /* depth = */ 1, - }, - /* mipLevels = */ 1, - /* arrayLayers = */ 1, - /* samples = */ VK_SAMPLE_COUNT_1_BIT, - /* tiling = */ VK_IMAGE_TILING_OPTIMAL, - /* usage = */ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | - VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT, - /* sharingMode = */ VK_SHARING_MODE_EXCLUSIVE, - /* queueFamilyIndexCount = */ 0, - /* pQueueFamilyIndices = */ nullptr, - /* initialLayout = */ VK_IMAGE_LAYOUT_UNDEFINED, - }; - - vulkan::ImagePointer image = - application.CreateAndBindImage(&image_create_info); - - // Create a buffer for transferring to our image. - VkBufferCreateInfo create_info = { - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // createFlags - 32 * 32 * 4, // size - VK_BUFFER_USAGE_TRANSFER_SRC_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr // pQueueFamilyIndices - }; - vulkan::BufferPointer src_buffer = - application.CreateAndBindHostBuffer(&create_info); - - create_info.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT; - vulkan::BufferPointer dest_buffer = - application.CreateAndBindHostBuffer(&create_info); - - // Set up the memory for our buffers. - // Set the soruce_buf - for (size_t i = 0; i < 32 * 32 * 4; ++i) { - src_buffer->base_address()[i] = (0xFF & i); - dest_buffer->base_address()[i] = 0; - } - src_buffer->flush(); - - vulkan::VkCommandBuffer command_buffer = application.GetCommandBuffer(); - - VkCommandBufferBeginInfo begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr, 0, nullptr}; - command_buffer->vkBeginCommandBuffer(command_buffer, &begin_info); - - // Copy our entire image from/to the buffers in packed format. - VkBufferImageCopy region{ - 0, 0, 0, {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, {0, 0, 0}, {32, 32, 1}}; - - // Insert a pipeline barrier to wait until the host has flushed - // the buffer. - { - VkMemoryBarrier barrier{VK_STRUCTURE_TYPE_MEMORY_BARRIER, nullptr, - VK_ACCESS_HOST_WRITE_BIT, - VK_ACCESS_TRANSFER_READ_BIT}; - - // The image needs to be in IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL - // in order to be copied to, so transition to that now. - VkImageMemoryBarrier image_barrier{VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, - nullptr, - 0, // no source bit - VK_ACCESS_TRANSFER_WRITE_BIT, - VK_IMAGE_LAYOUT_UNDEFINED, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - VK_QUEUE_FAMILY_IGNORED, - VK_QUEUE_FAMILY_IGNORED, - *image, - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}}; - - command_buffer->vkCmdPipelineBarrier( - command_buffer, VK_PIPELINE_STAGE_HOST_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 1, &barrier, 0, nullptr, 1, - &image_barrier); - } - - command_buffer->vkCmdCopyBufferToImage(command_buffer, *src_buffer, *image, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - 1, ®ion); - // Transfer the image from DST_OPTIMAL to SRC_OPTIMAL so that we can - // copy it to the other buffer. - { - VkImageMemoryBarrier barrier{VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, - nullptr, - VK_ACCESS_TRANSFER_WRITE_BIT, - VK_ACCESS_TRANSFER_READ_BIT, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, - VK_QUEUE_FAMILY_IGNORED, - VK_QUEUE_FAMILY_IGNORED, - *image, - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}}; - - command_buffer->vkCmdPipelineBarrier( - command_buffer, VK_PIPELINE_STAGE_TRANSFER_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &barrier); - } - - command_buffer->vkCmdCopyImageToBuffer(command_buffer, *image, - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, - *dest_buffer, 1, ®ion); - - // Insert a pipeline barrier to make sure that the image has copied correctly. - { - VkMemoryBarrier barrier{VK_STRUCTURE_TYPE_MEMORY_BARRIER, nullptr, - VK_ACCESS_TRANSFER_WRITE_BIT, - VK_ACCESS_HOST_READ_BIT}; - - command_buffer->vkCmdPipelineBarrier( - command_buffer, VK_PIPELINE_STAGE_TRANSFER_BIT, - VK_PIPELINE_STAGE_HOST_BIT, 0, 1, &barrier, 0, nullptr, 0, nullptr); - } - - command_buffer->vkEndCommandBuffer(command_buffer); - - VkCommandBuffer buffers[1] = {command_buffer}; - - VkSubmitInfo submit{VK_STRUCTURE_TYPE_SUBMIT_INFO, - nullptr, - 0, - nullptr, - nullptr, - 1, - buffers, - 0, - nullptr}; - - application.render_queue()->vkQueueSubmit( - application.render_queue(), 1, &submit, - static_cast(VK_NULL_HANDLE)); - // Make sure that the queue has finished all of its operations, including - // the memory barriers before we continue. - application.render_queue()->vkQueueWaitIdle(application.render_queue()); - - dest_buffer->invalidate(); - for (size_t i = 0; i < 32 * 32 * 4; ++i) { - LOG_ASSERT(==, data->logger(), (0xFF & i), - static_cast(dest_buffer->base_address()[i])); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/CMakeLists.txt b/gapid_tests/command_buffer_tests/CMakeLists.txt deleted file mode 100644 index 67733c4a..00000000 --- a/gapid_tests/command_buffer_tests/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -add_vulkan_subdirectory(BeginAndEndCommandBuffer_test) -add_vulkan_subdirectory(BeginAndEndRenderPass_test) -add_vulkan_subdirectory(BeginAndEndQuery_test) -add_vulkan_subdirectory(BufferImageCopy_test) -add_vulkan_subdirectory(DispatchAndDispatchIndirect_test) -add_vulkan_subdirectory(DrawCommands_test) -add_vulkan_subdirectory(QueueSubmitAndWait_test) -add_vulkan_subdirectory(vkQueuePresentKHR_test) -add_vulkan_subdirectory(SetDepthBias_test) -add_vulkan_subdirectory(SetLineWidthAndBlendConstants_test) -add_vulkan_subdirectory(SetStencilMask_test) -add_vulkan_subdirectory(SetViewportScissorAndBindPipeline_test) -add_vulkan_subdirectory(vkCmdBindDescriptorSets_test) -add_vulkan_subdirectory(vkCmdBindIndexBuffer_test) -add_vulkan_subdirectory(vkCmdBindVertexBuffers_test) -add_vulkan_subdirectory(vkCmdBlitImage_test) -add_vulkan_subdirectory(vkCmdPushConstants_test) -add_vulkan_subdirectory(vkCmdExecuteCommands_test) -add_vulkan_subdirectory(vkCmdNextSubpass_test) -add_vulkan_subdirectory(vkCmdResolveImage_test) -add_vulkan_subdirectory(vkCmdCopyImage_test) -add_vulkan_subdirectory(vkCmdClearAttachments_test) -add_vulkan_subdirectory(vkCmdClearColorImage_test) -add_vulkan_subdirectory(vkCmdClearDepthStencilImage_test) -add_vulkan_subdirectory(vkCmdUpdateBuffer_test) -add_vulkan_subdirectory(vkCmdFillBuffer_test) -add_vulkan_subdirectory(vkCmdCopyQueryPoolResults_test) -add_vulkan_subdirectory(vkCmdResetQueryPool_test) -add_vulkan_subdirectory(vkCmdSetDepthBounds_test) -add_vulkan_subdirectory(vkCmdSetStencilReference_test) -add_vulkan_subdirectory(vkCmdWriteTimestamp_test) -add_vulkan_subdirectory(vkTrimCommandPool_test) diff --git a/gapid_tests/command_buffer_tests/DispatchAndDispatchIndirect_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/DispatchAndDispatchIndirect_test/CMakeLists.txt deleted file mode 100644 index 6b604c13..00000000 --- a/gapid_tests/command_buffer_tests/DispatchAndDispatchIndirect_test/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(DispatchAndDispatchIndirect_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) diff --git a/gapid_tests/command_buffer_tests/DispatchAndDispatchIndirect_test/DispatchAndDispatchIndirect_test.py b/gapid_tests/command_buffer_tests/DispatchAndDispatchIndirect_test/DispatchAndDispatchIndirect_test.py deleted file mode 100644 index c8a6c33d..00000000 --- a/gapid_tests/command_buffer_tests/DispatchAndDispatchIndirect_test/DispatchAndDispatchIndirect_test.py +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, GapitTest -from gapit_test_framework import require, require_equal, require_not_equal - - -@gapit_test("DispatchAndDispatchIndirect_test") -class DispatchGroupCountX512(GapitTest): - - def expect(self): - dispatch = require( - self.next_call_of("vkCmdDispatch")) - - require_not_equal(0, dispatch.int_commandBuffer) - require_equal(512, dispatch.int_groupCountX) - require_equal(1, dispatch.int_groupCountY) - require_equal(1, dispatch.int_groupCountZ) - - -@gapit_test("DispatchAndDispatchIndirect_test") -class DispatchIndirectWithOffsetZero(GapitTest): - - def expect(self): - dispatch_indirect = require( - self.next_call_of("vkCmdDispatchIndirect")) - - require_not_equal(0, dispatch_indirect.int_commandBuffer) - require_not_equal(0, dispatch_indirect.int_buffer) - require_equal(0, dispatch_indirect.int_offset) diff --git a/gapid_tests/command_buffer_tests/DispatchAndDispatchIndirect_test/README.md b/gapid_tests/command_buffer_tests/DispatchAndDispatchIndirect_test/README.md deleted file mode 100644 index dab61abc..00000000 --- a/gapid_tests/command_buffer_tests/DispatchAndDispatchIndirect_test/README.md +++ /dev/null @@ -1,71 +0,0 @@ -# vkCmdDispatch / vkCmdDispatchIndirect - -## Signatures -```c++ -void vkCmdDispatch( - VkCommandBuffer commandBuffer, - uint32_t groupCountX, - uint32_t groupCountY, - uint32_t groupCountZ); - -void vkCmdDispatchIndirect( - VkCommandBuffer commandBuffer, - VkBuffer buffer, - VkDeviceSize offset); -``` - -According to the Vulkan spec: -- `commandBuffer` **must** be in the recording state -- This command **must** only be called out of a render pass instance -- A valid compute pipeline must be bound to the current command buffer with - `VK_PIPELINE_BIND_POINT_COMPUTE` -- Descriptors in each bound descriptor set, specified via - `vkCmdBindDescriptorSets`, must be valid if they are statically used by the - currently bound VkPipeline object, specified via `vkCmdBindPipeline` -- For each push constant that is statically used by the `VkPipeline` currently - bound to `VK_PIPELINE_BIND_POINT_COMPUTE`, a push constant value must have - been set for `VK_PIPELINE_BIND_POINT_COMPUTE`, with a `VkPipelineLayout` that - is compatible for push constants with the one used to create the current - `VkPipeline` -- If any `VkSampler` object that is accessed from a shader by the `VkPipeline` - currently bound to `VK_PIPELINE_BIND_POINT_COMPUTE` uses unnormalized - coordinates, it **must** NOT be used to sample from any `VkImage` with a - `VkImageView` of the type `VK_IMAGE_VIEW_TYPE_3D`, `VK_IMAGE_VIEW_TYPE_CUBE`, - `VK_IMAGE_VIEW_TYPE_1D_ARRAY`, `VK_IMAGE_VIEW_TYPE_2D_ARRAY` or - `VK_IMAGE_VIEW_TYPE_CUBE_ARRAY`, in any shader stage, and it **must** NOT be - used with any of the SPIR-V `OpImageSample*` or `OpImageSparseSample*` - instructions with `ImplicitLod`, `Dref` or `Proj` in their name, or that - includes a LOD bias or any offset values, in any shader stage -- If the *robust buffer* access feature is not enabled, and any shader stage in - the `VkPipeline` object currently bound to `VK_PIPELINE_BIND_POINT_COMPUTE` - accesses a uniform buffer, it must not access values outside of the range of - that buffer specified in the currently bound descriptor set -- Any `VkImageView` being sampled with `VK_FILTER_LINEAR` as a result of this - command must be of a format which supports linear filtering, as specified by - the `VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT` flag in - `VkFormatProperties`::linearTilingFeatures (for a linear image) or - `VkFormatProperties`::optimalTilingFeatures(for an optimally tiled image) - returned by `vkGetPhysicalDeviceFormatProperties` -- vkCmdDispatch - - `groupCountX` **must** be less than or equal to - `VkPhysicalDeviceLimits::maxComputeWorkGroupCount[0]` - - `groupCountY` **must** be less than or equal to - `VkPhysicalDeviceLimits::maxComputeWorkGroupCount[1]` - - `groupCountZ` **must** be less than or equal to - `VkPhysicalDeviceLimits::maxComputeWorkGroupCount[2]` -- vkCmdDispatchIndirect - - If `buffer` is non-sparse then it **must** be bound completely and - contiguously to a single `VkDeviceMemory` object - - `buffer` **must** have been created with the - `VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT` bit set - - `offset` **must** be a multiple of 4 - - The sum of `offset` and the size of `VkDispatchIndirectCommand` must be - less than or equal to the size of `buffer` - -These tests should test the following cases: -- [x] `groupCountX` of value larger than 1 -- [ ] `groupCountY` of value larger than 1 -- [ ] `groupCountZ` of value larger than 1 -- [x] `buffer` of a valid `VkBuffer` for `vkCmdDispatchIndirect` -- [x] `offset` of value 0 -- [ ] `offset` of value other than 0 diff --git a/gapid_tests/command_buffer_tests/DispatchAndDispatchIndirect_test/main.cpp b/gapid_tests/command_buffer_tests/DispatchAndDispatchIndirect_test/main.cpp deleted file mode 100644 index a3a385cb..00000000 --- a/gapid_tests/command_buffer_tests/DispatchAndDispatchIndirect_test/main.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -uint32_t compute_shader[] = -#include "double_numbers.comp.spv" - ; - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - vulkan::VkDevice& device = app.device(); - - // Both input and output buffers have 512 32-bit integers. - const uint32_t kNumElements = 512; - const uint32_t in_out_buffer_size = kNumElements * sizeof(uint32_t); - - VkBufferUsageFlags in_out_buf_usages = VK_BUFFER_USAGE_TRANSFER_SRC_BIT | - VK_BUFFER_USAGE_TRANSFER_DST_BIT | - VK_BUFFER_USAGE_STORAGE_BUFFER_BIT; - auto in_buffer = app.CreateAndBindDefaultExclusiveHostBuffer( - in_out_buffer_size, in_out_buf_usages); - auto out_buffer = app.CreateAndBindDefaultExclusiveHostBuffer( - in_out_buffer_size, in_out_buf_usages); - - // Create descriptor set - VkDescriptorSetLayoutBinding in_binding{ - 0, // binding - VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_COMPUTE_BIT, // stageFlags - nullptr, // pImmutableSamplers - }; - VkDescriptorSetLayoutBinding out_binding{ - 1, // binding - VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_COMPUTE_BIT, // stageFlags - nullptr, // pImmutableSamplers - }; - auto compute_descriptor_set = containers::make_unique( - data->allocator(), app.AllocateDescriptorSet({in_binding, out_binding})); - - const VkDescriptorBufferInfo buffer_infos[2] = { - {*in_buffer, 0, VK_WHOLE_SIZE}, {*out_buffer, 0, VK_WHOLE_SIZE}}; - - const VkWriteDescriptorSet write_descriptor_set{ - VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, // sType - nullptr, // pNext - *compute_descriptor_set, // dstSet - 0, // dstBinding - 0, // dstArrayElement - 2, // descriptorCount - VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, // descriptorType - nullptr, // pImageInfo - buffer_infos, // pBufferInfo - nullptr, // pTexelBufferView - }; - device->vkUpdateDescriptorSets(device, 1, &write_descriptor_set, 0, nullptr); - - // Create pipeline - auto compute_pipeline_layout = - containers::make_unique( - data->allocator(), - app.CreatePipelineLayout({{in_binding, out_binding}})); - auto compute_pipeline = - containers::make_unique( - data->allocator(), - app.CreateComputePipeline( - compute_pipeline_layout.get(), - VkShaderModuleCreateInfo{ - VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO, nullptr, 0, - sizeof(compute_shader), compute_shader}, - "main")); - { - // 1. vkCmdDispatch - auto cmd_buf = app.GetCommandBuffer(); - app.BeginCommandBuffer(&cmd_buf); - - // Set inital values for the in-buffer and clear the out-buffer - containers::vector initial_in_buffer_value(kNumElements, 1, - data->allocator()); - app.FillHostVisibleBuffer( - &*in_buffer, - reinterpret_cast(initial_in_buffer_value.data()), - initial_in_buffer_value.size() * sizeof(uint32_t), 0, &cmd_buf, - VK_ACCESS_SHADER_READ_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT); - containers::vector initial_out_buffer_value(kNumElements, 0, - data->allocator()); - app.FillHostVisibleBuffer( - &*out_buffer, - reinterpret_cast(initial_out_buffer_value.data()), - initial_out_buffer_value.size() * sizeof(uint32_t), 0, &cmd_buf, - VK_ACCESS_SHADER_WRITE_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT); - - // Call dispatch - cmd_buf->vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_COMPUTE, - *compute_pipeline); - cmd_buf->vkCmdBindDescriptorSets( - cmd_buf, VK_PIPELINE_BIND_POINT_COMPUTE, *compute_pipeline_layout, 0, 1, - &compute_descriptor_set->raw_set(), 0, nullptr); - cmd_buf->vkCmdDispatch(cmd_buf, kNumElements, 1, 1); - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - app.EndAndSubmitCommandBufferAndWaitForQueueIdle( - &cmd_buf, &app.render_queue())); - - // Check the output values - containers::vector output = - vulkan::GetHostVisibleBufferData(data->allocator(), &*out_buffer); - std::for_each(output.begin(), output.end(), - [data](uint32_t w) { LOG_EXPECT(==, data->logger(), 2, w); }); - } - - { - // 2. vkCmdDispatch Indirect - // Prepare the indirect buffer - auto indirect_buffer = app.CreateAndBindDefaultExclusiveHostBuffer( - sizeof(VkDispatchIndirectCommand), - VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT); - - auto cmd_buf = app.GetCommandBuffer(); - app.BeginCommandBuffer(&cmd_buf); - - // Set inital values for the in-buffer and clear the out-buffer - containers::vector initial_in_buffer_value(kNumElements, 1, - data->allocator()); - app.FillHostVisibleBuffer( - &*in_buffer, - reinterpret_cast(initial_in_buffer_value.data()), - initial_in_buffer_value.size() * sizeof(uint32_t), 0, &cmd_buf, - VK_ACCESS_SHADER_READ_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT); - containers::vector initial_out_buffer_value(kNumElements, 0, - data->allocator()); - app.FillHostVisibleBuffer( - &*out_buffer, - reinterpret_cast(initial_out_buffer_value.data()), - initial_out_buffer_value.size() * sizeof(uint32_t), 0, &cmd_buf, - VK_ACCESS_SHADER_WRITE_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT); - - // Set the values for the indirect buffer - VkDispatchIndirectCommand indirect_command{kNumElements, 1, 1}; - app.FillHostVisibleBuffer(&*indirect_buffer, - reinterpret_cast(&indirect_command), - sizeof(indirect_command), 0, &cmd_buf, - VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT, - VK_ACCESS_INDIRECT_COMMAND_READ_BIT); - - // Call dispatch indirect - cmd_buf->vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_COMPUTE, - *compute_pipeline); - cmd_buf->vkCmdBindDescriptorSets( - cmd_buf, VK_PIPELINE_BIND_POINT_COMPUTE, *compute_pipeline_layout, 0, 1, - &compute_descriptor_set->raw_set(), 0, nullptr); - cmd_buf->vkCmdDispatchIndirect(cmd_buf, *indirect_buffer, 0); - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - app.EndAndSubmitCommandBufferAndWaitForQueueIdle( - &cmd_buf, &app.render_queue())); - - // Check the output values - containers::vector output = - vulkan::GetHostVisibleBufferData(data->allocator(), &*out_buffer); - std::for_each(output.begin(), output.end(), - [data](uint32_t w) { LOG_EXPECT(==, data->logger(), 2, w); }); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/DrawCommands_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/DrawCommands_test/CMakeLists.txt deleted file mode 100644 index 18392e5e..00000000 --- a/gapid_tests/command_buffer_tests/DrawCommands_test/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(DrawCommands_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) diff --git a/gapid_tests/command_buffer_tests/DrawCommands_test/DrawCommands_test.py b/gapid_tests/command_buffer_tests/DrawCommands_test/DrawCommands_test.py deleted file mode 100644 index ef765493..00000000 --- a/gapid_tests/command_buffer_tests/DrawCommands_test/DrawCommands_test.py +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, GapitTest -from gapit_test_framework import require, require_equal, require_not_equal - - -@gapit_test("DrawCommands_test") -class vkCmdDraw(GapitTest): - - def expect(self): - draw = require( - self.next_call_of("vkCmdDraw")) - - require_not_equal(0, draw.int_commandBuffer) - require_equal(3, draw.int_vertexCount) - require_equal(1, draw.int_instanceCount) - require_equal(0, draw.int_firstVertex) - require_equal(0, draw.int_firstInstance) - - -@gapit_test("DrawCommands_test") -class vkCmdDrawIndexed(GapitTest): - - def expect(self): - draw = require( - self.next_call_of("vkCmdDrawIndexed")) - - require_not_equal(0, draw.int_commandBuffer) - require_equal(3, draw.int_indexCount) - require_equal(1, draw.int_instanceCount) - require_equal(0, draw.int_firstIndex) - require_equal(0, draw.int_vertexOffset) - require_equal(0, draw.int_firstInstance) - - -@gapit_test("DrawCommands_test") -class vkCmdDrawIndirect(GapitTest): - - def expect(self): - draw = require( - self.next_call_of("vkCmdDrawIndirect")) - - require_not_equal(0, draw.int_commandBuffer) - require_not_equal(0, draw.int_buffer) - require_equal(0, draw.int_offset) - require_equal(1, draw.int_drawCount) - require_equal(0, draw.int_stride) - - -@gapit_test("DrawCommands_test") -class vkCmdDrawIndexedIndirect(GapitTest): - - def expect(self): - draw = require( - self.next_call_of("vkCmdDrawIndexedIndirect")) - - require_not_equal(0, draw.int_commandBuffer) - require_not_equal(0, draw.int_buffer) - require_equal(0, draw.int_offset) - require_equal(1, draw.int_drawCount) - require_equal(0, draw.int_stride) diff --git a/gapid_tests/command_buffer_tests/DrawCommands_test/README.md b/gapid_tests/command_buffer_tests/DrawCommands_test/README.md deleted file mode 100644 index 00ec6fa0..00000000 --- a/gapid_tests/command_buffer_tests/DrawCommands_test/README.md +++ /dev/null @@ -1,116 +0,0 @@ -# vkCmdDraw / vkCmdDrawIndexed / vkCmdDrawIndirect / vkCmdDrawIndexedIndirect - -## Signatures -```c++ -void vkCmdDraw( - VkCommandBuffer commandBuffer, - uint32_t vertexCount, - uint32_t instanceCount, - uint32_t firstVertex, - uint32_t firstInstance); - -void vkCmdDrawIndexed( - VkCommandBuffer commandBuffer, - uint32_t indexCount, - uint32_t instanceCount, - uint32_t firstIndex, - int32_t vertexOffset, - uint32_t firstInstance); - -void vkCmdDrawIndirect( - VkCommandBuffer commandBuffer, - VkBuffer buffer, - VkDeviceSize offset, - uint32_t drawCount, - uint32_t stride); - -void vkCmdDrawIndexedIndirect( - VkCommandBuffer commandBuffer, - VkBuffer buffer, - VkDeviceSize offset, - uint32_t drawCount, - uint32_t stride); -``` - -# VkDrawIndirectCommand / VkDrawIndexedIndirectCommand -```c++ -typedef struct VkDrawIndirectCommand { - uint32_t vertexCount; - uint32_t instanceCount; - uint32_t firstVertex; - uint32_t firstInstance; -} VkDrawIndirectCommand; - -typedef struct VkDrawIndexedIndirectCommand { - uint32_t indexCount; - uint32_t instanceCount; - uint32_t firstIndex; - int32_t vertexOffset; - uint32_t firstInstance; -} VkDrawIndexedIndirectCommand; -``` - -According to the Vulkan spec: -- A valid graphics pipeline **must** be bound to the current command buffer - with `VK_PIPELINE_BIND_POINT_GRAPHICS` -- `commandBuffer` **must** be in the recording state -- These commands **must** only be called inside of a render pass instance -- vkCmdDrawIndexed - - `(indexSize * (firstIndex + indexCount) + offset)` **must** be less than or - equal to the size of the currently bound index buffer, with `indexSize` being - based on the type specified by `indexType`, where the index buffer, - `indexType`, and `offset` are specified via `vkCmdBindIndexBuffer` -- vkCmdDrawIndirect / vkCmdDrawIndexedIndirect - - `offset` must be a multiple of 4 - - If `drawCount` is greater than 1, `stride` must be a multiple of 4 and must - be greater than or equal to `sizeof(VkDrawIndirectCommand|VkDrawIndexedIndirectCommand)` - - If `drawCount` is equal to 1, - `(offset + sizeof(VkDrawIndirectCommand|VkDrawIndexedIndirectCommand))` - **must** be less than or equal to the size of buffer - - If `drawCount` is greater than 1, `(stride × (drawCount - 1) + offset + - sizeof(VkDrawIndirectCommand|VkDrawIndexedIndirectCommand))` **must** be less - than or equal to the size of buffer - - If the `drawIndirectFirstInstance` feature is not enabled, all the - `firstInstance` members of the - `VkDrawIndirectCommand|VkDrawIndexedIndirectCommand` structures accessed by - this command must be 0 - - `drawCount` **must** be less than or equal to - VkPhysicalDeviceLimits::maxDrawIndirectCount - -These tests should test the following cases: -- vkCmdDraw - - [ ] `vertexCount` == 0 - - [x] `vertexCount` > 0 - - [ ] `instanceCount` == 0 - - [x] `instanceCount` > 0 - - [x] `firstVertex` == 0 - - [ ] `firstVertex` > 0 - - [x] `firstInstance` == 0 - - [ ] `firstInstance` > 0 -- vkCmdDrawIndexed - - [ ] `indexCount` == 0 - - [x] `indexCount` > 0 - - [ ] `instanceCount` == 0 - - [x] `instanceCount` > 0 - - [x] `firstIndex` == 0 - - [ ] `firstIndex` > 0 - - [x] `vertexOffset` == 0 - - [ ] `vertexOffset` > 0 - - [x] `firstInstance` == 0 - - [ ] `firstInstance` > 0 -- vkCmdDrawIndirect - - [x] `buffer` of valid indirect command buffer - - [x] `offset` == 0 - - [ ] `offset` > 0 - - [ ] `drawCount` == 0 - - [x] `drawCount` > 0 - - [x] `stride` == 0 - - [ ] `stride` > 0 -- vkCmdDrawIndexedIndirect - - [x] `buffer` of valid indirect command buffer - - [x] `offset` == 0 - - [ ] `offset` > 0 - - [ ] `drawCount` == 0 - - [x] `drawCount` > 0 - - [x] `stride` == 0 - - [ ] `stride` > 0 diff --git a/gapid_tests/command_buffer_tests/DrawCommands_test/main.cpp b/gapid_tests/command_buffer_tests/DrawCommands_test/main.cpp deleted file mode 100644 index c4f102af..00000000 --- a/gapid_tests/command_buffer_tests/DrawCommands_test/main.cpp +++ /dev/null @@ -1,349 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -uint32_t fragment_shader[] = -#include "simple_fragment.frag.spv" - ; - -uint32_t vertex_shader[] = -#include "simple_vertex.vert.spv" - ; - -namespace { -// Geometry data of the triangle to be drawn -const float kVertices[] = { - -0.5, -0.5, 0.0, // point 1 - 0.5, -0.5, 0.0, // point 2 - 0.0, 0.5, 0.0, // point 3 -}; -const vulkan::VulkanGraphicsPipeline::InputStream kVerticesStream{ - 0, // binding - VK_FORMAT_R32G32B32_SFLOAT, // format - 0, // offset -}; - -const float kUV[] = { - 0.0, 0.0, // point 1 - 1.0, 0.0, // point 2 - 0.0, 1.0, // point 3 -}; -const vulkan::VulkanGraphicsPipeline::InputStream kUVStream{ - 1, // binding - VK_FORMAT_R32G32_SFLOAT, // format - 0, // offset -}; - -const uint32_t kIndex[] = {0, 1, 2}; -} // anonymous namespace - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - vulkan::VkDevice& device = app.device(); - - // Create vertex buffers and index buffer - auto vertices_buf = app.CreateAndBindDefaultExclusiveHostBuffer( - sizeof(kVertices), - VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT); - auto uv_buf = app.CreateAndBindDefaultExclusiveHostBuffer( - sizeof(kUV), - VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT); - auto index_buf = app.CreateAndBindDefaultExclusiveHostBuffer( - sizeof(kIndex), - VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT); - const ::VkBuffer vertex_buffers[2] = {*vertices_buf, *uv_buf}; - const ::VkDeviceSize vertex_buffer_offsets[2] = {0, 0}; - - // Create render pass. - VkAttachmentReference color_attachment = { - 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - vulkan::VkRenderPass render_pass = app.CreateRenderPass( - {{ - 0, // flags - app.swapchain().format(), // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_UNDEFINED, // initialLayout - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // finalLayout - }}, // AttachmentDescriptions - {{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment, // colorAttachment - nullptr, // pResolveAttachments - nullptr, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }}, // SubpassDescriptions - {} // SubpassDependencies - ); - - // Create pipeline - vulkan::PipelineLayout pipeline_layout(app.CreatePipelineLayout({{}})); - vulkan::VulkanGraphicsPipeline pipeline = - app.CreateGraphicsPipeline(&pipeline_layout, &render_pass, 0); - pipeline.AddShader(VK_SHADER_STAGE_VERTEX_BIT, "main", vertex_shader); - pipeline.AddShader(VK_SHADER_STAGE_FRAGMENT_BIT, "main", fragment_shader); - pipeline.SetTopology(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST); - pipeline.AddInputStream(sizeof(float), VK_VERTEX_INPUT_RATE_VERTEX, - {kVerticesStream}); - pipeline.AddInputStream(sizeof(float), VK_VERTEX_INPUT_RATE_VERTEX, - {kUVStream}); - pipeline.SetScissor({{ - 0, // offset.x - 0, // offset.y - }, - { - app.swapchain().width(), // extent.width - app.swapchain().height() // extent.height - }}); - pipeline.SetViewport({ - 0.0f, // x - 0.0f, // y - static_cast(app.swapchain().width()), // width - static_cast(app.swapchain().height()), // height - 0.0f, // minDepth - 1.0f, // maxDepth - }); - pipeline.SetSamples(VK_SAMPLE_COUNT_1_BIT); - pipeline.AddAttachment(); - pipeline.Commit(); - - // Create image view - VkImageViewCreateInfo image_view_create_info{ - VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - app.swapchain_images().front(), // image - VK_IMAGE_VIEW_TYPE_2D, // viewType - app.swapchain().format(), // format - { - VK_COMPONENT_SWIZZLE_IDENTITY, // components.r - VK_COMPONENT_SWIZZLE_IDENTITY, // components.g - VK_COMPONENT_SWIZZLE_IDENTITY, // components.b - VK_COMPONENT_SWIZZLE_IDENTITY, // components.a - }, - { - VK_IMAGE_ASPECT_COLOR_BIT, // subresourceRange.aspectMask - 0, // subresourceRange.baseMipLevel - 1, // subresourceRange.levelCount - 0, // subresourceRange.baseArrayLayer - 1, // subresourceRange.layerCount - }, - }; - ::VkImageView raw_image_view; - LOG_ASSERT( - ==, data->logger(), - app.device()->vkCreateImageView(app.device(), &image_view_create_info, - nullptr, &raw_image_view), - VK_SUCCESS); - vulkan::VkImageView image_view(raw_image_view, nullptr, &app.device()); - - // Create framebuffer - VkFramebufferCreateInfo framebuffer_create_info{ - VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - render_pass, // renderPass - 1, // attachmentCount - &raw_image_view, // attachments - app.swapchain().width(), // width - app.swapchain().height(), // height - 1 // layers - }; - ::VkFramebuffer raw_framebuffer; - app.device()->vkCreateFramebuffer(app.device(), &framebuffer_create_info, - nullptr, &raw_framebuffer); - vulkan::VkFramebuffer framebuffer(raw_framebuffer, nullptr, &app.device()); - - // Create render pass begin info - VkRenderPassBeginInfo pass_begin{ - VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, // sType - nullptr, // pNext - render_pass, // renderPass - framebuffer, // framebuffer - {{0, 0}, - {app.swapchain().width(), app.swapchain().height()}}, // renderArea - 0, // clearValueCount - nullptr // clears - }; - - { - // 1. vkCmdDraw - auto cmd_buf = app.GetCommandBuffer(); - app.BeginCommandBuffer(&cmd_buf); - vulkan::RecordImageLayoutTransition( - app.swapchain_images().front(), {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, - VK_IMAGE_LAYOUT_UNDEFINED, 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, &cmd_buf); - app.FillHostVisibleBuffer( - &*vertices_buf, reinterpret_cast(kVertices), - sizeof(kVertices), 0, &cmd_buf, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT); - app.FillHostVisibleBuffer(&*uv_buf, reinterpret_cast(kUV), - sizeof(kUV), 0, &cmd_buf, - VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT); - - cmd_buf->vkCmdBeginRenderPass(cmd_buf, &pass_begin, - VK_SUBPASS_CONTENTS_INLINE); - cmd_buf->vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_GRAPHICS, - pipeline); - cmd_buf->vkCmdBindVertexBuffers(cmd_buf, 0, 2, vertex_buffers, - vertex_buffer_offsets); - cmd_buf->vkCmdDraw(cmd_buf, 3, 1, 0, 0); - cmd_buf->vkCmdEndRenderPass(cmd_buf); - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - app.EndAndSubmitCommandBufferAndWaitForQueueIdle( - &cmd_buf, &app.render_queue())); - } - - { - // 2. vkCmdDrawIndexed - auto cmd_buf = app.GetCommandBuffer(); - app.BeginCommandBuffer(&cmd_buf); - vulkan::RecordImageLayoutTransition( - app.swapchain_images().front(), {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, - VK_IMAGE_LAYOUT_UNDEFINED, 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, &cmd_buf); - app.FillHostVisibleBuffer( - &*vertices_buf, reinterpret_cast(kVertices), - sizeof(kVertices), 0, &cmd_buf, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT); - app.FillHostVisibleBuffer(&*uv_buf, reinterpret_cast(kUV), - sizeof(kUV), 0, &cmd_buf, - VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT); - app.FillHostVisibleBuffer( - &*index_buf, reinterpret_cast(kIndex), sizeof(kIndex), 0, - &cmd_buf, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, VK_ACCESS_INDEX_READ_BIT); - - cmd_buf->vkCmdBeginRenderPass(cmd_buf, &pass_begin, - VK_SUBPASS_CONTENTS_INLINE); - cmd_buf->vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_GRAPHICS, - pipeline); - cmd_buf->vkCmdBindVertexBuffers(cmd_buf, 0, 2, vertex_buffers, - vertex_buffer_offsets); - cmd_buf->vkCmdBindIndexBuffer(cmd_buf, *index_buf, 0, VK_INDEX_TYPE_UINT32); - cmd_buf->vkCmdDrawIndexed(cmd_buf, 3, 1, 0, 0, 0); - cmd_buf->vkCmdEndRenderPass(cmd_buf); - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - app.EndAndSubmitCommandBufferAndWaitForQueueIdle( - &cmd_buf, &app.render_queue())); - } - - { - // 3. vkCmdDrawIndirect - // Prepare indirect command - const VkDrawIndirectCommand ic{3, 1, 0, 0}; - auto ic_buf = app.CreateAndBindDefaultExclusiveHostBuffer( - sizeof(ic), - VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT); - - auto cmd_buf = app.GetCommandBuffer(); - app.BeginCommandBuffer(&cmd_buf); - vulkan::RecordImageLayoutTransition( - app.swapchain_images().front(), {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, - VK_IMAGE_LAYOUT_UNDEFINED, 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, &cmd_buf); - app.FillHostVisibleBuffer( - &*vertices_buf, reinterpret_cast(kVertices), - sizeof(kVertices), 0, &cmd_buf, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT); - app.FillHostVisibleBuffer(&*uv_buf, reinterpret_cast(kUV), - sizeof(kUV), 0, &cmd_buf, - VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT); - app.FillHostVisibleBuffer(&*ic_buf, reinterpret_cast(&ic), - sizeof(ic), 0, &cmd_buf, - VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT, - VK_ACCESS_INDIRECT_COMMAND_READ_BIT); - - cmd_buf->vkCmdBeginRenderPass(cmd_buf, &pass_begin, - VK_SUBPASS_CONTENTS_INLINE); - cmd_buf->vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_GRAPHICS, - pipeline); - cmd_buf->vkCmdBindVertexBuffers(cmd_buf, 0, 2, vertex_buffers, - vertex_buffer_offsets); - cmd_buf->vkCmdDrawIndirect(cmd_buf, *ic_buf, 0, 1, 0); - cmd_buf->vkCmdEndRenderPass(cmd_buf); - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - app.EndAndSubmitCommandBufferAndWaitForQueueIdle( - &cmd_buf, &app.render_queue())); - } - - { - // 4, vkCmdDrawIndexedIndirect - const VkDrawIndexedIndirectCommand ic{3, 1, 0, 0, 0}; - auto ic_buf = app.CreateAndBindDefaultExclusiveHostBuffer( - sizeof(ic), - VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT); - - auto cmd_buf = app.GetCommandBuffer(); - app.BeginCommandBuffer(&cmd_buf); - vulkan::RecordImageLayoutTransition( - app.swapchain_images().front(), {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, - VK_IMAGE_LAYOUT_UNDEFINED, 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, &cmd_buf); - app.FillHostVisibleBuffer( - &*vertices_buf, reinterpret_cast(kVertices), - sizeof(kVertices), 0, &cmd_buf, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT); - app.FillHostVisibleBuffer(&*uv_buf, reinterpret_cast(kUV), - sizeof(kUV), 0, &cmd_buf, - VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT); - app.FillHostVisibleBuffer( - &*index_buf, reinterpret_cast(kIndex), sizeof(kIndex), 0, - &cmd_buf, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, VK_ACCESS_INDEX_READ_BIT); - app.FillHostVisibleBuffer(&*ic_buf, reinterpret_cast(&ic), - sizeof(ic), 0, &cmd_buf, - VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT, - VK_ACCESS_INDIRECT_COMMAND_READ_BIT); - - cmd_buf->vkCmdBeginRenderPass(cmd_buf, &pass_begin, - VK_SUBPASS_CONTENTS_INLINE); - cmd_buf->vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_GRAPHICS, - pipeline); - cmd_buf->vkCmdBindVertexBuffers(cmd_buf, 0, 2, vertex_buffers, - vertex_buffer_offsets); - cmd_buf->vkCmdBindIndexBuffer(cmd_buf, *index_buf, 0, VK_INDEX_TYPE_UINT32); - cmd_buf->vkCmdDrawIndexedIndirect(cmd_buf, *ic_buf, 0, 1, 0); - cmd_buf->vkCmdEndRenderPass(cmd_buf); - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - app.EndAndSubmitCommandBufferAndWaitForQueueIdle( - &cmd_buf, &app.render_queue())); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/QueueSubmitAndWait_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/QueueSubmitAndWait_test/CMakeLists.txt deleted file mode 100644 index 2f28e0d8..00000000 --- a/gapid_tests/command_buffer_tests/QueueSubmitAndWait_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(QueueSubmitAndWait_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/QueueSubmitAndWait_test/QueueSubmitAndWait_test.py b/gapid_tests/command_buffer_tests/QueueSubmitAndWait_test/QueueSubmitAndWait_test.py deleted file mode 100644 index a1bc840b..00000000 --- a/gapid_tests/command_buffer_tests/QueueSubmitAndWait_test/QueueSubmitAndWait_test.py +++ /dev/null @@ -1,153 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -import gapit_test_framework -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY -from vulkan_constants import * - -#/* -# memory_requirements = VulkanStruct( -# architecture, MEMORY_REQUIREMENTS, get_write_offset_function( -# get_image_memory_requirements, -# get_image_memory_requirements.hex_pMemoryRequirements)) -#*/ - -SUBMIT_INFO = [ - ("sType", UINT32_T), ("pNext", POINTER), ("waitSemaphoreCount", UINT32_T), - ("pWaitSemaphores", POINTER), ("pWaitDstStageMask", POINTER), - ("commandBufferCount", UINT32_T), ("pCommandBuffers", POINTER), - ("signalSemaphoreCount", UINT32_T), ("pSignalSemaphores", POINTER) -] - - -@gapit_test("QueueSubmitAndWait_test") -class ZeroSubmits(GapitTest): - - def expect(self): - architecture = self.architecture - queue_submit = require(self.nth_call_of("vkQueueSubmit", 1)) - require_not_equal(0, queue_submit.int_queue) - require_equal(0, queue_submit.int_submitCount) - require_equal(0, queue_submit.hex_pSubmits) - require_equal(0, queue_submit.int_fence) - - queue_wait_idle = require(self.next_call_of("vkQueueWaitIdle")) - require_equal(queue_wait_idle.int_queue, queue_submit.int_queue) - - -@gapit_test("QueueSubmitAndWait_test") -class OneSubmitZeroCommandBuffers(GapitTest): - - def expect(self): - architecture = self.architecture - queue_submit = require(self.nth_call_of("vkQueueSubmit", 2)) - require_not_equal(0, queue_submit.int_queue) - require_not_equal(0, queue_submit.int_submitCount) - require_not_equal(0, queue_submit.hex_pSubmits) - require_equal(0, queue_submit.int_fence) - - queue_wait_idle = require(self.next_call_of("vkQueueWaitIdle")) - require_equal(queue_wait_idle.int_queue, queue_submit.int_queue) - - queue_submit_info = VulkanStruct( - architecture, SUBMIT_INFO, - get_read_offset_function(queue_submit, queue_submit.hex_pSubmits)) - - require_equal(VK_STRUCTURE_TYPE_SUBMIT_INFO, queue_submit_info.sType) - require_equal(0, queue_submit_info.pNext) - require_equal(0, queue_submit_info.waitSemaphoreCount) - require_equal(0, queue_submit_info.pWaitSemaphores) - require_equal(0, queue_submit_info.pWaitDstStageMask) - require_equal(0, queue_submit_info.commandBufferCount) - require_equal(0, queue_submit_info.pCommandBuffers) - require_equal(0, queue_submit_info.signalSemaphoreCount) - require_equal(0, queue_submit_info.pSignalSemaphores) - - -@gapit_test("QueueSubmitAndWait_test") -class OneCommandBuffer(GapitTest): - - def expect(self): - architecture = self.architecture - queue_submit = require(self.nth_call_of("vkQueueSubmit", 3)) - require_not_equal(0, queue_submit.int_queue) - require_equal(1, queue_submit.int_submitCount) - require_not_equal(0, queue_submit.hex_pSubmits) - require_equal(0, queue_submit.int_fence) - - queue_wait_idle = require(self.next_call_of("vkQueueWaitIdle")) - require_equal(queue_wait_idle.int_queue, queue_submit.int_queue) - - queue_submit_info = VulkanStruct( - architecture, SUBMIT_INFO, - get_read_offset_function(queue_submit, queue_submit.hex_pSubmits)) - - require_equal(VK_STRUCTURE_TYPE_SUBMIT_INFO, queue_submit_info.sType) - require_equal(0, queue_submit_info.pNext) - require_equal(0, queue_submit_info.waitSemaphoreCount) - require_equal(0, queue_submit_info.pWaitSemaphores) - require_equal(0, queue_submit_info.pWaitDstStageMask) - require_equal(1, queue_submit_info.commandBufferCount) - require_not_equal(0, queue_submit_info.pCommandBuffers) - require_equal(0, queue_submit_info.signalSemaphoreCount) - require_equal(0, queue_submit_info.pSignalSemaphores) - - # commandBuffers are dispatchable handles, i.e. pointers - command_buffer = little_endian_bytes_to_int( - require( - queue_submit.get_read_data(queue_submit_info.pCommandBuffers, - architecture.int_pointerSize))) - require_not_equal(command_buffer, 0) - - -@gapit_test("QueueSubmitAndWait_test") -class TwoCommandBuffers(GapitTest): - - def expect(self): - architecture = self.architecture - queue_submit = require(self.nth_call_of("vkQueueSubmit", 4)) - require_not_equal(0, queue_submit.int_queue) - require_not_equal(0, queue_submit.int_submitCount) - require_not_equal(0, queue_submit.hex_pSubmits) - require_equal(0, queue_submit.int_fence) - - queue_wait_idle = require(self.next_call_of("vkQueueWaitIdle")) - require_equal(queue_wait_idle.int_queue, queue_submit.int_queue) - - queue_submit_info = VulkanStruct( - architecture, SUBMIT_INFO, - get_read_offset_function(queue_submit, queue_submit.hex_pSubmits)) - require_equal(VK_STRUCTURE_TYPE_SUBMIT_INFO, queue_submit_info.sType) - require_equal(0, queue_submit_info.pNext) - require_equal(0, queue_submit_info.waitSemaphoreCount) - require_equal(0, queue_submit_info.pWaitSemaphores) - require_equal(0, queue_submit_info.pWaitDstStageMask) - require_equal(2, queue_submit_info.commandBufferCount) - require_not_equal(0, queue_submit_info.pCommandBuffers) - require_equal(0, queue_submit_info.signalSemaphoreCount) - require_equal(0, queue_submit_info.pSignalSemaphores) - - # commandBuffers are dispatchable handles, i.e. pointers - command_buffer = little_endian_bytes_to_int( - require( - queue_submit.get_read_data(queue_submit_info.pCommandBuffers, - architecture.int_pointerSize))) - command_buffer2 = little_endian_bytes_to_int( - require( - queue_submit.get_read_data(queue_submit_info.pCommandBuffers + - architecture.int_pointerSize, - architecture.int_pointerSize))) - require_not_equal(command_buffer, 0) - require_not_equal(command_buffer2, 0) diff --git a/gapid_tests/command_buffer_tests/QueueSubmitAndWait_test/README.md b/gapid_tests/command_buffer_tests/QueueSubmitAndWait_test/README.md deleted file mode 100644 index 53b34ca5..00000000 --- a/gapid_tests/command_buffer_tests/QueueSubmitAndWait_test/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# vkQueueSubmit - -## Signatures -```c++ -VkResult vkQueueSubmit( - VkQueue queue, - uint32_t submitCount, - const VkSubmitInfo* pSubmits, - VkFence fence); - -VkResult vkQueueWaitIdle( - VkQueue queue); -``` - -# VkSubmitInfo -```c++ -typedef struct VkSubmitInfo { - VkStructureType sType; - const void* pNext; - uint32_t waitSemaphoreCount; - const VkSemaphore* pWaitSemaphores; - const VkPipelineStageFlags* pWaitDstStageMask; - uint32_t commandBufferCount; - const VkCommandBuffer* pCommandBuffers; - uint32_t signalSemaphoreCount; - const VkSemaphore* pSignalSemaphores; -} VkSubmitInfo; -``` - -According to the Vulkan spec: -- `pSubmits` points to `submitCount` `VkSubmitInfo` structures -- `pFence` can be `VK_NULL_HANDLE` or a valid handle -- `waitSemaphoreCount` can be 0 or > 0 -- `pWaitDstStageMask` is a pointer to `pWaitDstStageMask` `VkPipelineStageFlags` -- `pCommandBuffers` is a pointer to `commandBufferCount` `VkCommandBuffer`s -- `pSignalSemaphores` is a pointer to `signalSemaphoreCount` `VkSemaphore`s - -These tests should test the following cases: -- [x] `submitCount` == 0 -- [x] `submitCount` > 0 -- [x] `fence` == `VK_NULL_HANDLE` -- [ ] `fence` != `VK_NULL_HANDLE` -- [x] `waitSemaphoreCount` == 0 -- [ ] `waitSemaphoreCount` == 1 -- [ ] `waitSemaphoreCount` > 1 -- [x] `commandBufferCount` == 0 -- [x] `commandBufferCount` == 1 -- [x] `commandBufferCount` > 1 -- [x] `signalSemaphoreCount` == 0 -- [ ] `signalSemaphoreCount` == 1 -- [ ] `signalSemaphoreCount` > 1 \ No newline at end of file diff --git a/gapid_tests/command_buffer_tests/QueueSubmitAndWait_test/main.cpp b/gapid_tests/command_buffer_tests/QueueSubmitAndWait_test/main.cpp deleted file mode 100644 index daa4bc16..00000000 --- a/gapid_tests/command_buffer_tests/QueueSubmitAndWait_test/main.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/queue_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateDefaultInstance(data->allocator(), &wrapper)); - vulkan::VkSurfaceKHR surface(vulkan::CreateDefaultSurface(&instance, data)); - - uint32_t queues[2]; - vulkan::VkDevice device(vulkan::CreateDeviceForSwapchain( - data->allocator(), &instance, &surface, &queues[0], &queues[1], false)); - - vulkan::VkQueue queue = vulkan::GetQueue(&device, queues[0]); - { // 0 submits - queue->vkQueueSubmit(queue, 0, nullptr, - static_cast(VK_NULL_HANDLE)); - queue->vkQueueWaitIdle(queue); - } - - { // 1 submit, 0 command_buffers - VkSubmitInfo queue_submit_info{ - VK_STRUCTURE_TYPE_SUBMIT_INFO, // sType - nullptr, // pNext - 0, // waitSemaphoreCount - nullptr, // pWaitSemaphores - nullptr, // pWaitDstStageMask - 0, // commandBufferCount - nullptr, // pCommandBuffers - 0, // signalSemaphoreCount - nullptr // pSignalSemaphores - }; - queue->vkQueueSubmit(queue, 1, &queue_submit_info, - static_cast(VK_NULL_HANDLE)); - queue->vkQueueWaitIdle(queue); - } - - { // 1 submit, 1 command_buffer - vulkan::VkCommandPool pool( - vulkan::CreateDefaultCommandPool(data->allocator(), device, false)); - vulkan::VkCommandBuffer command_buffer = - vulkan::CreateDefaultCommandBuffer(&pool, &device); - - VkCommandBufferBeginInfo info{ - /* sType = */ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* pInheritanceInfo = */ nullptr, - }; - command_buffer->vkBeginCommandBuffer(command_buffer, &info); - command_buffer->vkEndCommandBuffer(command_buffer); - - ::VkCommandBuffer raw_command_buffer = command_buffer; - - VkSubmitInfo queue_submit_info{ - VK_STRUCTURE_TYPE_SUBMIT_INFO, // sType - nullptr, // pNext - 0, // waitSemaphoreCount - nullptr, // pWaitSemaphores - nullptr, // pWaitDstStageMask - 1, // commandBufferCount - &raw_command_buffer, // pCommandBuffers - 0, // signalSemaphoreCount - nullptr // pSignalSemaphores - }; - - queue->vkQueueSubmit(queue, 1, &queue_submit_info, - static_cast(VK_NULL_HANDLE)); - queue->vkQueueWaitIdle(queue); - } - - { // 1 submit, 2 command_buffers - vulkan::VkCommandPool pool( - vulkan::CreateDefaultCommandPool(data->allocator(), device, false)); - vulkan::VkCommandBuffer command_buffer = - vulkan::CreateDefaultCommandBuffer(&pool, &device); - - VkCommandBufferBeginInfo info{ - /* sType = */ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* pInheritanceInfo = */ nullptr, - }; - command_buffer->vkBeginCommandBuffer(command_buffer, &info); - command_buffer->vkEndCommandBuffer(command_buffer); - - vulkan::VkCommandBuffer command_buffer2 = - vulkan::CreateDefaultCommandBuffer(&pool, &device); - command_buffer->vkBeginCommandBuffer(command_buffer2, &info); - command_buffer->vkEndCommandBuffer(command_buffer2); - - VkCommandBuffer command_buffers[2] = {command_buffer, command_buffer2}; - - VkSubmitInfo queue_submit_info{ - VK_STRUCTURE_TYPE_SUBMIT_INFO, // sType - nullptr, // pNext - 0, // waitSemaphoreCount - nullptr, // pWaitSemaphores - nullptr, // pWaitDstStageMask - 2, // commandBufferCount - command_buffers, // pCommandBuffers - 0, // signalSemaphoreCount - nullptr // pSignalSemaphores - }; - - queue->vkQueueSubmit(queue, 1, &queue_submit_info, - static_cast(VK_NULL_HANDLE)); - queue->vkQueueWaitIdle(queue); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/README.md b/gapid_tests/command_buffer_tests/README.md deleted file mode 100644 index e55bc8bd..00000000 --- a/gapid_tests/command_buffer_tests/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# Command buffer tests - -These tests are specifically for testing Vulkan API commands that apply on -command buffers. - -# Tests -- [BeginAndEndCommandBuffer_test](BeginAndEndCommandBuffer_test/README.md) -- [BeginAndEndQuery_test](BeginAndEndQuery_test/README.md) -- [BeginAndEndRenderPass_test](BeginAndEndRenderPass_test/README.md) -- [BufferImageCopy_test](BufferImageCopy_test/README.md) -- [DispatchAndDispatchIndirect_test](DispatchAndDispatchIndirect_test/README.md) -- [DrawCommands_test](DrawCommands_test/README.md) -- [QueueSubmitAndWait_test](QueueSubmitAndWait_test/README.md) -- [SetDepthBias_test](SetDepthBias_test/README.md) -- [SetLineWidthAndBlendConstants_test](SetLineWidthAndBlendConstants_test/README.md) -- [SetStencilMask_test](SetStencilMask_test/README.md) -- [SetViewportAndScissor_test](SetViewportAndScissor_test/README.md) -- [vkCmdBindDescriptorSets_test](vkCmdBindDescriptorSets_test/README.md) -- [vkCmdBindIndexBuffer_test](vkCmdBindIndexBuffer_test/README.md) -- [vkCmdBindVertexBuffers_test](vkCmdBindVertexBuffers_test/README.md) -- [vkCmdBlitImage_test](vkCmdBlitImage_test/README.md) -- [vkCmdClearAttachments_test](vkCmdClearAttachments_test/README.md) -- [vkCmdClearColorImage_test](vkCmdClearColorImage_test/README.md) -- [vkCmdClearDepthStencilImage_test](vkCmdClearDepthStencilImage_test/README.md) -- [vkCmdCopyImage_test](vkCmdCopyImage_test/README.md) -- [vkCmdCopyQueryPoolResults_test](vkCmdCopyQueryPoolResults_test/README.md) -- [vkCmdNextSubpass_test](vkCmdNextSubpass_test/README.md) -- [vkCmdExecuteCommands_test](vkCmdExecuteCommands_test/README.md) -- [vkCmdFillBuffer_test](vkCmdFillBuffer_test/README.md) -- [vkCmdPushConstants_test](vkCmdPushConstants_test/README.md) -- [vkCmdResetQueryPool_test](vkCmdResetQueryPool_test/README.md) -- [vkCmdResolveImage_test](vkCmdResolveImage_test/README.md) -- [vkCmdSetDepthBounds_test](vkCmdSetDepthBounds_test/README.md) -- [vkCmdSetStencilReference_test](vkCmdSetStencilReference_test/README.md) -- [vkCmdUpdateBuffer_test](vkCmdUpdateBuffer_test/README.md) -- [vkCmdWriteTimestamp_test](vkCmdWriteTimestamp_test/README.md) -- [vkQueuePresentKHR_test](vkQueuePresentKHR_test/README.md) -- [vkTrimCommandPool_test](vkTrimCommandPool_test/README.md) diff --git a/gapid_tests/command_buffer_tests/SetDepthBias_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/SetDepthBias_test/CMakeLists.txt deleted file mode 100644 index 73e607ad..00000000 --- a/gapid_tests/command_buffer_tests/SetDepthBias_test/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(SetDepthBias_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) diff --git a/gapid_tests/command_buffer_tests/SetDepthBias_test/README.md b/gapid_tests/command_buffer_tests/SetDepthBias_test/README.md deleted file mode 100644 index adf96f72..00000000 --- a/gapid_tests/command_buffer_tests/SetDepthBias_test/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# vkCmdSetDepthBias - -## Signatures -```c++ -void vkCmdSetDepthBias( - VkCommandBuffer commandBuffer, - float depthBiasConstantFactor, - float depthBiasClamp, - float depthBiasSlopeFactor); -``` - -According to the Vulkan spec: -- The currently bound graphics pipeline **must** have been created with the - `VK_DYNAMIC_STATE_DEPTH_BIAS` dynamic state enabled -- If the depth bias clamping feature is not enabled, `depthBiasClamp` **must** - be 0.0 -- If `depthBiasEnable` in the currently bound graphics pipeline's - `VkPipelineRasterizationStateCrateInfo` is `VK_FALSE`, no depth bias is - applied and the fragment's depth values are unchanged. - -These tests should test the following cases: -- [x] `depthBiasConstantFactor`, `depthBiasClamp` and `depthBiasSlopeFactor` - of float values. diff --git a/gapid_tests/command_buffer_tests/SetDepthBias_test/SetDepthBias_test.py b/gapid_tests/command_buffer_tests/SetDepthBias_test/SetDepthBias_test.py deleted file mode 100644 index 6a34d511..00000000 --- a/gapid_tests/command_buffer_tests/SetDepthBias_test/SetDepthBias_test.py +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from gapit_test_framework import GapidUnsupportedException -import gapit_test_framework -from vulkan_constants import * - - -@gapit_test("SetDepthBias_test") -class SetDepthBiasWithDepthBiasClampOfValueZero(GapitTest): - - def expect(self): - DEPTH_BIAS_CONSTANT_FACTOR = 1.1 - DEPTH_BIAS_CLAMP = 0.0 - DEPTH_BIAS_SLOPE_FACTOR = 3.3 - - set_depth_bias = require(self.nth_call_of("vkCmdSetDepthBias", 1)) - - require_not_equal(0, set_depth_bias.int_commandBuffer) - require_equal(DEPTH_BIAS_CONSTANT_FACTOR, - set_depth_bias.float_depthBiasConstantFactor) - require_equal(DEPTH_BIAS_CLAMP, set_depth_bias.float_depthBiasClamp) - require_equal(DEPTH_BIAS_SLOPE_FACTOR, - set_depth_bias.float_depthBiasSlopeFactor) - - -@gapit_test("SetDepthBias_test") -class SetDepthBiasWithDepthBiasClampOfValueNonZero(GapitTest): - - def expect(self): - DEPTH_BIAS_CONSTANT_FACTOR = 1.1 - DEPTH_BIAS_CLAMP = 2.2 - DEPTH_BIAS_SLOPE_FACTOR = 3.3 - - create_device = self.nth_call_of("vkCreateDevice", 2) - if create_device[0] is None: - raise GapidUnsupportedException( - "physical device feature: depthBiasClamp not supported") - - set_depth_bias = require(self.next_call_of("vkCmdSetDepthBias")) - - require_not_equal(0, set_depth_bias.int_commandBuffer) - require_equal(DEPTH_BIAS_CONSTANT_FACTOR, - set_depth_bias.float_depthBiasConstantFactor) - require_equal(DEPTH_BIAS_CLAMP, set_depth_bias.float_depthBiasClamp) - require_equal(DEPTH_BIAS_SLOPE_FACTOR, - set_depth_bias.float_depthBiasSlopeFactor) diff --git a/gapid_tests/command_buffer_tests/SetDepthBias_test/main.cpp b/gapid_tests/command_buffer_tests/SetDepthBias_test/main.cpp deleted file mode 100644 index c10c67ab..00000000 --- a/gapid_tests/command_buffer_tests/SetDepthBias_test/main.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/queue_wrapper.h" - -uint32_t fragment_shader[] = -#include "simple_fragment.frag.spv" - ; - -uint32_t vertex_shader[] = -#include "simple_vertex.vert.spv" - ; - -void CreatePipelineAndSetDepthBias(const entry::EntryData* data, - vulkan::VulkanApplication* app_ptr, - float depth_bias_constant_factor, - float depth_bias_clamp, - float depth_bias_slope_factor) { - LOG_ASSERT(!=, data->logger(), 0, (uintptr_t)app_ptr); - vulkan::VulkanApplication& app = *app_ptr; - vulkan::PipelineLayout pipeline_layout(app.CreatePipelineLayout( - {{{ - 0, // binding - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_VERTEX_BIT, // stageFlags - nullptr, // pImmutableSamplers - }, - { - 1, // binding - VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_FRAGMENT_BIT, // stageFlags - nullptr, // pImmutableSamplers - }}})); - - VkAttachmentReference color_attachment = { - 1, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - VkAttachmentReference depth_attachment = { - 0, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}; - - vulkan::VkRenderPass render_pass = app.CreateRenderPass( - {{ - 0, // flags - VK_FORMAT_D32_SFLOAT, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL // finalLayout - }, - { - 0, // flags - VK_FORMAT_R8G8B8A8_UNORM, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // finalLayout - }}, // AttachmentDescriptions - {{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment, // colorAttachment - nullptr, // pResolveAttachments - &depth_attachment, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }}, // SubpassDescriptions - {} // SubpassDependencies - ); - - vulkan::VulkanGraphicsPipeline pipeline = - app.CreateGraphicsPipeline(&pipeline_layout, &render_pass, 0); - pipeline.AddShader(VK_SHADER_STAGE_VERTEX_BIT, "main", vertex_shader); - pipeline.AddShader(VK_SHADER_STAGE_FRAGMENT_BIT, "main", fragment_shader); - pipeline.AddDynamicState(VK_DYNAMIC_STATE_DEPTH_BIAS); - pipeline.SetTopology(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST); - pipeline.AddInputStream(4 * 6, // vec4 + vec2 - VK_VERTEX_INPUT_RATE_VERTEX, - { - {0, VK_FORMAT_R32G32B32A32_SFLOAT, 0}, - {1, VK_FORMAT_R32G32B32A32_SFLOAT, 4 * 4}, - }); - pipeline.AddAttachment(); - pipeline.Commit(); - - vulkan::VkCommandBuffer command_buffer = app.GetCommandBuffer(); - VkCommandBufferBeginInfo begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType - nullptr, // pNext - VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, // flags - nullptr // pInheritanceInfo - }; - - command_buffer->vkBeginCommandBuffer(command_buffer, &begin_info); - command_buffer->vkCmdBindPipeline(command_buffer, - VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline); - - command_buffer->vkCmdSetDepthBias(command_buffer, depth_bias_constant_factor, - depth_bias_clamp, depth_bias_slope_factor); - - command_buffer->vkEndCommandBuffer(command_buffer); -} - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - { - const float depth_bias_constant_factor = 1.1f; - const float depth_bias_clamp = - 0.0f; // only 0.0 is valid as depthBiasClamp - // has not been confirmed as supported. - const float depth_bias_slope_factor = 3.3f; - // 1. Test with depthBiasClamp set to zero, so physical device feature: - // depthBiasClamp is not required. - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - CreatePipelineAndSetDepthBias(data, &app, depth_bias_constant_factor, - depth_bias_clamp, depth_bias_slope_factor); - } - - { - // 2. Test with depthBiasClamp not set to zero, i.e. depthBiasClamp is - // required. - const float depth_bias_constant_factor = 1.1f; - const float depth_bias_clamp = 2.2f; - const float depth_bias_slope_factor = 3.3f; - VkPhysicalDeviceFeatures request_features = {0}; - request_features.depthBiasClamp = VK_TRUE; - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions(), {}, {}, - request_features); - if (app.device().is_valid()) { - CreatePipelineAndSetDepthBias(data, &app, depth_bias_constant_factor, - depth_bias_clamp, depth_bias_slope_factor); - } else { - data->logger()->LogInfo( - "Disabled test due to missing physical device feature: " - "depthBiasClamp"); - } - } - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/CMakeLists.txt deleted file mode 100644 index 93af0274..00000000 --- a/gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(SetLineWidthAndBlendConstants_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) - - -add_gapid_test(SetLineWidthWideLines_test - SOURCES wide_lines.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) diff --git a/gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/README.md b/gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/README.md deleted file mode 100644 index 95fd4bfa..00000000 --- a/gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# vkCmdSetLineWidth / vkCmdSetBlendConstants - -## Signatures -```c++ -void vkCmdSetLineWidth( - VkCommandBuffer commandBuffer, - float lineWidth); - -void vkCmdSetBlendConstants( - VkCommandBuffer commandBuffer, - const float blendConstants[4]); -``` - - -According to the Vulkan spec: -- `commandBuffer` **must** be a valid `VkCommandBuffer` handle -- `commandBuffer` **must** be in the *recording state* -- vkCmdSetLineWidth - - The current bound graphics pipeline **must** have been created with the - `VK_DYNAMIC_STATE_LINE_WIDTH` dynamic state enabled - - If the *wide lines* feature is not enabled, `lineWidth` **must** be `1.0` -- vkCmdSetBlendConstants - - The current bound graphics pipeline **must** have been created with the - `VK_DYNAMIC_STATE_BLEND_CONSTANTS` dynamic state enabled - -These tests should test the following cases: -- [x] `lineWidth` of valid value -- [x] `blendConstants` of valid values diff --git a/gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/SetViewportScissorAndBindPipeline_test.py b/gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/SetViewportScissorAndBindPipeline_test.py deleted file mode 100644 index b86174d1..00000000 --- a/gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/SetViewportScissorAndBindPipeline_test.py +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from gapit_test_framework import GapidUnsupportedException -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER, INT32_T -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY -from vulkan_constants import * - - -@gapit_test("SetLineWidthAndBlendConstants_test") -class SetBlendConstants(GapitTest): - - def expect(self): - set_blend_constants = require(self.next_call_of( - "vkCmdSetBlendConstants")) - - require_not_equal(0, set_blend_constants.int_commandBuffer) - require_equal([1.25, 2.5, 5.0, 10.0], - set_blend_constants.float_blendConstants) - - -@gapit_test("SetLineWidthAndBlendConstants_test") -class SetLineWidthOnePointZero(GapitTest): - - def expect(self): - """The first call to vkCmdSetLineWidth should have line width value: 1.0 - """ - set_line_width = require(self.nth_call_of("vkCmdSetLineWidth", 1)) - - require_not_equal(0, set_line_width.int_commandBuffer) - require_equal(1.0, set_line_width.float_lineWidth) - - -@gapit_test("SetLineWidthWideLines_test") -class SetLineWidthTwoPointZero(GapitTest): - - def expect(self): - """The second call to vkCmdSetLineWidth should have line width value: 2.0 - """ - create_device = self.nth_call_of("vkCreateDevice", 1) - if create_device[0] is None: - raise GapidUnsupportedException( - "physical device feature: wideLine not supported") - - set_line_width = require(self.nth_call_of("vkCmdSetLineWidth", 1)) - - require_not_equal(0, set_line_width.int_commandBuffer) - require_equal(2.0, set_line_width.float_lineWidth) diff --git a/gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/main.cpp b/gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/main.cpp deleted file mode 100644 index 89931c66..00000000 --- a/gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/main.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/queue_wrapper.h" - -uint32_t fragment_shader[] = -#include "simple_fragment.frag.spv" - ; - -uint32_t vertex_shader[] = -#include "simple_vertex.vert.spv" - ; - -namespace { -const VkCommandBufferBeginInfo kBeginInfo{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr, - VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, nullptr}; - -vulkan::VulkanGraphicsPipeline CreateAndCommitPipeline( - const entry::EntryData* data, vulkan::VulkanApplication* app_ptr, - std::initializer_list dynamic_states) { - LOG_ASSERT(!=, data->logger(), 0, (uintptr_t)app_ptr); - vulkan::VulkanApplication& app = *app_ptr; - vulkan::PipelineLayout pipeline_layout(app.CreatePipelineLayout( - {{{ - 0, // binding - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_VERTEX_BIT, // stageFlags - nullptr, // pImmutableSamplers - }, - { - 1, // binding - VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_FRAGMENT_BIT, // stageFlags - nullptr, // pImmutableSamplers - }}})); - - VkAttachmentReference color_attachment = { - 1, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - VkAttachmentReference depth_attachment = { - 0, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}; - - vulkan::VkRenderPass render_pass = app.CreateRenderPass( - {{ - 0, // flags - VK_FORMAT_D32_SFLOAT, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL // finalLayout - }, - { - 0, // flags - VK_FORMAT_R8G8B8A8_UNORM, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // finalLayout - }}, // AttachmentDescriptions - {{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment, // colorAttachment - nullptr, // pResolveAttachments - &depth_attachment, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }}, // SubpassDescriptions - {} // SubpassDependencies - ); - - vulkan::VulkanGraphicsPipeline pipeline = - app.CreateGraphicsPipeline(&pipeline_layout, &render_pass, 0); - pipeline.AddShader(VK_SHADER_STAGE_VERTEX_BIT, "main", vertex_shader); - pipeline.AddShader(VK_SHADER_STAGE_FRAGMENT_BIT, "main", fragment_shader); - pipeline.SetTopology(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST); - pipeline.AddInputStream(4 * 6, // vec4 + vec2 - VK_VERTEX_INPUT_RATE_VERTEX, - { - {0, VK_FORMAT_R32G32B32A32_SFLOAT, 0}, - {1, VK_FORMAT_R32G32B32A32_SFLOAT, 4 * 4}, - }); - pipeline.AddAttachment(); - for (auto dynamic_state : dynamic_states) { - pipeline.AddDynamicState(dynamic_state); - } - pipeline.Commit(); - return pipeline; -} -} // anonymous namespace - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - - { - // 1. Test vkCmdBlendConstants - const float blend_constants[4] = {1.25, 2.5, 5.0, 10.0}; - vulkan::VkDevice& device = app.device(); - // Create a pipeline - vulkan::VulkanGraphicsPipeline pipeline = - CreateAndCommitPipeline(data, &app, {VK_DYNAMIC_STATE_BLEND_CONSTANTS}); - // Populate command buffer - vulkan::VkCommandBuffer cmd_buf = app.GetCommandBuffer(); - cmd_buf->vkBeginCommandBuffer(cmd_buf, &kBeginInfo); - cmd_buf->vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_GRAPHICS, - pipeline); - cmd_buf->vkCmdSetBlendConstants(cmd_buf, blend_constants); - cmd_buf->vkEndCommandBuffer(cmd_buf); - // Don't need to submit the commands as we don't the correctness of the - // execution of the commands are not the goal of this test. - } - - { - // 2. Test vkCmdSetLineWidth without 'Wide Line' feature, the only valid - // value for the line width is 1.0 - const float line_width = 1.0; - vulkan::VkDevice& device = app.device(); - // Create a pipeline - vulkan::VulkanGraphicsPipeline pipeline = - CreateAndCommitPipeline(data, &app, {VK_DYNAMIC_STATE_LINE_WIDTH}); - // Populate command buffer - vulkan::VkCommandBuffer cmd_buf = app.GetCommandBuffer(); - cmd_buf->vkBeginCommandBuffer(cmd_buf, &kBeginInfo); - cmd_buf->vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_GRAPHICS, - pipeline); - cmd_buf->vkCmdSetLineWidth(cmd_buf, line_width); - cmd_buf->vkEndCommandBuffer(cmd_buf); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/wide_lines.cpp b/gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/wide_lines.cpp deleted file mode 100644 index 03265662..00000000 --- a/gapid_tests/command_buffer_tests/SetLineWidthAndBlendConstants_test/wide_lines.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/queue_wrapper.h" - -uint32_t fragment_shader[] = -#include "simple_fragment.frag.spv" - ; - -uint32_t vertex_shader[] = -#include "simple_vertex.vert.spv" - ; - -namespace { -const VkCommandBufferBeginInfo kBeginInfo{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr, - VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, nullptr}; - -vulkan::VulkanGraphicsPipeline CreateAndCommitPipeline( - const entry::EntryData* data, vulkan::VulkanApplication* app_ptr, - std::initializer_list dynamic_states) { - LOG_ASSERT(!=, data->logger(), 0, (uintptr_t)app_ptr); - vulkan::VulkanApplication& app = *app_ptr; - vulkan::PipelineLayout pipeline_layout(app.CreatePipelineLayout( - {{{ - 0, // binding - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_VERTEX_BIT, // stageFlags - nullptr, // pImmutableSamplers - }, - { - 1, // binding - VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_FRAGMENT_BIT, // stageFlags - nullptr, // pImmutableSamplers - }}})); - - VkAttachmentReference color_attachment = { - 1, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - VkAttachmentReference depth_attachment = { - 0, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}; - - vulkan::VkRenderPass render_pass = app.CreateRenderPass( - {{ - 0, // flags - VK_FORMAT_D32_SFLOAT, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL // finalLayout - }, - { - 0, // flags - VK_FORMAT_R8G8B8A8_UNORM, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // finalLayout - }}, // AttachmentDescriptions - {{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment, // colorAttachment - nullptr, // pResolveAttachments - &depth_attachment, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }}, // SubpassDescriptions - {} // SubpassDependencies - ); - - vulkan::VulkanGraphicsPipeline pipeline = - app.CreateGraphicsPipeline(&pipeline_layout, &render_pass, 0); - pipeline.AddShader(VK_SHADER_STAGE_VERTEX_BIT, "main", vertex_shader); - pipeline.AddShader(VK_SHADER_STAGE_FRAGMENT_BIT, "main", fragment_shader); - pipeline.SetTopology(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST); - pipeline.AddInputStream(4 * 6, // vec4 + vec2 - VK_VERTEX_INPUT_RATE_VERTEX, - { - {0, VK_FORMAT_R32G32B32A32_SFLOAT, 0}, - {1, VK_FORMAT_R32G32B32A32_SFLOAT, 4 * 4}, - }); - pipeline.AddAttachment(); - for (auto dynamic_state : dynamic_states) { - pipeline.AddDynamicState(dynamic_state); - } - pipeline.Commit(); - return pipeline; -} -} // anonymous namespace - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - { - const float line_width = 2.0; - VkPhysicalDeviceFeatures requested_feateures{}; - requested_feateures.wideLines = VK_TRUE; - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions(), {}, {}, - requested_feateures); - if (app.device().is_valid()) { - // Create a pipeline - vulkan::VulkanGraphicsPipeline pipeline = - CreateAndCommitPipeline(data, &app, {VK_DYNAMIC_STATE_LINE_WIDTH}); - // Populate command buffer - vulkan::VkCommandBuffer cmd_buf = app.GetCommandBuffer(); - cmd_buf->vkBeginCommandBuffer(cmd_buf, &kBeginInfo); - cmd_buf->vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_GRAPHICS, - pipeline); - cmd_buf->vkCmdSetLineWidth(cmd_buf, line_width); - cmd_buf->vkEndCommandBuffer(cmd_buf); - } else { - data->logger()->LogInfo( - "Disable test due to missing physical device feature: " - "widthLines"); - } - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/SetStencilMask_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/SetStencilMask_test/CMakeLists.txt deleted file mode 100644 index a2843467..00000000 --- a/gapid_tests/command_buffer_tests/SetStencilMask_test/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(SetStencilMask_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) diff --git a/gapid_tests/command_buffer_tests/SetStencilMask_test/README.md b/gapid_tests/command_buffer_tests/SetStencilMask_test/README.md deleted file mode 100644 index 9ad7f67d..00000000 --- a/gapid_tests/command_buffer_tests/SetStencilMask_test/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# vkCmdSetStencilCompareMask / vkCmdSetStencilWriteMask - -## Signatures -```c++ -void vkCmdSetStencilCompareMask( - VkCommandBuffer commandBuffer, - VkStencilFaceFlags faceMask, - uint32_t compareMask); - -void vkCmdSetStencilWriteMask( - VkCommandBuffer commandBuffer, - VkStencilFaceFlags faceMask, - uint32_t writeMask); -``` - -According to the Vulkan spec: -- `vkCmdSetStencilCompareMask`: - - The currently bound graphics pipeline **must** have been created with the - `VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK` dynamic state enabled. -- `vkCmdSetStencilWriteMask`: - - The currently bound graphics pipeline **must** have been created with the - `VK_DYNAMIC_STATE_STENCIL_WRITE_MASK` dynamic state enabled. -- `faceMask` **must** be a valid combination of `VkStencilFaceFlagBits` values -- `faceMask` must not be 0 -- `commandBuffer` **must** be in the recording state - -These tests should test the following cases: -- `flagMask` of valid value: - - [x] `VK_STENCIL_FACE_FRONT_BIT` - - [x] `VK_STENCIL_FACE_BACK_BIT` - - [x] `VK_STENCILFRONT_AND_BACK` -- [x] `compareMask` of valid value -- [x] `wirteMask` of valid value diff --git a/gapid_tests/command_buffer_tests/SetStencilMask_test/SetStencilMask_test.py b/gapid_tests/command_buffer_tests/SetStencilMask_test/SetStencilMask_test.py deleted file mode 100644 index d318517a..00000000 --- a/gapid_tests/command_buffer_tests/SetStencilMask_test/SetStencilMask_test.py +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from gapit_test_framework import GapidUnsupportedException -from vulkan_constants import * - - -@gapit_test("SetStencilMask_test") -class SetStencilCompareMask(GapitTest): - - def expect(self): - first_set_stencil = require( - self.next_call_of("vkCmdSetStencilCompareMask")) - require_not_equal(0, first_set_stencil.int_commandBuffer) - require_equal(VK_STENCIL_FACE_FRONT_BIT, - first_set_stencil.int_faceMask) - require_equal(0, first_set_stencil.int_compareMask) - - second_set_stencil = require( - self.next_call_of("vkCmdSetStencilCompareMask")) - require_not_equal(0, second_set_stencil.int_commandBuffer) - require_equal(VK_STENCIL_FACE_BACK_BIT, - second_set_stencil.int_faceMask) - require_equal(10, second_set_stencil.int_compareMask) - - third_set_stencil = require( - self.next_call_of("vkCmdSetStencilCompareMask")) - require_not_equal(0, third_set_stencil.int_commandBuffer) - require_equal(VK_STENCIL_FRONT_AND_BACK, - third_set_stencil.int_faceMask) - require_equal(0xFFFFFFFF, third_set_stencil.int_compareMask) - - -@gapit_test("SetStencilMask_test") -class SetStencilWriteMask(GapitTest): - - def expect(self): - first_set_stencil = require( - self.next_call_of("vkCmdSetStencilWriteMask")) - require_not_equal(0, first_set_stencil.int_commandBuffer) - require_equal(VK_STENCIL_FACE_FRONT_BIT, - first_set_stencil.int_faceMask) - require_equal(0, first_set_stencil.int_writeMask) - - second_set_stencil = require( - self.next_call_of("vkCmdSetStencilWriteMask")) - require_not_equal(0, second_set_stencil.int_commandBuffer) - require_equal(VK_STENCIL_FACE_BACK_BIT, - second_set_stencil.int_faceMask) - require_equal(10, second_set_stencil.int_writeMask) - - third_set_stencil = require( - self.next_call_of("vkCmdSetStencilWriteMask")) - require_not_equal(0, third_set_stencil.int_commandBuffer) - require_equal(VK_STENCIL_FRONT_AND_BACK, - third_set_stencil.int_faceMask) - require_equal(0xFFFFFFFF, third_set_stencil.int_writeMask) diff --git a/gapid_tests/command_buffer_tests/SetStencilMask_test/main.cpp b/gapid_tests/command_buffer_tests/SetStencilMask_test/main.cpp deleted file mode 100644 index 449e9ea9..00000000 --- a/gapid_tests/command_buffer_tests/SetStencilMask_test/main.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/queue_wrapper.h" - -uint32_t fragment_shader[] = -#include "simple_fragment.frag.spv" - ; - -uint32_t vertex_shader[] = -#include "simple_vertex.vert.spv" - ; - -vulkan::VulkanGraphicsPipeline CreatePipeline( - const entry::EntryData* data, vulkan::VulkanApplication* app_ptr) { - LOG_ASSERT(!=, data->logger(), 0, (uintptr_t)app_ptr); - vulkan::VulkanApplication& app = *app_ptr; - vulkan::PipelineLayout pipeline_layout(app.CreatePipelineLayout( - {{{ - 0, // binding - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_VERTEX_BIT, // stageFlags - nullptr, // pImmutableSamplers - }, - { - 1, // binding - VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_FRAGMENT_BIT, // stageFlags - nullptr, // pImmutableSamplers - }}})); - - VkAttachmentReference color_attachment = { - 1, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - VkAttachmentReference depth_attachment = { - 0, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}; - - vulkan::VkRenderPass render_pass = app.CreateRenderPass( - {{ - 0, // flags - VK_FORMAT_D32_SFLOAT, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL // finalLayout - }, - { - 0, // flags - VK_FORMAT_R8G8B8A8_UNORM, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // finalLayout - }}, // AttachmentDescriptions - {{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment, // colorAttachment - nullptr, // pResolveAttachments - &depth_attachment, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }}, // SubpassDescriptions - {} // SubpassDependencies - ); - - vulkan::VulkanGraphicsPipeline pipeline = - app.CreateGraphicsPipeline(&pipeline_layout, &render_pass, 0); - pipeline.AddShader(VK_SHADER_STAGE_VERTEX_BIT, "main", vertex_shader); - pipeline.AddShader(VK_SHADER_STAGE_FRAGMENT_BIT, "main", fragment_shader); - pipeline.AddDynamicState(VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK); - pipeline.AddDynamicState(VK_DYNAMIC_STATE_STENCIL_WRITE_MASK); - pipeline.SetTopology(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST); - pipeline.AddInputStream(4 * 6, // vec4 + vec2 - VK_VERTEX_INPUT_RATE_VERTEX, - { - {0, VK_FORMAT_R32G32B32A32_SFLOAT, 0}, - {1, VK_FORMAT_R32G32B32A32_SFLOAT, 4 * 4}, - }); - pipeline.AddAttachment(); - pipeline.Commit(); - return pipeline; -} - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - auto pipeline = CreatePipeline(data, &app); - - { - // Test vkCmdSetStencilCompareMask - vulkan::VkCommandBuffer cmd_buf = app.GetCommandBuffer(); - app.BeginCommandBuffer(&cmd_buf); - cmd_buf->vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_GRAPHICS, - pipeline); - cmd_buf->vkCmdSetStencilCompareMask(cmd_buf, VK_STENCIL_FACE_FRONT_BIT, 0u); - cmd_buf->vkCmdSetStencilCompareMask(cmd_buf, VK_STENCIL_FACE_BACK_BIT, 10u); - cmd_buf->vkCmdSetStencilCompareMask(cmd_buf, VK_STENCIL_FRONT_AND_BACK, - 0xFFFFFFFFU); - app.EndAndSubmitCommandBufferAndWaitForQueueIdle(&cmd_buf, - &app.render_queue()); - } - - { - // Test vkCmdSetStencilWriteMask - vulkan::VkCommandBuffer cmd_buf = app.GetCommandBuffer(); - app.BeginCommandBuffer(&cmd_buf); - cmd_buf->vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_GRAPHICS, - pipeline); - cmd_buf->vkCmdSetStencilWriteMask(cmd_buf, VK_STENCIL_FACE_FRONT_BIT, 0u); - cmd_buf->vkCmdSetStencilWriteMask(cmd_buf, VK_STENCIL_FACE_BACK_BIT, 10u); - cmd_buf->vkCmdSetStencilWriteMask(cmd_buf, VK_STENCIL_FRONT_AND_BACK, - 0xFFFFFFFFU); - app.EndAndSubmitCommandBufferAndWaitForQueueIdle(&cmd_buf, - &app.render_queue()); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/SetViewportScissorAndBindPipeline_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/SetViewportScissorAndBindPipeline_test/CMakeLists.txt deleted file mode 100644 index ad43bb49..00000000 --- a/gapid_tests/command_buffer_tests/SetViewportScissorAndBindPipeline_test/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(SetViewportScissorAndBindPipeline_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) diff --git a/gapid_tests/command_buffer_tests/SetViewportScissorAndBindPipeline_test/README.md b/gapid_tests/command_buffer_tests/SetViewportScissorAndBindPipeline_test/README.md deleted file mode 100644 index abf603b3..00000000 --- a/gapid_tests/command_buffer_tests/SetViewportScissorAndBindPipeline_test/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# vkCmdSetViewport / vkCmdSetScissor / vkCmdBindPipeline - -## Signatures -```c++ -void vkCmdSetViewport( - VkCommandBuffer commandBuffer, - uint32_t firstViewport, - uint32_t viewportCount, - const VkViewport* pViewports); - -void vkCmdSetScissor( - VkCommandBuffer commandBuffer, - uint32_t firstScissor, - uint32_t scissorCount, - const VkRect2D* pScissors); - -void vkCmdBindPipeline( - VkCommandBuffer commandBuffer, - VkPipelineBindPoint pipelineBindPoint, - VkPipeline pipeline); -``` - - -According to the Vulkan spec: -- `pViewports` **must** point to `viewportCount` `VkViewport` structures -- `firstViewport` **must** be < `VkPhysicalDeviceLimits::maxViewports` -- `firstViewport` + `viewportCount` **must** be <= - `VkPhysicalDeviceLimits::maxViewports` -- `viewportCount` **must** be > 0 -- `pScissors` **must** point to `scissorCount` `VkRect2D` structures -- `firstScissor` **must** be < `VkPhysicalDeviceLimits::maxViewports` -- `firstScissor` + `scissorCount` **must** be <= - `VkPhysicalDeviceLimits::maxViewports` -- `scissorCount` **must** be > 0 - -These tests should test the following cases: -- [x] `firstViewport` == 0 -- [x] `firstScissor` == 0 -- [ ] `firstViewport` > 0 -- [ ] `firstScissor` > 0 -- [x] `viewportCount` == 1 -- [x] `scissorCount` == 1 -- [ ] `viewportCount` > 1 -- [ ] `scissorCount` > 1 -- [x] `pipelineBindPoint` == `VK_PIPELINE_BIND_POINT_GRAPHICS` -- [ ] `pipelineBindPoint` == `VK_PIPELINE_BIND_POINT_COMPUTE` \ No newline at end of file diff --git a/gapid_tests/command_buffer_tests/SetViewportScissorAndBindPipeline_test/SetViewportScissorAndBindPipeline_test.py b/gapid_tests/command_buffer_tests/SetViewportScissorAndBindPipeline_test/SetViewportScissorAndBindPipeline_test.py deleted file mode 100644 index 57a97ad9..00000000 --- a/gapid_tests/command_buffer_tests/SetViewportScissorAndBindPipeline_test/SetViewportScissorAndBindPipeline_test.py +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -import gapit_test_framework -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER, INT32_T -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY -from vulkan_constants import * - -VIEWPORT = [ - ("x", FLOAT), - ("y", FLOAT), - ("width", FLOAT), - ("height", FLOAT), - ("minDepth", FLOAT), - ("maxDepth", FLOAT) -] - -RECT2D = [ - ("offset_x", INT32_T), - ("offset_y", INT32_T), - ("extent_width", INT32_T), - ("extent_height", INT32_T) -] - - -@gapit_test("SetViewportScissorAndBindPipeline_test") -class SetViewport(GapitTest): - - def expect(self): - architecture = self.architecture - set_viewport = require(self.next_call_of("vkCmdSetViewport")) - - require_not_equal(0, set_viewport.int_commandBuffer) - require_equal(0, set_viewport.int_firstViewport) - require_equal(1, set_viewport.int_viewportCount) - require_not_equal(0, set_viewport.hex_pViewports) - - viewport = VulkanStruct( - architecture, VIEWPORT, - get_read_offset_function(set_viewport, set_viewport.hex_pViewports)) - require_equal(0.0, viewport.x) - require_equal(0.0, viewport.y) - require_not_equal(0.0, viewport.width) - require_not_equal(0.0, viewport.height) - require_equal(0.0, viewport.minDepth) - require_equal(1.0, viewport.maxDepth) - - -@gapit_test("SetViewportScissorAndBindPipeline_test") -class SetScissor(GapitTest): - - def expect(self): - architecture = self.architecture - set_scissor = require(self.next_call_of("vkCmdSetScissor")) - - require_not_equal(0, set_scissor.int_commandBuffer) - require_equal(0, set_scissor.int_firstScissor) - require_equal(1, set_scissor.int_scissorCount) - require_not_equal(0, set_scissor.hex_pScissors) - - scissor = VulkanStruct( - architecture, RECT2D, - get_read_offset_function(set_scissor, set_scissor.hex_pScissors)) - require_equal(0, scissor.offset_x) - require_equal(0, scissor.offset_x) - require_not_equal(0, scissor.extent_width) - require_not_equal(0, scissor.extent_width) - - -@gapit_test("SetViewportScissorAndBindPipeline_test") -class BindGraphicsPipeline(GapitTest): - - def expect(self): - architecture = self.architecture - bind_pipeline = require(self.next_call_of("vkCmdBindPipeline")) - - require_not_equal(0, bind_pipeline.int_commandBuffer) - require_equal(VK_PIPELINE_BIND_POINT_GRAPHICS, - bind_pipeline.int_pipelineBindPoint) - require_not_equal(0, bind_pipeline.int_pipeline) diff --git a/gapid_tests/command_buffer_tests/SetViewportScissorAndBindPipeline_test/main.cpp b/gapid_tests/command_buffer_tests/SetViewportScissorAndBindPipeline_test/main.cpp deleted file mode 100644 index 9927ec8e..00000000 --- a/gapid_tests/command_buffer_tests/SetViewportScissorAndBindPipeline_test/main.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/queue_wrapper.h" - -uint32_t fragment_shader[] = -#include "simple_fragment.frag.spv" - ; - -uint32_t vertex_shader[] = -#include "simple_vertex.vert.spv" - ; - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - // So we don't have to type app.device every time. - vulkan::VkDevice& device = app.device(); - - { - vulkan::PipelineLayout pipeline_layout(app.CreatePipelineLayout( - {{{ - 0, // binding - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_VERTEX_BIT, // stageFlags - nullptr, // pImmutableSamplers - }, - { - 1, // binding - VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_FRAGMENT_BIT, // stageFlags - nullptr, // pImmutableSamplers - }}})); - - VkAttachmentReference color_attachment = { - 1, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - VkAttachmentReference depth_attachment = { - 0, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}; - - vulkan::VkRenderPass render_pass = app.CreateRenderPass( - {{ - 0, // flags - VK_FORMAT_D32_SFLOAT, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL // finalLayout - }, - { - 0, // flags - VK_FORMAT_R8G8B8A8_UNORM, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // finalLayout - }}, // AttachmentDescriptions - {{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment, // colorAttachment - nullptr, // pResolveAttachments - &depth_attachment, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }}, // SubpassDescriptions - {} // SubpassDependencies - ); - - vulkan::VulkanGraphicsPipeline pipeline = - app.CreateGraphicsPipeline(&pipeline_layout, &render_pass, 0); - pipeline.AddShader(VK_SHADER_STAGE_VERTEX_BIT, "main", vertex_shader); - pipeline.AddShader(VK_SHADER_STAGE_FRAGMENT_BIT, "main", fragment_shader); - pipeline.SetTopology(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST); - pipeline.AddInputStream(4 * 6, // vec4 + vec2 - VK_VERTEX_INPUT_RATE_VERTEX, - { - {0, VK_FORMAT_R32G32B32A32_SFLOAT, 0}, - {1, VK_FORMAT_R32G32B32A32_SFLOAT, 4 * 4}, - }); - pipeline.AddAttachment(); - pipeline.Commit(); - - vulkan::VkCommandBuffer command_buffer = app.GetCommandBuffer(); - VkCommandBufferBeginInfo begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType - nullptr, // pNext - VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, // flags - nullptr // pInheritanceInfo - }; - - command_buffer->vkBeginCommandBuffer(command_buffer, &begin_info); - command_buffer->vkCmdBindPipeline( - command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline); - VkViewport viewport{0.0f, - 0.0f, - static_cast(app.swapchain().width()), - static_cast(app.swapchain().height()), - 0.0f, - 1.0f}; - command_buffer->vkCmdSetViewport(command_buffer, 0, 1, &viewport); - - VkRect2D scissor{{0, 0}, - {static_cast(app.swapchain().width()), - static_cast(app.swapchain().height())}}; - command_buffer->vkCmdSetScissor(command_buffer, 0, 1, &scissor); - command_buffer->vkEndCommandBuffer(command_buffer); - } - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdBindDescriptorSets_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdBindDescriptorSets_test/CMakeLists.txt deleted file mode 100644 index a8d91209..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdBindDescriptorSets_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdBindDescriptorSets_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/vkCmdBindDescriptorSets_test/README.md b/gapid_tests/command_buffer_tests/vkCmdBindDescriptorSets_test/README.md deleted file mode 100644 index 0e95b032..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdBindDescriptorSets_test/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# vkCmdBindDescriptorSets - -## Signatures -```c++ -void vkCmdBindDescriptorSets( - VkCommandBuffer commandBuffer, - VkPipelineBindPoint pipelineBindPoint, - VkPipelineLayout layout, - uint32_t firstSet, - uint32_t descriptorSetCount, - const VkDescriptorSet* pDescriptorSets, - uint32_t dynamicOffsetCount, - const uint32_t* pDynamicOffsets); -``` - -According to the Vulkan spec: -- `pDescriptorSets` **must** be a pointer to an array of `descriptorSetCount` - valid `VkDescriptorSet` handles -- If `dynamicOffsetCount` is not 0, pDynamicOffsets **must** be a pointer to - an array of `dynamicOffsetCount` `uint32_t` values -- `commandBuffer` **must** be in the recording state -- The `VkCommandPool` that commandBuffer was allocated from **must** support - graphics, or compute operations -- `descriptorSetCount` **must** be greater than 0 - -These tests should test the following cases: -- `pipelineBindPoint` - - [x] `VK_PIPELINE_BIND_POINT_GRAPHICS` - - [ ] `VK_PIPELINE_BIND_POINT_COMPUTE` -- `firstSet` - - [x] == 0 - - [ ] != 0 -- `descriptorSetCount` - - [x] == 1 - - [ ] > 1 -- `dynamicOffsetCount` - - [x] == 0 - - [ ] != 0 -- `pDynamicOffsets` - - [x] == nullptr - - [ ] != nullptr diff --git a/gapid_tests/command_buffer_tests/vkCmdBindDescriptorSets_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdBindDescriptorSets_test/main.cpp deleted file mode 100644 index aa002b57..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdBindDescriptorSets_test/main.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/vulkan_application.h" -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - vulkan::VkDevice& device = app.device(); - - vulkan::VkCommandBuffer command_buffer = app.GetCommandBuffer(); - - VkCommandBufferBeginInfo begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr, 0, nullptr}; - command_buffer->vkBeginCommandBuffer(command_buffer, &begin_info); - - VkDescriptorSetLayoutBinding binding{ - /* binding = */ 2, - /* descriptorType = */ VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, - /* descriptorCount = */ 1, - /* stageFlags = */ VK_SHADER_STAGE_ALL_GRAPHICS, - /* pImmutableSamplers = */ nullptr, - }; - vulkan::PipelineLayout pipeline_layout = - app.CreatePipelineLayout({{binding}}); - vulkan::DescriptorSet descriptor_set = app.AllocateDescriptorSet({binding}); - ::VkDescriptorSet sets[1] = {descriptor_set}; - - command_buffer->vkCmdBindDescriptorSets( - /* commandBuffer = */ command_buffer, - /* pipelineBindPoint = */ VK_PIPELINE_BIND_POINT_GRAPHICS, - /* layout = */ ::VkPipelineLayout(pipeline_layout), - /* firstSet = */ 0, - /* descriptorSetCount = */ 1, - /* pDescriptorSets = */ sets, - /* dynamicOffsetCount = */ 0, - /* pDynamicOffsets = */ nullptr); - - command_buffer->vkEndCommandBuffer(command_buffer); - - VkCommandBuffer buffers[1] = {command_buffer}; - - VkSubmitInfo submit_info{ - /* sType = */ VK_STRUCTURE_TYPE_SUBMIT_INFO, - /* pNext = */ nullptr, - /* waitSemaphoreCount = */ 0, - /* pWaitSemaphores = */ nullptr, - /* pWaitDstStageMask = */ nullptr, - /* commandBufferCount = */ 1, - /* pCommandBuffers = */ buffers, - /* signalSemaphoreCount = */ 0, - /* pSignalSemaphores = */ nullptr, - }; - - app.render_queue()->vkQueueSubmit(app.render_queue(), 1, &submit_info, - static_cast(VK_NULL_HANDLE)); - app.render_queue()->vkQueueWaitIdle(app.render_queue()); - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdBindDescriptorSets_test/vkCmdBindDescriptorSets_test.py b/gapid_tests/command_buffer_tests/vkCmdBindDescriptorSets_test/vkCmdBindDescriptorSets_test.py deleted file mode 100644 index 89676bbf..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdBindDescriptorSets_test/vkCmdBindDescriptorSets_test.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -import gapit_test_framework -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY, DEVICE_SIZE -from vulkan_constants import * - - -@gapit_test("vkCmdBindDescriptorSets_test") -class SingleDescriptorSet(GapitTest): - - def expect(self): - bind_atom = require( - self.next_call_of("vkCmdBindDescriptorSets")) - - require_not_equal(0, bind_atom.int_commandBuffer) - require_equal(VK_PIPELINE_BIND_POINT_GRAPHICS, - bind_atom.int_pipelineBindPoint) - require_not_equal(0, bind_atom.int_layout) - require_equal(0, bind_atom.int_firstSet) - require_equal(1, bind_atom.int_descriptorSetCount) - require_not_equal(0, bind_atom.hex_pDescriptorSets) - require_equal(0, bind_atom.int_dynamicOffsetCount) - require_equal(0, bind_atom.hex_pDynamicOffsets) - - descriptor_set = little_endian_bytes_to_int(require( - bind_atom.get_read_data( - bind_atom.hex_pDescriptorSets, - NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(0, descriptor_set) diff --git a/gapid_tests/command_buffer_tests/vkCmdBindIndexBuffer_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdBindIndexBuffer_test/CMakeLists.txt deleted file mode 100644 index 67b11965..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdBindIndexBuffer_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdBindIndexBuffer_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/vkCmdBindIndexBuffer_test/README.md b/gapid_tests/command_buffer_tests/vkCmdBindIndexBuffer_test/README.md deleted file mode 100644 index 2a54efcb..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdBindIndexBuffer_test/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# vkCmdBindIndexBuffer - -## Signatures -```c++ -void vkCmdBindIndexBuffer( - VkCommandBuffer commandBuffer, - VkBuffer buffer, - VkDeviceSize offset, - VkIndexType indexType); -``` - -According to the Vulkan spec: -- `indexType` **must** be `VK_INDEX_TYPE_UINT16` or `VK_INDEX_TYPE_UINT32` - -These tests should test the following cases: -- [x] `indexType` == `VK_INDEX_TYPE_UINT16` -- [x] `indexType` == ``VK_INDEX_TYPE_UINT32` -- [x] `offset` == 0 -- [x] `offset` != 0 diff --git a/gapid_tests/command_buffer_tests/vkCmdBindIndexBuffer_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdBindIndexBuffer_test/main.cpp deleted file mode 100644 index 33540e4f..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdBindIndexBuffer_test/main.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/queue_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - // So we don't have to type app.device every time. - vulkan::VkDevice& device = app.device(); - - { - // 32-bit buffer, 0-offset - uint32_t num_buffer_elements = 256; - VkBufferCreateInfo index_buffer_create_info{ - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 256 * sizeof(uint32_t), // size - VK_BUFFER_USAGE_INDEX_BUFFER_BIT | - VK_BUFFER_USAGE_TRANSFER_DST_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr // queueFamilyIndices - }; - - auto index_buffer = - app.CreateAndBindDeviceBuffer(&index_buffer_create_info); - - VkBufferCreateInfo transfer_buffer_create_info{ - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 256 * sizeof(uint32_t), // size - VK_BUFFER_USAGE_TRANSFER_SRC_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr // queueFamilyIndices - }; - - auto transfer_buffer = - app.CreateAndBindHostBuffer(&transfer_buffer_create_info); - - for (uint32_t i = 0; i < 256; ++i) { - *reinterpret_cast(transfer_buffer->base_address()) = i; - } - transfer_buffer->flush(); - - vulkan::VkCommandBuffer command_buffer = app.GetCommandBuffer(); - VkCommandBufferBeginInfo begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType - nullptr, // pNext - VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, // flags - nullptr // pInheritanceInfo - }; - - command_buffer->vkBeginCommandBuffer(command_buffer, &begin_info); - VkMemoryBarrier upload_barrier{ - VK_STRUCTURE_TYPE_MEMORY_BARRIER, // sType - nullptr, // pNext - VK_ACCESS_HOST_WRITE_BIT, // srcAccessMask - VK_ACCESS_TRANSFER_READ_BIT // dstAccessMask - }; - command_buffer->vkCmdPipelineBarrier( - command_buffer, VK_PIPELINE_STAGE_HOST_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 1, &upload_barrier, 0, nullptr, 0, - nullptr); - - VkBufferCopy copy{ - 0, // srcOffset - 0, // dstOffset - 256 * sizeof(uint32_t) // size - }; - command_buffer->vkCmdCopyBuffer(command_buffer, *transfer_buffer, - *index_buffer, 1, ©); - VkMemoryBarrier transfer_barrier{ - VK_STRUCTURE_TYPE_MEMORY_BARRIER, // sType - nullptr, // pNext - VK_ACCESS_TRANSFER_READ_BIT, // srcAccessMask - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT // dstAccessMask - }; - command_buffer->vkCmdPipelineBarrier( - command_buffer, VK_PIPELINE_STAGE_HOST_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 1, &transfer_barrier, 0, nullptr, 0, - nullptr); - - command_buffer->vkCmdBindIndexBuffer(command_buffer, *index_buffer, 0, - VK_INDEX_TYPE_UINT32); - - command_buffer->vkEndCommandBuffer(command_buffer); - } - - { - // 16-bit buffer, 128-offset - uint32_t num_buffer_elements = 256; - VkBufferCreateInfo index_buffer_create_info{ - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 256 * sizeof(uint16_t), // size - VK_BUFFER_USAGE_INDEX_BUFFER_BIT | - VK_BUFFER_USAGE_TRANSFER_DST_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr // queueFamilyIndices - }; - - auto index_buffer = - app.CreateAndBindDeviceBuffer(&index_buffer_create_info); - - VkBufferCreateInfo transfer_buffer_create_info{ - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 256 * sizeof(uint16_t), // size - VK_BUFFER_USAGE_TRANSFER_SRC_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr // queueFamilyIndices - }; - - auto transfer_buffer = - app.CreateAndBindHostBuffer(&transfer_buffer_create_info); - - for (uint16_t i = 0; i < 256; ++i) { - *reinterpret_cast(transfer_buffer->base_address()) = i; - } - transfer_buffer->flush(); - - vulkan::VkCommandBuffer command_buffer = app.GetCommandBuffer(); - VkCommandBufferBeginInfo begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType - nullptr, // pNext - VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, // flags - nullptr // pInheritanceInfo - }; - - command_buffer->vkBeginCommandBuffer(command_buffer, &begin_info); - VkMemoryBarrier upload_barrier{ - VK_STRUCTURE_TYPE_MEMORY_BARRIER, // sType - nullptr, // pNext - VK_ACCESS_HOST_WRITE_BIT, // srcAccessMask - VK_ACCESS_TRANSFER_READ_BIT // dstAccessMask - }; - command_buffer->vkCmdPipelineBarrier( - command_buffer, VK_PIPELINE_STAGE_HOST_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 1, &upload_barrier, 0, nullptr, 0, - nullptr); - - VkBufferCopy copy{ - 0, // srcOffset - 0, // dstOffset - 256 * sizeof(uint16_t) // size - }; - command_buffer->vkCmdCopyBuffer(command_buffer, *transfer_buffer, - *index_buffer, 1, ©); - VkMemoryBarrier transfer_barrier{ - VK_STRUCTURE_TYPE_MEMORY_BARRIER, // sType - nullptr, // pNext - VK_ACCESS_TRANSFER_READ_BIT, // srcAccessMask - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT // dstAccessMask - }; - command_buffer->vkCmdPipelineBarrier( - command_buffer, VK_PIPELINE_STAGE_TRANSFER_BIT, - VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, 0, 1, &transfer_barrier, 0, nullptr, - 0, nullptr); - - command_buffer->vkCmdBindIndexBuffer(command_buffer, *index_buffer, - 128 * sizeof(uint16_t), - VK_INDEX_TYPE_UINT16); - - command_buffer->vkEndCommandBuffer(command_buffer); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdBindIndexBuffer_test/vkCmdBindIndexBuffer_test.py b/gapid_tests/command_buffer_tests/vkCmdBindIndexBuffer_test/vkCmdBindIndexBuffer_test.py deleted file mode 100644 index be4edf29..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdBindIndexBuffer_test/vkCmdBindIndexBuffer_test.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -import gapit_test_framework -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY, DEVICE_SIZE -from vulkan_constants import * - - -@gapit_test("vkCmdBindIndexBuffer_test") -class U32Buffer(GapitTest): - - def expect(self): - architecture = self.architecture - cmd_bind_vertex_buffers = require( - self.nth_call_of("vkCmdBindIndexBuffer", 1)) - - require_not_equal(0, cmd_bind_vertex_buffers.int_commandBuffer) - require_not_equal(0, cmd_bind_vertex_buffers.int_buffer) - require_equal(0, cmd_bind_vertex_buffers.int_offset) - require_equal(VK_INDEX_TYPE_UINT32, - cmd_bind_vertex_buffers.int_indexType) - - -@gapit_test("vkCmdBindIndexBuffer_test") -class U16Buffer(GapitTest): - - def expect(self): - architecture = self.architecture - cmd_bind_vertex_buffers = require( - self.nth_call_of("vkCmdBindIndexBuffer", 2)) - - require_not_equal(0, cmd_bind_vertex_buffers.int_commandBuffer) - require_not_equal(0, cmd_bind_vertex_buffers.int_buffer) - require_equal(128 * 2, cmd_bind_vertex_buffers.int_offset) - require_equal(VK_INDEX_TYPE_UINT16, - cmd_bind_vertex_buffers.int_indexType) diff --git a/gapid_tests/command_buffer_tests/vkCmdBindVertexBuffers_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdBindVertexBuffers_test/CMakeLists.txt deleted file mode 100644 index 3285c074..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdBindVertexBuffers_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdBindVertexBuffers_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/vkCmdBindVertexBuffers_test/README.md b/gapid_tests/command_buffer_tests/vkCmdBindVertexBuffers_test/README.md deleted file mode 100644 index b9f140ce..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdBindVertexBuffers_test/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# vkCmdBindVertexBuffers / vkCmdCopyBuffer - -## Signatures -```c++ -void vkCmdBindVertexBuffers( - VkCommandBuffer commandBuffer, - uint32_t firstBinding, - uint32_t bindingCount, - const VkBuffer* pBuffers, - const VkDeviceSize* pOffsets); - -void vkCmdCopyBuffer( - VkCommandBuffer commandBuffer, - VkBuffer srcBuffer, - VkBuffer dstBuffer, - uint32_t regionCount, - const VkBufferCopy* pRegions); -``` - -# VkBufferCopy -```c++ -typedef struct VkBufferCopy { - VkDeviceSize srcOffset; - VkDeviceSize dstOffset; - VkDeviceSize size; -} VkBufferCopy; -``` - -According to the Vulkan spec: -- `pBuffers` **must** point to `bindingCount` `VkBuffer` structures -- `pOffsets` **must** point to `bindingCount` `VkDeviceSize` values -- `bindingCount` **must** be > 0 -- `firstBinding` **must** be < `VkPhysicalDeviceLimits::maxVertexInputBindings` -- `firstBinding` + `bindingCount` **must** be <= - `VkPhysicalDeviceLimits::maxVertexInputBindings` -- `pRegions` **must** point to `regionCount` `VkBufferCopy` structs -- `VkBufferCopy.size` **must** be > 0 - -These tests should test the following cases: -- [x] `bindingCount` == 1 -- [ ] `bindingCount` > 1 -- [x] `firstBinding` == 0 -- [ ] `firstBinding` > 0 -- [ ] `regionCount` == 0 -- [x] `regionCount` == 1 -- [ ] `regionCount` > 1 -- [x] `srcOffset` == 0 -- [ ] `srcOffset`> 0 -- [x] `dstOffset` == 0 -- [ ] `dstOffset`> 0 diff --git a/gapid_tests/command_buffer_tests/vkCmdBindVertexBuffers_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdBindVertexBuffers_test/main.cpp deleted file mode 100644 index 8dbc7b0e..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdBindVertexBuffers_test/main.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/queue_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - // So we don't have to type app.device every time. - vulkan::VkDevice& device = app.device(); - - { - // - VkBufferCreateInfo vertex_buffer_create_info{ - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 1024, // size - VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | - VK_BUFFER_USAGE_TRANSFER_DST_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr // queueFamilyIndices - }; - - auto vertex_buffer = - app.CreateAndBindDeviceBuffer(&vertex_buffer_create_info); - - VkBufferCreateInfo transfer_buffer_create_info{ - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 1024, // size - VK_BUFFER_USAGE_TRANSFER_SRC_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr // queueFamilyIndices - }; - - auto transfer_buffer = - app.CreateAndBindHostBuffer(&transfer_buffer_create_info); - - for (size_t i = 0; i < 1024; ++i) { - *(transfer_buffer->base_address()) = i & 0xFF; - } - transfer_buffer->flush(); - - vulkan::VkCommandBuffer command_buffer = app.GetCommandBuffer(); - VkCommandBufferBeginInfo begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType - nullptr, // pNext - VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, // flags - nullptr // pInheritanceInfo - }; - - command_buffer->vkBeginCommandBuffer(command_buffer, &begin_info); - VkMemoryBarrier upload_barrier{ - VK_STRUCTURE_TYPE_MEMORY_BARRIER, // sType - nullptr, // pNext - VK_ACCESS_HOST_WRITE_BIT, // srcAccessMask - VK_ACCESS_TRANSFER_READ_BIT // dstAccessMask - }; - command_buffer->vkCmdPipelineBarrier( - command_buffer, VK_PIPELINE_STAGE_HOST_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 1, &upload_barrier, 0, nullptr, 0, - nullptr); - - VkBufferCopy copy{ - 0, // srcOffset - 0, // dstOffset - 1024 // size - }; - command_buffer->vkCmdCopyBuffer(command_buffer, *transfer_buffer, - *vertex_buffer, 1, ©); - VkMemoryBarrier transfer_barrier{ - VK_STRUCTURE_TYPE_MEMORY_BARRIER, // sType - nullptr, // pNext - VK_ACCESS_TRANSFER_READ_BIT, // srcAccessMask - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT // dstAccessMask - }; - command_buffer->vkCmdPipelineBarrier( - command_buffer, VK_PIPELINE_STAGE_HOST_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 1, &transfer_barrier, 0, nullptr, 0, - nullptr); - - VkBuffer raw_buffer = *vertex_buffer; - VkDeviceSize offset = 0; - - command_buffer->vkCmdBindVertexBuffers(command_buffer, 0, 1, &raw_buffer, - &offset); - - command_buffer->vkEndCommandBuffer(command_buffer); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdBindVertexBuffers_test/vkCmdBindVertexBuffers_test.py b/gapid_tests/command_buffer_tests/vkCmdBindVertexBuffers_test/vkCmdBindVertexBuffers_test.py deleted file mode 100644 index 72715740..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdBindVertexBuffers_test/vkCmdBindVertexBuffers_test.py +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -import gapit_test_framework -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY, DEVICE_SIZE -from vulkan_constants import * - -@gapit_test("vkCmdBindVertexBuffers_test") -class SingleBuffer(GapitTest): - - def expect(self): - architecture = self.architecture - cmd_bind_vertex_buffers = require( - self.next_call_of("vkCmdBindVertexBuffers")) - - require_not_equal(0, cmd_bind_vertex_buffers.int_commandBuffer) - require_equal(0, cmd_bind_vertex_buffers.int_firstBinding) - require_equal(1, cmd_bind_vertex_buffers.int_bindingCount) - require_not_equal(0, cmd_bind_vertex_buffers.hex_pBuffers) - require_not_equal(0, cmd_bind_vertex_buffers.hex_pOffsets) - - sent_buffer = little_endian_bytes_to_int( - require( - cmd_bind_vertex_buffers.get_read_data( - cmd_bind_vertex_buffers.hex_pBuffers, - NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(sent_buffer, 0) - - sent_offset = little_endian_bytes_to_int( - require( - cmd_bind_vertex_buffers.get_read_data( - cmd_bind_vertex_buffers.hex_pOffsets, - 8))) - require_equal(0, sent_offset) - -BUFFER_COPY = [ - ("srcOffset", DEVICE_SIZE), - ("dstOffset", DEVICE_SIZE), - ("size", DEVICE_SIZE) -] - -@gapit_test("vkCmdBindVertexBuffers_test") -class CopyBuffer(GapitTest): - - def expect(self): - architecture = self.architecture - cmd_copy_buffer = require( - self.next_call_of("vkCmdCopyBuffer")) - - require_not_equal(0, cmd_copy_buffer.int_commandBuffer) - require_not_equal(0, cmd_copy_buffer.int_srcBuffer) - require_not_equal(0, cmd_copy_buffer.int_dstBuffer) - require_equal(1, cmd_copy_buffer.int_regionCount) - require_not_equal(0, cmd_copy_buffer.hex_pRegions) - - copy = VulkanStruct( - architecture, BUFFER_COPY, - get_read_offset_function(cmd_copy_buffer, - cmd_copy_buffer.hex_pRegions)) - require_equal(0, copy.srcOffset) - require_equal(0, copy.dstOffset) - require_equal(1024, copy.size) diff --git a/gapid_tests/command_buffer_tests/vkCmdBlitImage_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdBlitImage_test/CMakeLists.txt deleted file mode 100644 index 4c85fa54..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdBlitImage_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdBlitImage_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/vkCmdBlitImage_test/README.md b/gapid_tests/command_buffer_tests/vkCmdBlitImage_test/README.md deleted file mode 100644 index a5f425ef..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdBlitImage_test/README.md +++ /dev/null @@ -1,76 +0,0 @@ -# vkCmdBlitImage - -## Signatures -```c++ -void vkCmdBlitImage( - VkCommandBuffer commandBuffer, - VkImage srcImage, - VkImageLayout srcImageLayout, - VkImage dstImage, - VkImageLayout dstImageLayout, - uint32_t regionCount, - const VkImageBlit* pRegions, - VkFilter filter); -``` - -# VkImageBlit -```c++ -typedef struct VkImageBlit { - VkImageSubresourceLayers srcSubresource; - VkOffset3D srcOffsets[2]; - VkImageSubresourceLayers dstSubresource; - VkOffset3D dstOffsets[2]; -} VkImageBlit; -``` - -According to the Vulkan spec: -- Integer format can **only** be converted to other integer format with the - same signedness -- Format conversions on unorm, snorm, unscaled and packed float formats of the - copied aspect of the image are performed by first converting the pixels to - float values -- For sRGB source formats, nonlinear RGB values are converted to linear - representation prior to filtering -- After filtering, the float values are first clamped and then cast to the - destination image format. In case of sRGB destination format, linear RGB - values are converted to nonlinear representation before writing the pixel to - the image -- The union of all destination regions, specified by the elements of `pRegions`, - must not overlap in memory with any texel that may be sampled during the blit - operation -- `srcImage` **must** have been created with `VK_IMAGE_USAGE_TRANSFER_SRC_BIT` - usage flag. -- `dstImage` **must** have been created with `VK_IMAGE_USAGE_TRANSFER_DST_BIT` - usage flag. -- `srcImageLayout` **must** be `VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL` or - `VK_IMAGE_LAYOUT_GENERAL` -- `dstImageLayout` **must** be `VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL` or - `VK_IMAGE_LAYOUT_GENERAL` -- If either of `srcImage` or `dstImage` was created with a signed integer - `VkFormat`, the other **must** also have been created with the a signed - integer `VKFormat` -- If either of `srcImage` or `dstImage` was created with a unsigned integer - `VkFormat`, the other **must** also have been created with the a unsigned - integer `VKFormat` -- If either of `srcImage` or `dstImage` was created with a depth/stencil format, - the other **must** have exactly the same format -- `srcImage`/`dstImage` **must** use a format that support - `VK_FORMAT_FEATURE_BLIT_DST_BIT`/`VK_FORMAT_FEATURE_BLIT_DST_BIT` respectively -- Both `srcImage` and `dstImage` **must** have been created with a `samples` - value of `VK_SAMPLE_COUNT_1_BIT` -- `regionCount` **must** be greater than 0 -- `commandBuffer` **must** be in the recording state -- Each of `commandBuffer`, `dstImage` and `srcImage` **must** have been created, - allocated, or retrieved from the same `VkDevice` -- If `filter` is `VK_FILTER_LINEAR`, `srcImage` **must** be of a format which - supports linear filtering, as specified by the - `VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT` flag - - -These tests should test the following cases: -- [x] Blit to an exactly the same color image -- [ ] Blit to an image with different dimensions -- [ ] Blit to an image with different format -- [ ] Blit a depth/stencil image -- [x] `filter` of value `VK_FILTER_LINEAR` -- [ ] `filter` of value `VK_FILTER_NEAREST` diff --git a/gapid_tests/command_buffer_tests/vkCmdBlitImage_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdBlitImage_test/main.cpp deleted file mode 100644 index 8c84a691..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdBlitImage_test/main.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include -#include - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/vulkan_application.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication application(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions() - .SetHostBufferSize(1024 * 100) - .SetDeviceImageSize(1024 * 100) - .SetCoherentBufferSize(1024 * 100)); - - VkExtent3D src_image_extent{32, 32, 1}; - VkImageCreateInfo image_create_info{ - /* sType = */ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* imageType = */ VK_IMAGE_TYPE_2D, - /* format = */ VK_FORMAT_R8G8B8A8_UNORM, - /* extent = */ src_image_extent, - /* mipLevels = */ 1, - /* arrayLayers = */ 1, - /* samples = */ VK_SAMPLE_COUNT_1_BIT, - /* tiling = */ VK_IMAGE_TILING_OPTIMAL, - /* usage = */ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | - VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT, - /* sharingMode = */ VK_SHARING_MODE_EXCLUSIVE, - /* queueFamilyIndexCount = */ 0, - /* pQueueFamilyIndices = */ nullptr, - /* initialLayout = */ VK_IMAGE_LAYOUT_UNDEFINED, - }; - - vulkan::ImagePointer src_image = - application.CreateAndBindImage(&image_create_info); - size_t image_data_size = vulkan::GetImageExtentSizeInBytes( - src_image_extent, VK_FORMAT_R8G8B8A8_UNORM); - containers::vector image_data(image_data_size, 0, data->allocator()); - for (size_t i = 0; i < image_data_size; i++) { - image_data[i] = i & 0xFF; - } - vulkan::ImagePointer dst_image = - application.CreateAndBindImage(&image_create_info); - - // Create semaphores, one for image data filling, another for layout - // transitioning. - VkSemaphoreCreateInfo image_fill_semaphore_create_info{ - VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, nullptr, 0}; - ::VkSemaphore image_fill_semaphore; - application.device()->vkCreateSemaphore(application.device(), - &image_fill_semaphore_create_info, - nullptr, &image_fill_semaphore); - vulkan::VkSemaphore image_fill_semaphore_wrapper( - image_fill_semaphore, nullptr, &application.device()); - VkSemaphoreCreateInfo layout_transition_semaphore_create_info{ - VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, nullptr, 0}; - - ::VkSemaphore src_layout_transition_semaphore; - application.device()->vkCreateSemaphore( - application.device(), &layout_transition_semaphore_create_info, nullptr, - &src_layout_transition_semaphore); - vulkan::VkSemaphore src_layout_transition_semaphore_wrapper( - src_layout_transition_semaphore, nullptr, &application.device()); - ::VkSemaphore dst_layout_transition_semaphore; - application.device()->vkCreateSemaphore( - application.device(), &layout_transition_semaphore_create_info, nullptr, - &dst_layout_transition_semaphore); - vulkan::VkSemaphore dst_layout_transition_semaphore_wrapper( - dst_layout_transition_semaphore, nullptr, &application.device()); - ::VkSemaphore layout_transition_semaphores[2] = { - src_layout_transition_semaphore, dst_layout_transition_semaphore}; - - std::tuple fill_result = - application.FillImageLayersData( - src_image.get(), - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, // subresourcelayer - {0, 0, 0}, // offset - src_image_extent, // extent - VK_IMAGE_LAYOUT_UNDEFINED, // initial layout - image_data, // data - {}, // wait_semaphores - {image_fill_semaphore}, // signal_semaphores - static_cast<::VkFence>(VK_NULL_HANDLE) // fence - ); - bool fill_succeed = std::get<0>(fill_result); - // Before the all the image filling commands are executed, the command buffer - // must not be freed. - vulkan::VkCommandBuffer fill_image_cmd_buf( - std::move(std::get<1>(fill_result))); - - VkCommandBufferInheritanceInfo cmd_buf_hinfo{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, - nullptr, - VK_NULL_HANDLE, - 0, - VK_NULL_HANDLE, - VK_FALSE, - 0, - 0}; - VkCommandBufferBeginInfo cmd_buf_begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr, 0, &cmd_buf_hinfo}; - vulkan::VkCommandBuffer layout_transition_cmd_buf = - application.GetCommandBuffer(); - { - // Image layout transition. - - VkImageMemoryBarrier src_image_barrier = { - VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // sType - nullptr, // pNext - VK_ACCESS_TRANSFER_WRITE_BIT, // srcAccessMask - VK_ACCESS_TRANSFER_READ_BIT, // dstAccessMask - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, // oldLayout - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, // newLayout - VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex - VK_QUEUE_FAMILY_IGNORED, // dstQueueFamilyIndex - *src_image, // image - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, // subresourceRange - }; - VkImageMemoryBarrier dst_image_barrier = src_image_barrier; - dst_image_barrier.srcAccessMask = 0; - dst_image_barrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; - dst_image_barrier.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; - dst_image_barrier.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; - dst_image_barrier.image = *dst_image; - - VkImageMemoryBarrier barriers[2] = {src_image_barrier, dst_image_barrier}; - VkPipelineStageFlags wait_stages[1] = {VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT}; - application.BeginCommandBuffer(&layout_transition_cmd_buf); - layout_transition_cmd_buf->vkCmdPipelineBarrier( - layout_transition_cmd_buf, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0, 0, nullptr, 0, nullptr, 2, - barriers); - application.EndAndSubmitCommandBuffer( - &layout_transition_cmd_buf, &application.render_queue(), - {image_fill_semaphore}, {VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT}, - {src_layout_transition_semaphore, dst_layout_transition_semaphore}, - ::VkFence(VK_NULL_HANDLE)); - } - - { - // 1. Blit to an image with exactly the same image create info as the source - // image. And the source image has only one layer and one mip level. - VkImageBlit region{ - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, - {{0, 0, 0}, - {int32_t(src_image_extent.width), int32_t(src_image_extent.height), - 1}}, - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, - {{0, 0, 0}, - {int32_t(src_image_extent.width), int32_t(src_image_extent.height), - 1}}, - }; - auto cmd_buf = application.GetCommandBuffer(); - cmd_buf->vkBeginCommandBuffer(cmd_buf, &cmd_buf_begin_info); - cmd_buf->vkCmdBlitImage( - cmd_buf, *src_image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, *dst_image, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ®ion, VK_FILTER_LINEAR); - cmd_buf->vkEndCommandBuffer(cmd_buf); - - VkCommandBuffer raw_cmd_buf = cmd_buf.get_command_buffer(); - const VkPipelineStageFlags wait_dst_stage_masks[2] = { - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT}; - const ::VkSemaphore wait_semaphores[2] = {src_layout_transition_semaphore, - dst_layout_transition_semaphore}; - VkSubmitInfo submit{VK_STRUCTURE_TYPE_SUBMIT_INFO, - nullptr, - 2, - wait_semaphores, - wait_dst_stage_masks, - 1, - &raw_cmd_buf, - 0, - nullptr}; - - application.render_queue()->vkQueueSubmit( - application.render_queue(), 1, &submit, - static_cast(VK_NULL_HANDLE)); - application.render_queue()->vkQueueWaitIdle(application.render_queue()); - - // Dump the content of the destination image to check the result. - containers::vector dump_data(data->allocator()); - application.DumpImageLayersData( - dst_image.get(), - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, // subresourcelayer - {0, 0, 0}, // offset - src_image_extent, // extent - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, // initial layout - &dump_data, // data - {} // wait_semaphores - ); - LOG_ASSERT(==, data->logger(), image_data.size(), dump_data.size()); - LOG_ASSERT( - ==, data->logger(), true, - std::equal(image_data.begin(), image_data.end(), dump_data.begin())); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdBlitImage_test/vkCmdBlitImage_test.py b/gapid_tests/command_buffer_tests/vkCmdBlitImage_test/vkCmdBlitImage_test.py deleted file mode 100644 index b839d57d..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdBlitImage_test/vkCmdBlitImage_test.py +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -import gapit_test_framework -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY, DEVICE_SIZE, INT32_T -from vulkan_constants import * - -IMAGE_BLIT = [ - ("srcSubresource_aspectMask", UINT32_T), - ("srcSubresource_mipLevel", UINT32_T), - ("srcSubresource_baseArrayLayer", UINT32_T), - ("srcSubresource_layerCount", UINT32_T), - ("srcOffset_0_x", UINT32_T), - ("srcOffset_0_y", UINT32_T), - ("srcOffset_0_z", UINT32_T), - ("srcOffset_1_x", UINT32_T), - ("srcOffset_1_y", UINT32_T), - ("srcOffset_1_z", UINT32_T), - ("dstSubresource_aspectMask", UINT32_T), - ("dstSubresource_mipLevel", UINT32_T), - ("dstSubresource_baseArrayLayer", UINT32_T), - ("dstSubresource_layerCount", UINT32_T), - ("dstOffset_0_x", UINT32_T), - ("dstOffset_0_y", UINT32_T), - ("dstOffset_0_z", UINT32_T), - ("dstOffset_1_x", UINT32_T), - ("dstOffset_1_y", UINT32_T), - ("dstOffset_1_z", UINT32_T), -] - - -@gapit_test("vkCmdBlitImage_test") -class BlitToSameColorImageWithLinearFilter(GapitTest): - - def expect(self): - """Check the arguments to vkCmdBlitImage""" - architecture = self.architecture - blit_image = require(self.nth_call_of("vkCmdBlitImage", 1)) - - require_not_equal(0, blit_image.int_commandBuffer) - require_not_equal(0, blit_image.int_srcImage) - require_equal(VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, - blit_image.int_srcImageLayout) - require_not_equal(0, blit_image.int_dstImage) - require_equal(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - blit_image.int_dstImageLayout) - require_equal(1, blit_image.int_regionCount) - require_equal(VK_FILTER_LINEAR, blit_image.int_filter) - - image_blit = VulkanStruct(architecture, IMAGE_BLIT, - get_read_offset_function( - blit_image, blit_image.hex_pRegions)) - - require_equal(VK_IMAGE_ASPECT_COLOR_BIT, - image_blit.srcSubresource_aspectMask) - require_equal(0, image_blit.srcSubresource_mipLevel) - require_equal(0, image_blit.srcSubresource_baseArrayLayer) - require_equal(1, image_blit.srcSubresource_layerCount) - require_equal(0, image_blit.srcOffset_0_x) - require_equal(0, image_blit.srcOffset_0_y) - require_equal(0, image_blit.srcOffset_0_z) - require_equal(32, image_blit.srcOffset_1_x) - require_equal(32, image_blit.srcOffset_1_y) - require_equal(1, image_blit.srcOffset_1_z) - require_equal(VK_IMAGE_ASPECT_COLOR_BIT, - image_blit.dstSubresource_aspectMask) - require_equal(0, image_blit.dstSubresource_mipLevel) - require_equal(0, image_blit.dstSubresource_baseArrayLayer) - require_equal(1, image_blit.dstSubresource_layerCount) - require_equal(0, image_blit.dstOffset_0_x) - require_equal(0, image_blit.dstOffset_0_y) - require_equal(0, image_blit.dstOffset_0_z) - require_equal(32, image_blit.dstOffset_1_x) - require_equal(32, image_blit.dstOffset_1_y) - require_equal(1, image_blit.dstOffset_1_z) diff --git a/gapid_tests/command_buffer_tests/vkCmdClearAttachments_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdClearAttachments_test/CMakeLists.txt deleted file mode 100644 index 375c1d72..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdClearAttachments_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdClearAttachments_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/vkCmdClearAttachments_test/README.md b/gapid_tests/command_buffer_tests/vkCmdClearAttachments_test/README.md deleted file mode 100644 index 6433411a..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdClearAttachments_test/README.md +++ /dev/null @@ -1,59 +0,0 @@ -# vkCmdClearAttachments - -## Signatures -```c++ -void vkCmdClearAttachments( - VkCommandBuffer commandBuffer, - uint32_t attachmentCount, - const VkClearAttachment* pAttachments, - uint32_t rectCount, - const VkClearRect* pRects); -``` - -# VkClearRect -```c++ -typedef struct VkClearRect { - VkRect2D rect; - uint32_t baseArrayLayer; - uint32_t layerCount; -} VkClearRect; -``` - -# VkClearAttachment -```c++ -typedef struct VkClearAttachment { - VkImageAspectFlags aspectMask; - uint32_t colorAttachment; - VkClearValue clearValue; -} VkClearAttachment; -``` - -According to the Vulkan spec: -- The rectangular region specified by a given element of `pRects` **must** be - contained within the render area of the current render pass instance -- The layers specified by a given element of `pRects` **must** be contained - within every attachment that `pAttachments` refers to -- `commandBuffer` **must** be in the recording state and this command **must** - be called inside of a render pass instance -- `attachmentCount` **must** be greater than 0 -- `rectCount` **must** be greater than 0 -- If the `aspectMask` member of any given element of `pAttachments` contains - `VK_IMAGE_ASPECT_COLOR_BIT`, the `colorAttachment` member of those elements - **must** refer to a valid color attachment in the current subpass -- `colorAttachment` is only meaningful if `VK_IMAGE_ASPECT_COLOR_BIT` is set in - `aspectMask`, in which case it is an index to the `pColorAttachments` array - in the `VkSubpassDescription` structure of the current subpass which selectes - the color attachment to clear. If `colorAttachment` is `VK_ATTACHMENT_UNUSED` - then the clear has no effect. -- `aspectMast` **must not** include `VK_IMAGE_ASPECT_METADATA_BIT` - -These tests should test the following cases: -- [x] Color attachment -- [ ] Depth attachment -- [ ] Stencil attachment -- [x] Single attachment -- [ ] Multiple attachments -- [x] Single layer image -- [ ] Multiple layers image -- [x] Single clear rectangular -- [ ] Multiple clear rectangulars diff --git a/gapid_tests/command_buffer_tests/vkCmdClearAttachments_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdClearAttachments_test/main.cpp deleted file mode 100644 index a01862b8..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdClearAttachments_test/main.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication application(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - vulkan::VkDevice& device = application.device(); - - { - // 1. Clear a 32 x 32 rect of a single-layer color attachment in a render - // pass with one color attachments, one subpasses and no dependencies. - // Create render pass - VkAttachmentReference color_attachment_reference{ - 0, // attachment - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // layout - }; - vulkan::VkRenderPass render_pass = application.CreateRenderPass( - {{ - 0, // flags - application.swapchain().format(), // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, // initialLayout - VK_IMAGE_LAYOUT_PRESENT_SRC_KHR // finalLayout - }}, - {{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment_reference, // pColorAttachments - nullptr, // pResolveAttachments - nullptr, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }}, - {}); - - // Create image view - VkImageViewCreateInfo image_view_create_info{ - VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - application.swapchain_images().front(), // image - VK_IMAGE_VIEW_TYPE_2D, // viewType - application.swapchain().format(), // format - { - VK_COMPONENT_SWIZZLE_IDENTITY, // components.r - VK_COMPONENT_SWIZZLE_IDENTITY, // components.g - VK_COMPONENT_SWIZZLE_IDENTITY, // components.b - VK_COMPONENT_SWIZZLE_IDENTITY, // components.a - }, - { - VK_IMAGE_ASPECT_COLOR_BIT, // subresourceRange.aspectMask - 0, // subresourceRange.baseMipLevel - 1, // subresourceRange.levelCount - 0, // subresourceRange.baseArrayLayer - 1, // subresourceRange.layerCount - }, - }; - ::VkImageView raw_image_view; - LOG_EXPECT(==, data->logger(), - device->vkCreateImageView(device, &image_view_create_info, - nullptr, &raw_image_view), - VK_SUCCESS); - vulkan::VkImageView image_view(raw_image_view, nullptr, &device); - - // Create framebuffer - VkFramebufferCreateInfo framebuffer_create_info{ - VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - render_pass, // renderPass - 1, // attachmentCount - &raw_image_view, // attachments - application.swapchain().width(), // width - application.swapchain().height(), // height - 1 // layers - }; - ::VkFramebuffer raw_framebuffer; - device->vkCreateFramebuffer(device, &framebuffer_create_info, nullptr, - &raw_framebuffer); - vulkan::VkFramebuffer framebuffer(raw_framebuffer, nullptr, &device); - vulkan::VkCommandBuffer command_buffer = application.GetCommandBuffer(); - VkCommandBufferBeginInfo command_buffer_begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType - nullptr, // pNext - 0, // flags - nullptr, // pInheritanceInfo - }; - command_buffer->vkBeginCommandBuffer(command_buffer, - &command_buffer_begin_info); - VkRenderPassBeginInfo render_pass_begin_info{ - VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, // sType - nullptr, // pNext - render_pass, // renderPass - framebuffer, // framebuffer - { - 0, // renderArea.offset.x - 0, // renderArea.offset.y - application.swapchain().width(), // renderArea.extent.width - application.swapchain().height(), // renderArea.extent.height - }, - 0, // clearValueCount - nullptr, // pClearValues - }; - command_buffer->vkCmdBeginRenderPass( - command_buffer, &render_pass_begin_info, VK_SUBPASS_CONTENTS_INLINE); - - // Call vkCmdClearAttachments - VkClearRect clear_rect{ - { - {0, 0}, // offset - {32, 32} // extent - }, // rect - 0, // baseArrayLayer - 1, // layerCount - }; - VkClearValue clear_value{}; - clear_value.color.float32[0] = 0.2; - clear_value.color.float32[1] = 0.2; - clear_value.color.float32[2] = 0.2; - clear_value.color.float32[3] = 0.2; - VkClearAttachment clear_attachment{ - VK_IMAGE_ASPECT_COLOR_BIT, // aspectMask - 0, // colorAttachment - clear_value // clearValue - }; - command_buffer->vkCmdClearAttachments(command_buffer, 1, &clear_attachment, - 1, &clear_rect); - - command_buffer->vkCmdEndRenderPass(command_buffer); - command_buffer->vkEndCommandBuffer(command_buffer); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdClearAttachments_test/vkCmdClearAttachments_test.py b/gapid_tests/command_buffer_tests/vkCmdClearAttachments_test/vkCmdClearAttachments_test.py deleted file mode 100644 index f80af66e..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdClearAttachments_test/vkCmdClearAttachments_test.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal, require_true -from gapit_test_framework import require_not_equal -from gapit_test_framework import GapitTest, get_read_offset_function -from vulkan_constants import VK_IMAGE_ASPECT_COLOR_BIT -from struct_offsets import VulkanStruct, ARRAY, FLOAT, UINT32_T - -from array import array - -CLEAR_RECT = [ - ("rect_offset_x", UINT32_T), - ("rect_offset_y", UINT32_T), - ("rect_extent_width", UINT32_T), - ("rect_extent_height", UINT32_T), - ("baseArrayLayer", UINT32_T), - ("layerCount", UINT32_T), -] - -CLEAR_ATTACHMENT = [ - ("aspectMask", UINT32_T), - ("colorAttachment", UINT32_T), - ("clearValue_color_float32", ARRAY, 4, FLOAT), -] - - -@gapit_test("vkCmdClearAttachments_test") -class ClearASingleLayerColorAttachment(GapitTest): - - def expect(self): - """Expect the vkCmdClearAttachments() is called successfully. The - pAttachments and pRects point to the expected values""" - architecture = self.architecture - - cmd_clear_attachments = require(self.nth_call_of( - "vkCmdClearAttachments", 1)) - require_not_equal(0, cmd_clear_attachments.int_commandBuffer) - require_equal(1, cmd_clear_attachments.int_attachmentCount) - require_not_equal(0, cmd_clear_attachments.hex_pAttachments) - require_equal(1, cmd_clear_attachments.int_rectCount) - require_not_equal(0, cmd_clear_attachments.hex_pRects) - - clear_rect = VulkanStruct( - architecture, CLEAR_RECT, get_read_offset_function( - cmd_clear_attachments, cmd_clear_attachments.hex_pRects)) - - require_equal(0, clear_rect.rect_offset_x) - require_equal(0, clear_rect.rect_offset_y) - require_equal(32, clear_rect.rect_extent_width) - require_equal(32, clear_rect.rect_extent_height) - require_equal(0, clear_rect.baseArrayLayer) - require_equal(1, clear_rect.layerCount) - - clear_attachment = VulkanStruct( - architecture, CLEAR_ATTACHMENT, get_read_offset_function( - cmd_clear_attachments, cmd_clear_attachments.hex_pAttachments)) - require_equal(VK_IMAGE_ASPECT_COLOR_BIT, clear_attachment.aspectMask) - require_equal(0, clear_attachment.colorAttachment) - require_true( - array('f', [0.2 for i in range(4)]) == - array('f', clear_attachment.clearValue_color_float32)) diff --git a/gapid_tests/command_buffer_tests/vkCmdClearColorImage_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdClearColorImage_test/CMakeLists.txt deleted file mode 100644 index b4b24d0e..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdClearColorImage_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdClearColorImage_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/vkCmdClearColorImage_test/README.md b/gapid_tests/command_buffer_tests/vkCmdClearColorImage_test/README.md deleted file mode 100644 index 81b84af5..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdClearColorImage_test/README.md +++ /dev/null @@ -1,61 +0,0 @@ -# vkCmdClearColorImage - -## Signatures -```c++ -void vkCmdClearColorImage( - VkCommandBuffer commandBuffer, - VkImage image, - VkImageLayout imageLayout, - const VkClearColorValue* pColor, - uint32_t rangeCount, - const VkImageSubresourceRange* pRanges); -``` - -# VkClearColorValue -```c++ -typedef union VkClearColorValue { - float float32[4]; - int32_t int32[4]; - uint32_t uint32[4]; -} VkClearColorValue; -``` - -# VkImageSubresourceRange -```c++ -typedef struct VkImageSubresourceRange { - VkImageAspectFlags aspectMask; - uint32_t baseMipLevel; - uint32_t levelCount; - uint32_t baseArrayLayer; - uint32_t layerCount; -} VkImageSubresourceRange; -``` - -According to the Vulkan spec: -- `image` **must** have been created with `VK_IMAGE_USAGE_TRANSFER_DST_BIT` - usage flag -- `imageLayout` **must** specify the layout of the image subresource ranges of - `image` specified in the `pRanges` at the time this command is executed on a - `VkDevice` -- `imageLayout` **must** be either of `VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL` or - `VK_IMAGE_LAYOUT_GENERAL` -- The image range of any given element of `pRanges` **must** be an image - subresource range that is contained within `image` -- `image` **must** not have a compressed or depth/stencil format -- `rangeCount` **must** be greater than 0 -- The `aspectMask` of all image subresource ranges **must** only include - `VK_IMAGE_ASPECT_COLOR_BIT` - -These tests should test the following cases: -- [x] `rangeCount` of value 1 -- [ ] `rangeCount` of value more than 1 -- [x] `imageLayout` of `VK_IMAEG_LAYOUT_TRANSFER_DST_OPTIMAL` -- [ ] `imageLayout` of `VK_IMAEG_LAYOUT_GENERAL` -- [x] `baseMipLevel` of value 0 -- [ ] `baseMipLevel` of value other than 0 -- [x] `levelCount` of value 1 -- [ ] `levelCount` of value more than 1 -- [x] `baseArrayLayer` of value 0 -- [ ] `baseArrayLayer` of value other than 0 -- [x] `layerCount` of value 1 -- [ ] `layerCount` of value more than 1 diff --git a/gapid_tests/command_buffer_tests/vkCmdClearColorImage_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdClearColorImage_test/main.cpp deleted file mode 100644 index 7b5768b9..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdClearColorImage_test/main.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* Copyright 2017 Google 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. - */ -#include - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - vulkan::VkDevice& device = app.device(); - { - // 1. Clear a 2D single layer, single mip level color image - const VkExtent3D image_extent{32, 32, 1}; - const VkImageCreateInfo image_create_info{ - /* sType = */ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* imageType = */ VK_IMAGE_TYPE_2D, - /* format = */ VK_FORMAT_R8G8B8A8_UNORM, - /* extent = */ image_extent, - /* mipLevels = */ 1, - /* arrayLayers = */ 1, - /* samples = */ VK_SAMPLE_COUNT_1_BIT, - /* tiling = */ VK_IMAGE_TILING_OPTIMAL, - /* usage = */ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | - VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT | - VK_IMAGE_USAGE_SAMPLED_BIT, - /* sharingMode = */ VK_SHARING_MODE_EXCLUSIVE, - /* queueFamilyIndexCount = */ 0, - /* pQueueFamilyIndices = */ nullptr, - /* initialLayout = */ VK_IMAGE_LAYOUT_UNDEFINED, - }; - vulkan::ImagePointer image_ptr = app.CreateAndBindImage(&image_create_info); - - // Clear value and range - VkClearColorValue clear_color{ - {0.2, 0.2, 0.2, 0.2} // float32[4] - }; - VkImageSubresourceRange clear_range{ - VK_IMAGE_ASPECT_COLOR_BIT, // aspectMask - 0, // baseMipLevel - 1, // levelCount - 0, // baseArrayLayer - 1, // layerCount - }; - - // Get command buffer and call the clear command - vulkan::VkCommandBuffer cmd_buf = app.GetCommandBuffer(); - ::VkCommandBuffer raw_cmd_buf = cmd_buf.get_command_buffer(); - VkCommandBufferBeginInfo cmd_buf_begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr, 0, nullptr}; - cmd_buf->vkBeginCommandBuffer(cmd_buf, &cmd_buf_begin_info); - - VkImageMemoryBarrier image_barrier = { - VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // sType - nullptr, // pNext - 0, // srcAccessMask - VK_ACCESS_TRANSFER_WRITE_BIT, // dstAccessMask - VK_IMAGE_LAYOUT_UNDEFINED, // oldLayout - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, // newLayout - VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex - VK_QUEUE_FAMILY_IGNORED, // dstQueueFamilyIndex - *image_ptr, // image - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, // subresourceRange - }; - - cmd_buf->vkCmdPipelineBarrier(cmd_buf, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0, 0, - nullptr, 0, nullptr, 1, &image_barrier); - - cmd_buf->vkCmdClearColorImage(cmd_buf, *image_ptr, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - &clear_color, 1, &clear_range); - cmd_buf->vkEndCommandBuffer(cmd_buf); - VkSubmitInfo submit_info{VK_STRUCTURE_TYPE_SUBMIT_INFO, - nullptr, - 0, - nullptr, - nullptr, - 1, - &raw_cmd_buf, - 0, - nullptr}; - app.render_queue()->vkQueueSubmit(app.render_queue(), 1, &submit_info, - static_cast(VK_NULL_HANDLE)); - app.render_queue()->vkQueueWaitIdle(app.render_queue()); - - // Dump the data in the cleared image - containers::vector dump_data(data->allocator()); - app.DumpImageLayersData( - image_ptr.get(), {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, {0, 0, 0}, - image_extent, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &dump_data, {}); - - // Check the dump data - containers::vector expected_data(32 * 32 * 4, 0.2 * 255, - data->allocator()); - LOG_ASSERT(==, data->logger(), expected_data.size(), dump_data.size()); - LOG_ASSERT(==, data->logger(), true, - std::equal(expected_data.begin(), expected_data.end(), - dump_data.begin())); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdClearColorImage_test/vkCmdClearColorImage_test.py b/gapid_tests/command_buffer_tests/vkCmdClearColorImage_test/vkCmdClearColorImage_test.py deleted file mode 100644 index c684024d..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdClearColorImage_test/vkCmdClearColorImage_test.py +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal, require_true -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -import gapit_test_framework -from struct_offsets import VulkanStruct, UINT32_T, FLOAT, ARRAY -from vulkan_constants import * - -from array import array - -COLOR_VALUE = [ - ("float32", ARRAY, 4, FLOAT) -] - -SUBRESOURCE_RANGE = [ - ("aspectMask", UINT32_T), - ("baseMipLevel", UINT32_T), - ("levelCount", UINT32_T), - ("baseArrayLayer", UINT32_T), - ("layerCount", UINT32_T), -] - - -@gapit_test("vkCmdClearColorImage_test") -class Clear2DColorImageSingleLayerSingleLevel(GapitTest): - def expect(self): - """1. Expects vkCmdClearColorImage() is called and traced successfully.""" - architecture = self.architecture - clear_color_image = require(self.nth_call_of("vkCmdClearColorImage", 1)) - require_not_equal(0, clear_color_image.int_commandBuffer) - require_not_equal(0, clear_color_image.int_image) - require_equal(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, clear_color_image.int_imageLayout) - require_not_equal(0, clear_color_image.hex_pColor) - require_equal(1, clear_color_image.int_rangeCount) - require_not_equal(0, clear_color_image.hex_pRanges) - - color = VulkanStruct( - architecture, COLOR_VALUE, get_read_offset_function( - clear_color_image, clear_color_image.hex_pColor)) - require_true( - array('f', [0.2 for i in range(4)]) == - array('f', color.float32)) - - subresource_range = VulkanStruct( - architecture, SUBRESOURCE_RANGE, get_read_offset_function( - clear_color_image, clear_color_image.hex_pRanges)) - require_equal(VK_IMAGE_ASPECT_COLOR_BIT, subresource_range.aspectMask) - require_equal(0, subresource_range.baseMipLevel) - require_equal(1, subresource_range.levelCount) - require_equal(0, subresource_range.baseArrayLayer) - require_equal(1, subresource_range.layerCount) diff --git a/gapid_tests/command_buffer_tests/vkCmdClearDepthStencilImage_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdClearDepthStencilImage_test/CMakeLists.txt deleted file mode 100644 index 32308023..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdClearDepthStencilImage_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdClearDepthStencilImage_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/vkCmdClearDepthStencilImage_test/README.md b/gapid_tests/command_buffer_tests/vkCmdClearDepthStencilImage_test/README.md deleted file mode 100644 index fe56ffaa..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdClearDepthStencilImage_test/README.md +++ /dev/null @@ -1,63 +0,0 @@ -# vkCmdClearDepthStencilImage - -## Signatures -```c++ -void vkCmdClearDepthStencilImage( - VkCommandBuffer commandBuffer, - VkImage image, - VkImageLayout imageLayout, - const VkClearDepthStencilValue* pDepthStencil, - uint32_t rangeCount, - const VkImageSubresourceRange* pRanges); -``` - -# VkClearDepthStencilValue -```c++ -typedef union VkClearDepthStencilValue { - float depth; - uint32_t stencil; -} VkClearDepthStencilValue; -``` - -# VkImageSubresourceRange -```c++ -typedef struct VkImageSubresourceRange { - VkImageAspectFlags aspectMask; - uint32_t baseMipLevel; - uint32_t levelCount; - uint32_t baseArrayLayer; - uint32_t layerCount; -} VkImageSubresourceRange; -``` - -According to the Vulkan spec: -- `image` **must** have been created with `VK_IMAGE_USAGE_TRANSFER_DST_BIT` - usage flag -- `image` **must** have a depth/stencil format -- `imageLayout` **must** specify the layout of the image subresource ranges of - `image` specified in the `pRanges` at the time this command is executed on a - `VkDevice` -- `imageLayout` **must** be either of `VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL` or - `VK_IMAGE_LAYOUT_GENERAL` -- The image range of any given element of `pRanges` **must** be an image - subresource range that is contained within `image` -- `rangeCount` **must** be greater than 0 -- The `aspectMask` of each image subresource ranges **can** include - `VK_IMAGE_ASPECT_DEPTH_BIT` if the image format has a depth component, and - `VK_IMAGE_ASPECT_STENCIL_BIT` if the image format has a stencil component. - -These tests should test the following cases: -- [x] Clear depth data with `VK_IMAGE_ASPECT_DEPTH_BIT` -- [ ] Clear stencil data with `VK_IMAGE_ASPECT_STENCIL_BIT` -- [x] `rangeCount` of value 1 -- [ ] `rangeCount` of value more than 1 -- [x] `imageLayout` of `VK_IMAEG_LAYOUT_TRANSFER_DST_OPTIMAL` -- [ ] `imageLayout` of `VK_IMAEG_LAYOUT_GENERAL` -- [x] `baseMipLevel` of value 0 -- [ ] `baseMipLevel` of value other than 0 -- [x] `levelCount` of value 1 -- [ ] `levelCount` of value more than 1 -- [x] `baseArrayLayer` of value 0 -- [ ] `baseArrayLayer` of value other than 0 -- [x] `layerCount` of value 1 -- [ ] `layerCount` of value more than 1 diff --git a/gapid_tests/command_buffer_tests/vkCmdClearDepthStencilImage_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdClearDepthStencilImage_test/main.cpp deleted file mode 100644 index 51e65522..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdClearDepthStencilImage_test/main.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - vulkan::VkDevice& device = app.device(); - { - // 1. Clear a 2D single layer, single mip level depth/stencil image - const VkExtent3D image_extent{32, 32, 1}; - const VkImageCreateInfo image_create_info{ - /* sType = */ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* imageType = */ VK_IMAGE_TYPE_2D, - /* format = */ VK_FORMAT_D16_UNORM, - /* extent = */ image_extent, - /* mipLevels = */ 1, - /* arrayLayers = */ 1, - /* samples = */ VK_SAMPLE_COUNT_1_BIT, - /* tiling = */ VK_IMAGE_TILING_OPTIMAL, - /* usage = */ VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | - VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT, - /* sharingMode = */ VK_SHARING_MODE_EXCLUSIVE, - /* queueFamilyIndexCount = */ 0, - /* pQueueFamilyIndices = */ nullptr, - /* initialLayout = */ VK_IMAGE_LAYOUT_UNDEFINED, - }; - vulkan::ImagePointer image_ptr = app.CreateAndBindImage(&image_create_info); - - // Clear value and range - const float depth_clear_float = 0.2; - unsigned short depth_clear_unorm = depth_clear_float * 0xffff; - VkClearDepthStencilValue clear_depth_stencil{ - depth_clear_float, // depth - 1, // stencil, not used here as the format does not contain stencil - // data. - }; - VkImageSubresourceRange clear_range{ - VK_IMAGE_ASPECT_DEPTH_BIT, // aspectMask - 0, // baseMipLevel - 1, // levelCount - 0, // baseArrayLayer - 1, // layerCount - }; - - // Get command buffer and call the vkCmdClearDepthStencilImage command - vulkan::VkCommandBuffer cmd_buf = app.GetCommandBuffer(); - ::VkCommandBuffer raw_cmd_buf = cmd_buf.get_command_buffer(); - VkCommandBufferBeginInfo cmd_buf_begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr, 0, nullptr}; - cmd_buf->vkBeginCommandBuffer(cmd_buf, &cmd_buf_begin_info); - - VkImageMemoryBarrier image_barrier = { - VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // sType - nullptr, // pNext - 0, // srcAccessMask - VK_ACCESS_TRANSFER_WRITE_BIT, // dstAccessMask - VK_IMAGE_LAYOUT_UNDEFINED, // oldLayout - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, // newLayout - VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex - VK_QUEUE_FAMILY_IGNORED, // dstQueueFamilyIndex - *image_ptr, // image - {VK_IMAGE_ASPECT_DEPTH_BIT, 0, 1, 0, 1}, // subresourceRange - }; - cmd_buf->vkCmdPipelineBarrier(cmd_buf, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0, 0, - nullptr, 0, nullptr, 1, &image_barrier); - - cmd_buf->vkCmdClearDepthStencilImage( - cmd_buf, // commandBuffer - *image_ptr, // image - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, // imageLayout - &clear_depth_stencil, // pDepthStencil - 1, // rangeCount - &clear_range // pRagnes - ); - cmd_buf->vkEndCommandBuffer(cmd_buf); - VkSubmitInfo submit_info{VK_STRUCTURE_TYPE_SUBMIT_INFO, - nullptr, - 0, - nullptr, - nullptr, - 1, - &raw_cmd_buf, - 0, - nullptr}; - app.render_queue()->vkQueueSubmit(app.render_queue(), 1, &submit_info, - static_cast(VK_NULL_HANDLE)); - app.render_queue()->vkQueueWaitIdle(app.render_queue()); - - // Dump the data in the cleared image - containers::vector dump_data(data->allocator()); - app.DumpImageLayersData( - image_ptr.get(), {VK_IMAGE_ASPECT_DEPTH_BIT, 0, 0, 1}, {0, 0, 0}, - image_extent, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &dump_data, {}); - - // Check the dump data - containers::vector expected_data( - vulkan::GetImageExtentSizeInBytes(image_extent, VK_FORMAT_D16_UNORM) / - sizeof(unsigned short), - depth_clear_unorm, data->allocator()); - LOG_ASSERT(==, data->logger(), expected_data.size(), - dump_data.size() / sizeof(unsigned short)); - unsigned short* dump_data_ptr = - reinterpret_cast(dump_data.data()); - std::for_each(expected_data.begin(), expected_data.end(), - [&data, &dump_data_ptr](unsigned short d) { - LOG_ASSERT(==, data->logger(), d, *dump_data_ptr++); - }); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdClearDepthStencilImage_test/vkCmdClearDepthStencilImage_test.py b/gapid_tests/command_buffer_tests/vkCmdClearDepthStencilImage_test/vkCmdClearDepthStencilImage_test.py deleted file mode 100644 index 956ff10e..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdClearDepthStencilImage_test/vkCmdClearDepthStencilImage_test.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal, require_true -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -import gapit_test_framework -from struct_offsets import VulkanStruct, UINT32_T, FLOAT, ARRAY -from vulkan_constants import * - -from array import array - -DEPTH_STENCIL_VALUE = [("depth", FLOAT), ("stencil", UINT32_T),] - -SUBRESOURCE_RANGE = [ - ("aspectMask", UINT32_T), - ("baseMipLevel", UINT32_T), - ("levelCount", UINT32_T), - ("baseArrayLayer", UINT32_T), - ("layerCount", UINT32_T), -] - - -@gapit_test("vkCmdClearDepthStencilImage_test") -class ClearDepthImage(GapitTest): - - def expect(self): - """1. Expects vkCmdClearDepthStencilImage() is called and traced - successfully.""" - architecture = self.architecture - clear_depth_image = require(self.nth_call_of( - "vkCmdClearDepthStencilImage", 1)) - require_not_equal(0, clear_depth_image.int_commandBuffer) - require_not_equal(0, clear_depth_image.int_image) - require_equal(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - clear_depth_image.int_imageLayout) - require_not_equal(0, clear_depth_image.hex_pDepthStencil) - require_equal(1, clear_depth_image.int_rangeCount) - require_not_equal(0, clear_depth_image.hex_pRanges) - - depth_stencil = VulkanStruct( - architecture, DEPTH_STENCIL_VALUE, get_read_offset_function( - clear_depth_image, clear_depth_image.hex_pDepthStencil)) - # float comparison - require_true(array('f', [0.2]) == array('f', [depth_stencil.depth])) - require_equal(1, depth_stencil.stencil) - - subresource_range = VulkanStruct( - architecture, SUBRESOURCE_RANGE, get_read_offset_function( - clear_depth_image, clear_depth_image.hex_pRanges)) - require_equal(VK_IMAGE_ASPECT_DEPTH_BIT, subresource_range.aspectMask) - require_equal(0, subresource_range.baseMipLevel) - require_equal(1, subresource_range.levelCount) - require_equal(0, subresource_range.baseArrayLayer) - require_equal(1, subresource_range.layerCount) diff --git a/gapid_tests/command_buffer_tests/vkCmdCopyImage_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdCopyImage_test/CMakeLists.txt deleted file mode 100644 index 35d246c4..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdCopyImage_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdCopyImage_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/vkCmdCopyImage_test/README.md b/gapid_tests/command_buffer_tests/vkCmdCopyImage_test/README.md deleted file mode 100644 index 068cca48..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdCopyImage_test/README.md +++ /dev/null @@ -1,107 +0,0 @@ -# vkCmdCopyImage - -## Signatures -```c++ -void vkCmdCopyImage( - VkCommandBuffer commandBuffer, - VkImage srcImage, - VkImageLayout srcImageLayout, - VkImage dstImage, - VkImageLayout dstImageLayout, - uint32_t regionCount, - const VkImageCopy* pRegions); -``` - -# VkImageCopy -```c++ -typedef struct VkImageCopy { - VkImageSubresourceLayers srcSubresource; - VkOffset3D srcOffset; - VkImageSubresourceLayers dstSubresource; - VkOffset3D dstOffset; - VkExtent3D extent; -} VkImageCopy; -``` - -# VkImageSubresourceLayers -```c++ -typedef struct VkImageSubresourceLayers { - VkImageAspectFlags aspectMask; - uint32_t mipLevel; - uint32_t baseArrayLayer; - uint32_t layerCount; -} VkImageSubresourceLayers; -``` - -According to the Vulkan spec: -- The format of `srcImage` and the `dstImage` **must** be compatible. Formats - are considered compatible if their element size is the same between both - formats. -- `srcImage` **must** have been created with `VK_IMAGE_USAGE_TRANSFER_SRC_BIT` - usage flag -- `srcImageLayout` **must** be either of `VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL` - or `VK_IMAGE_LAYOUT_GENERAL` -- `dstImage` **must** have been created with `VK_IMAGE_USAGE_TRANSFER_DST_BIT` - usage flag -- `dstImageLayout` **must** be either of `VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL` - or `VK_IMAGE_LAYOUT_GENERAL` -- The sample count of `srcImage` and `dstImage` **must** match -- `pRegions` **must** be a pointer to an array of `regionCount` valid - `VkImageCopy` structures -- `regionCount` **must** be greater than 0 -- The union of all source regions, and the union of all destination regions, - specified by the elements of `pRegions`, **must not** overlap in memory -- The `VkCommandPool` that `commandBuffer` was allocated from **must** support - transfer, graphics, or compute operations. -- If `srcImage` is compressed, then: - - If `extent.width` is not a multiple of the compressed texel block width, - then `(extent.width + srcOffset.x)` must equal the image subresource width. - - If `extent.height` is not a multiple of the compressed texel block height, - then `(extent.height + srcOffset.y)` must equal the image subresource height. - - If `extent.depth` is not a multiple of the compressed texel block depth, - then `(extent.depth + srcOffset.z)` must equal the image subresource depth. -- If `dstImage` is compressed, then: - - If `extent.width` is not a multiple of the compressed texel block width, - then `(extent.width + dstOffset.x)` must equal the image subresource width. - - If `extent.height` is not a multiple of the compressed texel block height, - then `(extent.height + dstOffset.y)` must equal the image subresource height. - - If `extent.depth` is not a multiple of the compressed texel block depth, - then `(extent.depth + dstOffset.z)` must equal the image subresource depth. -- The `aspectMask` of member of `srcSubresource` and `dstSubresource` **must** - match -- The `layerCount` member of `srcSubresource` and `dstSubresource` **must** - match -- If either of the calling command’s `srcImage` or `dstImage` parameters are of - `VkImageType VK_IMAGE_TYPE_3D`, the `baseArrayLayer` and `layerCount` members - of both `srcSubresource` and `dstSubresource` must be 0 and 1, respectively -- The `aspectMask` member of `srcSubresource` **must** specify aspects present - in the calling command's `srcImage` -- The `aspectMask` member of `dstSubresource` **must** specify aspects present - in the calling command's `dstImage` -- When copying between **compressed** and **uncompressed** formats the `extent` - members represent the texel dimensions of the source image and **not** the - destination. When copying from a **compressed** image to an **uncompressed** - image the image texel dimensions written to the uncompressed image will be - source extent **divided by the compressed texel block dimensions**. When - copying from an uncompressed image to a compressed image the image texel - dimensions written to the compressed image will be the source extent - **multiplied by the compressed texel block dimensions**. In both cases the - number of bytes read and the number of bytes written will be identical. - -These tests should test the following cases: -- [x] `regionCount` of value 1 -- [ ] `regionCount` of value more than 1 -- [x] `srcOffset` of value 0 -- [x] `srcOffset` of value other than 0 -- [x] `dstOffset` of value 0 -- [x] `dstOffset` of value other than 0 -- [x] `mipLevel` of value 0 -- [ ] `mipLevel` of value other than 0 -- [x] `baseArrayLayer` of value 0 -- [ ] `baseArrayLayer` of value other than 0 -- [x] `layerCount` of value 1 -- [ ] `layerCount` of value more than 1 -- [x] Copy from/to uncompressed image -- [x] Copy from/to compressed image -- [ ] Copy from uncompressed image to compressed image -- [ ] Copy from compressed image to uncompressed image diff --git a/gapid_tests/command_buffer_tests/vkCmdCopyImage_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdCopyImage_test/main.cpp deleted file mode 100644 index a5889689..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdCopyImage_test/main.cpp +++ /dev/null @@ -1,347 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include -#include - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/vulkan_application.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - const VkExtent3D sample_image_extent{32, 32, 1}; - const VkFormat sample_format = VK_FORMAT_R8G8B8A8_UNORM; - const VkImageCreateInfo sample_image_create_info{ - /* sType = */ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* imageType = */ VK_IMAGE_TYPE_2D, - /* format = */ sample_format, - /* extent = */ sample_image_extent, - /* mipLevels = */ 1, - /* arrayLayers = */ 1, - /* samples = */ VK_SAMPLE_COUNT_1_BIT, - /* tiling = */ VK_IMAGE_TILING_OPTIMAL, - /* usage = */ - VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT | - VK_IMAGE_USAGE_SAMPLED_BIT, - /* sharingMode = */ VK_SHARING_MODE_EXCLUSIVE, - /* queueFamilyIndexCount = */ 0, - /* pQueueFamilyIndices = */ nullptr, - /* initialLayout = */ VK_IMAGE_LAYOUT_UNDEFINED, - }; - size_t sample_image_data_size = - vulkan::GetImageExtentSizeInBytes(sample_image_extent, sample_format); - containers::vector sample_image_data(sample_image_data_size, 0, - data->allocator()); - for (size_t i = 0; i < sample_image_data_size; i++) { - sample_image_data[i] = i & 0xFF; - } - - { - // 1. Copy from an uncompressed 2D color image, with only 1 layer, 1 - // miplevel and 0 offsets in all dimensions to another 2D image created - // with same create info. - vulkan::VulkanApplication application( - data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions() - .SetHostBufferSize(1024 * 100) - .SetDeviceImageSize(1024 * 100) - .SetCoherentBufferSize(1024 * 100)); - vulkan::VkDevice& device = application.device(); - - vulkan::ImagePointer src_image = - application.CreateAndBindImage(&sample_image_create_info); - vulkan::ImagePointer dst_image = - application.CreateAndBindImage(&sample_image_create_info); - - // Create semaphores, one for image data filling, another for layout - // transitioning. - VkSemaphoreCreateInfo image_fill_semaphore_create_info{ - VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, nullptr, 0}; - ::VkSemaphore image_fill_semaphore; - device->vkCreateSemaphore(device, &image_fill_semaphore_create_info, - nullptr, &image_fill_semaphore); - vulkan::VkSemaphore image_fill_semaphore_wrapper(image_fill_semaphore, - nullptr, &device); - - VkSemaphoreCreateInfo layout_transition_semaphore_create_info{ - VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, nullptr, 0}; - ::VkSemaphore layout_transition_semaphore; - device->vkCreateSemaphore(device, &layout_transition_semaphore_create_info, - nullptr, &layout_transition_semaphore); - vulkan::VkSemaphore layout_transition_semaphore_wrapper( - layout_transition_semaphore, nullptr, &device); - - // Fill initial data in the source image - std::tuple - fill_result = application.FillImageLayersData( - src_image.get(), - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, // subresourcelayer - {0, 0, 0}, // offset - sample_image_extent, // extent - VK_IMAGE_LAYOUT_UNDEFINED, // initial layout - sample_image_data, // data - {}, // wait_semaphores - {image_fill_semaphore}, // signal_semaphores - static_cast<::VkFence>(VK_NULL_HANDLE) // fence - ); - bool fill_succeeded = std::get<0>(fill_result); - // Before the all the image filling commands are executed, the command - // buffer must not be freed. - LOG_ASSERT(==, data->logger(), true, fill_succeeded); - vulkan::VkCommandBuffer fill_image_cmd_buf( - std::move(std::get<1>(fill_result))); - - // Change the layout of the source and destination images - auto layout_transition_cmd_buf = application.GetCommandBuffer(); - application.BeginCommandBuffer(&layout_transition_cmd_buf); - vulkan::RecordImageLayoutTransition( - *src_image.get(), {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_ACCESS_TRANSFER_WRITE_BIT, - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT, - &layout_transition_cmd_buf); - vulkan::RecordImageLayoutTransition( - *dst_image.get(), {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, - VK_IMAGE_LAYOUT_UNDEFINED, 0, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - VK_ACCESS_TRANSFER_WRITE_BIT, &layout_transition_cmd_buf); - application.EndAndSubmitCommandBuffer( - &layout_transition_cmd_buf, &application.render_queue(), - {image_fill_semaphore}, {VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT}, - {layout_transition_semaphore}, ::VkFence(VK_NULL_HANDLE)); - - // Copy image - auto copy_image_cmd_buf = application.GetCommandBuffer(); - ::VkCommandBuffer raw_copy_image_cmd_buf = - copy_image_cmd_buf.get_command_buffer(); - VkCommandBufferBeginInfo cmd_buf_begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr, 0, nullptr}; - copy_image_cmd_buf->vkBeginCommandBuffer(copy_image_cmd_buf, - &cmd_buf_begin_info); - const VkImageCopy region{ - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, - {0, 0, 0}, - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, - {0, 0, 0}, - sample_image_extent, - }; - copy_image_cmd_buf->vkCmdCopyImage( - copy_image_cmd_buf, - *src_image, // srcImage - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, // srcImageLayout - *dst_image, // dstImage - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, // dstImageLayout - 1, // regionCount - ®ion // pRegions - ); - copy_image_cmd_buf->vkEndCommandBuffer(copy_image_cmd_buf); - - // Submit the commands - const VkPipelineStageFlags wait_dst_stage_masks[1] = { - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT}; - VkSubmitInfo submit_info{VK_STRUCTURE_TYPE_SUBMIT_INFO, - nullptr, - 1, - &layout_transition_semaphore, - wait_dst_stage_masks, - 1, - &raw_copy_image_cmd_buf, - 0, - nullptr}; - application.render_queue()->vkQueueSubmit( - application.render_queue(), 1, &submit_info, - static_cast(VK_NULL_HANDLE)); - application.render_queue()->vkQueueWaitIdle(application.render_queue()); - - // Dump the data from the destination image - containers::vector dump_data(data->allocator()); - application.DumpImageLayersData( - dst_image.get(), - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, // subresourcelayer - {0, 0, 0}, // offset - sample_image_extent, // extent - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, // initial layout - &dump_data, // data - {} // wait_semaphores - ); - LOG_ASSERT(==, data->logger(), sample_image_data.size(), dump_data.size()); - LOG_ASSERT(==, data->logger(), true, - std::equal(sample_image_data.begin(), sample_image_data.end(), - dump_data.begin())); - } - - { - // 2. Copy a region of an BC2 2D color image, with only 1 layer, 1 - // miplevel, to a different region of another 2D image created with same - // dimensions but in BC3 format. - VkPhysicalDeviceFeatures requested_features = {0}; - requested_features.textureCompressionBC = VK_TRUE; - vulkan::VulkanApplication application( - data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions() - .SetHostBufferSize(1024 * 100) - .SetDeviceImageSize(1024 * 100) - .SetCoherentBufferSize(1024 * 100), - {}, {}, requested_features); - vulkan::VkDevice& device = application.device(); - if (device.is_valid()) { - VkImageCreateInfo src_image_create_info = sample_image_create_info; - src_image_create_info.format = VK_FORMAT_BC2_UNORM_BLOCK; - vulkan::ImagePointer src_image = - application.CreateAndBindImage(&src_image_create_info); - VkImageCreateInfo dst_image_create_info = sample_image_create_info; - dst_image_create_info.format = VK_FORMAT_BC3_UNORM_BLOCK; - vulkan::ImagePointer dst_image = - application.CreateAndBindImage(&dst_image_create_info); - - // Create semaphores, one for image data filling, another for layout - // transitioning. - VkSemaphoreCreateInfo image_fill_semaphore_create_info{ - VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, nullptr, 0}; - ::VkSemaphore image_fill_semaphore; - device->vkCreateSemaphore(device, &image_fill_semaphore_create_info, - nullptr, &image_fill_semaphore); - vulkan::VkSemaphore image_fill_semaphore_wrapper(image_fill_semaphore, - nullptr, &device); - - VkSemaphoreCreateInfo layout_transition_semaphore_create_info{ - VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, nullptr, 0}; - ::VkSemaphore layout_transition_semaphore; - device->vkCreateSemaphore(device, - &layout_transition_semaphore_create_info, - nullptr, &layout_transition_semaphore); - vulkan::VkSemaphore layout_transition_semaphore_wrapper( - layout_transition_semaphore, nullptr, &device); - - // Fill initial data in the source image, only fill the region to be - // copied - // to the destination image. - const VkExtent3D copy_extent{16, 12, 1}; - size_t copy_image_data_size = vulkan::GetImageExtentSizeInBytes( - copy_extent, src_image_create_info.format); - containers::vector copy_image_data(copy_image_data_size, 0, - data->allocator()); - for (size_t i = 0; i < copy_image_data_size; i++) { - copy_image_data[i] = i & 0xFF; - } - - std::tuple - fill_result = application.FillImageLayersData( - src_image.get(), - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, // subresourcelayer - {8, 12, 0}, // offset - copy_extent, // extent - VK_IMAGE_LAYOUT_UNDEFINED, // initial layout - copy_image_data, // data - {}, // wait_semaphores - {image_fill_semaphore}, // signal_semaphores - static_cast<::VkFence>(VK_NULL_HANDLE) // fence - ); - bool fill_succeeded = std::get<0>(fill_result); - // Before the all the image filling commands are executed, the command - // buffer must not be freed. - LOG_ASSERT(==, data->logger(), true, fill_succeeded); - vulkan::VkCommandBuffer fill_image_cmd_buf( - std::move(std::get<1>(fill_result))); - - // Change the layout of the source and destination image - auto layout_transition_cmd_buf = application.GetCommandBuffer(); - - application.BeginCommandBuffer(&layout_transition_cmd_buf); - vulkan::RecordImageLayoutTransition( - *src_image.get(), {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_ACCESS_TRANSFER_WRITE_BIT, - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT, - &layout_transition_cmd_buf); - vulkan::RecordImageLayoutTransition( - *dst_image.get(), {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, - VK_IMAGE_LAYOUT_UNDEFINED, 0, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - VK_ACCESS_TRANSFER_WRITE_BIT, &layout_transition_cmd_buf); - application.EndAndSubmitCommandBuffer( - &layout_transition_cmd_buf, &application.render_queue(), - {image_fill_semaphore}, {VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT}, - {layout_transition_semaphore}, ::VkFence(VK_NULL_HANDLE)); - - // Copy image - auto copy_image_cmd_buf = application.GetCommandBuffer(); - ::VkCommandBuffer raw_copy_image_cmd_buf = - copy_image_cmd_buf.get_command_buffer(); - VkCommandBufferBeginInfo cmd_buf_begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr, 0, nullptr}; - copy_image_cmd_buf->vkBeginCommandBuffer(copy_image_cmd_buf, - &cmd_buf_begin_info); - const VkImageCopy region{ - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, - {8, 12, 0}, - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, - {16, 16, 0}, - copy_extent, - }; - copy_image_cmd_buf->vkCmdCopyImage( - copy_image_cmd_buf, - *src_image, // srcImage - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, // srcImageLayout - *dst_image, // dstImage - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, // dstImageLayout - 1, // regionCount - ®ion // pRegions - ); - copy_image_cmd_buf->vkEndCommandBuffer(copy_image_cmd_buf); - - // Submit the commands - const VkPipelineStageFlags wait_dst_stage_masks[1] = { - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT}; - VkSubmitInfo submit_info{VK_STRUCTURE_TYPE_SUBMIT_INFO, - nullptr, - 1, - &layout_transition_semaphore, - wait_dst_stage_masks, - 1, - &raw_copy_image_cmd_buf, - 0, - nullptr}; - application.render_queue()->vkQueueSubmit( - application.render_queue(), 1, &submit_info, - static_cast(VK_NULL_HANDLE)); - application.render_queue()->vkQueueWaitIdle(application.render_queue()); - - // Dump the data from the destination image - containers::vector dump_data(data->allocator()); - application.DumpImageLayersData( - dst_image.get(), - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, // subresourcelayer - {16, 16, 0}, // offset - copy_extent, // extent - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, // initial layout - &dump_data, // data - {} // wait_semaphores - ); - LOG_ASSERT(==, data->logger(), copy_image_data.size(), dump_data.size()); - LOG_ASSERT(==, data->logger(), true, - std::equal(copy_image_data.begin(), copy_image_data.end(), - dump_data.begin())); - } else { - data->logger()->LogInfo( - "Disable test due to missing physical device feature: " - "textureCompressionBC"); - } - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdCopyImage_test/vkCmdCopyImage_test.py b/gapid_tests/command_buffer_tests/vkCmdCopyImage_test/vkCmdCopyImage_test.py deleted file mode 100644 index 9b97395a..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdCopyImage_test/vkCmdCopyImage_test.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from gapit_test_framework import GapidUnsupportedException -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY, DEVICE_SIZE, INT32_T -from vulkan_constants import * - -IMAGE_COPY = [ - ("srcSubresource_aspectMask", UINT32_T), - ("srcSubresource_mipLevel", UINT32_T), - ("srcSubresource_baseArrayLayer", UINT32_T), - ("srcSubresource_layerCount", UINT32_T), - ("srcOffset_x", UINT32_T), - ("srcOffset_y", UINT32_T), - ("srcOffset_z", UINT32_T), - ("dstSubresource_aspectMask", UINT32_T), - ("dstSubresource_mipLevel", UINT32_T), - ("dstSubresource_baseArrayLayer", UINT32_T), - ("dstSubresource_layerCount", UINT32_T), - ("dstOffset_x", UINT32_T), - ("dstOffset_y", UINT32_T), - ("dstOffset_z", UINT32_T), - ("extent_x", UINT32_T), - ("extent_y", UINT32_T), - ("extent_z", UINT32_T), -] - - -@gapit_test("vkCmdCopyImage_test") -class CopyWholeColorImageToSameColorImageOneLayer(GapitTest): - - def expect(self): - """Check the arguments to vkCmdCopyImage""" - architecture = self.architecture - copy_image = require(self.nth_call_of("vkCmdCopyImage", 1)) - - require_not_equal(0, copy_image.int_commandBuffer) - require_not_equal(0, copy_image.int_srcImage) - require_equal(VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, - copy_image.int_srcImageLayout) - require_not_equal(0, copy_image.int_dstImage) - require_equal(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - copy_image.int_dstImageLayout) - require_equal(1, copy_image.int_regionCount) - - image_copy = VulkanStruct(architecture, IMAGE_COPY, - get_read_offset_function( - copy_image, copy_image.hex_pRegions)) - - require_equal(VK_IMAGE_ASPECT_COLOR_BIT, - image_copy.srcSubresource_aspectMask) - require_equal(0, image_copy.srcSubresource_mipLevel) - require_equal(0, image_copy.srcSubresource_baseArrayLayer) - require_equal(1, image_copy.srcSubresource_layerCount) - require_equal(0, image_copy.srcOffset_x) - require_equal(0, image_copy.srcOffset_y) - require_equal(0, image_copy.srcOffset_z) - require_equal(VK_IMAGE_ASPECT_COLOR_BIT, - image_copy.dstSubresource_aspectMask) - require_equal(0, image_copy.dstSubresource_mipLevel) - require_equal(0, image_copy.dstSubresource_baseArrayLayer) - require_equal(1, image_copy.dstSubresource_layerCount) - require_equal(0, image_copy.dstOffset_x) - require_equal(0, image_copy.dstOffset_y) - require_equal(0, image_copy.dstOffset_z) - require_equal(32, image_copy.extent_x) - require_equal(32, image_copy.extent_y) - require_equal(1, image_copy.extent_z) - - -class CopyCompressedImageRegionToCompatibleImageRegion(GapitTest): - - def expect(self): - """Check the arguments to vkCmdCopyImage""" - architecture = self.architecture - create_device = self.nth_call_of("vkCreateDevice", 2) - if create_device[0] is None: - raise GapidUnsupportedException( - "physical device feature: textureCompressionBC not supported") - - copy_image = require(self.next_call_of("vkCmdCopyImage")) - - require_not_equal(0, copy_image.int_commandBuffer) - require_not_equal(0, copy_image.int_srcImage) - require_equal(VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, - copy_image.int_srcImageLayout) - require_not_equal(0, copy_image.int_dstImage) - require_equal(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - copy_image.int_dstImageLayout) - require_equal(1, copy_image.int_regionCount) - - image_copy = VulkanStruct(architecture, IMAGE_COPY, - get_read_offset_function( - copy_image, copy_image.hex_pRegions)) - - require_equal(VK_IMAGE_ASPECT_COLOR_BIT, - image_copy.srcSubresource_aspectMask) - require_equal(0, image_copy.srcSubresource_mipLevel) - require_equal(0, image_copy.srcSubresource_baseArrayLayer) - require_equal(1, image_copy.srcSubresource_layerCount) - require_equal(8, image_copy.srcOffset_x) - require_equal(12, image_copy.srcOffset_y) - require_equal(0, image_copy.srcOffset_z) - require_equal(VK_IMAGE_ASPECT_COLOR_BIT, - image_copy.dstSubresource_aspectMask) - require_equal(0, image_copy.dstSubresource_mipLevel) - require_equal(0, image_copy.dstSubresource_baseArrayLayer) - require_equal(1, image_copy.dstSubresource_layerCount) - require_equal(16, image_copy.dstOffset_x) - require_equal(16, image_copy.dstOffset_y) - require_equal(0, image_copy.dstOffset_z) - require_equal(16, image_copy.extent_x) - require_equal(12, image_copy.extent_y) - require_equal(1, image_copy.extent_z) diff --git a/gapid_tests/command_buffer_tests/vkCmdCopyQueryPoolResults_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdCopyQueryPoolResults_test/CMakeLists.txt deleted file mode 100644 index 2cfec40b..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdCopyQueryPoolResults_test/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdCopyQueryPoolResults_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) diff --git a/gapid_tests/command_buffer_tests/vkCmdCopyQueryPoolResults_test/README.md b/gapid_tests/command_buffer_tests/vkCmdCopyQueryPoolResults_test/README.md deleted file mode 100644 index 96ff82c2..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdCopyQueryPoolResults_test/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# vkCmdCopyQueryPoolResults - -## Signatures -```c++ -void vkCmdCopyQueryPoolResults( - VkCommandBuffer commandBuffer, - VkQueryPool queryPool, - uint32_t firstQuery, - uint32_t queryCount, - VkBuffer dstBuffer, - VkDeviceSize dstOffset, - VkDeviceSize stride, - VkQueryResultFlags flags); -``` - -According to the Vulkan spec: -- `vkCmdCopyQueryPoolResults` is guaranteed to see the effect of previous uses - of `vkCmdResetQueryPool` in the same queue, without any additional - synchronization. Thus, the results will always reflect the most recent use of - the query -- `commandBuffer` **must** be a valid `VkCommandBuffer` handle -- `firstQuery` **must** be less than the number of queries in `queryPool` -- The sum of `firstQuery` and `queryCount` **must** be less than or equal to - the number of queries in `queryPool` -- `vkCmdCopyQueryPoolResults` **must** only be called outside of a render pass - instance -- `dstOffset` **must** be less than the size of `dstBuffer` -- `dstBuffer` **must** have been created with `VK_BUFFER_USAGE_TRANSFER_DST_BIT` - useage flag -- The `VkCommandPool` that `commandBuffer` was allocated from **must** support - graphics, or compute operations -- If no bits are set in `flags`, results for all requested queries in the - available state are written as 32-bit unsigned integer values, and nothing is - written for queries in the unavailable state -- If `VK_QUERY_RESULT_64_BIT` is not set in flags then dstOffset and stride - must be multiples of 4 -- If `VK_QUERY_RESULT_64_BIT` is set in flags then dstOffset and stride must be - multiples of 8 -- If `VK_QUERY_RESULT_WAIT_BIT` is set, the implementation will wait for each - query’s status to be in the available state before retrieving the numerical - results for that query. This is guaranteed to reflect the most recent use of - the query on the same queue, assuming that the query is not being - simultaneously used by other queues. If the query does not become available - in a finite amount of time (e.g. due to not issuing a query since the last - reset), a `VK_ERROR_DEVICE_LOST` error may occur -- If `VK_QUERY_RESULT_WITH_AVAILABILITY_BIT` is set and - `VK_QUERY_RESULT_WAIT_BIT` is not set, the availability is guaranteed to - reflect the most recent use of the query on the same queue, assuming that the - query is not being simultaneously used by other queues. As with - `vkGetQueryPoolResults`, implementations must guarantee that if they return a - non-zero availability value, then the numerical results are valid. -- If `VK_QUERY_RESULT_PARTIAL_BIT` is set, `VK_QUERY_RESULT_WAIT_BIT` is not - set, and the query’s status is unavailable, an intermediate result value - between zero and the final result value is written for that query. -- `VK_QUERY_RESULT_PARTIAL_BIT` **must NOT** be used if the pool’s queryType is - `VK_QUERY_TYPE_TIMESTAMP`. - -These tests should test the following cases: -- [x] `firstQuery` of value 0 -- [x] `firstQuery` of value other than 0 -- [x] `queryCount` of value 1 -- [x] `queryCount` of value other than 1 -- [x] `stride` of value 4 -- [x] `stride` of value 8 -- [x] `stride` of value 12 -- [x] `dstOffset` of value 0 -- [x] `dstOffset` of value other than 0 -- [x] `flags` with no bit set -- [x] `flags` with `VK_QUERY_RESULT_64_BIT` set -- [x] `flags` with `VK_QUERY_RESULT_WAIT_BIT` set -- [x] `flags` with `VK_QUERY_RESULT_AVAILABILITY_BIT` set -- [x] `flags` with `VK_QUERY_RESULT_PARTIAL_BIT` set diff --git a/gapid_tests/command_buffer_tests/vkCmdCopyQueryPoolResults_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdCopyQueryPoolResults_test/main.cpp deleted file mode 100644 index 9bd21d57..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdCopyQueryPoolResults_test/main.cpp +++ /dev/null @@ -1,499 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include -#include - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -uint32_t fragment_shader[] = -#include "hardcode_pos_triangle.frag.spv" - ; - -uint32_t vertex_shader[] = -#include "hardcode_pos_triangle.vert.spv" - ; - -namespace { -void QueryWithoutDrawingAnythingAndCopyResults( - const entry::EntryData* data, vulkan::VulkanApplication* app, - const VkQueryPoolCreateInfo& query_pool_create_info, uint32_t first_query, - uint32_t query_count, ::VkBuffer dst_buffer, VkDeviceSize dst_offset, - VkDeviceSize stride, VkQueryResultFlags flags) { - vulkan::VkDevice& device = app->device(); - - // Create render pass. - VkAttachmentReference color_attachment = { - 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - vulkan::VkRenderPass render_pass = app->CreateRenderPass( - {{ - 0, // flags - app->swapchain().format(), // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_UNDEFINED, // initialLayout - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // finalLayout - }}, // AttachmentDescriptions - {{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment, // colorAttachment - nullptr, // pResolveAttachments - nullptr, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }}, // SubpassDescriptions - {} // SubpassDependencies - ); - - // Create shader modules. - vulkan::VkShaderModule vertex_shader_module = - app->CreateShaderModule(vertex_shader); - vulkan::VkShaderModule fragment_shader_module = - app->CreateShaderModule(fragment_shader); - VkPipelineShaderStageCreateInfo shader_stage_create_infos[2] = { - { - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_SHADER_STAGE_VERTEX_BIT, // stage - vertex_shader_module, // module - "main", // pName - nullptr // pSpecializationInfo - }, - { - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_SHADER_STAGE_FRAGMENT_BIT, // stage - fragment_shader_module, // module - "main", // pName - nullptr // pSpecializationInfo - }}; - - // Specify vertex input state. - VkPipelineVertexInputStateCreateInfo vertex_input_state = { - VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 0, // vertexBindingDescriptionCount - nullptr, // pVertexBindingDescriptions - 0, // vertexAttributeDescriptionCount - nullptr, // pVertexAttributeDescriptions - }; - - // Other fixed function stage configuration. - VkPipelineInputAssemblyStateCreateInfo input_assembly_state = { - VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, // topology - VK_FALSE // primitiveRestartEnable - }; - - VkViewport viewport = { - 0.0f, // x - 0.0f, // y - static_cast(app->swapchain().width()), // width - static_cast(app->swapchain().height()), // height - 0.0f, // minDepth - 1.0f, // maxDepth - }; - - VkRect2D scissor = {{ - 0, // offset.x - 0, // offset.y - }, - { - app->swapchain().width(), // extent.width - app->swapchain().height() // extent.height - }}; - - VkPipelineViewportStateCreateInfo viewport_state = { - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 1, // viewportCount - &viewport, // pViewports - 1, // scissorCount - &scissor, // pScissors - }; - - VkPipelineRasterizationStateCreateInfo rasterization_state = { - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_FALSE, // depthClampEnable - VK_FALSE, // rasterizerDiscardEnable - VK_POLYGON_MODE_FILL, // polygonMode - VK_CULL_MODE_BACK_BIT, // cullMode - VK_FRONT_FACE_CLOCKWISE, // frontFace - VK_FALSE, // depthBiasEnable - 0.0f, // depthBiasConstantFactor - 0.0f, // depthBiasClamp - 0.0f, // depthBiasSlopeFactor - 1.0f, // lineWidth - }; - - VkPipelineMultisampleStateCreateInfo multisample_state = { - VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_SAMPLE_COUNT_1_BIT, // rasterizationSamples - VK_FALSE, // sampleShadingEnable - 0, // minSampleShading - 0, // pSampleMask - VK_FALSE, // alphaToCoverageEnable - VK_FALSE, // alphaToOneEnable - }; - - VkPipelineColorBlendAttachmentState color_blend_attachment_state = { - VK_FALSE, // blendEnable - VK_BLEND_FACTOR_ZERO, // srcColorBlendFactor - VK_BLEND_FACTOR_ONE, // dstColorBlendFactor - VK_BLEND_OP_ADD, // colorBlendOp - VK_BLEND_FACTOR_ZERO, // srcAlphaBlendFactor - VK_BLEND_FACTOR_ONE, // dstAlphaBlendFactor - VK_BLEND_OP_ADD, // alphaBlendOp - (VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | - VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT), // colorWriteMask - }; - - VkPipelineColorBlendStateCreateInfo color_blend_state = { - VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_FALSE, // logicOpEnable - VK_LOGIC_OP_CLEAR, // logicOp - 1, // attachmentCount - &color_blend_attachment_state, // pAttachments - {1.0f, 1.0f, 1.0f, 1.0f} // blendConstants - }; - - vulkan::PipelineLayout pipeline_layout(app->CreatePipelineLayout({{}})); - - // Create the graphics pipeline. - VkGraphicsPipelineCreateInfo create_info = { - VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 2, // stageCount - shader_stage_create_infos, // pStages - &vertex_input_state, // pVertexInputState - &input_assembly_state, // pInputAssemblyState - nullptr, // pTessellationState - &viewport_state, // pViewportState - &rasterization_state, // pRasterizationState - &multisample_state, // pMultisampleState - nullptr, // pDepthStencilState - &color_blend_state, // pColorBlendState - nullptr, // pDynamicState - pipeline_layout, // layout - render_pass, // renderPass - 0, // subpass - VK_NULL_HANDLE, // basePipelineHandle - 0 // basePipelineIndex - }; - - VkPipeline raw_pipeline; - LOG_EXPECT( - ==, data->logger(), - device->vkCreateGraphicsPipelines(device, app->pipeline_cache(), 1, - &create_info, nullptr, &raw_pipeline), - VK_SUCCESS); - vulkan::VkPipeline pipeline(raw_pipeline, nullptr, &device); - - // Create image view. - VkImageViewCreateInfo image_view_create_info{ - VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - app->swapchain_images().front(), // image - VK_IMAGE_VIEW_TYPE_2D, // viewType - app->swapchain().format(), // format - { - VK_COMPONENT_SWIZZLE_IDENTITY, // components.r - VK_COMPONENT_SWIZZLE_IDENTITY, // components.g - VK_COMPONENT_SWIZZLE_IDENTITY, // components.b - VK_COMPONENT_SWIZZLE_IDENTITY, // components.a - }, - { - VK_IMAGE_ASPECT_COLOR_BIT, // subresourceRange.aspectMask - 0, // subresourceRange.baseMipLevel - 1, // subresourceRange.levelCount - 0, // subresourceRange.baseArrayLayer - 1, // subresourceRange.layerCount - }, - }; - ::VkImageView raw_image_view; - LOG_EXPECT( - ==, data->logger(), - app->device()->vkCreateImageView(app->device(), &image_view_create_info, - nullptr, &raw_image_view), - VK_SUCCESS); - vulkan::VkImageView image_view(raw_image_view, nullptr, &app->device()); - - // Create framebuffer - VkFramebufferCreateInfo framebuffer_create_info{ - VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - render_pass, // renderPass - 1, // attachmentCount - &raw_image_view, // attachments - app->swapchain().width(), // width - app->swapchain().height(), // height - 1 // layers - }; - ::VkFramebuffer raw_framebuffer; - app->device()->vkCreateFramebuffer(app->device(), &framebuffer_create_info, - nullptr, &raw_framebuffer); - vulkan::VkFramebuffer framebuffer(raw_framebuffer, nullptr, &app->device()); - - // Create query pool. - vulkan::VkQueryPool query_pool = - vulkan::CreateQueryPool(&app->device(), query_pool_create_info); - - // Create command buffer. - vulkan::VkCommandBuffer command_buffer = app->GetCommandBuffer(); - VkCommandBufferBeginInfo command_buffer_begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType - nullptr, // pNext - 0, // flags - nullptr, // pInheritanceInfo - }; - command_buffer->vkBeginCommandBuffer(command_buffer, - &command_buffer_begin_info); - VkRenderPassBeginInfo render_pass_begin_info{ - VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, // sType - nullptr, // pNext - render_pass, // renderPass - framebuffer, // framebuffer - { - {0, // renderArea.offset.x - 0}, // renderArea.offset.y - {app->swapchain().width(), // renderArea.extent.width - app->swapchain().height()}, // renderArea.extent.height - }, - 0, // clearValueCount - nullptr, // pClearValues - }; - - command_buffer->vkCmdResetQueryPool(command_buffer, query_pool, 0, 2); - - // Begin all the queries - for (uint32_t q = 0; q < query_pool_create_info.queryCount; q++) { - command_buffer->vkCmdBeginQuery(command_buffer, query_pool, q, 0); - } - - command_buffer->vkCmdBeginRenderPass(command_buffer, &render_pass_begin_info, - VK_SUBPASS_CONTENTS_INLINE); - command_buffer->vkCmdBindPipeline( - command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, raw_pipeline); - // Do not draw anything, do not call vkCmdDraw - command_buffer->vkCmdEndRenderPass(command_buffer); - - // End all the queries - for (uint32_t q = 0; q < query_pool_create_info.queryCount; q++) { - command_buffer->vkCmdEndQuery(command_buffer, query_pool, q); - } - - // Result buffer barrier - VkBufferMemoryBarrier to_dst_barrier{ - VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, // sType - nullptr, // pNext - 0, // srcAccessMask - VK_ACCESS_TRANSFER_WRITE_BIT, // dstAccessMask - VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex - VK_QUEUE_FAMILY_IGNORED, // dstQueueFamilyIndex - dst_buffer, // buffer - dst_offset, // offset - VK_WHOLE_SIZE, // size - }; - command_buffer->vkCmdPipelineBarrier( - command_buffer, // commandBuffer - VK_PIPELINE_STAGE_TRANSFER_BIT, // srcStageMask - VK_PIPELINE_STAGE_TRANSFER_BIT, // dstStageMask - 0, // dependencyFlags - 0, // memoryBarrierCount - nullptr, // pMemoryBarriers - 1, // bufferMemoryBarrierCount - &to_dst_barrier, // pBufferMemoryBarriers - 0, // imageMemoryBarrierCount - nullptr // pImageMemoryBarriers - ); - - // Call vkCmdCopyQueryPoolResults - command_buffer->vkCmdCopyQueryPoolResults( - command_buffer, query_pool, first_query, query_count, dst_buffer, - dst_offset, stride, flags); - - command_buffer->vkEndCommandBuffer(command_buffer); - - ::VkCommandBuffer raw_cmd_buf = command_buffer.get_command_buffer(); - VkSubmitInfo submit_info{VK_STRUCTURE_TYPE_SUBMIT_INFO, - nullptr, - 0, - nullptr, - nullptr, - 1, - &raw_cmd_buf, - 0, - nullptr}; - app->render_queue()->vkQueueSubmit(app->render_queue(), 1, &submit_info, - static_cast(VK_NULL_HANDLE)); - app->render_queue()->vkQueueWaitIdle(app->render_queue()); -} - -vulkan::BufferPointer CreateBufferAndFlush(vulkan::VulkanApplication* app, - uint32_t size, uint8_t content) { - VkBufferCreateInfo create_info{ - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // createFlags - size, // size - VK_BUFFER_USAGE_TRANSFER_SRC_BIT | - VK_BUFFER_USAGE_TRANSFER_DST_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr // pQueueFamilyIndices - }; - vulkan::BufferPointer buffer = app->CreateAndBindHostBuffer(&create_info); - uint8_t* ptr = reinterpret_cast(buffer->base_address()); - std::for_each(ptr, ptr + size, [content](uint8_t& n) { n = content; }); - buffer->flush(); - return std::move(buffer); -} -} // namespace - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - - { - // 1. Get 32-bit results from all the queries in a four-query pool, - // without any result flags, copy to result buffer with non-zero offset. - const uint32_t num_queries = 4; - const uint32_t first_query = 0; - const VkDeviceSize offset = 4 * sizeof(uint32_t); - const VkDeviceSize stride = sizeof(uint32_t); - const uint32_t buffer_size = offset + num_queries * stride; - const VkQueryResultFlags flags = 0; - - vulkan::BufferPointer result_buffer = - CreateBufferAndFlush(&app, buffer_size, 0xff); - - QueryWithoutDrawingAnythingAndCopyResults( - data, &app, - {VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, nullptr, 0, - VK_QUERY_TYPE_OCCLUSION, num_queries, 0}, - first_query, num_queries, *result_buffer, offset, stride, flags); - - result_buffer->invalidate(); - - for (uint32_t i = 0; i < buffer_size; i++) { - if (i < offset) { - LOG_ASSERT(==, data->logger(), - uint8_t(result_buffer->base_address()[i]), 0xFFU); - } else { - LOG_ASSERT(==, data->logger(), - uint8_t(result_buffer->base_address()[i]), 0x0U); - } - } - } - - { - // 2. Get 64-bit results from the fifth to eighth query in a eight-query - // pool, with VK_QUERY_RESULT_WAIT_BIT flag, copy to result buffer with - // zero offset. - const uint32_t total_num_queries = 8; - const uint32_t first_query = 4; - const uint32_t num_queries = total_num_queries - first_query; - const VkDeviceSize offset = 0; - const VkDeviceSize stride = sizeof(uint64_t); - const uint32_t buffer_size = offset + num_queries * stride; - const VkQueryResultFlags flags = - VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT; - - vulkan::BufferPointer result_buffer = - CreateBufferAndFlush(&app, buffer_size, 0xff); - - QueryWithoutDrawingAnythingAndCopyResults( - data, &app, - {VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, nullptr, 0, - VK_QUERY_TYPE_OCCLUSION, total_num_queries, 0}, - first_query, num_queries, *result_buffer, offset, stride, flags); - - result_buffer->invalidate(); - - for (uint32_t i = 0; i < buffer_size; i++) { - LOG_ASSERT(==, data->logger(), uint8_t(result_buffer->base_address()[i]), - 0x0U); - } - } - - { - // 3. Get 32-bit results from all the queries in a four-query - // pool, with VK_QUERY_RESULT_PARTIAL_BIT and - // VK_QUERY_RESULT_WITH_AVAILABILITY_BIT flag, and stride value 12, copy to - // result buffer with zero offset. - const uint32_t num_queries = 4; - const uint32_t first_query = 0; - const VkDeviceSize offset = 0; - const VkDeviceSize stride = 3 * sizeof(uint32_t); - const uint32_t buffer_size = offset + num_queries * stride; - const VkQueryResultFlags flags = - VK_QUERY_RESULT_WITH_AVAILABILITY_BIT | VK_QUERY_RESULT_PARTIAL_BIT; - - vulkan::BufferPointer result_buffer = - CreateBufferAndFlush(&app, buffer_size, 0xff); - - QueryWithoutDrawingAnythingAndCopyResults( - data, &app, - {VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, nullptr, 0, - VK_QUERY_TYPE_OCCLUSION, num_queries, 0}, - first_query, num_queries, *result_buffer, offset, stride, flags); - - result_buffer->invalidate(); - - uint32_t* ptr = reinterpret_cast(result_buffer->base_address()); - for (uint32_t i = 0; i < buffer_size / sizeof(uint32_t); i++) { - if (i % 3 == 0) { - LOG_ASSERT(==, data->logger(), ptr[i], 0x0U); - } else if (i % 3 == 1) { - LOG_ASSERT(==, data->logger(), ptr[i], 0x1U); - } else { - LOG_ASSERT(==, data->logger(), ptr[i], 0xFFFFFFFFU); - } - } - } - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdCopyQueryPoolResults_test/vkCmdResetQueryPool_test.py b/gapid_tests/command_buffer_tests/vkCmdCopyQueryPoolResults_test/vkCmdResetQueryPool_test.py deleted file mode 100644 index 8abe89ab..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdCopyQueryPoolResults_test/vkCmdResetQueryPool_test.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal, require_true -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -import gapit_test_framework -from vulkan_constants import * - - -@gapit_test("vkCmdCopyQueryPoolResults_test") -class AllFourQueryResultsIn32BitWithNoFlagCopyWithOffsets(GapitTest): - - def expect(self): - """1. Expects vkCmdCopyQueryPoolResults() is called with firstQuery: 0, - queryCount: 4 stride: 4 and dstOffset: 16.""" - copy_query_pool_results = require(self.nth_call_of( - "vkCmdCopyQueryPoolResults", 1)) - require_not_equal(0, copy_query_pool_results.int_commandBuffer) - require_not_equal(0, copy_query_pool_results.int_queryPool) - require_equal(0, copy_query_pool_results.int_firstQuery) - require_equal(4, copy_query_pool_results.int_queryCount) - require_not_equal(0, copy_query_pool_results.int_dstBuffer) - require_equal(16, copy_query_pool_results.int_dstOffset) - require_equal(4, copy_query_pool_results.int_stride) - require_equal(0, copy_query_pool_results.int_flags) - - -@gapit_test("vkCmdCopyQueryPoolResults_test") -class FifthToEighthQueryResultsIn64BitWithWaitBitCopyWithZeroOffsets(GapitTest): - - def expect(self): - """2. Expects vkCmdCopyQueryPoolResults() is called with firstQuery: 4, - queryCount: 4, stride: 8 and dstOffset: 0.""" - copy_query_pool_results = require(self.nth_call_of( - "vkCmdCopyQueryPoolResults", 2)) - require_not_equal(0, copy_query_pool_results.int_commandBuffer) - require_not_equal(0, copy_query_pool_results.int_queryPool) - require_equal(4, copy_query_pool_results.int_firstQuery) - require_equal(4, copy_query_pool_results.int_queryCount) - require_not_equal(0, copy_query_pool_results.int_dstBuffer) - require_equal(0, copy_query_pool_results.int_dstOffset) - require_equal(8, copy_query_pool_results.int_stride) - require_equal(VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT, - copy_query_pool_results.int_flags) - - -@gapit_test("vkCmdCopyQueryPoolResults_test") -class AllFourQueryResultsIn32BitAnd12StrideWithPartialAndAvailabilityBitWithZeroOffset(GapitTest): - - def expect(self): - """3. Expects vkCmdCopyQueryPoolResults() is called with firstQuery: 0, - queryCount: 4, stride: 12 and dstOffset: 0.""" - copy_query_pool_results = require(self.nth_call_of( - "vkCmdCopyQueryPoolResults", 3)) - require_not_equal(0, copy_query_pool_results.int_commandBuffer) - require_not_equal(0, copy_query_pool_results.int_queryPool) - require_equal(0, copy_query_pool_results.int_firstQuery) - require_equal(4, copy_query_pool_results.int_queryCount) - require_not_equal(0, copy_query_pool_results.int_dstBuffer) - require_equal(0, copy_query_pool_results.int_dstOffset) - require_equal(12, copy_query_pool_results.int_stride) - require_equal(VK_QUERY_RESULT_PARTIAL_BIT - | VK_QUERY_RESULT_WITH_AVAILABILITY_BIT, - copy_query_pool_results.int_flags) diff --git a/gapid_tests/command_buffer_tests/vkCmdExecuteCommands_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdExecuteCommands_test/CMakeLists.txt deleted file mode 100644 index e114e86c..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdExecuteCommands_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdExecuteCommands_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/vkCmdExecuteCommands_test/README.md b/gapid_tests/command_buffer_tests/vkCmdExecuteCommands_test/README.md deleted file mode 100644 index fc2c4f15..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdExecuteCommands_test/README.md +++ /dev/null @@ -1,87 +0,0 @@ -# vkCmdExecuteCommands - -## Signatures -```c++ -void vkCmdExecuteCommands( - VkCommandBuffer commandBuffer, - uint32_t commandBufferCount, - const VkCommandBuffer* pCommandBuffers); -``` - -According to the Vulkan spec: -- `commandBuffer` is a handle to a **primary** command buffer that the secondary - command buffers are executed in, it **must** be allocated with a `level` of - `VK_COMMAND_BUFFER_LEVEL_PRIMARY` -- Any given element of `pCommandBuffers` **must** have been allocated with a - level of `VK_COMMAND_BUFFER_LEVEL_SECONDARY`, and **must not** be already - pending execution in `commandBuffer`, or appear twice in `pCommandBuffers`, - unless it was recorded with the `VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT` - flag -- Any given element of `pCommandBuffers` **must not** be in the pending - execution in any other `VkCommandBuffer`, unless it was recorded with the - `VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT` -- Any given element of `pCommandBuffers` **must** be in the executable state -- Any given element of `pCommandBuffers` **must** have been allocated from a - `VkCommandPool` that was created for the same queue family as the - `VkCommandPool` from which `commandBuffer` was allocated -- If `vkCmdExecuteCommands` is being called within a render pass instance, any - given element of `pCommandBuffers` **must** have been recorded with the - `VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT` -- If `vkCmdExecuteCommands` is being called within a render pass instance, any - given element of `pCommandBuffers` **must** have been recorded with - `VkCommandBufferInheritanceInfo::subpass` set to the index of the subpass - which the given command buffer will be executed in -- If `vkCmdExecuteCommands` is being called within a render pass instance, any - given element of `pCommandBuffers` **must** have been recorded with a render - pass that is compatible with the current render pass -- If `vkCmdExecuteCommands` is being called within a render pass instance, and - any given element of `pCommandBuffers` was recorded with - `VkCommandBufferInheritanceInfo::framebuffer` not equal to `VK_NULL_HANDLE`, - that `VkFramebuffer` **must** match the `VkFramebuffer` used in the current - render pass instance -- If `vkCmdExecuteCommands` is not being called within a render pass instance, - any given element of `pCommandBuffers` **must not** have been recorded with the - `VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT` -- If the *inherited queries* feature is not enabled, `commandBuffer` **must** - not have any queries *active* -- If `commandBuffer` has a `VK_QUERY_TYPE_OCCLUSION` query active, then each - element of `pCommandBuffers` **must** have been recorded with - `VkCommandBufferInheritanceInfo::occlusionQueryEnable` set to `VK_TRUE` -- If `commandBuffer` has a `VK_QUERY_TYPE_OCCLUSION` query active, then each - element of `pCommandBuffers` **must** have been recorded with - `VkCommandBufferInheritanceInfo::queryFlags` having all bits set that are set - for the query -- If `commandBuffer` has a `VK_QUERY_TYPE_PIPELINE_STATISTICS` query active, - then each element of `pCommandBuffers` **must** have been recorded with - `VkCommandBufferInheritanceInfo::pipelineStatistics` having all bits set that - are set in the `VkQueryPool` the query uses -- Any given element of `pCommandBuffers` **must not** begin any query types that - are active in `commandBuffer` -- The `VkCommandPool` that `commandBuffer` was allocated from **must** support - transfer, graphics, or compute operations -- `commandBufferCount` **must** be greater than 0 -- Both of `commandBuffer`, and the elements of `pCommandBuffers` **must** have - been created, allocated, or retrieved from the same `VkDevice` - -These tests should test the following cases: -- [x] `pCommandBuffers` without `VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT` -- [ ] `pCommandBuffers` with `VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT`, - i.e., used in multiple `VkCommandBuffer` -- [ ] `vkCmdExecuteCommands` called within a render pass, i.e., created with - `VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT` -- [x] `vkCmdExecuteCommands` called out of a render pass -- [x] `commandBuffer` with `VK_QUERY_TYPE_OCCLUSION` query inactive -- [ ] `commandBuffer` with `VK_QUERY_TYPE_OCCLUSION` query active, i.e., each - element of `pCommandBuffers` **must** have been recorded with - `VkCommandBufferInheritanceInfo::queryFlags` having all bits set that are set - for the query -- [ ] `commandBuffer` with `VK_QUERY_TYPE_PIPELINE_STATISTICS` query inactive -- [ ] `commandBuffer` with `VK_QUERY_TYPE_PIPELINE_STATISTICS` query active, - i.e., each element of `pCommandBuffers` **must** have been recorded with - `VKCommandBufferInheritanceInfo::pipelineStatistics` having all bits set that - are set in the `VkQueryPool` the query uses -- [x] `commandBuffer` and all elements of `pCommandBuffers` are allocated from - the same `VkCommandPool` -- [ ] `commandBuffer` and elements of `pCommandBuffers` are allocated from - the different `VkCommandPool`s, but the pools are created from the same queue - family and `VkDevice` diff --git a/gapid_tests/command_buffer_tests/vkCmdExecuteCommands_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdExecuteCommands_test/main.cpp deleted file mode 100644 index fe15f9c9..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdExecuteCommands_test/main.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - vulkan::VkDevice& device = app.device(); - containers::vector pseudo_data(16, 0xba, data->allocator()); - - // Create pipeline layout - // Frist, create descriptor set layout bindings - VkDescriptorSetLayoutBinding vertex_binding{ - 0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT, - nullptr}; - VkDescriptorSetLayoutBinding fragement_binding{ - 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, - nullptr}; - // Second, create descriptor set layout - vulkan::VkDescriptorSetLayout descriptor_set_layout = - vulkan::CreateDescriptorSetLayout(data->allocator(), &device, - {vertex_binding, fragement_binding}); - // Third, create push constant range - VkPushConstantRange ranges[2]{ - {VK_SHADER_STAGE_VERTEX_BIT, 0, uint32_t(pseudo_data.size())}, - {VK_SHADER_STAGE_FRAGMENT_BIT, 0, uint32_t(pseudo_data.size())}}; - // Fourth, Create pipeline layout - VkPipelineLayoutCreateInfo pipeline_create_info{ - VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, nullptr, 0, 1, - &descriptor_set_layout.get_raw_object(), 2, ranges}; - ::VkPipelineLayout raw_pipeline_layout; - device->vkCreatePipelineLayout(device, &pipeline_create_info, nullptr, - &raw_pipeline_layout); - vulkan::VkPipelineLayout pipeline_layout(raw_pipeline_layout, nullptr, - &device); - - { - // 1. Two secondary command buffers allocated by the same pool as the - // primary command buffer and call vkCmdExecuteCommands out of a render - // pass. - vulkan::VkCommandBuffer primary_cmd_buf = app.GetCommandBuffer(); - vulkan::VkCommandBuffer secondary_cmd_bufs[2] = { - app.GetCommandBuffer(VK_COMMAND_BUFFER_LEVEL_SECONDARY), - app.GetCommandBuffer(VK_COMMAND_BUFFER_LEVEL_SECONDARY)}; - ::VkCommandBuffer raw_secondar_cmd_bufs[2] = { - secondary_cmd_bufs[0].get_command_buffer(), - secondary_cmd_bufs[1].get_command_buffer()}; - VkCommandBufferBeginInfo primary_begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType - nullptr, // pNext - 0, // flags - nullptr, // pInheritanceInfo - }; - VkCommandBufferInheritanceInfo secondary_inherit_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, // sType - nullptr, // pNext - VK_NULL_HANDLE, // renderPass - 0, // subpass - VK_NULL_HANDLE, // framebuffer - VK_FALSE, // occlusionQueryEnable - 0, // queryFlags - 0, // pipelineStatistics - }; - VkCommandBufferBeginInfo secondary_begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType - nullptr, // pNext - 0, // flags - &secondary_inherit_info, // pInheritanceInfo - }; - // Call vkCmdPushConstants on the secondary command buffers. - // First secondary command buffer - secondary_cmd_bufs[0]->vkBeginCommandBuffer(secondary_cmd_bufs[0], - &secondary_begin_info); - secondary_cmd_bufs[0]->vkCmdPushConstants( - secondary_cmd_bufs[0], pipeline_layout, VK_SHADER_STAGE_VERTEX_BIT, 0, - pseudo_data.size(), static_cast(pseudo_data.data())); - secondary_cmd_bufs[0]->vkEndCommandBuffer(secondary_cmd_bufs[0]); - // Second secondary command buffer - secondary_cmd_bufs[1]->vkBeginCommandBuffer(secondary_cmd_bufs[1], - &secondary_begin_info); - secondary_cmd_bufs[1]->vkCmdPushConstants( - secondary_cmd_bufs[1], pipeline_layout, VK_SHADER_STAGE_FRAGMENT_BIT, 0, - pseudo_data.size(), static_cast(pseudo_data.data())); - secondary_cmd_bufs[1]->vkEndCommandBuffer(secondary_cmd_bufs[1]); - // Call vkCmdExecuteCommands on the primary command buffer. - primary_cmd_buf->vkBeginCommandBuffer(primary_cmd_buf, &primary_begin_info); - primary_cmd_buf->vkCmdExecuteCommands(primary_cmd_buf, 2, - raw_secondar_cmd_bufs); - primary_cmd_buf->vkEndCommandBuffer(primary_cmd_buf); - // Submit the primary command buffer. - ::VkCommandBuffer raw_primary_cmd_buf = - primary_cmd_buf.get_command_buffer(); - VkSubmitInfo submit{ - VK_STRUCTURE_TYPE_SUBMIT_INFO, nullptr, 0, nullptr, nullptr, 1, - &raw_primary_cmd_buf, 0, nullptr}; - LOG_ASSERT( - ==, data->logger(), - app.render_queue()->vkQueueSubmit(app.render_queue(), 1, &submit, - static_cast(VK_NULL_HANDLE)), - VK_SUCCESS); - LOG_ASSERT(==, data->logger(), - app.render_queue()->vkQueueWaitIdle(app.render_queue()), - VK_SUCCESS); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdExecuteCommands_test/vkCmdExecuteCommands.py b/gapid_tests/command_buffer_tests/vkCmdExecuteCommands_test/vkCmdExecuteCommands.py deleted file mode 100644 index c3766c66..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdExecuteCommands_test/vkCmdExecuteCommands.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, GapitTest -from gapit_test_framework import require, require_equal, require_not_equal - - -@gapit_test("vkCmdExecuteCommands_test") -class TwoSecondaryCommandBuffersInSameCommandPoolOutOfRenderPass(GapitTest): - - def expect(self): - """Check the arguments to vkCmdExecuteCommands""" - execute_commands = require(self.nth_call_of("vkCmdExecuteCommands", 1)) - - require_not_equal(0, execute_commands.int_commandBuffer) - require_equal(2, execute_commands.int_commandBufferCount) - require_not_equal(0, execute_commands.hex_pCommandBuffers) diff --git a/gapid_tests/command_buffer_tests/vkCmdFillBuffer_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdFillBuffer_test/CMakeLists.txt deleted file mode 100644 index c4576ab2..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdFillBuffer_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdFillBuffer_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/vkCmdFillBuffer_test/README.md b/gapid_tests/command_buffer_tests/vkCmdFillBuffer_test/README.md deleted file mode 100644 index f1bcf844..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdFillBuffer_test/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# vkCmdFillBuffer - -## Signatures -```c++ -void vkCmdFillBuffer( - VkCommandBuffer commandBuffer, - VkBuffer dstBuffer, - VkDeviceSize dstOffset, - VkDeviceSize size, - uint32_t data); -``` - -According to the Vulkan spec: -- `vkCmdFillBuffer` is treated as "transfer" operation for the purposes of - synchronization barriers. The `VK_BUFFER_USAGE_TRANSFER_DST_BIT` **must** be - specified in `usage` of `VkBufferCreateInfo` in order for the buffer to be - compatible with `vkCmdFillBuffer` -- `vkCmdFillBuffer` **must** only be called outside of a render pass instance -- `dstOffset` **must** be less than the size of `dstBuffer` -- `dstOffset` **must** be a multiple of 4 -- `size` is the number of bytes to fill -- If `size` is not equal to `VK_WHOLE_SIZE`, `size` **must** be greater than 0 - , **must** be less than or equal to the size of `dstBuffer` minus - `dstOffset`, and **must** be a multiple of 4 -- `dstBuffer` **must** have been created with `VK_BUFFER_USAGE_TRANSFER_DST_BIT` - usage flag -- If `dstBuffer` is non-sparse then it **must** be bound completely and - contiguously to a single `VkDeviceMemory` object - -These tests should test the following cases: -- [x] `dstOffset` of value 0 -- [x] `dstOffset` of value other than 0 -- [x] `size` of value VK_WHOLE_SIZE -- [x] `size` of value other than VK_WHOLE_SIZE diff --git a/gapid_tests/command_buffer_tests/vkCmdFillBuffer_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdFillBuffer_test/main.cpp deleted file mode 100644 index 9a7132d3..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdFillBuffer_test/main.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/vulkan_application.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication application(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - { - // Fill a buffer first with data: 0x12345678, size: VK_WHOLE_SIZE and - // offset: 0, then fill it again with data: 0xabcdabcd, size: 256 and - // offset: 128. - const size_t buffer_size = 1024; - const uint32_t first_fill_uint = 0x12345678; - VkBufferCreateInfo create_info = { - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // createFlags - buffer_size, // size - VK_BUFFER_USAGE_TRANSFER_DST_BIT | - VK_BUFFER_USAGE_TRANSFER_SRC_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr // pQueueFamilyIndices - }; - // Create a buffer as the destination buffer for vkCmdFillBuffer - vulkan::BufferPointer buffer = - application.CreateAndBindHostBuffer(&create_info); - - vulkan::VkCommandBuffer cmd_buf = application.GetCommandBuffer(); - - // Fill the buffer first time. - VkCommandBufferBeginInfo begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr, 0, nullptr}; - cmd_buf->vkBeginCommandBuffer(cmd_buf, &begin_info); - cmd_buf->vkCmdFillBuffer(cmd_buf, // commandBuffer - *buffer, // dstBuffer - 0, // dstOffset - VK_WHOLE_SIZE, // size - first_fill_uint // pData - ); - - VkBufferMemoryBarrier dst_to_src_barrier{ - VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, // sType - nullptr, // pNext - VK_ACCESS_TRANSFER_WRITE_BIT, // srcAccessMask - VK_ACCESS_TRANSFER_READ_BIT, // dstAccessMask - VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex - VK_QUEUE_FAMILY_IGNORED, // dstQueueFamilyIndex - *buffer, // buffer - 0, // offset - buffer_size, // size - }; - cmd_buf->vkCmdPipelineBarrier( - cmd_buf, // commandBuffer - VK_PIPELINE_STAGE_HOST_BIT, // srcStageMask - VK_PIPELINE_STAGE_TRANSFER_BIT, // dstStageMask - 0, // dependencyFlags - 0, // memoryBarrierCount - nullptr, // pMemoryBarriers - 1, // bufferMemoryBarrierCount - &dst_to_src_barrier, // pBufferMemoryBarriers - 0, // imageMemoryBarrierCount - nullptr // pImageMemoryBarriers - ); - - cmd_buf->vkEndCommandBuffer(cmd_buf); - VkCommandBuffer raw_cmd_buf = cmd_buf.get_command_buffer(); - VkSubmitInfo submit{VK_STRUCTURE_TYPE_SUBMIT_INFO, - nullptr, - 0, - nullptr, - nullptr, - 1, - &raw_cmd_buf, - 0, - nullptr}; - application.render_queue()->vkQueueSubmit( - application.render_queue(), 1, &submit, - static_cast(VK_NULL_HANDLE)); - application.render_queue()->vkQueueWaitIdle(application.render_queue()); - - // Check the result of the first buffer fill. - buffer->invalidate(); - uint32_t* data_ptr = reinterpret_cast(buffer->base_address()); - std::for_each(data_ptr, data_ptr + buffer_size / sizeof(uint32_t), - [&data, first_fill_uint](uint32_t d) { - LOG_ASSERT(==, data->logger(), d, first_fill_uint); - }); - - // Fill the buffer second time - const size_t fill_offset = 128; - const size_t fill_size = 256; - const uint32_t second_fill_uint = 0xabcdabcd; - cmd_buf->vkBeginCommandBuffer(cmd_buf, &begin_info); - cmd_buf->vkCmdFillBuffer(cmd_buf, // commandBuffer - *buffer, // dstBuffer - fill_offset, // dstOffset - fill_size, // size - second_fill_uint // pData - ); - cmd_buf->vkCmdPipelineBarrier( - cmd_buf, // commandBuffer - VK_PIPELINE_STAGE_HOST_BIT, // srcStageMask - VK_PIPELINE_STAGE_TRANSFER_BIT, // dstStageMask - 0, // dependencyFlags - 0, // memoryBarrierCount - nullptr, // pMemoryBarriers - 1, // bufferMemoryBarrierCount - &dst_to_src_barrier, // pBufferMemoryBarriers - 0, // imageMemoryBarrierCount - nullptr // pImageMemoryBarriers - ); - cmd_buf->vkEndCommandBuffer(cmd_buf); - application.render_queue()->vkQueueSubmit( - application.render_queue(), 1, &submit, - static_cast(VK_NULL_HANDLE)); - application.render_queue()->vkQueueWaitIdle(application.render_queue()); - - // Check the result of the second buffer fill - buffer->invalidate(); - size_t counter = 0; - std::for_each( - data_ptr, data_ptr + buffer_size / sizeof(uint32_t), - [&data, &counter, first_fill_uint, second_fill_uint, fill_offset, - fill_size](uint32_t d) { - if (counter >= fill_offset / sizeof(uint32_t) && - counter < (fill_offset + fill_size) / sizeof(uint32_t)) { - LOG_ASSERT(==, data->logger(), d, second_fill_uint); - } else { - LOG_ASSERT(==, data->logger(), d, first_fill_uint); - } - counter++; - }); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdFillBuffer_test/vkCmdFillBuffer_test.py b/gapid_tests/command_buffer_tests/vkCmdFillBuffer_test/vkCmdFillBuffer_test.py deleted file mode 100644 index 2fd2a5e3..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdFillBuffer_test/vkCmdFillBuffer_test.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -import gapit_test_framework -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY, DEVICE_SIZE, INT32_T -from vulkan_constants import * - - -@gapit_test("vkCmdFillBuffer_test") -class FillBufferWithWholeSizeAndZeroOffset(GapitTest): - - def expect(self): - """Check the arguments to vkCmdFillBuffer""" - fill_buffer = require( - self.nth_call_of("vkCmdFillBuffer", 1)) - - require_not_equal(0, fill_buffer.int_commandBuffer) - require_not_equal(0, fill_buffer.int_dstBuffer) - require_equal(0, fill_buffer.int_dstOffset) - require_equal(VK_WHOLE_SIZE, fill_buffer.int_size) - require_equal(0x12345678, fill_buffer.int_data) - - -@gapit_test("vkCmdFillBuffer_test") -class FillBufferWithNonWholeSizeAndNonZeroOffset(GapitTest): - - def expect(self): - """Check the arguments to vkCmdFillBuffer""" - fill_buffer = require( - self.nth_call_of("vkCmdFillBuffer", 2)) - - require_not_equal(0, fill_buffer.int_commandBuffer) - require_not_equal(0, fill_buffer.int_dstBuffer) - require_equal(128, fill_buffer.int_dstOffset) - require_equal(256, fill_buffer.int_size) - require_equal(0xabcdabcd, fill_buffer.int_data) diff --git a/gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/CMakeLists.txt deleted file mode 100644 index b9c4bfce..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_shader_library(subpass_shader - SOURCES - only_red_channel.frag - hardcode_full_screen_quad.vert -) - -add_gapid_test(vkCmdNextSubpass_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library - subpass_shader -) - diff --git a/gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/README.md b/gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/README.md deleted file mode 100644 index 4e14c289..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# vkCmdNextSubpass - -## Signatures -```c++ -void vkCmdNextSubpass( - VkCommandBuffer commandBuffer, - VkSubpassContents contents); -``` - -According to the Vulkan spec: -- The subpass index for a render pass begins at zero when `vkCmdBeginRenderPass` - is recorded, and increments each time `vkCmdNextSubpass` is recorded. -- Moving to the next subpass automatically performs any multisample resolve - operations in the subpass being ended. End-of-subpass multisample resolves - are treated as color attachment writes for the purposes of synchronization. -- The current subpass index **must** be less than the number of subpasses in - the render pass minus one -- This command **must** only be called inside of a render pass instance - -These tests should test the following cases: -- [x] `content` of value `VK_SUBPASS_CONTENTS_INLINE` -- [ ] `content` of value `VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS` diff --git a/gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/hardcode_full_screen_quad.vert b/gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/hardcode_full_screen_quad.vert deleted file mode 100644 index 6c455130..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/hardcode_full_screen_quad.vert +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#version 450 - -vec2 plane[6] = vec2[]( - vec2(-1.0, -1.0), - vec2(-1.0, 1.0), - vec2(1.0, 1.0), - - vec2(1.0, 1.0), - vec2(1.0,-1.0), - vec2(-1.0, -1.0) -); - -void main() { - gl_Position = vec4(plane[gl_VertexIndex], 0.0, 1.0); -} diff --git a/gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/main.cpp deleted file mode 100644 index 9581ffe0..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/main.cpp +++ /dev/null @@ -1,434 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -uint32_t render_frag_shader[] = -#include "simple_fragment.frag.spv" - ; - -uint32_t render_vert_shader[] = -#include "simple_vertex.vert.spv" - ; - -uint32_t input_attachment_vert_shader[] = -#include "hardcode_full_screen_quad.vert.spv" - ; - -uint32_t input_attachment_frag_shader[] = -#include "only_red_channel.frag.spv" - ; - -namespace { -// Geometry data of the triangle to be drawn -const float kVertices[] = { - -0.5, -0.5, 0.5, // point 1 - 0.0, 0.5, 1.0, // point 2 - 0.5, -0.5, 0.0, // point 3 -}; -const vulkan::VulkanGraphicsPipeline::InputStream kVerticesStream{ - 0, // binding - VK_FORMAT_R32G32B32_SFLOAT, // format - 0, // offset -}; - -const float kUV[] = { - 0.0, 0.0, // point 1 - 1.0, 0.0, // point 2 - 0.0, 1.0, // point 3 -}; -const vulkan::VulkanGraphicsPipeline::InputStream kUVStream{ - 1, // binding - VK_FORMAT_R32G32_SFLOAT, // format - 0, // offset -}; - -const VkCommandBufferBeginInfo kCommandBufferBeginInfo{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, - nullptr, - VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, - nullptr, -}; - -const VkSampleCountFlagBits kSampleCountBit = VK_SAMPLE_COUNT_1_BIT; - -// A helper function that change the layout of the given image. -void EnqueueImageLayoutTransition( - ::VkImage img, VkImageAspectFlags aspect, VkImageLayout old_layout, - VkImageLayout new_layout, VkAccessFlags src_access_mask, - VkAccessFlags dst_access_mask, VkPipelineStageFlags src_stage, - VkPipelineStageFlags dst_stage, vulkan::VkCommandBuffer* cmd_buf_ptr) { - if (!cmd_buf_ptr) return; - auto& cmd_buf = *cmd_buf_ptr; - VkImageMemoryBarrier barrier = { - VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // sType - nullptr, // pNext - src_access_mask, // srcAccessMask - dst_access_mask, // dstAccessMask - old_layout, // oldLayout - new_layout, // newLayout - VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex - VK_QUEUE_FAMILY_IGNORED, // dstQueueFamilyIndex - img, // image - {aspect, 0, 1, 0, 1}}; - cmd_buf->vkCmdPipelineBarrier(cmd_buf, src_stage, dst_stage, 0, 0, nullptr, 0, - nullptr, 1, &barrier); -} -} // anonymous namespace - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions() - .SetHostBufferSize(1024 * 1024) - .SetDeviceImageSize(1024 * 1024 * 100)); - vulkan::VkDevice& device = app.device(); - - auto fence = vulkan::CreateFence(&app.device(), false); - uint32_t image_index = 0; - app.device()->vkAcquireNextImageKHR(app.device(), app.swapchain(), - 0xFFFFFFFFFFFFFFFF, VkSemaphore(0), fence, - &image_index); - app.device()->vkWaitForFences(app.device(), 1, &fence.get_raw_object(), - VK_TRUE, 0xFFFFFFFFFFFFFFFF); - - // Create vertex buffers and index buffer - auto vertices_buf = app.CreateAndBindDefaultExclusiveHostBuffer( - sizeof(kVertices), - VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT); - auto uv_buf = app.CreateAndBindDefaultExclusiveHostBuffer( - sizeof(kUV), - VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT); - const ::VkBuffer vertex_buffers[2] = {*vertices_buf, *uv_buf}; - const ::VkDeviceSize vertex_buffer_offsets[2] = {0, 0}; - - // Create subpasses and render pass. - VkAttachmentReference swapchain_image_attachment = { - 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - VkAttachmentReference write_intermediate_image_attachment = { - 1, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - VkAttachmentReference read_intermediate_image_attachment = { - 1, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL}; - vulkan::VkRenderPass render_pass = app.CreateRenderPass( - { - { - 0, // flags - app.swapchain().format(), // format - kSampleCountBit, // samples - VK_ATTACHMENT_LOAD_OP_CLEAR, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_UNDEFINED, // initialLayout - VK_IMAGE_LAYOUT_PRESENT_SRC_KHR // finalLayout - }, - { - 0, // flags - app.swapchain().format(), // format - kSampleCountBit, // samples - VK_ATTACHMENT_LOAD_OP_CLEAR, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_UNDEFINED, // initialLayout - VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL // finalLayout - }, - }, // AttachmentDescriptions - { - { - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &write_intermediate_image_attachment, // colorAttachment - nullptr, // pResolveAttachments - nullptr, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }, - { - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 1, // inputAttachmentCount - &read_intermediate_image_attachment, // pInputAttachments - 1, // colorAttachmentCount - &swapchain_image_attachment, // colorAttachment - nullptr, // pResolveAttachments - nullptr, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }, - }, - { - { - 0, // srcSubpass - 1, // dstSubpass - VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, // srcStageMask - VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, // dstStageMask - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, // srcAccessMask - VK_ACCESS_SHADER_READ_BIT, // dstAccessMask - 0, // flags - }, - { - 1, // srcSubpass - VK_SUBPASS_EXTERNAL, // dstSubpass - VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, // srcStageMask - VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, // dstStageMask - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, // srcAccessMask - VK_ACCESS_MEMORY_READ_BIT, // dstAccessMask - 0, // flags - }, - } // SubpassDependencies - ); - - // Create pipeline for the first subpass - vulkan::PipelineLayout first_subpass_pipeline_layout( - app.CreatePipelineLayout({{}})); - vulkan::VulkanGraphicsPipeline first_subpass_pipeline = - app.CreateGraphicsPipeline(&first_subpass_pipeline_layout, &render_pass, - 0); - first_subpass_pipeline.AddShader(VK_SHADER_STAGE_VERTEX_BIT, "main", - render_vert_shader); - first_subpass_pipeline.AddShader(VK_SHADER_STAGE_FRAGMENT_BIT, "main", - render_frag_shader); - first_subpass_pipeline.SetTopology(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST); - first_subpass_pipeline.AddInputStream( - sizeof(float) * 3, VK_VERTEX_INPUT_RATE_VERTEX, {kVerticesStream}); - first_subpass_pipeline.AddInputStream( - sizeof(float) * 2, VK_VERTEX_INPUT_RATE_VERTEX, {kUVStream}); - first_subpass_pipeline.SetScissor( - {{ - 0, // offset.x - 0, // offset.y - }, - { - app.swapchain().width(), // extent.width - app.swapchain().height() // extent.height - }}); - first_subpass_pipeline.SetViewport({ - 0.0f, // x - 0.0f, // y - static_cast(app.swapchain().width()), // width - static_cast(app.swapchain().height()), // height - 0.0f, // minDepth - 1.0f, // maxDepth - }); - first_subpass_pipeline.SetSamples(kSampleCountBit); - first_subpass_pipeline.AddAttachment(); - first_subpass_pipeline.Commit(); - - // Create pipeline for the second subpass - VkDescriptorSetLayoutBinding second_subpass_descriptor_set_binding{ - 0, VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, 1, VK_SHADER_STAGE_FRAGMENT_BIT, - nullptr}; - vulkan::PipelineLayout second_subpass_pipeline_layout( - app.CreatePipelineLayout({{second_subpass_descriptor_set_binding}})); - vulkan::VulkanGraphicsPipeline second_subpass_pipeline = - app.CreateGraphicsPipeline(&second_subpass_pipeline_layout, &render_pass, - 1); - second_subpass_pipeline.AddShader(VK_SHADER_STAGE_VERTEX_BIT, "main", - input_attachment_vert_shader); - second_subpass_pipeline.AddShader(VK_SHADER_STAGE_FRAGMENT_BIT, "main", - input_attachment_frag_shader); - second_subpass_pipeline.SetTopology(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST); - second_subpass_pipeline.SetScissor( - {{ - 0, // offset.x - 0, // offset.y - }, - { - app.swapchain().width(), // extent.width - app.swapchain().height() // extent.height - }}); - second_subpass_pipeline.SetViewport({ - 0.0f, // x - 0.0f, // y - static_cast(app.swapchain().width()), // width - static_cast(app.swapchain().height()), // height - 0.0f, // minDepth - 1.0f, // maxDepth - }); - second_subpass_pipeline.SetSamples(kSampleCountBit); - second_subpass_pipeline.AddAttachment(); - second_subpass_pipeline.Commit(); - - // Create image view for the swapchain image - VkImageViewCreateInfo swapchain_image_view_create_info{ - VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - app.swapchain_images()[image_index], // image - VK_IMAGE_VIEW_TYPE_2D, // viewType - app.swapchain().format(), // format - { - VK_COMPONENT_SWIZZLE_IDENTITY, // components.r - VK_COMPONENT_SWIZZLE_IDENTITY, // components.g - VK_COMPONENT_SWIZZLE_IDENTITY, // components.b - VK_COMPONENT_SWIZZLE_IDENTITY, // components.a - }, - { - VK_IMAGE_ASPECT_COLOR_BIT, // subresourceRange.aspectMask - 0, // subresourceRange.baseMipLevel - 1, // subresourceRange.levelCount - 0, // subresourceRange.baseArrayLayer - 1, // subresourceRange.layerCount - }, - }; - ::VkImageView raw_swapchain_image_view; - LOG_ASSERT(==, data->logger(), - app.device()->vkCreateImageView( - app.device(), &swapchain_image_view_create_info, nullptr, - &raw_swapchain_image_view), - VK_SUCCESS); - vulkan::VkImageView swapchain_image_view(raw_swapchain_image_view, nullptr, - &app.device()); - - // Create image and view for the input attachment image - VkImageCreateInfo intermediate_image_create_info{ - VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - nullptr, - 0, - VK_IMAGE_TYPE_2D, - app.swapchain().format(), - {app.swapchain().width(), app.swapchain().height(), - app.swapchain().depth()}, - 1, - 1, - kSampleCountBit, - VK_IMAGE_TILING_OPTIMAL, - VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT, - VK_SHARING_MODE_EXCLUSIVE, - 0, - nullptr, - VK_IMAGE_LAYOUT_UNDEFINED}; - vulkan::ImagePointer intermediate_image = - app.CreateAndBindImage(&intermediate_image_create_info); - VkImageViewCreateInfo intermediate_image_view_create_info = - swapchain_image_view_create_info; - intermediate_image_view_create_info.image = *intermediate_image; - ::VkImageView raw_intermediate_image_view; - LOG_ASSERT(==, data->logger(), - app.device()->vkCreateImageView( - app.device(), &intermediate_image_view_create_info, nullptr, - &raw_intermediate_image_view), - VK_SUCCESS); - vulkan::VkImageView intermediate_image_view(raw_intermediate_image_view, - nullptr, &app.device()); - - // Create framebuffer - ::VkImageView attachments[2] = {raw_swapchain_image_view, - raw_intermediate_image_view}; - VkFramebufferCreateInfo framebuffer_create_info{ - VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - render_pass, // renderPass - 2, // attachmentCount - attachments, // attachments - app.swapchain().width(), // width - app.swapchain().height(), // height - 1 // layers - }; - ::VkFramebuffer raw_framebuffer; - app.device()->vkCreateFramebuffer(app.device(), &framebuffer_create_info, - nullptr, &raw_framebuffer); - vulkan::VkFramebuffer framebuffer(raw_framebuffer, nullptr, &app.device()); - - // Create render pass begin info - VkClearValue clear_values[4]{{0}, {0}, {0}, {0}}; - VkRenderPassBeginInfo pass_begin{ - VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, // sType - nullptr, // pNext - render_pass, // renderPass - framebuffer, // framebuffer - {{0, 0}, - {app.swapchain().width(), app.swapchain().height()}}, // renderArea - 2, // clearValueCount - clear_values // clears - }; - - // Create descriptor for reading input attachment - vulkan::DescriptorSet intermediate_image_descriptor_set = - app.AllocateDescriptorSet({second_subpass_descriptor_set_binding}); - VkDescriptorImageInfo intermediate_image_info{ - VK_NULL_HANDLE, raw_intermediate_image_view, - VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL}; - VkWriteDescriptorSet write_descriptor_set{ - VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, // sType - nullptr, // pNext - intermediate_image_descriptor_set, // dstSet - 0, // dstBinding - 0, // dstArrayElement - 1, // descriptorType - VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, // descriptorType - &intermediate_image_info, // pImageInfo - nullptr, // pBufferInfo - nullptr, // pTexelBufferView - }; - app.device()->vkUpdateDescriptorSets(app.device(), 1, &write_descriptor_set, - 0, nullptr); - - // Draw - auto cmd_buf = app.GetCommandBuffer(); - cmd_buf->vkBeginCommandBuffer(cmd_buf, &kCommandBufferBeginInfo); - app.FillHostVisibleBuffer( - &*vertices_buf, reinterpret_cast(kVertices), - sizeof(kVertices), 0, &cmd_buf, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT); - app.FillHostVisibleBuffer( - &*uv_buf, reinterpret_cast(kUV), sizeof(kUV), 0, &cmd_buf, - VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT); - - // First subpass - cmd_buf->vkCmdBeginRenderPass(cmd_buf, &pass_begin, - VK_SUBPASS_CONTENTS_INLINE); - cmd_buf->vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_GRAPHICS, - first_subpass_pipeline); - cmd_buf->vkCmdBindVertexBuffers(cmd_buf, 0, 2, vertex_buffers, - vertex_buffer_offsets); - cmd_buf->vkCmdDraw(cmd_buf, 3, 1, 0, 0); - - // Second subpass - cmd_buf->vkCmdNextSubpass(cmd_buf, VK_SUBPASS_CONTENTS_INLINE); - cmd_buf->vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_GRAPHICS, - second_subpass_pipeline); - cmd_buf->vkCmdBindDescriptorSets( - cmd_buf, VK_PIPELINE_BIND_POINT_GRAPHICS, second_subpass_pipeline_layout, - 0, 1, &intermediate_image_descriptor_set.raw_set(), 0, nullptr); - cmd_buf->vkCmdDraw(cmd_buf, 6, 1, 0, 0); - - cmd_buf->vkCmdEndRenderPass(cmd_buf); - - app.EndAndSubmitCommandBufferAndWaitForQueueIdle(&cmd_buf, - &app.render_queue()); - - VkPresentInfoKHR present_info{ - VK_STRUCTURE_TYPE_PRESENT_INFO_KHR, nullptr, 0, nullptr, 1, - &app.swapchain().get_raw_object(), &image_index, nullptr}; - app.present_queue()->vkQueuePresentKHR(app.present_queue(), &present_info); - app.device()->vkDeviceWaitIdle(app.device()); - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/only_red_channel.frag b/gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/only_red_channel.frag deleted file mode 100644 index c60a0258..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/only_red_channel.frag +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#version 450 - -layout(location = 0) out vec4 out_color; - -layout(input_attachment_index = 0, set = 0, binding = 0) uniform subpassInput input_img; - -void main() { - vec3 f = subpassLoad(input_img).rgb; - out_color = vec4(f.r, 0.0, 0.0, 1.0); -} diff --git a/gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/vkCmdNextSubpass_test.py b/gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/vkCmdNextSubpass_test.py deleted file mode 100644 index 5b594183..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdNextSubpass_test/vkCmdNextSubpass_test.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, GapitTest -from gapit_test_framework import require, require_equal, require_not_equal -from vulkan_constants import * - - -@gapit_test("vkCmdNextSubpass_test") -class vkCmdNextSubpass(GapitTest): - - def expect(self): - next_subpass = require(self.next_call_of("vkCmdNextSubpass")) - - require_not_equal(0, next_subpass.int_commandBuffer) - require_equal(VK_SUBPASS_CONTENTS_INLINE, next_subpass.int_contents) diff --git a/gapid_tests/command_buffer_tests/vkCmdPushConstants_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdPushConstants_test/CMakeLists.txt deleted file mode 100644 index 51e7cea7..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdPushConstants_test/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdPushConstants_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) diff --git a/gapid_tests/command_buffer_tests/vkCmdPushConstants_test/README.md b/gapid_tests/command_buffer_tests/vkCmdPushConstants_test/README.md deleted file mode 100644 index ca67e20e..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdPushConstants_test/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# vkCmdPushConstants - -## Signatures -```c++ -void vkCmdPushConstants( - VkCommandBuffer commandBuffer, - VkPipelineLayout layout, - VkShaderStageFlags stageFlags, - uint32_t offset, - uint32_t size, - const void* pValues); -``` - -According to the Vulkan spec: -- `commandBuffer` **must** be a valid `VkCommandBuffer` handle in recording - state -- `stageFlags` **must** be valid combination of `VkShaderStageFlagBits` values - and **must not** be 0 -- `pValues` **must** be a pointer to an array of `size` bytes -- `size` **must** be greater than 0 and **must** be a multiple of 4 -- `offset` **must** be a multiple of 4 and **must** be less than - `VkPhysicalDeviceLimits::maxPushConstantsSize` -- `stageFlags` **must** match exactly the shader stages used in `layout` for the - range specified by `offset` and `size` -- Both of `commandBuffer`, and `layout` **must** have been created, allocated - or retrieved from the same `VkDevice` - -These tests should test the following cases: -- [x] `offset` of value 0 -- [ ] `offset` of value non-zero -- [x] `stageFlags` of value `VK_SHADER_STAGE_VERTEX_BIT` -- [ ] `stageFlags` of value `VK_SHADER_STAGE_ALL` diff --git a/gapid_tests/command_buffer_tests/vkCmdPushConstants_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdPushConstants_test/main.cpp deleted file mode 100644 index bb77d689..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdPushConstants_test/main.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - vulkan::VkDevice& device = app.device(); - VkDescriptorSetLayoutBinding binding{0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, - VK_SHADER_STAGE_VERTEX_BIT, nullptr}; - vulkan::VkDescriptorSetLayout descriptor_set_layout = - vulkan::CreateDescriptorSetLayout(data->allocator(), &device, {binding}); - - // The size of the data must be a multiple of 4 - containers::vector constants(100, 0xab, data->allocator()); - - VkPushConstantRange range{VK_SHADER_STAGE_VERTEX_BIT, 0, - uint32_t(constants.size())}; - VkPipelineLayoutCreateInfo pipeline_create_info{ - VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, nullptr, 0, 1, - &descriptor_set_layout.get_raw_object(), 1, &range}; - ::VkPipelineLayout raw_pipeline_layout; - device->vkCreatePipelineLayout(device, &pipeline_create_info, nullptr, - &raw_pipeline_layout); - vulkan::VkPipelineLayout pipeline_layout(raw_pipeline_layout, nullptr, - &device); - { - // 1. Offset of value 0, push to vertex stage. - vulkan::VkCommandBuffer cmd_buf = app.GetCommandBuffer(); - ::VkCommandBuffer raw_cmd_buf = cmd_buf.get_command_buffer(); - ::VkPipelineLayout raw_pipeline_layout = - static_cast<::VkPipelineLayout>(pipeline_layout); - VkCommandBufferBeginInfo command_buffer_begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType - nullptr, // pNext - 0, // flags - nullptr, // pInheritanceInfo - }; - cmd_buf->vkBeginCommandBuffer(cmd_buf, &command_buffer_begin_info); - cmd_buf->vkCmdPushConstants(cmd_buf, raw_pipeline_layout, - VK_SHADER_STAGE_VERTEX_BIT, 0, constants.size(), - static_cast(constants.data())); - cmd_buf->vkEndCommandBuffer(cmd_buf); - VkSubmitInfo submit{VK_STRUCTURE_TYPE_SUBMIT_INFO, - nullptr, - 0, - nullptr, - nullptr, - 1, - &raw_cmd_buf, - 0, - nullptr}; - - app.render_queue()->vkQueueSubmit(app.render_queue(), 1, &submit, - static_cast(VK_NULL_HANDLE)); - app.render_queue()->vkQueueWaitIdle(app.render_queue()); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdPushConstants_test/vkCmdPushConstants.py b/gapid_tests/command_buffer_tests/vkCmdPushConstants_test/vkCmdPushConstants.py deleted file mode 100644 index 70d0e8a6..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdPushConstants_test/vkCmdPushConstants.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, GapitTest -from gapit_test_framework import require, require_equal, require_not_equal -from gapit_test_framework import get_read_offset_function -from vulkan_constants import VK_SHADER_STAGE_VERTEX_BIT -from struct_offsets import VulkanStruct, ARRAY, CHAR - - -@gapit_test("vkCmdPushConstants_test") -class PushConstantsWithOffsetZeroToVertexStage(GapitTest): - - def expect(self): - """Check the arguments and data to vkCmdPushConstants""" - architecture = self.architecture - push_constants = require(self.nth_call_of("vkCmdPushConstants", 1)) - - require_not_equal(0, push_constants.int_commandBuffer) - require_not_equal(0, push_constants.int_layout) - require_equal(VK_SHADER_STAGE_VERTEX_BIT, push_constants.int_stageFlags) - require_equal(0, push_constants.int_offset) - require_equal(100, push_constants.int_size) - require_not_equal(0, push_constants.hex_pValues) - - CHAR_ARRAY_100 = [("values", ARRAY, 100, CHAR)] - data = VulkanStruct(architecture, CHAR_ARRAY_100, - get_read_offset_function( - push_constants, push_constants.hex_pValues)) - expected_data = [0xab for i in range(100)] - require_equal(expected_data, data.values) diff --git a/gapid_tests/command_buffer_tests/vkCmdResetQueryPool_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdResetQueryPool_test/CMakeLists.txt deleted file mode 100644 index e230224c..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdResetQueryPool_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdResetQueryPool_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/vkCmdResetQueryPool_test/README.md b/gapid_tests/command_buffer_tests/vkCmdResetQueryPool_test/README.md deleted file mode 100644 index 6bd52882..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdResetQueryPool_test/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# vkCmdResetQueryPool - -## Signatures -```c++ -void vkCmdResetQueryPool( - VkCommandBuffer commandBuffer, - VkQueryPool queryPool, - uint32_t firstQuery, - uint32_t queryCount); -``` - -According to the Vulkan spec: -- `firstQuery` **must** be less than the number of queries in `queryPool` -- The sum of `firstQuery` and `queryCount` **must** be less than or equal to - the number of queries in `queryPool` -- `vkCmdResetQueryPool` **must** only be called outside of a render pass - instance -- The `VkCommandPool` that `commandBuffer` was allocated from **must** support - graphics, or compute operations - -These tests should test the following cases: -- [x] `firstQuery` of value 0 -- [x] `firstQuery` of value other than 0 -- [x] `queryCount` of value 1 -- [x] `queryCount` of value other than 1 diff --git a/gapid_tests/command_buffer_tests/vkCmdResetQueryPool_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdResetQueryPool_test/main.cpp deleted file mode 100644 index cff9f674..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdResetQueryPool_test/main.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - vulkan::VkDevice& device = app.device(); - { - // Creates one query pool with 4 queries, another one with 7 queries, then - // resets the first pool with firstQuery: 0, queryCount: 4, resets the - // second pool with firstQuery: 1, queryCount: 5 - vulkan::VkQueryPool four_queries_pool = vulkan::CreateQueryPool( - &device, - { - VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_QUERY_TYPE_OCCLUSION, // queryType - 4, // queryCount - 0, // pipelineStatistics - }); - vulkan::VkQueryPool seven_queries_pool = vulkan::CreateQueryPool( - &device, - { - VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_QUERY_TYPE_OCCLUSION, // queryType - 7, // queryCount - 0, // pipelineStatistics - }); - - // Get command buffer and call the vkCmdResetQueryPool command - vulkan::VkCommandBuffer cmd_buf = app.GetCommandBuffer(); - ::VkCommandBuffer raw_cmd_buf = cmd_buf.get_command_buffer(); - VkCommandBufferBeginInfo cmd_buf_begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr, 0, nullptr}; - cmd_buf->vkBeginCommandBuffer(cmd_buf, &cmd_buf_begin_info); - cmd_buf->vkCmdResetQueryPool(cmd_buf, // commandBuffer - four_queries_pool, // queryPool - 0, // firstQuery - 4 // queryCount - ); - cmd_buf->vkCmdResetQueryPool(cmd_buf, // commandBuffer - seven_queries_pool, // queryPool - 1, // firstQuery - 5 // queryCount - ); - cmd_buf->vkEndCommandBuffer(cmd_buf); - VkSubmitInfo submit_info{VK_STRUCTURE_TYPE_SUBMIT_INFO, - nullptr, - 0, - nullptr, - nullptr, - 1, - &raw_cmd_buf, - 0, - nullptr}; - app.render_queue()->vkQueueSubmit(app.render_queue(), 1, &submit_info, - static_cast(VK_NULL_HANDLE)); - app.render_queue()->vkQueueWaitIdle(app.render_queue()); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdResetQueryPool_test/vkCmdResetQueryPool_test.py b/gapid_tests/command_buffer_tests/vkCmdResetQueryPool_test/vkCmdResetQueryPool_test.py deleted file mode 100644 index c785fab9..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdResetQueryPool_test/vkCmdResetQueryPool_test.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal, require_true -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -import gapit_test_framework -from vulkan_constants import * - - -@gapit_test("vkCmdResetQueryPool_test") -class ClearAllQueriesInAFourQueriesPool(GapitTest): - - def expect(self): - """1. Expects vkCmdResetQueryPool() is called with firstQuery: 0, - queryCount: 4.""" - reset_query_pool = require(self.nth_call_of( - "vkCmdResetQueryPool", 1)) - require_not_equal(0, reset_query_pool.int_commandBuffer) - require_not_equal(0, reset_query_pool.int_queryPool) - require_equal(0, reset_query_pool.int_firstQuery) - require_equal(4, reset_query_pool.int_queryCount) - - -@gapit_test("vkCmdResetQueryPool_test") -class ClearQueryOneToFiveInASevenQueriesPool(GapitTest): - - def expect(self): - """2. Expects vkCmdResetQueryPool() is called with firstQuery: 1, - queryCount: 5.""" - reset_query_pool = require(self.nth_call_of( - "vkCmdResetQueryPool", 2)) - require_not_equal(0, reset_query_pool.int_commandBuffer) - require_not_equal(0, reset_query_pool.int_queryPool) - require_equal(1, reset_query_pool.int_firstQuery) - require_equal(5, reset_query_pool.int_queryCount) diff --git a/gapid_tests/command_buffer_tests/vkCmdResolveImage_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdResolveImage_test/CMakeLists.txt deleted file mode 100644 index 995e649a..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdResolveImage_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdResolveImage_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/vkCmdResolveImage_test/README.md b/gapid_tests/command_buffer_tests/vkCmdResolveImage_test/README.md deleted file mode 100644 index ebf08cd4..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdResolveImage_test/README.md +++ /dev/null @@ -1,96 +0,0 @@ -# vkCmdResolveImage - -## Signatures -```c++ -void vkCmdResolveImage( - VkCommandBuffer commandBuffer, - VkImage srcImage, - VkImageLayout srcImageLayout, - VkImage dstImage, - VkImageLayout dstImageLayout, - uint32_t regionCount, - const VkImageResolve* pRegions); -``` - -# VkImageResolve -```c++ -typedef struct VkImageResolve { - VkImageSubresourceLayers srcSubresource; - VkOffset3D srcOffset; - VkImageSubresourceLayers dstSubresource; - VkOffset3D dstOffset; - VkExtent3D extent; -} VkImageResolve; -``` - -According to the Vulkan spec: -- This command **must** only be called **outside** of a render pass instance -- `srcImage` **must** have a sample count equal to any valid sample count value - other than `VK_SAMPLE_COUNT_1_BIT` -- `dstImage` **must** have a sample count equal to `VK_SAMPLE_COUNT_1_BIT` -- If `dstImage` was created with `tiling` equal to `VK_IMAGE_TILING_LINEAR`, - `dstImage` **must** have been created with a `format` that supports being a - color attachment, as specified by the `VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT` - flag in `VkFormatProperties::linearTilingFeatures` returned by - `vkGetPhysicalDeviceFormatProperties` -- If `dstImage` was created with `tiling` equal to `VK_IMAGE_TILING_OPTIMAL`, - `dstImage` **must** have been created with a `format` that supports being a - color attachment, as specified by the `VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT` - flag in `VkFormatProperties::optimalTilingFeatures` returned by - `vkGetPhysicalDeviceFormatProperties` -- `srcImageLayout` **must** be either of `VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL` - or `VK_IMAGE_LAYOUT_GENERAL` -- `dstImageLayout` **must** be either of `VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL` - or `VK_IMAGE_LAYOUT_GENERAL` -- `commandBuffer` **must** be in the recording state -- `pRegions` **must** be a pointer to an array of `regionCount` valid - `VkImageResolve` structures -- `regionCount` **must** be greater than 0 -- `aspectMask` member of `srcSubresource` and `dstSubresource` **must** only - contain `VK_IMAGE_ASPECT_COLOR_BIT` -- The `layerCount` member of `srcSubresource` and `dstSubresource` **must** - match -- If either of the calling command's `srcImage` or `dstImage` parameters are of - `VkImageType VK_IMAGE_TYPE_3D`, the `baseArrayLayer` and `layerCount` members - of both `srcSubresource` and `dstSubresource` **must** be 0 and 1, - respectively -- `srcOffset.x` and `(extent.width + srcOffset.x)` **must** both be greater than - or equal to 0 and less than or equal to the source image subresource width -- `srcOffset.y` and `(extent.height + srcOffset.y)` **must** both be greater - than or equal to 0 and less than or equal to the source image subresource - height -- If the calling command's `srcImage` is of type `VK_IMAGE_TYPE_1D`, then - `srcOffset.y` **must** be 0 and `extent.height` **must** be 1 -- `srcOffset.z` and `(extent.depth + srcOffset.z)` **must** both be greater - than or equal to 0 and less than or equal to the source image subresource - depth -- If the calling command's `srcImage` is of type `VK_IMAGE_TYPE_1D` or - `VK_IMAGE_TYPE_2D`, then `srcOffset.z` **must** be 0 and `extent.depth` - **must** be 1 -- `dstOffset.x` and `(extent.width + dstOffset.x)` **must** both be greater than - or equal to 0 and less than or equal to the source image subresource width -- `dstOffset.y` and `(extent.height + dstOffset.y)` **must** both be greater - than or equal to 0 and less than or equal to the source image subresource - height -- If the calling command's `dstImage` is of type `VK_IMAGE_TYPE_1D`, then - `dstOffset.y` **must** be 0 and `extent.height` **must** be 1 -- `dstOffset.z` and `(extent.depth + dstOffset.z)` **must** both be greater - than or equal to 0 and less than or equal to the source image subresource - depth -- If the calling command's `dstImage` is of type `VK_IMAGE_TYPE_1D` or - `VK_IMAGE_TYPE_2D`, then `dstOffset.z` **must** be 0 and `extent.depth` - **must** be 1 - -These tests should test the following cases: -- [x] 2D type image -- [ ] 3D type image -- [x] `layerCount` of value 1 -- [ ] `layerCount` of value other than 1 -- [x] `srcOffset` of value 0 in all dimensions -- [ ] `srcOffset` of value other than 0 in all dimensions -- [x] `dstOffset` of value 0 in all dimensions -- [ ] `dstOffset` of value other than 0 in all dimensions -- [x] `dstImage` with `tiling` equal to `VK_IMAGE_TILING_OPTIMAL` -- [ ] `dstImage` with `tiling` equal to `VK_IMAGE_TILING_LINEAR` -- [x] one region -- [ ] multiple regions diff --git a/gapid_tests/command_buffer_tests/vkCmdResolveImage_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdResolveImage_test/main.cpp deleted file mode 100644 index 1ae8c78e..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdResolveImage_test/main.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/vulkan_application.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication application(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - - const VkExtent3D sample_image_extent{32, 32, 1}; - const VkImageCreateInfo sample_image_create_info{ - /* sType = */ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* imageType = */ VK_IMAGE_TYPE_2D, - /* format = */ VK_FORMAT_R8G8B8A8_UINT, - /* extent = */ sample_image_extent, - /* mipLevels = */ 1, - /* arrayLayers = */ 1, - /* samples = */ VK_SAMPLE_COUNT_1_BIT, - /* tiling = */ VK_IMAGE_TILING_OPTIMAL, - /* usage = */ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | - VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT, - /* sharingMode = */ VK_SHARING_MODE_EXCLUSIVE, - /* queueFamilyIndexCount = */ 0, - /* pQueueFamilyIndices = */ nullptr, - /* initialLayout = */ VK_IMAGE_LAYOUT_UNDEFINED, - }; - - { - // 1. Resolve from a 2D, Optimal tiling, 4x multi-sampled color image, with - // only 1 layer, 1 miplevel and 0 offsets in all dimensions. - VkImageCreateInfo src_image_create_info = sample_image_create_info; - src_image_create_info.samples = VK_SAMPLE_COUNT_4_BIT; // 4x multi-sampled - vulkan::ImagePointer src_image = - application.CreateAndBindImage(&src_image_create_info); - VkImageCreateInfo dst_image_create_info = sample_image_create_info; - vulkan::ImagePointer dst_image = - application.CreateAndBindImage(&dst_image_create_info); - // Data in the multi-sampled source image - VkClearColorValue clear_color; - clear_color.uint32[0] = 150; - clear_color.uint32[1] = 150; - clear_color.uint32[2] = 150; - clear_color.uint32[3] = 150; - // Range used for vkCmdClearColorImage() to fill the multi-sampled image - // with data - VkImageSubresourceRange clear_color_range{VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, - 0, 1}; - - // Fill the multi-sampled image with data through vkCmdClearColorImage() - vulkan::VkCommandBuffer cmd_buf = application.GetCommandBuffer(); - ::VkCommandBuffer raw_cmd_buf = cmd_buf.get_command_buffer(); - VkCommandBufferBeginInfo cmd_buf_begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr, 0, nullptr}; - cmd_buf->vkBeginCommandBuffer(cmd_buf, &cmd_buf_begin_info); - vulkan::RecordImageLayoutTransition(*src_image, clear_color_range, - VK_IMAGE_LAYOUT_UNDEFINED, 0, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - VK_ACCESS_TRANSFER_WRITE_BIT, &cmd_buf); - cmd_buf->vkCmdClearColorImage(cmd_buf, *src_image, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - &clear_color, 1, &clear_color_range); - // Switch src image layout from TRANSFER_DST to TRANSFER_SRC - vulkan::RecordImageLayoutTransition( - *src_image, clear_color_range, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - VK_ACCESS_TRANSFER_WRITE_BIT, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, - VK_ACCESS_TRANSFER_READ_BIT, &cmd_buf); - vulkan::RecordImageLayoutTransition(*dst_image, clear_color_range, - VK_IMAGE_LAYOUT_UNDEFINED, 0, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - VK_ACCESS_TRANSFER_WRITE_BIT, &cmd_buf); - VkImageResolve image_resolve{ - // mip level 0, layerbase 0, layer count 1 - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, - {0, 0, 0}, - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, - {0, 0, 0}, - sample_image_extent, - }; - // Call vkCmdResolveImage - cmd_buf->vkCmdResolveImage( - cmd_buf, *src_image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, *dst_image, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &image_resolve); - cmd_buf->vkEndCommandBuffer(cmd_buf); - VkSubmitInfo submit_info{VK_STRUCTURE_TYPE_SUBMIT_INFO, - nullptr, - 0, - nullptr, - nullptr, - 1, - &raw_cmd_buf, - 0, - nullptr}; - application.render_queue()->vkQueueSubmit( - application.render_queue(), 1, &submit_info, - static_cast(VK_NULL_HANDLE)); - application.render_queue()->vkQueueWaitIdle(application.render_queue()); - - // Dump the resolved image data - containers::vector dump_data(data->allocator()); - application.DumpImageLayersData( - dst_image.get(), - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, // subresourceLayer - {0, 0, 0}, // offset - sample_image_extent, // extent - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, // initial layout - &dump_data, // data - {} // wait_semaphores - ); - containers::vector expected_data(32 * 32 * 4, 150, - data->allocator()); - LOG_ASSERT(==, data->logger(), expected_data.size(), dump_data.size()); - LOG_ASSERT(==, data->logger(), true, - std::equal(expected_data.begin(), expected_data.end(), - dump_data.begin())); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdResolveImage_test/vkCmdResolveImage_test.py b/gapid_tests/command_buffer_tests/vkCmdResolveImage_test/vkCmdResolveImage_test.py deleted file mode 100644 index 8ed28968..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdResolveImage_test/vkCmdResolveImage_test.py +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -import gapit_test_framework -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY, DEVICE_SIZE, INT32_T -from vulkan_constants import * - -IMAGE_RESOLVE = [ - ("srcSubresource_aspectMask", UINT32_T), - ("srcSubresource_mipLevel", UINT32_T), - ("srcSubresource_baseArrayLayer", UINT32_T), - ("srcSubresource_layerCount", UINT32_T), - ("srcOffset_x", UINT32_T), - ("srcOffset_y", UINT32_T), - ("srcOffset_z", UINT32_T), - ("dstSubresource_aspectMask", UINT32_T), - ("dstSubresource_mipLevel", UINT32_T), - ("dstSubresource_baseArrayLayer", UINT32_T), - ("dstSubresource_layerCount", UINT32_T), - ("dstOffset_x", UINT32_T), - ("dstOffset_y", UINT32_T), - ("dstOffset_z", UINT32_T), - ("extent_width", UINT32_T), - ("extent_height", UINT32_T), - ("extent_depth", UINT32_T), -] - - -@gapit_test("vkCmdResolveImage_test") -class ResolveFrom2DOptimalTiling4XMultiSampledColorImage(GapitTest): - - def expect(self): - """Check the arguments to vkCmdResolveImage""" - architecture = self.architecture - resolve_image = require(self.nth_call_of("vkCmdResolveImage", 1)) - - require_not_equal(0, resolve_image.int_commandBuffer) - require_not_equal(0, resolve_image.int_srcImage) - require_equal(VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, - resolve_image.int_srcImageLayout) - require_not_equal(0, resolve_image.int_dstImage) - require_equal(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - resolve_image.int_dstImageLayout) - require_equal(1, resolve_image.int_regionCount) - - image_resolve = VulkanStruct( - architecture, IMAGE_RESOLVE, get_read_offset_function( - resolve_image, resolve_image.hex_pRegions)) - - require_equal(VK_IMAGE_ASPECT_COLOR_BIT, - image_resolve.srcSubresource_aspectMask) - require_equal(0, image_resolve.srcSubresource_mipLevel) - require_equal(0, image_resolve.srcSubresource_baseArrayLayer) - require_equal(1, image_resolve.srcSubresource_layerCount) - require_equal(0, image_resolve.srcOffset_x) - require_equal(0, image_resolve.srcOffset_y) - require_equal(0, image_resolve.srcOffset_z) - require_equal(VK_IMAGE_ASPECT_COLOR_BIT, - image_resolve.dstSubresource_aspectMask) - require_equal(0, image_resolve.dstSubresource_mipLevel) - require_equal(0, image_resolve.dstSubresource_baseArrayLayer) - require_equal(1, image_resolve.dstSubresource_layerCount) - require_equal(0, image_resolve.dstOffset_x) - require_equal(0, image_resolve.dstOffset_y) - require_equal(0, image_resolve.dstOffset_z) - require_equal(32, image_resolve.extent_width) - require_equal(32, image_resolve.extent_height) - require_equal(1, image_resolve.extent_depth) diff --git a/gapid_tests/command_buffer_tests/vkCmdSetDepthBounds_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdSetDepthBounds_test/CMakeLists.txt deleted file mode 100644 index 07682292..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdSetDepthBounds_test/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdSetDepthBounds_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) diff --git a/gapid_tests/command_buffer_tests/vkCmdSetDepthBounds_test/README.md b/gapid_tests/command_buffer_tests/vkCmdSetDepthBounds_test/README.md deleted file mode 100644 index 146933b3..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdSetDepthBounds_test/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# vkCmdSetDepthBounds - -## Signatures -```c++ -void vkCmdSetDepthBounds( - VkCommandBuffer commandBuffer, - float minDepthBounds, - float maxDepthBounds) -``` - -According to the Vulkan spec: -- The currently bound graphics pipeline **must** have been created with the - `VK_DYNAMIC_STATE_DEPTH_BOUNDS` dynamic state enabled -- `minDepthBounds` **must** be between 0.0 and 1.0, inclusive -- `maxDepthBounds` **must** be between 0.0 and 1.0, inclusive -- If there is no depth framebuffer or if the depth bounds test is disabled, it - is as if the depth bounds test always passes -- `depthBounds` feature in `VkPhysicalDeviceFeatures` **must** be enabled. If - the feature is not enabled, in `VkPipelineDepthStencilStateCreateInfo` - structure, `depthBoundsTestEnable` **must** be set to `VK_FALSE`, and then - `VK_DYNAMIC_STATE_DEPTH_BOUNDS` will not be a valid state to be added to the - pipeline - -These tests should test the following cases: -- [x] `minDepthBounds` and `maxDepthBounds` of float values. diff --git a/gapid_tests/command_buffer_tests/vkCmdSetDepthBounds_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdSetDepthBounds_test/main.cpp deleted file mode 100644 index 0428737f..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdSetDepthBounds_test/main.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/queue_wrapper.h" - -uint32_t fragment_shader[] = -#include "simple_fragment.frag.spv" - ; - -uint32_t vertex_shader[] = -#include "simple_vertex.vert.spv" - ; - -vulkan::VulkanGraphicsPipeline CreatePipelineWithDepthBoundTestEnabled( - const entry::EntryData* data, vulkan::VulkanApplication* app_ptr) { - LOG_ASSERT(!=, data->logger(), 0, (uintptr_t)app_ptr); - vulkan::VulkanApplication& app = *app_ptr; - vulkan::PipelineLayout pipeline_layout(app.CreatePipelineLayout( - {{{ - 0, // binding - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_VERTEX_BIT, // stageFlags - nullptr, // pImmutableSamplers - }, - { - 1, // binding - VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_FRAGMENT_BIT, // stageFlags - nullptr, // pImmutableSamplers - }}})); - - VkAttachmentReference color_attachment = { - 1, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - VkAttachmentReference depth_attachment = { - 0, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}; - - vulkan::VkRenderPass render_pass = app.CreateRenderPass( - {{ - 0, // flags - VK_FORMAT_D32_SFLOAT, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL // finalLayout - }, - { - 0, // flags - VK_FORMAT_R8G8B8A8_UNORM, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // finalLayout - }}, // AttachmentDescriptions - {{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment, // colorAttachment - nullptr, // pResolveAttachments - &depth_attachment, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }}, // SubpassDescriptions - {} // SubpassDependencies - ); - - vulkan::VulkanGraphicsPipeline pipeline = - app.CreateGraphicsPipeline(&pipeline_layout, &render_pass, 0); - pipeline.AddShader(VK_SHADER_STAGE_VERTEX_BIT, "main", vertex_shader); - pipeline.AddShader(VK_SHADER_STAGE_FRAGMENT_BIT, "main", fragment_shader); - // Dynamic depth bounds - pipeline.AddDynamicState(VK_DYNAMIC_STATE_DEPTH_BOUNDS); - pipeline.SetTopology(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST); - pipeline.AddInputStream(4 * 6, // vec4 + vec2 - VK_VERTEX_INPUT_RATE_VERTEX, - { - {0, VK_FORMAT_R32G32B32A32_SFLOAT, 0}, - {1, VK_FORMAT_R32G32B32A32_SFLOAT, 4 * 4}, - }); - pipeline.AddAttachment(); - // Enable depth bound test - pipeline.DepthStencilState().depthBoundsTestEnable = VK_TRUE; - pipeline.Commit(); - return pipeline; -} - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - { - const float min_depth_bound = 0.01f; - const float max_depth_bound = 0.99f; - VkPhysicalDeviceFeatures request_features = {0}; - request_features.depthBounds = VK_TRUE; - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions(), {}, {}, - request_features); - if (app.device().is_valid()) { - auto pipeline = CreatePipelineWithDepthBoundTestEnabled(data, &app); - auto cmdBuf = app.GetCommandBuffer(); - app.BeginCommandBuffer(&cmdBuf); - cmdBuf->vkCmdBindPipeline(cmdBuf, VK_PIPELINE_BIND_POINT_GRAPHICS, - pipeline); - cmdBuf->vkCmdSetDepthBounds(cmdBuf, min_depth_bound, max_depth_bound); - app.EndAndSubmitCommandBufferAndWaitForQueueIdle(&cmdBuf, - &app.render_queue()); - } - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdSetDepthBounds_test/vkCmdSetDepthBounds_test.py b/gapid_tests/command_buffer_tests/vkCmdSetDepthBounds_test/vkCmdSetDepthBounds_test.py deleted file mode 100644 index 6a9089d5..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdSetDepthBounds_test/vkCmdSetDepthBounds_test.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from gapit_test_framework import GapidUnsupportedException -import gapit_test_framework -from vulkan_constants import * - - -@gapit_test("vkCmdSetDepthBounds_test") -class SetDepthBounds(GapitTest): - - def expect(self): - MIN_DEPTH_BOUNDS = 0.01 - MAX_DEPTH_BOUNDS = 0.99 - - create_device = self.next_call_of("vkCreateDevice") - if create_device[0] is None: - raise GapidUnsupportedException( - "physical device feature: depthBounds not supported") - - set_depth_bounds = require(self.next_call_of("vkCmdSetDepthBounds")) - - require_not_equal(0, set_depth_bounds.int_commandBuffer) - require_equal(MIN_DEPTH_BOUNDS, set_depth_bounds.float_minDepthBounds) - require_equal(MAX_DEPTH_BOUNDS, set_depth_bounds.float_maxDepthBounds) diff --git a/gapid_tests/command_buffer_tests/vkCmdSetStencilReference_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdSetStencilReference_test/CMakeLists.txt deleted file mode 100644 index 16dc308f..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdSetStencilReference_test/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdSetStencilReference_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) diff --git a/gapid_tests/command_buffer_tests/vkCmdSetStencilReference_test/README.md b/gapid_tests/command_buffer_tests/vkCmdSetStencilReference_test/README.md deleted file mode 100644 index 444b19d0..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdSetStencilReference_test/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# vkCmdSetStencilReference - -## Signatures -```c++ -void vkCmdSetStencilReference( - VkCommandBuffer commandBuffer, - VkStencilFaceFlags faceMask, - uint32_t reference); -``` - -According to the Vulkan spec: -- The currently bound graphics pipeline **must** have been created with the - `VK_DYNAMIC_STATE_STENCIL_REFERENCE` dynamic state enabled. -- `faceMask` **must** be a valid combination of `VkStencilFaceFlagBits` values -- `faceMask` must not be 0 -- `commandBuffer` **must** be in the recording state - -These tests should test the following cases: -- `flagMask` of valid value: - - [x] `VK_STENCIL_FACE_FRONT_BIT` - - [x] `VK_STENCIL_FACE_BACK_BIT` - - [x] `VK_STENCIL_FRONT_AND_BACK` -- [x] `reference` of valid values diff --git a/gapid_tests/command_buffer_tests/vkCmdSetStencilReference_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdSetStencilReference_test/main.cpp deleted file mode 100644 index 3e416cec..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdSetStencilReference_test/main.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/queue_wrapper.h" - -uint32_t fragment_shader[] = -#include "simple_fragment.frag.spv" - ; - -uint32_t vertex_shader[] = -#include "simple_vertex.vert.spv" - ; - -vulkan::VulkanGraphicsPipeline CreatePipeline( - const entry::EntryData* data, vulkan::VulkanApplication* app_ptr) { - LOG_ASSERT(!=, data->logger(), 0, (uintptr_t)app_ptr); - vulkan::VulkanApplication& app = *app_ptr; - vulkan::PipelineLayout pipeline_layout(app.CreatePipelineLayout( - {{{ - 0, // binding - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_VERTEX_BIT, // stageFlags - nullptr, // pImmutableSamplers - }, - { - 1, // binding - VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_FRAGMENT_BIT, // stageFlags - nullptr, // pImmutableSamplers - }}})); - - VkAttachmentReference color_attachment = { - 1, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - VkAttachmentReference depth_attachment = { - 0, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}; - - vulkan::VkRenderPass render_pass = app.CreateRenderPass( - {{ - 0, // flags - VK_FORMAT_D32_SFLOAT, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL // finalLayout - }, - { - 0, // flags - VK_FORMAT_R8G8B8A8_UNORM, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // finalLayout - }}, // AttachmentDescriptions - {{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment, // colorAttachment - nullptr, // pResolveAttachments - &depth_attachment, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }}, // SubpassDescriptions - {} // SubpassDependencies - ); - - vulkan::VulkanGraphicsPipeline pipeline = - app.CreateGraphicsPipeline(&pipeline_layout, &render_pass, 0); - pipeline.AddShader(VK_SHADER_STAGE_VERTEX_BIT, "main", vertex_shader); - pipeline.AddShader(VK_SHADER_STAGE_FRAGMENT_BIT, "main", fragment_shader); - pipeline.AddDynamicState(VK_DYNAMIC_STATE_STENCIL_REFERENCE); - pipeline.SetTopology(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST); - pipeline.AddInputStream(4 * 6, // vec4 + vec2 - VK_VERTEX_INPUT_RATE_VERTEX, - { - {0, VK_FORMAT_R32G32B32A32_SFLOAT, 0}, - {1, VK_FORMAT_R32G32B32A32_SFLOAT, 4 * 4}, - }); - pipeline.AddAttachment(); - pipeline.Commit(); - return pipeline; -} - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - auto pipeline = CreatePipeline(data, &app); - - { - // Test vkCmdSetStencilReference - vulkan::VkCommandBuffer cmd_buf = app.GetCommandBuffer(); - app.BeginCommandBuffer(&cmd_buf); - cmd_buf->vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_GRAPHICS, - pipeline); - cmd_buf->vkCmdSetStencilReference(cmd_buf, VK_STENCIL_FACE_FRONT_BIT, 0u); - cmd_buf->vkCmdSetStencilReference(cmd_buf, VK_STENCIL_FACE_BACK_BIT, 10u); - cmd_buf->vkCmdSetStencilReference(cmd_buf, VK_STENCIL_FRONT_AND_BACK, - 0xFFFFFFFFU); - app.EndAndSubmitCommandBufferAndWaitForQueueIdle(&cmd_buf, - &app.render_queue()); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdSetStencilReference_test/vkCmdSetStencilReference.py b/gapid_tests/command_buffer_tests/vkCmdSetStencilReference_test/vkCmdSetStencilReference.py deleted file mode 100644 index f00616a9..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdSetStencilReference_test/vkCmdSetStencilReference.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from gapit_test_framework import GapidUnsupportedException -from vulkan_constants import * - - -@gapit_test("vkCmdSetStencilReference_test") -class SetStencilReference(GapitTest): - - def expect(self): - first_set_stencil = require( - self.next_call_of("vkCmdSetStencilReference")) - require_not_equal(0, first_set_stencil.int_commandBuffer) - require_equal(VK_STENCIL_FACE_FRONT_BIT, - first_set_stencil.int_faceMask) - require_equal(0, first_set_stencil.int_reference) - - second_set_stencil = require( - self.next_call_of("vkCmdSetStencilReference")) - require_not_equal(0, second_set_stencil.int_commandBuffer) - require_equal(VK_STENCIL_FACE_BACK_BIT, - second_set_stencil.int_faceMask) - require_equal(10, second_set_stencil.int_reference) - - third_set_stencil = require( - self.next_call_of("vkCmdSetStencilReference")) - require_not_equal(0, third_set_stencil.int_commandBuffer) - require_equal(VK_STENCIL_FRONT_AND_BACK, - third_set_stencil.int_faceMask) - require_equal(0xFFFFFFFF, third_set_stencil.int_reference) diff --git a/gapid_tests/command_buffer_tests/vkCmdUpdateBuffer_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdUpdateBuffer_test/CMakeLists.txt deleted file mode 100644 index 90575e57..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdUpdateBuffer_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdUpdateBuffer_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/vkCmdUpdateBuffer_test/README.md b/gapid_tests/command_buffer_tests/vkCmdUpdateBuffer_test/README.md deleted file mode 100644 index f01385a6..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdUpdateBuffer_test/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# vkCmdUpdateBuffer - -## Signatures -```c++ -void vkCmdUpdateBuffer( - VkCommandBuffer commandBuffer, - VkBuffer dstBuffer, - VkDeviceSize dstOffset, - VkDeviceSize dataSize, - const void* pData); -``` - -According to the Vulkan spec: -- `vkCmdUpdateBuffer` is only allowed outside of a render pass. This command is - treated as "transfer" operation, for the purposes of synchronization barriers. -- The `VK_BUFFER_USAGE_TRANSFER_DST_BIT` **must** be specified in the `usage` - of `VkBufferCreateInfo` in order for the buffer to be compatible with this - command -- `dstOffset` **must** be less than the size of `dstBuffer` -- `dataSize` **must** be less than or equal to the size of `dstBuffer-dstOffset` -- `dstBuffer` **must** have been created with `VK_BUFFER_USAGE_TRANSFER_DST_BIT` - usage flag -- If `dstBuffer` is non-sparse then it **must** be bound completely and - contiguously to a single `VkDeviceMemory` object -- `dstOffset` **must** be a multiple of 4 -- `dataSize` **must** be less than or equal to 65536 -- `dstaSize` **must** be a multiple of 4 -- `pData` **must** be a pointer to an array of `dataSize` bytes -- The `VkCommandPool` that `commandBuffer` was allocated from **must** support -- transfer, graphics or compute operations -- `dataSize` **must** be greater than 0 -- Both of `commandBuffer`, and `dstBuffer` **must** have been created, - allocated, or retrieved from the same `VkDevice` - - -These tests should test the following cases: -- [x] `dstOffset` of value 0 -- [ ] `dstOffset` of value other than 0 -- [x] `dataSize` of value 65536 -- [ ] `dataSize` of value other than 65536 diff --git a/gapid_tests/command_buffer_tests/vkCmdUpdateBuffer_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdUpdateBuffer_test/main.cpp deleted file mode 100644 index c15205a5..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdUpdateBuffer_test/main.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/vulkan_application.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication application(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions() - .SetHostBufferSize(1024 * 100) - .SetDeviceImageSize(1024 * 100) - .SetCoherentBufferSize(1024 * 100)); - { - // Update a buffer with size 65536 bytes and 0 offset. - size_t update_size = 65536; - uint8_t update_byte = 0xab; - VkBufferCreateInfo create_info = { - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // createFlags - update_size, // size - VK_BUFFER_USAGE_TRANSFER_DST_BIT | - VK_BUFFER_USAGE_TRANSFER_SRC_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr // pQueueFamilyIndices - }; - // Create an update buffer as the destination buffer for vkCmdUpdateBuffer - vulkan::BufferPointer update_buffer = - application.CreateAndBindHostBuffer(&create_info); - - containers::vector buffer_data(update_size, update_byte, - data->allocator()); - vulkan::VkCommandBuffer cmd_buf = application.GetCommandBuffer(); - VkCommandBufferBeginInfo begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr, 0, nullptr}; - cmd_buf->vkBeginCommandBuffer(cmd_buf, &begin_info); - cmd_buf->vkCmdUpdateBuffer(cmd_buf, // commandBuffer - *update_buffer, // dstBuffer - 0, // dstOffset - update_size, // dataSize - buffer_data.data() // pData - ); - - VkBufferMemoryBarrier dst_to_src_barrier{ - VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, // sType - nullptr, // pNext - VK_ACCESS_TRANSFER_WRITE_BIT, // srcAccessMask - VK_ACCESS_TRANSFER_READ_BIT, // dstAccessMask - VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex - VK_QUEUE_FAMILY_IGNORED, // dstQueueFamilyIndex - *update_buffer, // buffer - 0, // offset - update_size, // size - }; - cmd_buf->vkCmdPipelineBarrier( - cmd_buf, // commandBuffer - VK_PIPELINE_STAGE_HOST_BIT, // srcStageMask - VK_PIPELINE_STAGE_TRANSFER_BIT, // dstStageMask - 0, // dependencyFlags - 0, // memoryBarrierCount - nullptr, // pMemoryBarriers - 1, // bufferMemoryBarrierCount - &dst_to_src_barrier, // pBufferMemoryBarriers - 0, // imageMemoryBarrierCount - nullptr // pImageMemoryBarriers - ); - - cmd_buf->vkEndCommandBuffer(cmd_buf); - VkCommandBuffer raw_cmd_buf = cmd_buf.get_command_buffer(); - VkSubmitInfo submit{VK_STRUCTURE_TYPE_SUBMIT_INFO, - nullptr, - 0, - nullptr, - nullptr, - 1, - &raw_cmd_buf, - 0, - nullptr}; - application.render_queue()->vkQueueSubmit( - application.render_queue(), 1, &submit, - static_cast(VK_NULL_HANDLE)); - application.render_queue()->vkQueueWaitIdle(application.render_queue()); - - update_buffer->invalidate(); - std::for_each(update_buffer->base_address(), - update_buffer->base_address() + update_size, - [&data, update_byte](uint8_t c) { - LOG_ASSERT(==, data->logger(), c, update_byte); - }); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdUpdateBuffer_test/vkCmdUpdateBuffer_test.py b/gapid_tests/command_buffer_tests/vkCmdUpdateBuffer_test/vkCmdUpdateBuffer_test.py deleted file mode 100644 index 3056ea76..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdUpdateBuffer_test/vkCmdUpdateBuffer_test.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -import gapit_test_framework -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY, DEVICE_SIZE, INT32_T -from vulkan_constants import * - - -@gapit_test("vkCmdUpdateBuffer_test") -class MaximumBufferUpdateWithZeroOffset(GapitTest): - - def expect(self): - """Check the arguments to vkCmdUpdateBuffer""" - update_buffer = require( - self.nth_call_of("vkCmdUpdateBuffer", 1)) - - require_not_equal(0, update_buffer.int_commandBuffer) - require_not_equal(0, update_buffer.int_dstBuffer) - require_equal(0, update_buffer.int_dstOffset) - require_equal(65536, update_buffer.int_dataSize) - require_not_equal(0, update_buffer.hex_pData) diff --git a/gapid_tests/command_buffer_tests/vkCmdWriteTimestamp_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkCmdWriteTimestamp_test/CMakeLists.txt deleted file mode 100644 index 9ed7efa8..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdWriteTimestamp_test/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdWriteTimestamp_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) diff --git a/gapid_tests/command_buffer_tests/vkCmdWriteTimestamp_test/README.md b/gapid_tests/command_buffer_tests/vkCmdWriteTimestamp_test/README.md deleted file mode 100644 index af877d0e..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdWriteTimestamp_test/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# vkCmdWriteTimestamp - -## Signatures -```c++ -void vkCmdWriteTimestamp( - VkCommandBuffer commandBuffer, - VkPipelineStageFlagBits pipelineStage, - VkQueryPool queryPool, - uint32_t query); -``` - -According to the Vulkan spec: -- The number of valid bits in a timestamp value is determined by the - `VkQueueFamilyProperties::timestampValidBits` property of the queue on which - the timestamp is written. Timestamps are supported on any queue which reports - a non-zero value for `timestampValidBits` via - `vkGetPhysicalDeviceQueueFamilyProperties` -- If the `timestampComputeAndGraphics` limit is `VK_TRUE`, timestamps are - supported by every queue family that supports either graphics or compute - operations -- The nubmer of nanoseconds it takes for a timestamp value to be incremented - by 1 can be obtained from `VkPhysicalDeviceLimits::timestampPeriod` after a - call to `vkGetPhysicalDeviceProperties` -- The query identified by `queryPool` and `query` **must** be *unavailable* -- The command pool's queue family **must** support a non-zero - `timestampValidBits` - -These tests should test the following cases: -- [x] `pipelineStage` of valid values -- [x] `queryPool` of valid values -- [x] `query` of valid values diff --git a/gapid_tests/command_buffer_tests/vkCmdWriteTimestamp_test/main.cpp b/gapid_tests/command_buffer_tests/vkCmdWriteTimestamp_test/main.cpp deleted file mode 100644 index 84d35ce2..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdWriteTimestamp_test/main.cpp +++ /dev/null @@ -1,321 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -uint32_t fragment_shader[] = -#include "simple_fragment.frag.spv" - ; - -uint32_t vertex_shader[] = -#include "simple_vertex.vert.spv" - ; - -namespace { -// Geometry data of the triangle to be drawn -const float kVertices[] = { - -0.5, -0.5, 0.0, // point 1 - 0.5, -0.5, 0.0, // point 2 - 0.0, 0.5, 0.0, // point 3 -}; -const vulkan::VulkanGraphicsPipeline::InputStream kVerticesStream{ - 0, // binding - VK_FORMAT_R32G32B32_SFLOAT, // format - 0, // offset -}; - -const float kUV[] = { - 0.0, 0.0, // point 1 - 1.0, 0.0, // point 2 - 0.0, 1.0, // point 3 -}; -const vulkan::VulkanGraphicsPipeline::InputStream kUVStream{ - 1, // binding - VK_FORMAT_R32G32_SFLOAT, // format - 0, // offset -}; - -const uint32_t kIndex[] = {0, 1, 2}; -} // anonymous namespace - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - vulkan::VkDevice& device = app.device(); - uint32_t queue_family_index = app.render_queue().index(); - auto queue_family_properties = vulkan::GetQueueFamilyProperties( - data->allocator(), app.instance(), device.physical_device()); - uint32_t time_stamp_valid_bits = - queue_family_properties[queue_family_index].timestampValidBits; - data->logger()->LogInfo(" Timestamp valid bits: ", time_stamp_valid_bits); - if (time_stamp_valid_bits == 0) { - data->logger()->LogInfo( - "Disable test due to zero valid bits of timestamp in physical device " - "queue family property"); - } else { - // Create vertex buffers and index buffer - auto vertices_buf = app.CreateAndBindDefaultExclusiveHostBuffer( - sizeof(kVertices), - VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT); - auto uv_buf = app.CreateAndBindDefaultExclusiveHostBuffer( - sizeof(kUV), - VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT); - auto index_buf = app.CreateAndBindDefaultExclusiveHostBuffer( - sizeof(kIndex), - VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT); - const ::VkBuffer vertex_buffers[2] = {*vertices_buf, *uv_buf}; - const ::VkDeviceSize vertex_buffer_offsets[2] = {0, 0}; - - // Create render pass. - VkAttachmentReference color_attachment = { - 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - vulkan::VkRenderPass render_pass = app.CreateRenderPass( - {{ - 0, // flags - app.swapchain().format(), // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_UNDEFINED, // initialLayout - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // finalLayout - }}, // AttachmentDescriptions - {{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment, // colorAttachment - nullptr, // pResolveAttachments - nullptr, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }}, // SubpassDescriptions - {} // SubpassDependencies - ); - - // Create pipeline - vulkan::PipelineLayout pipeline_layout(app.CreatePipelineLayout({{}})); - vulkan::VulkanGraphicsPipeline pipeline = - app.CreateGraphicsPipeline(&pipeline_layout, &render_pass, 0); - pipeline.AddShader(VK_SHADER_STAGE_VERTEX_BIT, "main", vertex_shader); - pipeline.AddShader(VK_SHADER_STAGE_FRAGMENT_BIT, "main", fragment_shader); - pipeline.SetTopology(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST); - pipeline.AddInputStream(sizeof(float), VK_VERTEX_INPUT_RATE_VERTEX, - {kVerticesStream}); - pipeline.AddInputStream(sizeof(float), VK_VERTEX_INPUT_RATE_VERTEX, - {kUVStream}); - pipeline.SetScissor({{ - 0, // offset.x - 0, // offset.y - }, - { - app.swapchain().width(), // extent.width - app.swapchain().height() // extent.height - }}); - pipeline.SetViewport({ - 0.0f, // x - 0.0f, // y - static_cast(app.swapchain().width()), // width - static_cast(app.swapchain().height()), // height - 0.0f, // minDepth - 1.0f, // maxDepth - }); - pipeline.SetSamples(VK_SAMPLE_COUNT_1_BIT); - pipeline.AddAttachment(); - pipeline.Commit(); - - // Create image view - VkImageViewCreateInfo image_view_create_info{ - VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - app.swapchain_images().front(), // image - VK_IMAGE_VIEW_TYPE_2D, // viewType - app.swapchain().format(), // format - { - VK_COMPONENT_SWIZZLE_IDENTITY, // components.r - VK_COMPONENT_SWIZZLE_IDENTITY, // components.g - VK_COMPONENT_SWIZZLE_IDENTITY, // components.b - VK_COMPONENT_SWIZZLE_IDENTITY, // components.a - }, - { - VK_IMAGE_ASPECT_COLOR_BIT, // subresourceRange.aspectMask - 0, // subresourceRange.baseMipLevel - 1, // subresourceRange.levelCount - 0, // subresourceRange.baseArrayLayer - 1, // subresourceRange.layerCount - }, - }; - ::VkImageView raw_image_view; - LOG_ASSERT( - ==, data->logger(), - app.device()->vkCreateImageView(app.device(), &image_view_create_info, - nullptr, &raw_image_view), - VK_SUCCESS); - vulkan::VkImageView image_view(raw_image_view, nullptr, &app.device()); - - // Create framebuffer - VkFramebufferCreateInfo framebuffer_create_info{ - VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - render_pass, // renderPass - 1, // attachmentCount - &raw_image_view, // attachments - app.swapchain().width(), // width - app.swapchain().height(), // height - 1 // layers - }; - ::VkFramebuffer raw_framebuffer; - app.device()->vkCreateFramebuffer(app.device(), &framebuffer_create_info, - nullptr, &raw_framebuffer); - vulkan::VkFramebuffer framebuffer(raw_framebuffer, nullptr, &app.device()); - - // Create render pass begin info - VkRenderPassBeginInfo pass_begin{ - VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, // sType - nullptr, // pNext - render_pass, // renderPass - framebuffer, // framebuffer - {{0, 0}, - {app.swapchain().width(), app.swapchain().height()}}, // renderArea - 0, // clearValueCount - nullptr // clears - }; - - // Create query pool - vulkan::VkQueryPool query_pool = vulkan::CreateQueryPool( - &device, {VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, nullptr, 0, - VK_QUERY_TYPE_TIMESTAMP, 2, 0}); - - { - // 1. Query time stamp for vkCmdDraw - auto cmd_buf = app.GetCommandBuffer(); - app.BeginCommandBuffer(&cmd_buf); - vulkan::RecordImageLayoutTransition( - app.swapchain_images().front(), - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, VK_IMAGE_LAYOUT_UNDEFINED, 0, - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, &cmd_buf); - app.FillHostVisibleBuffer( - &*vertices_buf, reinterpret_cast(kVertices), - sizeof(kVertices), 0, &cmd_buf, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT); - app.FillHostVisibleBuffer(&*uv_buf, reinterpret_cast(kUV), - sizeof(kUV), 0, &cmd_buf, - VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT); - - cmd_buf->vkCmdResetQueryPool(cmd_buf, query_pool, 0, 2); - - cmd_buf->vkCmdBeginRenderPass(cmd_buf, &pass_begin, - VK_SUBPASS_CONTENTS_INLINE); - cmd_buf->vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_GRAPHICS, - pipeline); - cmd_buf->vkCmdBindVertexBuffers(cmd_buf, 0, 2, vertex_buffers, - vertex_buffer_offsets); - cmd_buf->vkCmdDraw(cmd_buf, 3, 1, 0, 0); - cmd_buf->vkCmdWriteTimestamp(cmd_buf, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, - query_pool, 0); - cmd_buf->vkCmdWriteTimestamp( - cmd_buf, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, query_pool, 1); - cmd_buf->vkCmdEndRenderPass(cmd_buf); - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - app.EndAndSubmitCommandBufferAndWaitForQueueIdle( - &cmd_buf, &app.render_queue())); - uint64_t time_stamps[2] = {0ULL, 0ULL}; - device->vkGetQueryPoolResults( - device, query_pool, 0, 2, sizeof(time_stamps), - reinterpret_cast(time_stamps), sizeof(uint64_t), - VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT); - data->logger()->LogInfo(" Vertex shader timestamp for vkCmdDraw: ", - time_stamps[0]); - LOG_ASSERT(!=, data->logger(), 0, time_stamps[0]); - data->logger()->LogInfo(" Fragment shader timestamp for vkCmdDraw: ", - time_stamps[1]); - LOG_ASSERT(!=, data->logger(), 0, time_stamps[1]); - } - - { - // 2. Query time stamp for vkCmdDrawIndexed - auto cmd_buf = app.GetCommandBuffer(); - app.BeginCommandBuffer(&cmd_buf); - vulkan::RecordImageLayoutTransition( - app.swapchain_images().front(), - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, VK_IMAGE_LAYOUT_UNDEFINED, 0, - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, &cmd_buf); - app.FillHostVisibleBuffer( - &*vertices_buf, reinterpret_cast(kVertices), - sizeof(kVertices), 0, &cmd_buf, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT); - app.FillHostVisibleBuffer(&*uv_buf, reinterpret_cast(kUV), - sizeof(kUV), 0, &cmd_buf, - VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT); - app.FillHostVisibleBuffer( - &*index_buf, reinterpret_cast(kIndex), sizeof(kIndex), 0, - &cmd_buf, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, - VK_ACCESS_INDEX_READ_BIT); - - cmd_buf->vkCmdResetQueryPool(cmd_buf, query_pool, 0, 2); - - cmd_buf->vkCmdBeginRenderPass(cmd_buf, &pass_begin, - VK_SUBPASS_CONTENTS_INLINE); - cmd_buf->vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_GRAPHICS, - pipeline); - cmd_buf->vkCmdBindVertexBuffers(cmd_buf, 0, 2, vertex_buffers, - vertex_buffer_offsets); - cmd_buf->vkCmdBindIndexBuffer(cmd_buf, *index_buf, 0, - VK_INDEX_TYPE_UINT32); - cmd_buf->vkCmdDrawIndexed(cmd_buf, 3, 1, 0, 0, 0); - cmd_buf->vkCmdWriteTimestamp(cmd_buf, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, - query_pool, 0); - cmd_buf->vkCmdWriteTimestamp( - cmd_buf, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, query_pool, 1); - cmd_buf->vkCmdEndRenderPass(cmd_buf); - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - app.EndAndSubmitCommandBufferAndWaitForQueueIdle( - &cmd_buf, &app.render_queue())); - uint64_t time_stamps[2] = {0ULL, 0ULL}; - device->vkGetQueryPoolResults( - device, query_pool, 0, 2, sizeof(time_stamps), - reinterpret_cast(time_stamps), sizeof(uint64_t), - VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT); - data->logger()->LogInfo( - " Vertex shader timestamp for vkCmdDrawIndexed: ", time_stamps[0]); - LOG_ASSERT(!=, data->logger(), 0, time_stamps[0]); - data->logger()->LogInfo( - " Fragment shader timestamp for vkCmdDrawIndexed: ", - time_stamps[1]); - LOG_ASSERT(!=, data->logger(), 0, time_stamps[1]); - } - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkCmdWriteTimestamp_test/vkCmdWriteTimestamp_test.py b/gapid_tests/command_buffer_tests/vkCmdWriteTimestamp_test/vkCmdWriteTimestamp_test.py deleted file mode 100644 index 9787a761..00000000 --- a/gapid_tests/command_buffer_tests/vkCmdWriteTimestamp_test/vkCmdWriteTimestamp_test.py +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright 2017 Google 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. - - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, GapidUnsupportedException -from vulkan_constants import * - - -@gapit_test("vkCmdWriteTimestamp_test") -class TimeStampForDraw(GapitTest): - - def expect(self): - draw = self.next_call_of("vkCmdDraw") - # If queue does not support vkCmdWriteTimestamp, vkCmdDraw will not be - # called, so the test should be skipped. - if draw[0] is None: - raise GapidUnsupportedException( - "phsical device queue family has zero value of timestampValidBits") - first_write = require(self.next_call_of("vkCmdWriteTimestamp")) - second_write = require(self.next_call_of("vkCmdWriteTimestamp")) - require_not_equal(0, first_write.int_commandBuffer) - require_equal(first_write.int_commandBuffer, second_write.int_commandBuffer) - require_equal(VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, - first_write.int_pipelineStage) - require_equal(VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, - second_write.int_pipelineStage) - require_not_equal(0, first_write.int_queryPool) - require_equal(first_write.int_queryPool, second_write.int_queryPool) - require_equal(0, first_write.query) - require_equal(1, second_write.query) - - -@gapit_test("vkCmdWriteTimestamp_test") -class TimeStampForDrawIndexed(GapitTest): - - def expect(self): - draw = self.next_call_of("vkCmdDrawIndexed") - # If queue does not support vkCmdWriteTimestamp, vkCmdDrawIndexed will not be - # called, so the test should be skipped. - if draw[0] is None: - raise GapidUnsupportedException( - "phsical device queue family has zero value of timestampValidBits") - first_write = require(self.next_call_of("vkCmdWriteTimestamp")) - second_write = require(self.next_call_of("vkCmdWriteTimestamp")) - require_not_equal(0, first_write.int_commandBuffer) - require_equal(first_write.int_commandBuffer, second_write.int_commandBuffer) - require_equal(VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, - first_write.int_pipelineStage) - require_equal(VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, - second_write.int_pipelineStage) - require_not_equal(0, first_write.int_queryPool) - require_equal(first_write.int_queryPool, second_write.int_queryPool) - require_equal(0, first_write.query) - require_equal(1, second_write.query) diff --git a/gapid_tests/command_buffer_tests/vkQueuePresentKHR_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkQueuePresentKHR_test/CMakeLists.txt deleted file mode 100644 index 1935f928..00000000 --- a/gapid_tests/command_buffer_tests/vkQueuePresentKHR_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkQueuePresentKHR_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/vkQueuePresentKHR_test/README.md b/gapid_tests/command_buffer_tests/vkQueuePresentKHR_test/README.md deleted file mode 100644 index 2aac1774..00000000 --- a/gapid_tests/command_buffer_tests/vkQueuePresentKHR_test/README.md +++ /dev/null @@ -1,64 +0,0 @@ -# vkQueuePresentKHR - -## Signatures -```c++ -VkResult vkQueuePresentKHR( - VkQueue queue, - const VkPresentInfoKHR* pPresentInfo); -``` - -According to the Vulkan spec: -- vkQueuePresentKHR - - `queue` is a queue that is capable of presentation to the target surface's - platform on the ssame device as the image's swapchain. It **must** be a valid - `VkQueue` handle - - Any given element of `pSwapchains` member of `pPresentInfo` **must** be a - swapchain that is created for a surface for which presentation is supported - from `queue` as determined using a call to - `vkGetPhysicalDeviceSurfaceSupportKHR` - - Host access to `queue`, `pPresentInfo.pWaitSemaphores[]` and - - `pPresentInfo.pSwapchains[]` **must** be externally synchronized - - -## VkPresentInfoKHR -```c++ -typedef struct VkPresentInfoKHR { - VkStructureType sType; - const void* pNext; - uint32_t waitSemaphoreCount; - const VkSemaphore* pWaitSemaphores; - uint32_t swapchainCount; - const VkSwapchainKHR* pSwapchains; - const uint32_t* pImageIndices; - VkResult* pResults; -} VkPresentInfoKHR; -``` - -According to the Vulkan spec: -- VkPresentInfoKHR - - `sType` **must** be `VK_STRUCTURE_TYPE_PRESENT_INFO_KHR` - - `pNext` **must** be `NULL` or a pointer to a `VkDisplayPresentInfoKHR` - - `waitSemaphoreCount` **may** be zero - - `pWaitSemaphores` if not `NULL`, is an array of `VkSemaphore` objects with - `waitSemaphoreCount` entries, and specifies the semaphores to wait for before - issuing the present request - - `swapchainCount` is the number of swapchains being presented to by this command - - `pSwapchains` is an array of `VkSwapchainKHR` objects with `swapchainCount` - entries. A given swapchain **must not** appear in this list more than once - - `pImageIndices` is an array of indices into the array of each swapchain's - presentable images, with `swapchainCount` entries. Each entry in this array - identifies the image to the present on the corresponding entry in the - `pSwapchains` array. - - `pResults` is an array of `VkResult` typed elementes with `swapchainCount` - entries. If the given `pResults` is `non-Null`, each entry in `pResults` will - be set to the `VkResult` for presenting the swapchain corresponding to the - same index in `pSwapchains` - -These tests should test the following cases: -- [x] None waiting semaphores -- [ ] One waiting semaphores -- [ ] Multiple waiting semaphores -- [x] One swapchain -- [ ] Multiple swapchains -- [x] `pResults` of value `NULL` -- [ ] `pResults` points to a valid result array diff --git a/gapid_tests/command_buffer_tests/vkQueuePresentKHR_test/main.cpp b/gapid_tests/command_buffer_tests/vkQueuePresentKHR_test/main.cpp deleted file mode 100644 index dd81aa8b..00000000 --- a/gapid_tests/command_buffer_tests/vkQueuePresentKHR_test/main.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - vulkan::VkDevice& device = app.device(); - { - // 1. Present a queue with no semaphore and result array, but one swapchain. - // Get the index of the next image to present - // This semaphore is only created for getting the next image index, not for - // presenting queue. - ::VkSemaphore raw_semaphore; - VkSemaphoreCreateInfo semaphore_create_info{ - VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, // sType - NULL, // pNext - 0, // flags - }; - device->vkCreateSemaphore(device, &semaphore_create_info, nullptr, - &raw_semaphore); - vulkan::VkSemaphore semaphore(raw_semaphore, nullptr, &device); - - uint32_t image_index = 0; - device->vkAcquireNextImageKHR(device, app.swapchain(), 10u, semaphore, - (::VkFence)VK_NULL_HANDLE, &image_index); - data->logger()->LogInfo("Next image index: ", image_index); - // Get the image to be presented. - ::VkImage raw_image_to_present = app.swapchain_images()[image_index]; - - // Change the image layout, fill the image with clear color value, prepare - // to be presented. - vulkan::VkCommandBuffer cmd_buf = app.GetCommandBuffer(); - ::VkCommandBuffer raw_cmd_buf = cmd_buf.get_command_buffer(); - app.BeginCommandBuffer(&cmd_buf); - RecordImageLayoutTransition( - raw_image_to_present, {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, - VK_IMAGE_LAYOUT_UNDEFINED, static_cast(0u), - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_ACCESS_TRANSFER_WRITE_BIT, - &cmd_buf); - app.EndAndSubmitCommandBufferAndWaitForQueueIdle(&cmd_buf, - &app.present_queue()); - - VkCommandBufferBeginInfo info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType - nullptr, // pNext - 0, // flags - nullptr, // pInheritanceInfo - }; - cmd_buf->vkBeginCommandBuffer(cmd_buf, &info); - VkClearColorValue clear_color_value; - clear_color_value.float32[0] = 0.2f; - clear_color_value.float32[1] = 0.2f; - clear_color_value.float32[2] = 0.2f; - clear_color_value.float32[3] = 0.2f; - VkImageSubresourceRange range{ - VK_IMAGE_ASPECT_COLOR_BIT, // aspectMask; - 0, // baseMipLevel - 1, // levelCount - 0, // baseArrayLayer - 1, // layerCount - }; - cmd_buf->vkCmdClearColorImage(cmd_buf, raw_image_to_present, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - &clear_color_value, 1, &range); - cmd_buf->vkEndCommandBuffer(cmd_buf); - VkPipelineStageFlags pipe_stage_flags = - VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; - VkSubmitInfo submit_info{ - VK_STRUCTURE_TYPE_SUBMIT_INFO, // sType - NULL, // pNext - 1, // waitSemaphoreCount - &raw_semaphore, // pWaitSemaphores - &pipe_stage_flags, // pWaitDstStageMask - 1, // commandBufferCount - &raw_cmd_buf, // pCommandBuffers - 0, // signalSemaphoreCount - NULL, // pSignalSemaphores - }; - app.present_queue()->vkQueueSubmit(app.present_queue(), 1, &submit_info, - (::VkFence)VK_NULL_HANDLE); - app.present_queue()->vkQueueWaitIdle(app.present_queue()); - - // Set the layout of the image to be presented from - // VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL to VK_IMAGE_LAYOUT_PRESENT_SRC_KHR - app.BeginCommandBuffer(&cmd_buf); - RecordImageLayoutTransition( - raw_image_to_present, {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_ACCESS_TRANSFER_WRITE_BIT, - VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, static_cast(0u), - &cmd_buf); - app.EndAndSubmitCommandBufferAndWaitForQueueIdle(&cmd_buf, - &app.present_queue()); - - // Call vkQueuePresentKHR() - ::VkSwapchainKHR raw_swapchain = app.swapchain().get_raw_object(); - VkPresentInfoKHR present_info{ - VK_STRUCTURE_TYPE_PRESENT_INFO_KHR, // sType - nullptr, // pNext - 0, // waitSemaphoreCount - nullptr, // pWaitSemaphores - 1, // swapchainCount - &raw_swapchain, // pSwapchains - &image_index, // pImageIndices - nullptr, // pResults - }; - LOG_ASSERT(==, data->logger(), - app.present_queue()->vkQueuePresentKHR(app.present_queue(), - &present_info), - VK_SUCCESS); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkQueuePresentKHR_test/vkQueuePresentKHR_test.py b/gapid_tests/command_buffer_tests/vkQueuePresentKHR_test/vkQueuePresentKHR_test.py deleted file mode 100644 index 222d631c..00000000 --- a/gapid_tests/command_buffer_tests/vkQueuePresentKHR_test/vkQueuePresentKHR_test.py +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -import gapit_test_framework -from struct_offsets import VulkanStruct, UINT32_T, POINTER -from vulkan_constants import * - - -PRESENT_INFO = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("waitSemaphoreCount", UINT32_T), - ("pWaitSemaphores", POINTER), - ("swapchainCount", UINT32_T), - ("pSwapchains", POINTER), - ("pImageIndices", POINTER), - ("pResults", POINTER), -] - - -@gapit_test("vkQueuePresentKHR_test") -class QueuePresentWithoutSemaphoreAndResultsArray(GapitTest): - def expect(self): - """1. Expects a call of vkQueuePresentKHR() without waiting semaphore and - results array""" - architecture = self.architecture - queue_present = require(self.nth_call_of("vkQueuePresentKHR", 1)) - require_not_equal(0, queue_present.int_queue) - require_not_equal(0, queue_present.hex_pPresentInfo) - require_equal(VK_SUCCESS, int(queue_present.return_val)) - - present_info = VulkanStruct( - architecture, PRESENT_INFO, get_read_offset_function( - queue_present, queue_present.hex_pPresentInfo)) - - require_equal(VK_STRUCTURE_TYPE_PRESENT_INFO_KHR, present_info.sType) - require_equal(0, present_info.pNext) - require_equal(0, present_info.waitSemaphoreCount) - require_equal(0, present_info.pWaitSemaphores) - require_equal(1, present_info.swapchainCount) - require_not_equal(0, present_info.pSwapchains) - require_not_equal(0, present_info.pImageIndices) - require_equal(0, present_info.pResults) diff --git a/gapid_tests/command_buffer_tests/vkTrimCommandPool_test/CMakeLists.txt b/gapid_tests/command_buffer_tests/vkTrimCommandPool_test/CMakeLists.txt deleted file mode 100644 index db101473..00000000 --- a/gapid_tests/command_buffer_tests/vkTrimCommandPool_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2020 Google 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. -# - -add_gapid_test(vkTrimCommandPool_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/command_buffer_tests/vkTrimCommandPool_test/README.md b/gapid_tests/command_buffer_tests/vkTrimCommandPool_test/README.md deleted file mode 100644 index 3ad9cd65..00000000 --- a/gapid_tests/command_buffer_tests/vkTrimCommandPool_test/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# vkTrimCommandPool - -## Signatures -```c++ -void vkTrimCommandPool( - VkDevice device, - VkCommandPool commandPool, - VkCommandPoolTrimFlags flags); -``` diff --git a/gapid_tests/command_buffer_tests/vkTrimCommandPool_test/main.cpp b/gapid_tests/command_buffer_tests/vkTrimCommandPool_test/main.cpp deleted file mode 100644 index dc90b8f7..00000000 --- a/gapid_tests/command_buffer_tests/vkTrimCommandPool_test/main.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright 2020 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - // vkTrimCommandPool should only be called with VK version 1.1 and greater - vulkan::CreateEmptyInstance(data->allocator(), &wrapper, - VK_MAKE_VERSION(1, 1, 0))); - vulkan::VkDevice device( - vulkan::CreateDefaultDevice(data->allocator(), instance)); - vulkan::VkCommandPool pool( - vulkan::CreateDefaultCommandPool(data->allocator(), device, false)); - - { device->vkTrimCommandPool(device, pool, 0); } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/command_buffer_tests/vkTrimCommandPool_test/vkTrimCommandPool.py b/gapid_tests/command_buffer_tests/vkTrimCommandPool_test/vkTrimCommandPool.py deleted file mode 100644 index e64efd05..00000000 --- a/gapid_tests/command_buffer_tests/vkTrimCommandPool_test/vkTrimCommandPool.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2020 Google 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. - -from gapit_test_framework import gapit_test, GapitTest -from gapit_test_framework import require, require_equal, require_not_equal - -@gapit_test("vkTrimCommandPool_test") -class TrimCommandPool(GapitTest): - - def expect(self): - """1. Expects a default command pool that is trimmed for redundant - memory""" - - architecture = self.architecture - - trim_command_pool = require(self.next_call_of("vkTrimCommandPool")) - require_not_equal(0, trim_command_pool.int_device) - require_not_equal(0, trim_command_pool.int_commandPool) - require_equal(0, trim_command_pool.flags) diff --git a/gapid_tests/extension_tests/CMakeLists.txt b/gapid_tests/extension_tests/CMakeLists.txt deleted file mode 100644 index cb419a74..00000000 --- a/gapid_tests/extension_tests/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_vulkan_subdirectory(VK_NV_dedicated_allocation_test) diff --git a/gapid_tests/extension_tests/README.md b/gapid_tests/extension_tests/README.md deleted file mode 100644 index b6049034..00000000 --- a/gapid_tests/extension_tests/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Extension Tests - -These tests are for specific sets of extensions - -# Tests -- [VK_NV_dedicated_allocation](VK_NV_dedicated_allocation_test/README.md) \ No newline at end of file diff --git a/gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/CMakeLists.txt b/gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/CMakeLists.txt deleted file mode 100644 index d4f81ba3..00000000 --- a/gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(VK_NV_dedicated_allocation_test - SOURCES main.cpp - LIBS - vulkan_helpers -) - -add_gapid_test(VK_NV_dedicated_allocation_non_dedicated_test - SOURCES main_no_dedicated.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/README.md b/gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/README.md deleted file mode 100644 index 408fae1c..00000000 --- a/gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# VK_NV_dedicated_allocation - -## VkDedicatedAllocationImageCreateInfoNV -```c++ -typedef struct VkDedicatedAllocationImageCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkBool32 dedicatedAllocation; -} VkDedicatedAllocationImageCreateInfoNV; -``` - -## VkDedicatedAllocationBufferCreateInfoNV -```c++ -typedef struct VkDedicatedAllocationBufferCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkBool32 dedicatedAllocation; -} VkDedicatedAllocationBufferCreateInfoNV; -``` - -## VkDedicatedAllocationMemoryAllocateInfoNV -```c++ -typedef struct VkDedicatedAllocationMemoryAllocateInfoNV { - VkStructureType sType; - const void* pNext; - VkImage image; - VkBuffer buffer; -} VkDedicatedAllocationMemoryAllocateInfoNV; -``` - -According to the Vulkan spec: -- If `VkDedicatedAllocationBufferCreateInfoNV` is set - - bufferCreateInfo.flags must not contain - `VK_BUFFER_CREATE_SPARSE_BINDING_BIT` - `VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT` or - `VK_BUFFER_CREATE_SPARSE_ALIASED_BIT` -- If `VkDedicatedAllocationMemoryAllocateInfoNV` is set - - VkImage `must` be an image created with - `VkDedicatedAllocationImageCreateInfoNV` and `dedicatedAllocation` = `true` - - or - - VkBuffer `must` be a buffer created with - `VkDedicatedAllocationBufferCreateInfoNV` and `dedicatedAllocation` = `true` - - This memory can only be used with vkBind* on the VkImage or VBuffer it was - created with - - -These tests should test the following cases: -- [x] `VkDedicatedAllocationBufferCreateInfoNV` with dedicatedAllocation = `True` -- [x] `VkDedicatedAllocationBufferCreateInfoNV` with dedicatedAllocation = `False` -- [x] `VkDedicatedAllocationImageCreateInfoNV` with dedicatedAllocation = `True` -- [x] `VkDedicatedAllocationImageCreateInfoNV` with dedicatedAllocation = `False` -- [x] `VkDedicatedAllocationMemoryAllocateInfoNV` with `image` set -- [x] `VkDedicatedAllocationMemoryAllocateInfoNV` with `buffer` set diff --git a/gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/VK_NV_dedicated_allocation_test.py b/gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/VK_NV_dedicated_allocation_test.py deleted file mode 100644 index 8eafc7e8..00000000 --- a/gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/VK_NV_dedicated_allocation_test.py +++ /dev/null @@ -1,256 +0,0 @@ - -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from gapit_test_framework import GapidUnsupportedException -from struct_offsets import * -from vulkan_constants import * - -IMAGE_CREATE_INFO_ELEMENTS = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("imageType", UINT32_T), - ("format", UINT32_T), - ("extent_width", UINT32_T), - ("extent_height", UINT32_T), - ("extent_depth", UINT32_T), - ("mipLevels", UINT32_T), - ("arrayLayers", UINT32_T), - ("samples", UINT32_T), - ("tiling", UINT32_T), - ("usage", UINT32_T), - ("sharingMode", UINT32_T), - ("queueFamilyIndexCount", UINT32_T), - ("pQueueFamilyIndices", POINTER), - ("initialLayout", UINT32_T), -] - -BUFFER_CREATE_INFO = [ - ("sType", UINT32_T), ("pNext", POINTER), ("createFlags", UINT32_T), - ("size", DEVICE_SIZE), ("usage", UINT32_T), ("sharingMode", UINT32_T), - ("queueFamilyIndexCount", UINT32_T), ("pQueueFamilyIndices", POINTER) -] - - -DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("dedicated", BOOL32), -] - -DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("dedicated", BOOL32), -] - -DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("image", HANDLE), - ("buffer", HANDLE), -] -VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = 1000026000 -VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = 1000026001 -VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = 1000026002 - - -MEMORY_ALLOCATE_INFO = [ - ("sType", UINT32_T), ("pNext", POINTER), ("allocationSize", DEVICE_SIZE), - ("memoryTypeIndex", UINT32_T) -] - - -@gapit_test("VK_NV_dedicated_allocation_test") -class NV_Dedicated_Allocation_Image(GapitTest): - - def expect(self): - architecture = self.architecture - - create_device = self.next_call_of("vkCreateDevice") - if create_device[0] == None: - raise GapidUnsupportedException( - "VK_NV_dedicated_allocation not supported") - - create_image = require(self.nth_call_of( - "vkCreateImage", 2)) - image_create_info = VulkanStruct( - architecture, IMAGE_CREATE_INFO_ELEMENTS, - get_read_offset_function(create_image, - create_image.hex_pCreateInfo)) - - require_equal( - VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, image_create_info.sType) - - nv_image_create_info = VulkanStruct( - architecture, DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV, - get_read_offset_function(create_image, - image_create_info.pNext) - ) - require_equal( - VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV, - nv_image_create_info.sType - ) - require_equal(VK_TRUE, nv_image_create_info.dedicated) - - allocate_memory = require(self.next_call_of( - "vkAllocateMemory" - )) - - allocate_memory_info = VulkanStruct( - architecture, MEMORY_ALLOCATE_INFO, - get_read_offset_function(allocate_memory, - allocate_memory.hex_pAllocateInfo)) - - nv_allocate_memory = VulkanStruct( - architecture, DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV, - get_read_offset_function(allocate_memory, - allocate_memory_info.pNext) - ) - require_equal( - VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV, - nv_allocate_memory.sType - ) - image = little_endian_bytes_to_int( - require(create_image.get_write_data( - create_image.hex_pImage, NON_DISPATCHABLE_HANDLE_SIZE))) - - require_equal(image, nv_allocate_memory.image) - - -@gapit_test("VK_NV_dedicated_allocation_test") -class NV_Dedicated_Allocation_Buffer(GapitTest): - - def expect(self): - architecture = self.architecture - create_device = self.next_call_of("vkCreateDevice") - - if create_device[0] == None: - raise GapidUnsupportedException( - "VK_NV_dedicated_allocation not supported") - - create_buffer = require(self.nth_call_of( - "vkCreateBuffer", 4)) - buffer_create_info = VulkanStruct( - architecture, BUFFER_CREATE_INFO, - get_read_offset_function(create_buffer, - create_buffer.hex_pCreateInfo)) - - require_equal( - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, buffer_create_info.sType) - - nv_buffer_create_info = VulkanStruct( - architecture, DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV, - get_read_offset_function(create_buffer, - buffer_create_info.pNext) - ) - require_equal( - VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV, - nv_buffer_create_info.sType - ) - require_equal(VK_TRUE, nv_buffer_create_info.dedicated) - - allocate_memory = require(self.next_call_of( - "vkAllocateMemory" - )) - - allocate_memory_info = VulkanStruct( - architecture, MEMORY_ALLOCATE_INFO, - get_read_offset_function(allocate_memory, - allocate_memory.hex_pAllocateInfo)) - - nv_allocate_memory = VulkanStruct( - architecture, DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV, - get_read_offset_function(allocate_memory, - allocate_memory_info.pNext) - ) - require_equal( - VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV, - nv_allocate_memory.sType - ) - buffer = little_endian_bytes_to_int( - require(create_buffer.get_write_data( - create_buffer.hex_pBuffer, NON_DISPATCHABLE_HANDLE_SIZE))) - - require_equal(buffer, nv_allocate_memory.buffer) - - -@gapit_test("VK_NV_dedicated_allocation_non_dedicated_test") -class NV_Dedicated_Allocation_Image_Non_Dedicated(GapitTest): - - def expect(self): - architecture = self.architecture - - create_device = self.next_call_of("vkCreateDevice") - if create_device[0] == None: - raise GapidUnsupportedException( - "VK_NV_dedicated_allocation not supported") - - create_image = require(self.nth_call_of( - "vkCreateImage", 2)) - image_create_info = VulkanStruct( - architecture, IMAGE_CREATE_INFO_ELEMENTS, - get_read_offset_function(create_image, - create_image.hex_pCreateInfo)) - - require_equal( - VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, image_create_info.sType) - - nv_image_create_info = VulkanStruct( - architecture, DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV, - get_read_offset_function(create_image, - image_create_info.pNext) - ) - require_equal( - VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV, - nv_image_create_info.sType - ) - require_equal(VK_FALSE, nv_image_create_info.dedicated) - - -@gapit_test("VK_NV_dedicated_allocation_non_dedicated_test") -class NV_Dedicated_Allocation_Buffer_Non_Dedicated(GapitTest): - - def expect(self): - architecture = self.architecture - create_device = self.next_call_of("vkCreateDevice") - - if create_device[0] == None: - raise GapidUnsupportedException( - "VK_NV_dedicated_allocation not supported") - - create_buffer = require(self.nth_call_of( - "vkCreateBuffer", 4)) - buffer_create_info = VulkanStruct( - architecture, BUFFER_CREATE_INFO, - get_read_offset_function(create_buffer, - create_buffer.hex_pCreateInfo)) - - require_equal( - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, buffer_create_info.sType) - - nv_buffer_create_info = VulkanStruct( - architecture, DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV, - get_read_offset_function(create_buffer, - buffer_create_info.pNext) - ) - require_equal( - VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV, - nv_buffer_create_info.sType - ) - require_equal(VK_FALSE, nv_buffer_create_info.dedicated) diff --git a/gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/main.cpp b/gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/main.cpp deleted file mode 100644 index 12c43ff7..00000000 --- a/gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/main.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, {}, - {VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME}); - vulkan::VkDevice& device = app.device(); - if (device.is_valid()) { - data->logger()->LogInfo(VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME, - " found."); - - { // 1. Image Test - VkDedicatedAllocationImageCreateInfoNV dedicated_image_info = { - VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV, // sType - nullptr, // pNext - VK_TRUE // dedicatedAllocation - }; - - VkImageCreateInfo image_create_info = { - VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // sType - &dedicated_image_info, // pNext - 0, // flags - VK_IMAGE_TYPE_2D, // 2d image - VK_FORMAT_R8G8B8A8_UNORM, // format - {128, 128, 1}, // extent - 1, // mipLevels - 1, // arrayLayers - VK_SAMPLE_COUNT_1_BIT, // samples - VK_IMAGE_TILING_OPTIMAL, // tiling - VK_IMAGE_USAGE_TRANSFER_DST_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr, // queueFamilyIndices - VK_IMAGE_LAYOUT_UNDEFINED // initialLayout - }; - ::VkImage raw_image; - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkCreateImage(device, &image_create_info, nullptr, - &raw_image)); - vulkan::VkImage image(raw_image, nullptr, &device); - - VkMemoryRequirements memory_requirements; - device->vkGetImageMemoryRequirements(device, image, &memory_requirements); - - VkDedicatedAllocationMemoryAllocateInfoNV dedicated_allocate_info = { - VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV, - nullptr, image, VK_NULL_HANDLE}; - - VkMemoryAllocateInfo memoryAllocateInfo = { - VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, // sType - &dedicated_allocate_info, // pNext - memory_requirements.size, // size - GetMemoryIndex(&device, data->logger(), - memory_requirements.memoryTypeBits, 0)}; - ::VkDeviceMemory raw_memory; - device->vkAllocateMemory(device, &memoryAllocateInfo, nullptr, - &raw_memory); - vulkan::VkDeviceMemory memory(raw_memory, nullptr, &device); - - device->vkBindImageMemory(device, image, memory, 0); - } - { // 2. Buffer Test - VkDedicatedAllocationBufferCreateInfoNV dedicated_buffer_info = { - VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV, // sType - nullptr, // pNext - VK_TRUE // dedicatedAllocation - }; - - VkBufferCreateInfo buffer_create_info = { - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType - &dedicated_buffer_info, // pNext - 0, // flags - 1024, // size - VK_BUFFER_USAGE_TRANSFER_SRC_BIT | - VK_BUFFER_USAGE_TRANSFER_DST_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr // pQueueFamilyIndices - }; - ::VkBuffer raw_buffer; - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkCreateBuffer(device, &buffer_create_info, nullptr, - &raw_buffer)); - vulkan::VkBuffer buffer(raw_buffer, nullptr, &device); - - VkMemoryRequirements memory_requirements; - device->vkGetBufferMemoryRequirements(device, buffer, - &memory_requirements); - - VkDedicatedAllocationMemoryAllocateInfoNV dedicated_allocate_info = { - VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV, - nullptr, VK_NULL_HANDLE, buffer}; - - VkMemoryAllocateInfo memoryAllocateInfo = { - VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, // sType - &dedicated_allocate_info, // pNext - memory_requirements.size, // size - GetMemoryIndex(&device, data->logger(), - memory_requirements.memoryTypeBits, 0)}; - - ::VkDeviceMemory raw_memory; - device->vkAllocateMemory(device, &memoryAllocateInfo, nullptr, - &raw_memory); - vulkan::VkDeviceMemory memory(raw_memory, nullptr, &device); - - device->vkBindBufferMemory(device, buffer, memory, 0); - } - } else { - data->logger()->LogInfo("Disabled test due to missing ", - VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME); - } - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/main_no_dedicated.cpp b/gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/main_no_dedicated.cpp deleted file mode 100644 index c46b9cf5..00000000 --- a/gapid_tests/extension_tests/VK_NV_dedicated_allocation_test/main_no_dedicated.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, {}, - {VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME}); - vulkan::VkDevice& device = app.device(); - if (device.is_valid()) { - data->logger()->LogInfo(VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME, - " found."); - - { // 1. Image Test - VkDedicatedAllocationImageCreateInfoNV dedicated_image_info = { - VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV, // sType - nullptr, // pNext - VK_FALSE // dedicatedAllocation - }; - - VkImageCreateInfo image_create_info = { - VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // sType - &dedicated_image_info, // pNext - 0, // flags - VK_IMAGE_TYPE_2D, // 2d image - VK_FORMAT_R8G8B8A8_UNORM, // format - {128, 128, 1}, // extent - 1, // mipLevels - 1, // arrayLayers - VK_SAMPLE_COUNT_1_BIT, // samples - VK_IMAGE_TILING_OPTIMAL, // tiling - VK_IMAGE_USAGE_TRANSFER_DST_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr, // queueFamilyIndices - VK_IMAGE_LAYOUT_UNDEFINED // initialLayout - }; - ::VkImage raw_image; - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkCreateImage(device, &image_create_info, nullptr, - &raw_image)); - vulkan::VkImage image(raw_image, nullptr, &device); - - VkMemoryRequirements memory_requirements; - device->vkGetImageMemoryRequirements(device, image, &memory_requirements); - - VkMemoryAllocateInfo memoryAllocateInfo = { - VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, nullptr, - memory_requirements.size, - GetMemoryIndex(&device, data->logger(), - memory_requirements.memoryTypeBits, 0)}; - ::VkDeviceMemory raw_memory; - device->vkAllocateMemory(device, &memoryAllocateInfo, nullptr, - &raw_memory); - vulkan::VkDeviceMemory memory(raw_memory, nullptr, &device); - - device->vkBindImageMemory(device, image, memory, 0); - } - { // 2. Buffer Test - VkDedicatedAllocationBufferCreateInfoNV dedicated_buffer_info = { - VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV, // sType - nullptr, // pNext - VK_FALSE // dedicatedAllocation - }; - - VkBufferCreateInfo buffer_create_info = { - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType - &dedicated_buffer_info, // pNext - 0, // flags - 1024, // size - VK_BUFFER_USAGE_TRANSFER_SRC_BIT | - VK_BUFFER_USAGE_TRANSFER_DST_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr // pQueueFamilyIndices - }; - ::VkBuffer raw_buffer; - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkCreateBuffer(device, &buffer_create_info, nullptr, - &raw_buffer)); - vulkan::VkBuffer buffer(raw_buffer, nullptr, &device); - - VkMemoryRequirements memory_requirements; - device->vkGetBufferMemoryRequirements(device, buffer, - &memory_requirements); - - VkMemoryAllocateInfo memoryAllocateInfo = { - VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, nullptr, - memory_requirements.size, - GetMemoryIndex(&device, data->logger(), - memory_requirements.memoryTypeBits, 0)}; - - ::VkDeviceMemory raw_memory; - device->vkAllocateMemory(device, &memoryAllocateInfo, nullptr, - &raw_memory); - vulkan::VkDeviceMemory memory(raw_memory, nullptr, &device); - - device->vkBindBufferMemory(device, buffer, memory, 0); - } - } else { - data->logger()->LogInfo("Disabled test due to missing ", - VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME); - } - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/initialization_tests/CMakeLists.txt b/gapid_tests/initialization_tests/CMakeLists.txt deleted file mode 100644 index 4a7dba0c..00000000 --- a/gapid_tests/initialization_tests/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_vulkan_subdirectory(vkCreateDevice) -add_vulkan_subdirectory(vkCreateInstance) diff --git a/gapid_tests/initialization_tests/README.md b/gapid_tests/initialization_tests/README.md deleted file mode 100644 index 9521ccf0..00000000 --- a/gapid_tests/initialization_tests/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Initialization Tests - -These tests are specifically for testing functionality revolving around -the creation and destruction of Vulkan Objects. - -# Tests -- [vkCreateInstance](vkCreateInstance/README.md) -- [vkCreateDevice](vkCreateDevice/README.md) diff --git a/gapid_tests/initialization_tests/vkCreateDevice/CMakeLists.txt b/gapid_tests/initialization_tests/vkCreateDevice/CMakeLists.txt deleted file mode 100644 index 22ed14b0..00000000 --- a/gapid_tests/initialization_tests/vkCreateDevice/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCreateDevice_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/initialization_tests/vkCreateDevice/README.md b/gapid_tests/initialization_tests/vkCreateDevice/README.md deleted file mode 100644 index 436ede3c..00000000 --- a/gapid_tests/initialization_tests/vkCreateDevice/README.md +++ /dev/null @@ -1,106 +0,0 @@ -# vkCreateDevice / vkDestroyDevice - -## Signatures -```c++ -VkResult vkCreateDevice( - VkPhysicalDevice physicalDevice, - const VkDeviceCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkDevice* pDevice); -``` - -## VkDeviceCreateInfo -```c++ -typedef struct VkDeviceCreateInfo { - VkStructureType sType; - const void* pNext; - VkDeviceCreateFlags flags; - uint32_t queueCreateInfoCount; - const VkDeviceQueueCreateInfo* pQueueCreateInfos; - uint32_t enabledLayerCount; - const char* const* ppEnabledLayerNames; - uint32_t enabledExtensionCount; - const char* const* ppEnabledExtensionNames; - const VkPhysicalDeviceFeatures* pEnabledFeatures; -} VkDeviceCreateInfo; -``` - -## VkDeviceQueueCreateInfo -```c++ -typedef struct VkDeviceQueueCreateInfo { - VkStructureType sType; - const void* pNext; - VkDeviceQueueCreateFlags flags; - uint32_t queueFamilyIndex; - uint32_t queueCount; - const float* pQueuePriorities; -} VkDeviceQueueCreateInfo; -``` - -## VkPhysicalDeviceFeatures -```c++ -typedef struct VkPhysicalDeviceFeatures { - VkBool32 robustBufferAccess; - VkBool32 fullDrawIndexUint32; - VkBool32 imageCubeArray; - VkBool32 independentBlend; - VkBool32 geometryShader; - VkBool32 tessellationShader; - VkBool32 sampleRateShading; - VkBool32 dualSrcBlend; - VkBool32 logicOp; - VkBool32 multiDrawIndirect; - VkBool32 drawIndirectFirstInstance; - VkBool32 depthClamp; - VkBool32 depthBiasClamp; - VkBool32 fillModeNonSolid; - VkBool32 depthBounds; - VkBool32 wideLines; - VkBool32 largePoints; - VkBool32 alphaToOne; - VkBool32 multiViewport; - VkBool32 samplerAnisotropy; - VkBool32 textureCompressionETC2; - VkBool32 textureCompressionASTC_LDR; - VkBool32 textureCompressionBC; - VkBool32 occlusionQueryPrecise; - VkBool32 pipelineStatisticsQuery; - VkBool32 vertexPipelineStoresAndAtomics; - VkBool32 fragmentStoresAndAtomics; - VkBool32 shaderTessellationAndGeometryPointSize; - VkBool32 shaderImageGatherExtended; - VkBool32 shaderStorageImageExtendedFormats; - VkBool32 shaderStorageImageMultisample; - VkBool32 shaderStorageImageReadWithoutFormat; - VkBool32 shaderStorageImageWriteWithoutFormat; - VkBool32 shaderUniformBufferArrayDynamicIndexing; - VkBool32 shaderSampledImageArrayDynamicIndexing; - VkBool32 shaderStorageBufferArrayDynamicIndexing; - VkBool32 shaderStorageImageArrayDynamicIndexing; - VkBool32 shaderClipDistance; - VkBool32 shaderCullDistance; - VkBool32 shaderFloat64; - VkBool32 shaderInt64; - VkBool32 shaderInt16; - VkBool32 shaderResourceResidency; - VkBool32 shaderResourceMinLod; - VkBool32 sparseBinding; - VkBool32 sparseResidencyBuffer; - VkBool32 sparseResidencyImage2D; - VkBool32 sparseResidencyImage3D; - VkBool32 sparseResidency2Samples; - VkBool32 sparseResidency4Samples; - VkBool32 sparseResidency8Samples; - VkBool32 sparseResidency16Samples; - VkBool32 sparseResidencyAliased; - VkBool32 variableMultisampleRate; - VkBool32 inheritedQueries; -} VkPhysicalDeviceFeatures; -``` - -These tests should test the following cases: -- [x] `queueCreateInfoCount` of value 1 or greater -- [ ] `enabledLayerCount` 0 or >0 -- [ ] `enabledExtensionCount` 0 or >0 -- [ ] `enabledFeatures` Null or Not -- [x] `queueCount` 1 or greater diff --git a/gapid_tests/initialization_tests/vkCreateDevice/main.cpp b/gapid_tests/initialization_tests/vkCreateDevice/main.cpp deleted file mode 100644 index 02ee471e..00000000 --- a/gapid_tests/initialization_tests/vkCreateDevice/main.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/containers/vector.h" -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_wrapper/device_wrapper.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateEmptyInstance(data->allocator(), &wrapper)); - containers::vector devices( - vulkan::GetPhysicalDevices(data->allocator(), instance), - data->allocator()); - - float priority = 1.f; - VkDeviceQueueCreateInfo queue_info{ - VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 0, // queueFamilyIndex - 1, // queueCount - &priority // pQueuePriorities - }; - - VkDeviceCreateInfo info{ - VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 0, // queueCreateInfoCount - nullptr, // pQueueCreateInfo - 0, // enabledLayerNames - nullptr, // ppEnabledLayerNames - 0, // enabledExtensionCount - nullptr, // ppEnabledextensionNames - nullptr // pEnalbedFeatures - }; - - { - info.queueCreateInfoCount = 1; - info.pQueueCreateInfos = &queue_info; - ::VkDevice raw_device; - LOG_EXPECT(==, data->logger(), instance->vkCreateDevice(devices[0], &info, - nullptr, &raw_device), - VK_SUCCESS); - - vulkan::VkDevice device(data->allocator(), raw_device, nullptr, - &instance); - } - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/initialization_tests/vkCreateDevice/vkCreateDevice_test.py b/gapid_tests/initialization_tests/vkCreateDevice/vkCreateDevice_test.py deleted file mode 100644 index 5a164005..00000000 --- a/gapid_tests/initialization_tests/vkCreateDevice/vkCreateDevice_test.py +++ /dev/null @@ -1,132 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_write_offset_function -from gapit_test_framework import get_read_offset_function -from vulkan_constants import * -from struct_offsets import VulkanStruct, UINT32_T, UINT64_T, ARRAY, POINTER, FLOAT - -DEVICE_CREATE_INFO = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("queueCreateInfoCount", UINT32_T), - ("pQueueCreateInfos", POINTER), - ("enabledLayerCount", UINT32_T), - ("ppEnabledLayerNames", POINTER), - ("enabledExtensionCount", UINT32_T), - ("ppEnabledExtensionNames", POINTER), - ("pEnabledFeatures", POINTER), -] - -DEVICE_QUEUE_CREATE_INFO = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("queueFamilyIndex", UINT32_T), - ("queueCount", UINT32_T), - ("pQueuePriorities", POINTER), -] - - -def GetPhysicalDevices(test, architecture): - # first call to enumerate physical devices - first_enumerate_physical_devices = require(test.next_call_of( - "vkEnumeratePhysicalDevices")) - require_equal(VK_SUCCESS, int(first_enumerate_physical_devices.return_val)) - require_not_equal(0, first_enumerate_physical_devices.int_instance) - require_not_equal(0, - first_enumerate_physical_devices.hex_pPhysicalDeviceCount) - require_equal(0, first_enumerate_physical_devices.hex_pPhysicalDevices) - - num_phy_devices = little_endian_bytes_to_int(require( - first_enumerate_physical_devices.get_write_data( - first_enumerate_physical_devices.hex_pPhysicalDeviceCount, - architecture.int_integerSize))) - - # second call to enumerate physical devices - second_enumerate_physical_devices = require(test.next_call_of( - "vkEnumeratePhysicalDevices")) - require_equal( - VK_SUCCESS, int(second_enumerate_physical_devices.return_val)) - require_not_equal(0, second_enumerate_physical_devices.int_instance) - require_not_equal( - 0, second_enumerate_physical_devices.hex_pPhysicalDeviceCount) - require_not_equal( - 0, second_enumerate_physical_devices.hex_pPhysicalDevices) - require_not_equal(0, num_phy_devices) - PHYSICAL_DEVICES = [("physicalDevices", ARRAY, num_phy_devices, POINTER)] - returned_physical_devices = VulkanStruct( - architecture, PHYSICAL_DEVICES, get_write_offset_function( - second_enumerate_physical_devices, - second_enumerate_physical_devices.hex_pPhysicalDevices)) - return returned_physical_devices.physicalDevices - - -@gapit_test("vkCreateDevice_test") -class OneQueueDevice(GapitTest): - - def expect(self): - arch = self.architecture - physical_devices = GetPhysicalDevices(self, arch) - - create_device = require(self.nth_call_of("vkCreateDevice", 1)) - require_equal( - True, create_device.int_physicalDevice in physical_devices) - require_not_equal(0, create_device.hex_pCreateInfo) - require_equal(0, create_device.hex_pAllocator) - require_not_equal(0, create_device.hex_pDevice) - - create_info = VulkanStruct(arch, DEVICE_CREATE_INFO, - get_read_offset_function( - create_device, - create_device.hex_pCreateInfo)) - require_equal(VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, create_info.sType) - # require_equal(0, create_info.pNext) - require_equal(0, create_info.flags) - require_equal(1, create_info.queueCreateInfoCount) - require_not_equal(0, create_info.pQueueCreateInfos) - require_equal(0, create_info.enabledLayerCount) - require_equal(0, create_info.ppEnabledLayerNames) - require_equal(0, create_info.enabledExtensionCount) - require_equal(0, create_info.ppEnabledExtensionNames) - require_equal(0, create_info.pEnabledFeatures) - - DEVICE = [("device", POINTER)] - device = VulkanStruct(arch, DEVICE, get_write_offset_function( - create_device, create_device.hex_pDevice)).device - require_not_equal(0, device) - - queue_create_info = VulkanStruct(arch, DEVICE_QUEUE_CREATE_INFO, - get_read_offset_function( - create_device, - create_info.pQueueCreateInfos)) - require_equal( - VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, queue_create_info.sType) - # require_equal(0, queue_create_info.pNext) - require_equal(0, queue_create_info.flags) - require_equal(0, queue_create_info.queueFamilyIndex) - require_equal(1, queue_create_info.queueCount) - require_not_equal(0, queue_create_info.pQueuePriorities) - - PRIORITY = [("priority", FLOAT)] - priority = VulkanStruct(arch, PRIORITY, - get_read_offset_function(create_device, queue_create_info.pQueuePriorities)).priority - require_equal(1.0, priority) - - destroy_device = require(self.next_call_of("vkDestroyDevice")) - require_equal(device, destroy_device.int_device) - require_equal(0, destroy_device.hex_pAllocator) diff --git a/gapid_tests/initialization_tests/vkCreateInstance/CMakeLists.txt b/gapid_tests/initialization_tests/vkCreateInstance/CMakeLists.txt deleted file mode 100644 index 09c19615..00000000 --- a/gapid_tests/initialization_tests/vkCreateInstance/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCreateInstance_NullApp_test - SOURCES null_create_info.cpp - LIBS - vulkan_wrapper -) - -add_gapid_test(vkCreateInstance_NonNullApp_test - SOURCES non_null_create_info.cpp - LIBS - vulkan_wrapper -) diff --git a/gapid_tests/initialization_tests/vkCreateInstance/README.md b/gapid_tests/initialization_tests/vkCreateInstance/README.md deleted file mode 100644 index 2c011fc9..00000000 --- a/gapid_tests/initialization_tests/vkCreateInstance/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# vkCreateInstance / vkDestroyInstance - -## Signatures -```c++ -VkResult vkCreateInstance( - const VkInstanceCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkInstance* pInstance); - -void vkDestroyInstance( - VkInstance instance, - const VkAllocationCallbacks* pAllocator); -``` - -## VkInstanceCreateInfo -```c++ -typedef struct VkInstanceCreateInfo { - VkStructureType sType; - const void* pNext; - VkInstanceCreateFlags flags; - const VkApplicationInfo* pApplicationInfo; - uint32_t enabledLayerCount; - const char* const* ppEnabledLayerNames; - uint32_t enabledExtensionCount; - const char* const* ppEnabledExtensionNames; -} VkInstanceCreateInfo; -``` - -## VkApplicationInfo -```c++ -typedef struct VkApplicationInfo { - VkStructureType sType; - const void* pNext; - const char* pApplicationName; - uint32_t applicationVersion; - const char* pEngineName; - uint32_t engineVersion; - uint32_t apiVersion; -} VkApplicationInfo; -``` - -These tests should test the following cases: -- [x] `pApplicationInfo` Null or not -- [ ] `enabledLayerCount` of 0 or not -- [ ] `enabledExtensionCount` of 0 or not -- [ ] `enabledLayerCount` of 0 with non-null ppEnabledLayerNames -- [ ] `enabledExtensionCount` of 0 with non-null ppEnabledLayerNames -- [ ] `pAllocator` set or not for vkCreateInstance -- [ ] `pAllocator` set or not set for vkDestroyInstance -- [ ] `pApplicationName` normal, UTF-8 or empty -- [ ] `pEngineName` normal, UTF-8 or empty -- [ ] `apiVersion` 0 or valid number \ No newline at end of file diff --git a/gapid_tests/initialization_tests/vkCreateInstance/non_null_create_info.cpp b/gapid_tests/initialization_tests/vkCreateInstance/non_null_create_info.cpp deleted file mode 100644 index 2b60df53..00000000 --- a/gapid_tests/initialization_tests/vkCreateInstance/non_null_create_info.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - { - // Test a non-nullptr pApplicationInfo - VkApplicationInfo app_info{VK_STRUCTURE_TYPE_APPLICATION_INFO, - nullptr, - "Application", - 1, - "Engine", - 0, - VK_MAKE_VERSION(1, 0, 0)}; - - VkInstanceCreateInfo info{VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, - nullptr, - 0, - &app_info, - 0, - nullptr, - 0, - nullptr}; - - VkInstance raw_instance; - wrapper.vkCreateInstance(&info, nullptr, &raw_instance); - // vulkan::VkInstance will handle destroying the instance - vulkan::VkInstance instance(data->allocator(), raw_instance, nullptr, - &wrapper); - } - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/initialization_tests/vkCreateInstance/null_create_info.cpp b/gapid_tests/initialization_tests/vkCreateInstance/null_create_info.cpp deleted file mode 100644 index f2559bb5..00000000 --- a/gapid_tests/initialization_tests/vkCreateInstance/null_create_info.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - - { - // Test a nullptr pApplicationInfo - VkInstanceCreateInfo info{VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, - nullptr, - 0, - nullptr, - 0, - nullptr, - 0, - nullptr}; - - VkInstance raw_instance; - wrapper.vkCreateInstance(&info, nullptr, &raw_instance); - // vulkan::VkInstance will handle destroying the instance - vulkan::VkInstance instance(data->allocator(), raw_instance, nullptr, - &wrapper); - } - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/initialization_tests/vkCreateInstance/vkCreateInstance_tests.py b/gapid_tests/initialization_tests/vkCreateInstance/vkCreateInstance_tests.py deleted file mode 100644 index 36b6ae1f..00000000 --- a/gapid_tests/initialization_tests/vkCreateInstance/vkCreateInstance_tests.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest -from vulkan_constants import * - - -@gapit_test("vkCreateInstance_NullApp_test") -class NullApplicationInfoTest(GapitTest): - - def expect(self): - """Expect that the applicationInfoPointer is null for the first - vkCreateInstance""" - architecture = self.architecture - - create_instance = require(self.next_call_of("vkCreateInstance")) - require_not_equal(create_instance.hex_pCreateInfo, 0) - - create_info_memory = require( - create_instance.get_read_data(create_instance.hex_pCreateInfo, - architecture.int_integerSize)) - require_equal( - little_endian_bytes_to_int(create_info_memory), - VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO) - - applicationInfoPointer = require( - create_instance.get_read_data(create_instance.hex_pCreateInfo + - architecture.int_pointerSize * 3, - architecture.int_pointerSize)) - require_equal(little_endian_bytes_to_int(applicationInfoPointer), 0) - - -@gapit_test("vkCreateInstance_NonNullApp_test") -class NonNullApplicationInfoTest(GapitTest): - - def expect(self): - """Expect that the applicationInfoPointer is not null for the second - vkCreateInstance, and that it contains some of the expected data.""" - architecture = self.architecture - - create_instance = require(self.nth_call_of("vkCreateInstance", 1)) - require_not_equal(create_instance.hex_pCreateInfo, 0) - - create_info_memory = require( - create_instance.get_read_data(create_instance.hex_pCreateInfo, - architecture.int_integerSize)) - require_equal( - little_endian_bytes_to_int(create_info_memory), - VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO) - - applicationInfoPointer = require( - create_instance.get_read_data(create_instance.hex_pCreateInfo + - architecture.int_pointerSize * 3, - architecture.int_pointerSize)) - require_not_equal(little_endian_bytes_to_int( - applicationInfoPointer), 0) - # The 2nd pointer(3rd element) in VkApplicationInfo should be the string - # Application - application_info_application_name_ptr = require( - create_instance.get_read_data( - little_endian_bytes_to_int(applicationInfoPointer) + 2 * - architecture.int_pointerSize, architecture.int_pointerSize)) - application_name = require( - create_instance.get_read_string( - little_endian_bytes_to_int( - application_info_application_name_ptr))) - require_equal(application_name, "Application") diff --git a/gapid_tests/null_destruction_tests/CMakeLists.txt b/gapid_tests/null_destruction_tests/CMakeLists.txt deleted file mode 100644 index bd69149f..00000000 --- a/gapid_tests/null_destruction_tests/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_vulkan_subdirectory(vkDestroyNullHandles) diff --git a/gapid_tests/null_destruction_tests/README.md b/gapid_tests/null_destruction_tests/README.md deleted file mode 100644 index 281dd5fb..00000000 --- a/gapid_tests/null_destruction_tests/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# NullDestruction Tests - -These tests are specifically for testing that -`VkDestroy*(VK_NULL_HANDLE)` work. These are all in one place -since some drivers fail all of them. diff --git a/gapid_tests/null_destruction_tests/vkDestroyNullHandles/CMakeLists.txt b/gapid_tests/null_destruction_tests/vkDestroyNullHandles/CMakeLists.txt deleted file mode 100644 index c17dc200..00000000 --- a/gapid_tests/null_destruction_tests/vkDestroyNullHandles/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkDestroyNullHandles_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/null_destruction_tests/vkDestroyNullHandles/main.cpp b/gapid_tests/null_destruction_tests/vkDestroyNullHandles/main.cpp deleted file mode 100644 index d11d8f7c..00000000 --- a/gapid_tests/null_destruction_tests/vkDestroyNullHandles/main.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/containers/vector.h" -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_wrapper/device_wrapper.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateEmptyInstance(data->allocator(), &wrapper)); - containers::vector devices( - vulkan::GetPhysicalDevices(data->allocator(), instance), - data->allocator()); - - float priority = 1.f; - VkDeviceQueueCreateInfo queue_info{ - VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 0, // queueFamilyIndex - 1, // queueCount - &priority // pQueuePriorities - }; - - VkDeviceCreateInfo info{ - VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 0, // queueCreateInfoCount - nullptr, // pQueueCreateInfo - 0, // enabledLayerNames - nullptr, // ppEnabledLayerNames - 0, // enabledExtensionCount - nullptr, // ppEnabledextensionNames - nullptr // pEnalbedFeatures - }; - - { - info.queueCreateInfoCount = 1; - info.pQueueCreateInfos = &queue_info; - ::VkDevice raw_device; - LOG_EXPECT(==, data->logger(), instance->vkCreateDevice(devices[0], &info, - nullptr, &raw_device), - VK_SUCCESS); - - vulkan::VkDevice device( - vulkan::CreateDefaultDevice(data->allocator(), instance, false)); - - if (NOT_DEVICE(data->logger(), device, vulkan::NvidiaK2200, 0x5bce4000) && - NOT_DEVICE(data->logger(), device, vulkan::Nvidia965M, 0x5c4f4000)) { - device->vkDestroyPipelineCache( - device, static_cast(VK_NULL_HANDLE), nullptr); - VkDescriptorPoolSize pool_size = {VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1}; - vulkan::VkDescriptorPool pool = - CreateDescriptorPool(&device, 1, &pool_size, 1); - ::VkDescriptorPool raw_pool = pool.get_raw_object(); - - ::VkDescriptorSet sets[2] = {VK_NULL_HANDLE, VK_NULL_HANDLE}; - device->vkFreeDescriptorSets(device, raw_pool, 2, sets); - - device->vkDestroyBuffer(device, (VkBuffer)VK_NULL_HANDLE, nullptr); - - device->vkDestroyBufferView(device, (VkBufferView)VK_NULL_HANDLE, - nullptr); - - device->vkDestroyDescriptorSetLayout( - device, (VkDescriptorSetLayout)VK_NULL_HANDLE, nullptr); - - device->vkDestroyImage(device, (VkImage)VK_NULL_HANDLE, nullptr); - - device->vkDestroyImageView(device, (VkImageView)VK_NULL_HANDLE, nullptr); - - device->vkDestroyQueryPool(device, (VkQueryPool)VK_NULL_HANDLE, nullptr); - device->vkDestroySampler(device, (VkSampler)VK_NULL_HANDLE, nullptr); - device->vkDestroyDescriptorPool(device, (VkDescriptorPool)VK_NULL_HANDLE, - nullptr); - device->vkFreeMemory(device, VkDeviceMemory(VK_NULL_HANDLE), nullptr); - device->vkDestroyPipelineCache( - device, static_cast(VK_NULL_HANDLE), nullptr); - - device->vkDestroySemaphore(device, (VkSemaphore)VK_NULL_HANDLE, nullptr); - - device->vkDestroyFramebuffer( - device, static_cast(VK_NULL_HANDLE), nullptr); - device->vkDestroyPipelineLayout( - device, static_cast(VK_NULL_HANDLE), nullptr); - - device->vkDestroyRenderPass( - device, static_cast(VK_NULL_HANDLE), nullptr); - - device->vkDestroyShaderModule( - device, static_cast(VK_NULL_HANDLE), nullptr); - - device->vkDestroyFence(device, (VkFence)VK_NULL_HANDLE, nullptr); - - // These things also fail on Android 7.1 - if (NOT_ANDROID_VERSION(data, "7.1.1")) { - device->vkDestroySwapchainKHR(device, (VkSwapchainKHR)VK_NULL_HANDLE, - nullptr); - } - } - } - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/null_destruction_tests/vkDestroyNullHandles/vkDestroyNullHandles_tests.py b/gapid_tests/null_destruction_tests/vkDestroyNullHandles/vkDestroyNullHandles_tests.py deleted file mode 100644 index 63849e1c..00000000 --- a/gapid_tests/null_destruction_tests/vkDestroyNullHandles/vkDestroyNullHandles_tests.py +++ /dev/null @@ -1,127 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_write_offset_function -from gapit_test_framework import get_read_offset_function -from vulkan_constants import * -from struct_offsets import VulkanStruct, UINT32_T, UINT64_T, ARRAY, POINTER, FLOAT -from gapit_test_framework import NVIDIA_K2200, NVIDIA_965M - - -@gapit_test("vkDestroyNullHandles_test") -class AllDestroy(GapitTest): - - def expect(self): - arch = self.architecture - device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - - if (self.not_device(device_properties, 0x5BCE4000, NVIDIA_K2200) and - self.not_device(device_properties, 0x5BCE4000, NVIDIA_965M)): - destroy_pipeline_cache=require( - self.next_call_of("vkDestroyPipelineCache")) - require_not_equal(0, destroy_pipeline_cache.int_device) - require_equal(0, destroy_pipeline_cache.int_pipelineCache) - - free_descriptor_set=require( - self.next_call_of("vkFreeDescriptorSets")) - p_sets=free_descriptor_set.hex_pDescriptorSets - for i in range(2): - actual_set=little_endian_bytes_to_int( - require(free_descriptor_set.get_read_data( - p_sets + NON_DISPATCHABLE_HANDLE_SIZE * i, - NON_DISPATCHABLE_HANDLE_SIZE))) - require_equal(0, actual_set) - - destroy_buffer=require(self.next_call_of("vkDestroyBuffer")) - require_not_equal(0, destroy_buffer.int_device) - require_equal(0, destroy_buffer.int_buffer) - - destroy_null_buffer_view=require(self.next_call_of( - "vkDestroyBufferView")) - require_not_equal(0, destroy_null_buffer_view.int_device) - require_equal(0, destroy_null_buffer_view.int_bufferView) - - destroy_descriptor_set_layout=require(self.next_call_of( - "vkDestroyDescriptorSetLayout")) - require_equal(0, - destroy_descriptor_set_layout.int_descriptorSetLayout) - - destroy_image=require(self.next_call_of("vkDestroyImage")) - require_equal(0, destroy_image.int_image) - - destroy_image_view=require( - self.next_call_of("vkDestroyImageView")) - require_equal(0, destroy_image_view.int_imageView) - - destroy_null_query_pool=require(self.next_call_of( - "vkDestroyQueryPool")) - require_not_equal(0, destroy_null_query_pool.int_device) - require_equal(0, destroy_null_query_pool.int_queryPool) - - destroy_sampler=require( - self.next_call_of("vkDestroySampler")) - require_equal(0, destroy_sampler.int_sampler) - - destroy_descriptor_pool=require( - self.next_call_of("vkDestroyDescriptorPool")) - require_equal(0, destroy_descriptor_pool.int_descriptorPool) - - free_memory=require(self.next_call_of("vkFreeMemory")) - require_not_equal(0, free_memory.int_device) - require_equal(0, free_memory.int_memory) - - destroy_pipeline_cache=require(self.next_call_of( - "vkDestroyPipelineCache")) - require_not_equal(0, destroy_pipeline_cache.int_device) - require_equal(0, destroy_pipeline_cache.int_pipelineCache) - - destroy_semaphore_null=require( - self.next_call_of("vkDestroySemaphore")) - require_equal(0, destroy_semaphore_null.int_semaphore) - - destroy_framebuffer=require( - self.next_call_of("vkDestroyFramebuffer")) - require_equal(0, destroy_framebuffer.int_framebuffer) - require_not_equal(0, destroy_framebuffer.int_device) - require_equal(0, destroy_framebuffer.hex_pAllocator) - - destroy_pipeline=require( - self.next_call_of("vkDestroyPipelineLayout")) - require_equal(0, destroy_pipeline.int_pipelineLayout) - require_not_equal(0, destroy_pipeline.int_device) - require_equal(0, destroy_pipeline.hex_pAllocator) - - destroy_render_pass=require( - self.next_call_of("vkDestroyRenderPass")) - require_equal(0, destroy_render_pass.int_renderPass) - require_not_equal(0, destroy_render_pass.int_device) - - destroy_shader_module=require( - self.next_call_of("vkDestroyShaderModule")) - require_not_equal(0, destroy_shader_module.int_device) - require_equal(0, destroy_shader_module.int_shaderModule) - - destroy_fence=require(self.next_call_of("vkDestroyFence")) - require_not_equal(0, destroy_fence.int_device) - require_equal(0, destroy_fence.int_fence) - require_equal(0, destroy_fence.hex_pAllocator) - - # Things that fail on android 7.1.1 - if self.not_android_version("7.1.1"): - destroySwapchain=require(self.next_call_of( - "vkDestroySwapchainKHR")) - require_equal(0, destroySwapchain.int_swapchain) diff --git a/gapid_tests/resource_acquisition_tests/CMakeLists.txt b/gapid_tests/resource_acquisition_tests/CMakeLists.txt deleted file mode 100644 index ea4eda8c..00000000 --- a/gapid_tests/resource_acquisition_tests/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -add_vulkan_subdirectory(vkGetDeviceQueue) -add_vulkan_subdirectory(vkGetSwapchainImagesKHR_test) -add_vulkan_subdirectory(vkAcquireNextImageKHR_test) -add_vulkan_subdirectory(vkGetPipelineCacheData_test) -add_vulkan_subdirectory(vkGetQueryPoolResults_test) -add_vulkan_subdirectory(vkGetImageSparseMemoryRequirements_test) -add_vulkan_subdirectory(vkGetImageSubresourceLayout_test) -add_vulkan_subdirectory(vkGetRenderAreaGranularity_test) diff --git a/gapid_tests/resource_acquisition_tests/README.md b/gapid_tests/resource_acquisition_tests/README.md deleted file mode 100644 index 22bdaa75..00000000 --- a/gapid_tests/resource_acquisition_tests/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Resource Acquisition Tests - -These tests are specifically for testing functionality revolving around -the acquisition of vulkan resources. - -# Tests -- [vkAcquireNextImageKHR_test](vkAcquireNextImageKHR_test/README.md) -- [vkGetDeviceQueue](vkGetDeviceQueue/README.md) -- [vkGetImageSparseMemoryRequirements_test](vkGetImageSparseMemoryRequirements_test/README.md) -- [vkGetImageSubresourceLayout_test](vkGetImageSubresourceLayout_test/README.md) -- [vkGetPipelineCacheData_test](vkGetPipelineCacheData_test/README.md) -- [vkGetQueryPoolResults_test](vkGetQueryPoolResults_test/README.md) -- [vkGetRenderAreaGranularity_test](vkGetRenderAreaGranularity_test/README.md) -- [vkGetSwapchainImagesKHR_test](vkGetSwapchainImagesKHR_test/README.md) - diff --git a/gapid_tests/resource_acquisition_tests/vkAcquireNextImageKHR_test/CMakeLists.txt b/gapid_tests/resource_acquisition_tests/vkAcquireNextImageKHR_test/CMakeLists.txt deleted file mode 100644 index 8b1ac07a..00000000 --- a/gapid_tests/resource_acquisition_tests/vkAcquireNextImageKHR_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkAcquireNextImageKHR_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_acquisition_tests/vkAcquireNextImageKHR_test/README.md b/gapid_tests/resource_acquisition_tests/vkAcquireNextImageKHR_test/README.md deleted file mode 100644 index 02654ca2..00000000 --- a/gapid_tests/resource_acquisition_tests/vkAcquireNextImageKHR_test/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# vkAcquireNextImageKHR - -## Signatures -```c++ -VkResult vkAcquireNextImageKHR( - VkDevice device, - VkSwapchainKHR swapchain, - uint64_t timeout, - VkSemaphore semaphore, - VkFence fence, - uint32_t* pImageIndex); -``` - -According to the Vulkan spec: -- `device` is the device associated with `swapchain`, it **must** be a valid -`VkDevice` handle -- `swapchain` **must** be a valid `VkSwapchainKHR` handle -- If `semaphore` is not `VK_NULL_HANDLE`, `semaphore` **must** be a valid -`VkSemaphore` handle that **must** have been created, allocated, or retrieved -from `device` -- If `fence` is not `VK_NULL_HANDLE`, `fence` **must** be a valid `VkFence` -handle that **must** have been created, allocated, or retrieved from `device` -- `pImageIndex` **must** be a pointer to a `uint32_t` value -- Host access to `swapchain`, `semaphore` and `fence` **must** be externally -synchronized - - -These tests should test the following cases: -- [ ] non-Null `semaphore` and non-Null `fence` -- [x] non-Null `semaphore` and Null `fence` -- [ ] Null `semaphore` and non-Null `fence` diff --git a/gapid_tests/resource_acquisition_tests/vkAcquireNextImageKHR_test/main.cpp b/gapid_tests/resource_acquisition_tests/vkAcquireNextImageKHR_test/main.cpp deleted file mode 100644 index 287dd840..00000000 --- a/gapid_tests/resource_acquisition_tests/vkAcquireNextImageKHR_test/main.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/vulkan_application.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - vulkan::VkDevice& device = app.device(); - { - // 1. Acquire the next image with one semaphore but no fence - ::VkSemaphore raw_semaphore; - VkSemaphoreCreateInfo semaphore_create_info{ - VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, // sType - NULL, // pNext - 0, // flags - }; - device->vkCreateSemaphore(device, &semaphore_create_info, nullptr, - &raw_semaphore); - vulkan::VkSemaphore semaphore(raw_semaphore, nullptr, &device); - - uint32_t image_index = 0; - device->vkAcquireNextImageKHR(device, app.swapchain(), 10u, semaphore, - (::VkFence)VK_NULL_HANDLE, &image_index); - data->logger()->LogInfo("Next image index: ", image_index); - - // Begin and end an command buffer and submit the queue so that we can - // safely destroy the semaphore - vulkan::VkCommandBuffer cmd_buf = app.GetCommandBuffer(); - ::VkCommandBuffer raw_cmd_buf = cmd_buf.get_command_buffer(); - VkCommandBufferBeginInfo info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType - nullptr, // pNext - 0, // flags - nullptr, // pInheritanceInfo - }; - cmd_buf->vkBeginCommandBuffer(cmd_buf, &info); - cmd_buf->vkEndCommandBuffer(cmd_buf); - VkPipelineStageFlags pipe_stage_flags = - VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; - VkSubmitInfo submit_info{ - VK_STRUCTURE_TYPE_SUBMIT_INFO, // sType - NULL, // pNext - 1, // waitSemaphoreCount - &raw_semaphore, // pWaitSemaphores - &pipe_stage_flags, // pWaitDstStageMask - 1, // commandBufferCount - &raw_cmd_buf, // pCommandBuffers - 0, // signalSemaphoreCount - NULL, // pSignalSemaphores - }; - app.present_queue()->vkQueueSubmit(app.present_queue(), 1, &submit_info, - (::VkFence)VK_NULL_HANDLE); - app.present_queue()->vkQueueWaitIdle(app.present_queue()); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_acquisition_tests/vkAcquireNextImageKHR_test/vkAcquireNextImageKHR_test.py b/gapid_tests/resource_acquisition_tests/vkAcquireNextImageKHR_test/vkAcquireNextImageKHR_test.py deleted file mode 100644 index c2da00c7..00000000 --- a/gapid_tests/resource_acquisition_tests/vkAcquireNextImageKHR_test/vkAcquireNextImageKHR_test.py +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest -import gapit_test_framework -from vulkan_constants import * - - -@gapit_test("vkAcquireNextImageKHR_test") -class AcquireNextImageWithSemaphoreNoFence(GapitTest): - def expect(self): - """1. Expects a call of vkAcquireNextImageKHR() with semaphore and no - fence.""" - acquire_next_image = require(self.nth_call_of("vkAcquireNextImageKHR", - 1)) - require_equal(acquire_next_image.return_val, VK_SUCCESS) - - require_not_equal(0, acquire_next_image.int_device) - require_not_equal(0, acquire_next_image.int_swapchain) - require_equal(10, acquire_next_image.int_timeout) - require_not_equal(0, acquire_next_image.int_semaphore) - require_equal(0, acquire_next_image.int_fence) - require_not_equal(0, acquire_next_image.hex_pImageIndex) - - next_image_index = little_endian_bytes_to_int(require( - acquire_next_image.get_write_data( - acquire_next_image.hex_pImageIndex, 4))) - require_equal(0, next_image_index) diff --git a/gapid_tests/resource_acquisition_tests/vkGetDeviceQueue/CMakeLists.txt b/gapid_tests/resource_acquisition_tests/vkGetDeviceQueue/CMakeLists.txt deleted file mode 100644 index f594743d..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetDeviceQueue/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkGetDeviceQueue_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_acquisition_tests/vkGetDeviceQueue/README.md b/gapid_tests/resource_acquisition_tests/vkGetDeviceQueue/README.md deleted file mode 100644 index 553c1d29..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetDeviceQueue/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# vkGetDeviceQueue - -## Signatures -```c++ -void vkGetDeviceQueue( - VkDevice device, - uint32_t queueFamilyIndex, - uint32_t queueIndex, - VkQueue* pQueue); -``` - -According to the Vulkan spec: -- `queueFamilyIndex` **must** be one of the queue family indices specified when - device was created, via the `VkDeviceQueueCreateInfo` structure -- `queueIndex` **must** be less than the number of queues created for the - specified queue family index when device was created, via the `queueCount` - member of the `VkDeviceQueueCreateInfo` structure - -These tests should test the following cases: -- [ ] `queueFamilyIndex` == 0 -- [ ] `queueFamilyIndex` > 0 -- [x] `queueIndex` == 0 -- [ ] `queueIndex` == `queueCount` - 1 diff --git a/gapid_tests/resource_acquisition_tests/vkGetDeviceQueue/main.cpp b/gapid_tests/resource_acquisition_tests/vkGetDeviceQueue/main.cpp deleted file mode 100644 index 17202ff8..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetDeviceQueue/main.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateEmptyInstance(data->allocator(), &wrapper)); - vulkan::VkDevice device( - vulkan::CreateDefaultDevice(data->allocator(), instance)); - - { - VkQueue queue = {}; - device->vkGetDeviceQueue(device, 0, 0, &queue); - data->logger()->LogInfo(" VkQueue: ", queue); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_acquisition_tests/vkGetDeviceQueue/vkGetDeviceQueue_test.py b/gapid_tests/resource_acquisition_tests/vkGetDeviceQueue/vkGetDeviceQueue_test.py deleted file mode 100644 index 786dbc01..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetDeviceQueue/vkGetDeviceQueue_test.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal, require_true -from gapit_test_framework import require_not_equal -from gapit_test_framework import GapitTest, get_read_offset_function -from gapit_test_framework import little_endian_bytes_to_int -from vulkan_constants import * -from struct_offsets import VulkanStruct, ARRAY, FLOAT, UINT32_T - - -@gapit_test("vkGetDeviceQueue_test") -class GetDeviceQueue(GapitTest): - - def expect(self): - arch = self.architecture - - create_device = require(self.next_call_of("vkCreateDevice")) - device = little_endian_bytes_to_int(require( - create_device.get_write_data(create_device.hex_pDevice, - arch.int_pointerSize))) - require_equal(VK_SUCCESS, int(create_device.return_val)) - require_not_equal(0, device) - - get_queue = require(self.next_call_of("vkGetDeviceQueue")) - require_equal(device, get_queue.int_device) - require_equal(0, get_queue.int_queueFamilyIndex) - require_equal(0, get_queue.int_queueIndex) - require_not_equal(0, get_queue.hex_pQueue) - - queue = little_endian_bytes_to_int(require(get_queue.get_write_data( - get_queue.hex_pQueue, arch.int_pointerSize))) - require_not_equal(0, queue) diff --git a/gapid_tests/resource_acquisition_tests/vkGetImageSparseMemoryRequirements_test/CMakeLists.txt b/gapid_tests/resource_acquisition_tests/vkGetImageSparseMemoryRequirements_test/CMakeLists.txt deleted file mode 100644 index e456214b..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetImageSparseMemoryRequirements_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkGetImageSparseMemoryRequirements_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_acquisition_tests/vkGetImageSparseMemoryRequirements_test/README.md b/gapid_tests/resource_acquisition_tests/vkGetImageSparseMemoryRequirements_test/README.md deleted file mode 100644 index c5d31da9..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetImageSparseMemoryRequirements_test/README.md +++ /dev/null @@ -1,49 +0,0 @@ -# vkGetImageSparseMemoryRequirements - -## Signatures -```c++ -void vkGetImageSparseMemoryRequirements( - VkDevice device, - VkImage image, - uint32_t* pSparseMemoryRequirementCount, - VkSparseImageMemoryRequirements* pSparseMemoryRequirements); -``` - -# VkSparseImageMemoryRequirements -```c++ -typedef struct VkSparseImageMemoryRequirements { - VkSparseImageFormatProperties formatProperties; - uint32_t imageMipTailFirstLod; - VkDeviceSize imageMipTailSize; - VkDeviceSize imageMipTailOffset; - VkDeviceSize imageMipTailStride; -} VkSparseImageMemoryRequirements; -``` - -According to the Vulkan spec: -- `device` **must** be a valid device -- `image` **must** have come from device -- `pSparseMemoryRequirementCount` is a pointer to an integer related to the - number of sparse memory requirements available or queried, as described below. -- `pSparseMemoryRequirements` is either `NULL` or a pointer to an array of - `VkSparseImageMemoryRequirements` structures. -- If `pSparseMemoryRequirements` is `NULL`, then the number of sparse memory - requirements available is returned in `pSparseMemoryRequirementCount`. - Otherwise, `pSparseMemoryRequirementCount` **must** point to a variable set - by the user to the number of elements in the `pSparseMemoryRequirements` - array, and on return the variable is overwritten with the number of - structures actually written to `pSparseMemoryRequirements`. If - `pSparseMemoryRequirementCount` is less than the number of sparse memory - requirements available, at most `pSparseMemoryRequirementCount` structures - will be written. - -These tests should test the following cases: -- [x] `pSparseMemoryRequirements` == `NULL` -- [x] `pSparseMemoryRequirements` != `NULL` -- [x] `pSparseMemoryRequirementCount` points to a value equal to the actual - number of sparse memory requirements -- [ ] `pSparseMemoryRequirementCount` points to a value less than the actual - number of sparse memory requirements -- [ ] `pSparseMemoryRequirementCount` points to a value greater than the actual - number of sparse memory requirements - diff --git a/gapid_tests/resource_acquisition_tests/vkGetImageSparseMemoryRequirements_test/main.cpp b/gapid_tests/resource_acquisition_tests/vkGetImageSparseMemoryRequirements_test/main.cpp deleted file mode 100644 index e0fb816e..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetImageSparseMemoryRequirements_test/main.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - auto allocator = data->allocator(); - vulkan::LibraryWrapper wrapper(allocator, data->logger()); - vulkan::VkInstance instance( - vulkan::CreateEmptyInstance(data->allocator(), &wrapper)); - vulkan::VkDevice device(vulkan::CreateDefaultDevice(allocator, instance)); - { - VkImageCreateInfo image_create_info{ - VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_IMAGE_TYPE_2D, // imageType - VK_FORMAT_R8G8B8A8_UNORM, // format - { - 32, // extent.width - 32, // extent.height - 1, // depth - }, - 1, // mipLevels - 1, // arrayLayers - VK_SAMPLE_COUNT_1_BIT, // samples - VK_IMAGE_TILING_OPTIMAL, // tiling - VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr, // pQueueFamilyIndices - VK_IMAGE_LAYOUT_UNDEFINED, // initialLayout - }; - ::VkImage raw_image; - device->vkCreateImage(device, &image_create_info, nullptr, &raw_image); - vulkan::VkImage image(raw_image, nullptr, &device); - - uint32_t count = 0; - device->vkGetImageSparseMemoryRequirements(device, image, &count, nullptr); - data->logger()->LogInfo(" SparseMemoryRequirementCount: ", count); - containers::vector requirements( - count, {}, data->allocator()); - device->vkGetImageSparseMemoryRequirements(device, image, &count, - requirements.data()); - for (uint32_t i = 0; i < count; i++) { - data->logger()->LogInfo(" Memory Requirement: ", i); - data->logger()->LogInfo( - " formatProperties.imageGranularity.width: ", - requirements[i].formatProperties.imageGranularity.width); - data->logger()->LogInfo( - " formatProperties.imageGranularity.height: ", - requirements[i].formatProperties.imageGranularity.height); - data->logger()->LogInfo( - " formatProperties.imageGranularity.depth: ", - requirements[i].formatProperties.imageGranularity.depth); - data->logger()->LogInfo(" imageMipTailFirstLod: ", requirements[i].imageMipTailFirstLod); - data->logger()->LogInfo(" imageMipTailSize: ", requirements[i].imageMipTailSize); - data->logger()->LogInfo(" imageMipTailOffset: ", requirements[i].imageMipTailOffset); - data->logger()->LogInfo(" imageMipTailStride: ", requirements[i].imageMipTailStride); - } - } - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_acquisition_tests/vkGetImageSparseMemoryRequirements_test/vkGetImageSparseMemoryRequirements_test.py b/gapid_tests/resource_acquisition_tests/vkGetImageSparseMemoryRequirements_test/vkGetImageSparseMemoryRequirements_test.py deleted file mode 100644 index e7c8a5cf..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetImageSparseMemoryRequirements_test/vkGetImageSparseMemoryRequirements_test.py +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_write_offset_function -from gapit_test_framework import get_read_offset_function -from vulkan_constants import * -from struct_offsets import VulkanStruct, UINT32_T, POINTER, DEVICE_SIZE - -SPRASE_IMAGE_MEMORY_REQUIREMENTS = [ - ("formatProperties_aspectMask", UINT32_T), - ("formatProperties_imageGranularity_width", UINT32_T), - ("formatProperties_imageGranularity_height", UINT32_T), - ("formatProperties_imageGranularity_depth", UINT32_T), - ("formatProperties_flags", UINT32_T), - ("imageMipTailFirstLod", UINT32_T), - ("imageMipTailSize", DEVICE_SIZE), - ("imageMipTailOffset", DEVICE_SIZE), - ("imageMipTailStride", DEVICE_SIZE), -] - - -@gapit_test("vkGetImageSparseMemoryRequirements_test") -class GetImageSparseMemoryRequirements(GapitTest): - - def expect(self): - architecture = self.architecture - first_call = require(self.next_call_of( - "vkGetImageSparseMemoryRequirements")) - require_not_equal(0, first_call.int_device) - require_not_equal(0, first_call.int_image) - require_not_equal(0, first_call.hex_pSparseMemoryRequirementCount) - require_equal(0, first_call.hex_pSparseMemoryRequirements) - count = little_endian_bytes_to_int(require(first_call.get_write_data( - first_call.hex_pSparseMemoryRequirementCount, - architecture.int_integerSize))) - - second_call = require(self.next_call_of( - "vkGetImageSparseMemoryRequirements")) - require_not_equal(0, second_call.int_device) - require_not_equal(0, second_call.int_image) - require_not_equal(0, second_call.hex_pSparseMemoryRequirementCount) - require_not_equal(0, second_call.hex_pSparseMemoryRequirements) - - offset = 0 - for i in range(count): - memory_requirements = VulkanStruct( - architecture, SPRASE_IMAGE_MEMORY_REQUIREMENTS, - get_write_offset_function( - second_call, - second_call.hex_pSparseMemoryRequirements + offset)) - offset += memory_requirements.total_size diff --git a/gapid_tests/resource_acquisition_tests/vkGetImageSubresourceLayout_test/CMakeLists.txt b/gapid_tests/resource_acquisition_tests/vkGetImageSubresourceLayout_test/CMakeLists.txt deleted file mode 100644 index 1e7611e7..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetImageSubresourceLayout_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkGetImageSubresourceLayout_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_acquisition_tests/vkGetImageSubresourceLayout_test/README.md b/gapid_tests/resource_acquisition_tests/vkGetImageSubresourceLayout_test/README.md deleted file mode 100644 index ef18f686..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetImageSubresourceLayout_test/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# vkGetImageSubresourceLayout - -## Signatures -```c++ -void vkGetImageSubresourceLayout( - VkDevice device, - VkImage image, - const VkImageSubresource* pSubresource, - VkSubresourceLayout* pLayout); -``` - -According to the Vulkan spec: -- `image` **must** have been created with `tiling` equal to `VK_IMAGE_TILING_LINEAR` -- The `aspectMask` member of `pSubresource` **must** only have a single bit set - -These tests should test the following cases: -- [x] `pSubresource` and `pLayout` of pointers to valid `VkImageSubresource` - and `VkSubresourceLayout` struct diff --git a/gapid_tests/resource_acquisition_tests/vkGetImageSubresourceLayout_test/main.cpp b/gapid_tests/resource_acquisition_tests/vkGetImageSubresourceLayout_test/main.cpp deleted file mode 100644 index 3e51befe..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetImageSubresourceLayout_test/main.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/vulkan_application.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - vulkan::VkDevice& device = app.device(); - - const VkImageType type = VK_IMAGE_TYPE_2D; - const VkFormat format = VK_FORMAT_R8G8B8A8_UNORM; - const VkDeviceSize pixel_size = 4; // match with the format - const VkImageTiling tiling = VK_IMAGE_TILING_LINEAR; - const VkImageUsageFlags usage = - VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT; - uint32_t width = 32; - uint32_t height = 32; - uint32_t depth = 1; // becaue of 2D image - uint32_t mip_level = 6; - uint32_t array_layer = 3; - - VkImageFormatProperties props; - app.instance()->vkGetPhysicalDeviceImageFormatProperties( - app.device().physical_device(), format, type, tiling, usage, 0, &props); - data->logger()->LogInfo("Physical device image format properties:"); - data->logger()->LogInfo("\tmaxExtent.width: ", props.maxExtent.width); - data->logger()->LogInfo("\tmaxExtent.height: ", props.maxExtent.height); - data->logger()->LogInfo("\tmaxExtent.depth: ", props.maxExtent.depth); - data->logger()->LogInfo("\tmaxMipLevels: ", props.maxMipLevels); - data->logger()->LogInfo("\tmaxArrayLayers: ", props.maxArrayLayers); - data->logger()->LogInfo("\tsampleCounts: ", props.sampleCounts); - - width = props.maxExtent.width < width ? props.maxExtent.width : width; - height = props.maxExtent.height < height ? props.maxExtent.height : height; - depth = props.maxExtent.depth < depth ? props.maxExtent.depth : depth; - mip_level = props.maxMipLevels < mip_level ? props.maxMipLevels : mip_level; - array_layer = - props.maxArrayLayers < array_layer ? props.maxArrayLayers : array_layer; - - if (width == 0 || height == 0 || depth == 0 || mip_level == 0 || - array_layer == 0 || (props.sampleCounts & VK_SAMPLE_COUNT_1_BIT) == 0) { - data->logger()->LogInfo( - "Linear tiling image with following type/format/usage/sample not " - "supported"); - data->logger()->LogInfo("\tformat: ", format); - data->logger()->LogInfo("\ttype: ", type); - data->logger()->LogInfo("\tusage: ", usage); - data->logger()->LogInfo("\tsample count: VK_SAMPLE_COUNT_1_BIT"); - return 0; - } - - { - // Creates an image with two layers - VkImageCreateInfo create_info{ - /* sType = */ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* imageType = */ type, - /* format = */ format, - /* extent = */ - { - /* width = */ width, - /* height = */ height, - /* depth = */ depth, - }, - /* mipLevels = */ mip_level, - /* arrayLayers = */ array_layer, - /* samples = */ VK_SAMPLE_COUNT_1_BIT, - /* tiling = */ VK_IMAGE_TILING_LINEAR, - /* usage = */ usage, - /* sharingMode = */ VK_SHARING_MODE_EXCLUSIVE, - /* queueFamilyIndexCount = */ 0, - /* pQueueFamilyIndices = */ nullptr, - /* initialLayout = */ VK_IMAGE_LAYOUT_PREINITIALIZED, - }; - - auto image = app.CreateAndBindImage(&create_info); - - auto cmdbuf = app.GetCommandBuffer(); - app.BeginCommandBuffer(&cmdbuf); - vulkan::RecordImageLayoutTransition( - *image, {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, - VK_IMAGE_LAYOUT_UNDEFINED, 0, VK_IMAGE_LAYOUT_GENERAL, - VK_ACCESS_TRANSFER_WRITE_BIT, &cmdbuf); - app.EndAndSubmitCommandBufferAndWaitForQueueIdle(&cmdbuf, - &app.render_queue()); - - uint32_t query_level = mip_level > 1 ? 1 : 0; - uint32_t query_layer = array_layer > 1 ? 1 : 0; - VkImageSubresource layer{ - VK_IMAGE_ASPECT_COLOR_BIT, // aspectMask - query_level, // mipLevel - query_layer, // arrayLayer - }; - VkSubresourceLayout layout; - device->vkGetImageSubresourceLayout(device, *image, &layer, &layout); - - VkMemoryRequirements req; - device->vkGetImageMemoryRequirements(device, *image, &req); - - data->logger()->LogInfo("Image subresource layout info:"); - data->logger()->LogInfo("\tMip level: ", query_level); - data->logger()->LogInfo("\tArray layer: ", query_layer); - data->logger()->LogInfo("\tSubresourceLayout.offset: ", layout.offset); - data->logger()->LogInfo("\tSubresourceLayout.size: ", layout.size); - data->logger()->LogInfo("\tSubresourceLayout.rowPitch: ", layout.rowPitch); - data->logger()->LogInfo("\tSubresourceLayout.arrayPitch: ", - layout.arrayPitch); - data->logger()->LogInfo("\tSubresourceLayout.depthPitch: ", - layout.depthPitch); - - // offset, must be within the valid range. - LOG_EXPECT(<=, data->logger(), layout.offset + layout.size, req.size); - - uint32_t mip_width = - width / (1 << query_level) == 0 ? 1 : width / (1 << query_level); - uint32_t mip_height = - height / (1 << query_level) == 0 ? 1 : height / (1 << query_level); - uint32_t mip_depth = - depth / (1 << query_level) == 0 ? 1 : depth / (1 << query_level); - - // size, must be greater than or equal to a tightly packed pixel data blob. - LOG_EXPECT(>=, data->logger(), layout.size, - pixel_size * mip_width * mip_height * mip_depth); - - // rowPitch, must be greater than or equal to a tightly packed 1D row. - LOG_EXPECT(>=, data->logger(), layout.rowPitch, pixel_size * mip_width); - - if (depth > 1) { - // depthPitch, must be greater than or equal to a tightly packed 2D slice. - LOG_EXPECT(>=, data->logger(), layout.depthPitch, - pixel_size * mip_width * mip_height); - } - - if (array_layer > 1) { - // arrayPitch, must be greater than or equal to a tightly packed 3D - // subresource. But there is no guarantee that one layer contains multiple - // mip levels, nor the other way around. - LOG_EXPECT(>=, data->logger(), layout.arrayPitch, - pixel_size * mip_width * mip_height); - } - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_acquisition_tests/vkGetImageSubresourceLayout_test/vkGetImageSubresourceLayout.py b/gapid_tests/resource_acquisition_tests/vkGetImageSubresourceLayout_test/vkGetImageSubresourceLayout.py deleted file mode 100644 index 0d8d33fe..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetImageSubresourceLayout_test/vkGetImageSubresourceLayout.py +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal, require_true -from gapit_test_framework import require_not_equal -from gapit_test_framework import GapitTest, get_read_offset_function -from gapit_test_framework import get_write_offset_function -from gapit_test_framework import little_endian_bytes_to_int -from vulkan_constants import * -from struct_offsets import VulkanStruct, ARRAY, FLOAT, UINT32_T, UINT64_T - -IMAGE_SUBRESOURCE_ELEMENTS = [ - ("aspectMask", UINT32_T), - ("mipLevel", UINT32_T), - ("arrayLayer", UINT32_T), -] - -SUBRESOURCE_LAYOUT_ELEMENTS = [ - ("offset", UINT64_T), - ("size", UINT64_T), - ("rowPitch", UINT64_T), - ("arrayPitch", UINT64_T), - ("depthPitch", UINT64_T), -] - - -@gapit_test("vkGetImageSubresourceLayout_test") -class GetImageSubResourceLayout(GapitTest): - - def expect(self): - arch = self.architecture - - get_layout = require(self.next_call_of("vkGetImageSubresourceLayout")) - require_not_equal(0, get_layout.int_image) - subresource = VulkanStruct( - arch, IMAGE_SUBRESOURCE_ELEMENTS, - get_read_offset_function(get_layout, get_layout.hex_pSubresource)) - layout = VulkanStruct(arch, SUBRESOURCE_LAYOUT_ELEMENTS, - get_write_offset_function(get_layout, - get_layout.hex_pLayout)) - - require_equal(VK_IMAGE_ASPECT_COLOR_BIT, subresource.aspectMask) - require_equal(0, subresource.mipLevel) - require_equal(0, subresource.arrayLayer) - - require_not_equal(0, layout.size) - require_not_equal(0, layout.rowPitch) - # ArrayPitch and DepthPitch may be undefined diff --git a/gapid_tests/resource_acquisition_tests/vkGetPipelineCacheData_test/CMakeLists.txt b/gapid_tests/resource_acquisition_tests/vkGetPipelineCacheData_test/CMakeLists.txt deleted file mode 100644 index 710b8496..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetPipelineCacheData_test/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkGetPipelineCacheData_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) diff --git a/gapid_tests/resource_acquisition_tests/vkGetPipelineCacheData_test/README.md b/gapid_tests/resource_acquisition_tests/vkGetPipelineCacheData_test/README.md deleted file mode 100644 index 49ca038f..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetPipelineCacheData_test/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# vkGetPipelineCacheData - -## Signatures -```c++ -VkResult vkGetPipelineCacheData( - VkDevice device, - VkPipelineCache pipelineCache, - size_t* pDataSize, - void* pData); -``` - -```c++ -typedef enum VkPipelineCacheHeaderVersion { - VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1, -} VkPipelineCacheHeaderVersion; -``` - -According to the Vulkan spec: -- `device` **must** be a valid VkDevice -- `pDataSize` is a pointer to a value related to the amount of data in the - pipeline cache. It **must** be a pointer to a `size_t` value -- `pData` is either `NULL` or a pointer to a buffer -- If `pData` is `NULL`, then the maximum size of the data that can be retrieved - from the pipeline cache, in bytes, is returned in `pDataSize`. Otherwise, - `pDataSize` **must** point to a variable set by the user to the size of the - buffer, in bytes, pointed to by `pData`, and on return the variable is - overwritten with the amount of data actually written to `pData` -- If the value referenced by `pDataSize` is not 0, and `pData` is not `NULL`, - `pData` **must** be a pointer to an array of `pDataSize` bytes -- If `pDataSize` is less than the maximum size that can be retrieved by the - pipeline cache, at most `pDataSize` bytes will be written to `pData`, and - `vkGetPipelineCacheData` will return `VK_INCOMPLETE`. Any data written to - `pData` is valid and can be provided as the `pInitialData` member of the - `VkPipelineCacheCreateInfo` structure passed to `vkCreatepipelineCache` -- The initial bytes written to `pData` **must** be a header consisting of the - following members: - - Length in bytes of the entire pipeline cache header written as a stream of - bytes, with the least significant byte first - - a `VkPipelineCacheHeaderVersion` value written as a stream of bytes, with - the least significant byte first. The value must be one of the enum values - of `VkPipelineCacheHeaderVersion` - - a vendor ID euqal to `VkPhysicalDeviceProperties::vendorID` written as a - stream of bytes, with the least significant byte first - - a device ID equal to `VkPhysicalDeviceProperties::deviceID` written as a - stream of bytes, with the least significant byte first - - a pipeline cache ID equal to `VkPhysicalDeviceProperties::pipelineCacheUUID` - -These tests should test the following cases: -- `pData` is `NULL` - - [x] `pDataSize` refer to a value of 0 - - [ ] `pDataSize` refer to a value other than 0 -- `pData` is not `NULL` - - [x] `pDataSize` refer to a value of the size of the pipeline cache - - [ ] `pDataSize` refer to a value less than the size of the pipeline cache -- [x] Creates a graphics pipeline with pipeline cache data diff --git a/gapid_tests/resource_acquisition_tests/vkGetPipelineCacheData_test/main.cpp b/gapid_tests/resource_acquisition_tests/vkGetPipelineCacheData_test/main.cpp deleted file mode 100644 index cab29dbd..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetPipelineCacheData_test/main.cpp +++ /dev/null @@ -1,375 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -uint32_t fragment_shader[] = -#include "simple_fragment.frag.spv" - ; - -uint32_t vertex_shader[] = -#include "simple_vertex.vert.spv" - ; - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - - { - vulkan::VkDevice& device = app.device(); - - VkPipelineCacheCreateInfo create_info{ - VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 0, // initialDataSize - nullptr // pInitialData - }; - - VkPipelineCache cache; - LOG_ASSERT( - ==, data->logger(), - device->vkCreatePipelineCache(device, &create_info, nullptr, &cache), - VK_SUCCESS); - - // pData is null - size_t cache_data_size = 0; - LOG_ASSERT(==, data->logger(), - device->vkGetPipelineCacheData(device, cache, &cache_data_size, - nullptr), - VK_SUCCESS); - - // pData is not null and pDataSize refer to the size of the cache data - containers::vector cache_data(cache_data_size, 0, - data->allocator()); - LOG_ASSERT(==, data->logger(), - device->vkGetPipelineCacheData(device, cache, &cache_data_size, - cache_data.data()), - VK_SUCCESS); - - // Check the content of the pipeline cache data header - size_t cache_data_header_size = - size_t(cache_data[0]) | (size_t(cache_data[1]) << 8) | - (size_t(cache_data[2]) << 16) | (size_t(cache_data[3]) << 24); - LOG_ASSERT(==, data->logger(), cache_data_header_size, 16 + VK_UUID_SIZE); - LOG_ASSERT(==, data->logger(), cache_data[4], - uint8_t(VK_PIPELINE_CACHE_HEADER_VERSION_ONE)); - - device->vkDestroyPipelineCache(device, cache, nullptr); - } - - { - // 2. Create a graphics pipeline with pipeline cache, then get its data - // Create pipeline layout - - vulkan::VkDevice& dev = app.device(); - vulkan::PipelineLayout pipeline_layout(app.CreatePipelineLayout( - {{{ - 0, // binding - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_VERTEX_BIT, // stageFlags - nullptr, // pImmutableSamplers - }, - { - 1, // binding - VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_FRAGMENT_BIT, // stageFlags - nullptr, // pImmutableSamplers - }}})); - // Create renderpass - VkAttachmentReference color_attachment = { - 1, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - VkAttachmentReference depth_attachment = { - 0, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}; - - vulkan::VkRenderPass render_pass = app.CreateRenderPass( - {{ - 0, // flags - VK_FORMAT_D32_SFLOAT, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL // finalLayout - }, - { - 0, // flags - VK_FORMAT_R8G8B8A8_UNORM, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // finalLayout - }}, // AttachmentDescriptions - {{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment, // colorAttachment - nullptr, // pResolveAttachments - &depth_attachment, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }}, // SubpassDescriptions - {} // SubpassDependencies - ); - - // Create shader modules - vulkan::VkShaderModule vertex_shader_module = - app.CreateShaderModule(vertex_shader); - vulkan::VkShaderModule fragment_shader_module = - app.CreateShaderModule(fragment_shader); - - // Create graphics pipeline - VkPipelineShaderStageCreateInfo shader_stage_create_infos[2] = { - { - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_SHADER_STAGE_VERTEX_BIT, // stage - vertex_shader_module, // module - "main", // pName - nullptr // pSpecializationInfo - }, - { - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_SHADER_STAGE_FRAGMENT_BIT, // stage - fragment_shader_module, // module - "main", // pName - nullptr // pSpecializationInfo - }}; - - VkVertexInputBindingDescription vertex_binding_description = { - 0, // binding - 4 * 6, /* vec4 + vec2 */ // stride - VK_VERTEX_INPUT_RATE_VERTEX // inputRate - }; - - VkVertexInputAttributeDescription vertex_attribute_descriptions[2] = { - { - 0, // location - 0, // binding - VK_FORMAT_R32G32B32A32_SFLOAT, // format - 0 // offset - }, - { - 1, // location - 0, // binding - VK_FORMAT_R32G32_SFLOAT, // format - 4 * 4 // offset - }}; - - VkPipelineVertexInputStateCreateInfo vertex_input_state = { - VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 1, // vertexBindingDescriptionCount - &vertex_binding_description, // pVertexBindingDescriptions - 2, // vertexAttributeDescriptionCount - vertex_attribute_descriptions // pVertexAttributeDescriptions - }; - - VkPipelineInputAssemblyStateCreateInfo input_assembly_state = { - VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, // topology - VK_FALSE // primitiveRestartEnable - }; - - VkViewport viewport = { - 0.0f, // x - 0.0f, // y - static_cast(app.swapchain().width()), // width - static_cast(app.swapchain().height()), // height - 0.0f, // minDepth - 1.0f, // maxDepth - }; - - VkRect2D scissor = {{ - 0, // offset.x - 0, // offset.y - }, - { - app.swapchain().width(), // extent.width - app.swapchain().height() // extent.height - }}; - - VkPipelineViewportStateCreateInfo viewport_state = { - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 1, // viewportCount - &viewport, // pViewports - 1, // scissorCount - &scissor, // pScissors - }; - - VkPipelineRasterizationStateCreateInfo rasterization_state = { - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_FALSE, // depthClampEnable - VK_FALSE, // rasterizerDiscardEnable - VK_POLYGON_MODE_FILL, // polygonMode - VK_CULL_MODE_BACK_BIT, // cullMode - VK_FRONT_FACE_CLOCKWISE, // frontFace - VK_FALSE, // depthBiasEnable - 0.0f, // depthBiasConstantFactor - 0.0f, // depthBiasClamp - 0.0f, // depthBiasSlopeFactor - 1.0f, // lineWidth - }; - - VkPipelineMultisampleStateCreateInfo multisample_state = { - VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_SAMPLE_COUNT_1_BIT, // rasterizationSamples - VK_FALSE, // sampleShadingEnable - 0, // minSampleShading - 0, // pSampleMask - VK_FALSE, // alphaToCoverageEnable - VK_FALSE, // alphaToOneEnable - }; - - VkPipelineDepthStencilStateCreateInfo depth_stencil_state = { - VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_TRUE, // depthTestEnable - VK_TRUE, // depthWriteEnable - VK_COMPARE_OP_LESS, // depthCompareOp - VK_FALSE, // depthBoundsTestEnable - VK_FALSE, // stencilTestEnable - { - VK_STENCIL_OP_KEEP, // front.failOp - VK_STENCIL_OP_KEEP, // front.passOp - VK_STENCIL_OP_KEEP, // front.depthFailOp - VK_COMPARE_OP_NEVER, // front.compareOp - 0x0, // front.compareMask - 0x0, // front.writeMask - 0 // front.reference - }, - { - VK_STENCIL_OP_KEEP, // back.failOp - VK_STENCIL_OP_KEEP, // back.passOp - VK_STENCIL_OP_KEEP, // back.depthFailOp - VK_COMPARE_OP_NEVER, // back.compareOp - 0x0, // back.compareMask - 0x0, // back.writeMask - 0 // back.reference - }, - 0.0f, // minDepthBounds - 1.0f // maxDepthBounds - }; - - VkPipelineColorBlendAttachmentState color_blend_attachment_state = { - VK_FALSE, // blendEnable - VK_BLEND_FACTOR_ZERO, // srcColorBlendFactor - VK_BLEND_FACTOR_ONE, // dstColorBlendFactor - VK_BLEND_OP_ADD, // colorBlendOp - VK_BLEND_FACTOR_ZERO, // srcAlphaBlendFactor - VK_BLEND_FACTOR_ONE, // dstAlphaBlendFactor - VK_BLEND_OP_ADD, // alphaBlendOp - VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | - VK_COLOR_COMPONENT_B_BIT | - VK_COLOR_COMPONENT_A_BIT, // colorWriteMask - }; - - VkPipelineColorBlendStateCreateInfo color_blend_state = { - VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_FALSE, // logicOpEnable - VK_LOGIC_OP_CLEAR, // logicOp - 1, // attachmentCount - &color_blend_attachment_state, // pAttachments - {1.0f, 1.0f, 1.0f, 1.0f} // blendConstants - }; - - VkGraphicsPipelineCreateInfo create_info = { - VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 2, // stageCount - shader_stage_create_infos, // pStages - &vertex_input_state, // pVertexInputState - &input_assembly_state, // pInputAssemblyState - nullptr, // pTessellationState - &viewport_state, // pViewportState - &rasterization_state, // pRasterizationState - &multisample_state, // pMultisampleState - &depth_stencil_state, // pDepthStencilState - &color_blend_state, // pColorBlendState - nullptr, // pDynamicState - pipeline_layout, // layout - render_pass, // renderPass - 0, // subpass - VK_NULL_HANDLE, // basePipelineHandle - 0 // basePipelineIndex - }; - - VkPipeline raw_pipeline; - LOG_ASSERT( - ==, data->logger(), VK_SUCCESS, - dev->vkCreateGraphicsPipelines(dev, app.pipeline_cache(), 1, - &create_info, nullptr, &raw_pipeline)); - dev->vkDestroyPipeline(dev, raw_pipeline, nullptr); - - // Get the pipeline cache data - size_t cache_data_size = 0; - LOG_ASSERT(==, data->logger(), - dev->vkGetPipelineCacheData(dev, app.pipeline_cache(), - &cache_data_size, nullptr), - VK_SUCCESS); - - containers::vector cache_data(cache_data_size, 0, - data->allocator()); - LOG_ASSERT(==, data->logger(), - dev->vkGetPipelineCacheData(dev, app.pipeline_cache(), - &cache_data_size, cache_data.data()), - VK_SUCCESS); - - // Check the content of the pipeline cache data header - size_t cache_data_header_size = - size_t(cache_data[0]) | (size_t(cache_data[1]) << 8) | - (size_t(cache_data[2]) << 16) | (size_t(cache_data[3]) << 24); - LOG_ASSERT(==, data->logger(), cache_data_header_size, 16 + VK_UUID_SIZE); - LOG_ASSERT(==, data->logger(), cache_data[4], - uint8_t(VK_PIPELINE_CACHE_HEADER_VERSION_ONE)); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_acquisition_tests/vkGetPipelineCacheData_test/vkGetPipelineCacheData_test.py b/gapid_tests/resource_acquisition_tests/vkGetPipelineCacheData_test/vkGetPipelineCacheData_test.py deleted file mode 100644 index 0c65d9e3..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetPipelineCacheData_test/vkGetPipelineCacheData_test.py +++ /dev/null @@ -1,98 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal, require_true -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function, get_write_offset_function -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY -from vulkan_constants import * - -DATA_SIZE = [ - ("dataSize", SIZE_T), -] - -DATA_HEADER = [ - ("headerSize", UINT32_T), - ("headerVersion", UINT32_T), - ("venderID", UINT32_T), - ("deviceID", UINT32_T), - ("cacheID", ARRAY, VK_UUID_SIZE, CHAR), -] - -EMPTY_PIPELINE_CACHE_DATA_SIZE = 36 - - -@gapit_test("vkGetPipelineCacheData_test") -class GetDataOfAnEmptyPipelineCache(GapitTest): - - def expect(self): - architecture = self.architecture - device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - - get_cache_data_with_null_pdata = require( - self.nth_call_of("vkGetPipelineCacheData", 1)) - write_data_size = VulkanStruct( - architecture, DATA_SIZE, - get_write_offset_function(get_cache_data_with_null_pdata, - get_cache_data_with_null_pdata.hex_pDataSize)) - # The pipeline cache data size must be at least as large as its header - # size - require_true(16 + VK_UUID_SIZE <= write_data_size.dataSize) - - get_cache_data_with_not_null_pdata = require( - self.next_call_of("vkGetPipelineCacheData")) - # Check the header - cache_data_header = VulkanStruct( - architecture, DATA_HEADER, - get_write_offset_function(get_cache_data_with_not_null_pdata, - get_cache_data_with_not_null_pdata.hex_pData)) - require_equal(16 + VK_UUID_SIZE, cache_data_header.headerSize) - require_equal(1, cache_data_header.headerVersion) - require_not_equal(0, cache_data_header.venderID) - require_not_equal(0, cache_data_header.deviceID) - - destroy_pipeline_cache = require( - self.next_call_of("vkDestroyPipelineCache")) - - -@gapit_test("vkGetPipelineCacheData_test") -class GetPipelineCacheDataOfAGraphicsPipeline(GapitTest): - - def expect(self): - architecture = self.architecture - device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - - get_cache_data_with_null_pdata = require( - self.nth_call_of("vkGetPipelineCacheData", 3)) - write_data_size = VulkanStruct( - architecture, DATA_SIZE, - get_write_offset_function(get_cache_data_with_null_pdata, - get_cache_data_with_null_pdata.hex_pDataSize)) - # The pipeline cache data size must be at least as large as its header - # size - require_true(16 + VK_UUID_SIZE <= write_data_size.dataSize) - - get_cache_data_with_not_null_pdata = require( - self.next_call_of("vkGetPipelineCacheData")) - cache_data_header = VulkanStruct( - architecture, DATA_HEADER, - get_write_offset_function(get_cache_data_with_not_null_pdata, - get_cache_data_with_not_null_pdata.hex_pData)) - require_equal(16 + VK_UUID_SIZE, cache_data_header.headerSize) - require_equal(1, cache_data_header.headerVersion) - require_not_equal(0, cache_data_header.venderID) - require_not_equal(0, cache_data_header.deviceID) - - destroy_pipeline_cache = require( - self.next_call_of("vkDestroyPipelineCache")) diff --git a/gapid_tests/resource_acquisition_tests/vkGetQueryPoolResults_test/CMakeLists.txt b/gapid_tests/resource_acquisition_tests/vkGetQueryPoolResults_test/CMakeLists.txt deleted file mode 100644 index 39a3f74c..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetQueryPoolResults_test/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkGetQueryPoolResults_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) diff --git a/gapid_tests/resource_acquisition_tests/vkGetQueryPoolResults_test/README.md b/gapid_tests/resource_acquisition_tests/vkGetQueryPoolResults_test/README.md deleted file mode 100644 index 3ffd4fda..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetQueryPoolResults_test/README.md +++ /dev/null @@ -1,96 +0,0 @@ -# vkGetQueryPoolResults - -## Signatures -```c++ -VkResult vkGetQueryPoolResults( - VkDevice device, - VkQueryPool queryPool, - uint32_t firstQuery, - uint32_t queryCount, - size_t dataSize, - void* pData, - VkDeviceSize stride, - VkQueryResultFlags flags); -``` - -# VkQueryResultFlagBits -```c++ -typedef enum VkQueryResultFlagBits { - VK_QUERY_RESULT_64_BIT = 0x00000001, - VK_QUERY_RESULT_WAIT_BIT = 0x00000002, - VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, - VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, -} VkQueryResultFlagBits; -``` - -According to the Vulkan spec: -- The first query’s result is written starting at the first byte requested by - the command, and each subsequent query’s result begins stride bytes later. -- Each query’s result is a tightly packed array of unsigned integers, either - 32- or 64-bits as requested by the command, storing the numerical results - and, if requested, the availability status. -- If `VK_QUERY_RESULT_WITH_AVAILABILITY_BIT` is used, the final element of each - query’s result is an integer indicating whether the query’s result is - available, with any non-zero value indicating that it is available. -- Occlusion queries write one integer value - the number of samples passed. - Pipeline statistics queries write one integer value for each bit that is - enabled in the pipelineStatistics when the pool is created, and the - statistics values are written in bit order starting from the least - significant bit. Timestamps write one integer value. -- If more than one query is retrieved and `stride` is not at least as large as - the size of the array of integers corresponding to a single query, the values - written to memory are undefined. -- `firstQuery` **must** be less than the number of queries in `queryPool` -- If `VK_QUERY_RESULT_64_BIT` is not set in `flags` then `pData` and `stride` - **must** be multiples of 4 -- If `VK_QUERY_RESULT_64_BIT` is set in `flags` then `pData` and `stride` - **must** be multiples of 8 -- The sum of `firstQuery` and `queryCount` must be less than or equal to the - number of queries in `queryPool` -- `dataSize` **must** be large enough to contain the result of each query -- If the `queryType` used to create `queryPool` was `VK_QUERY_TYPE_TIMESTAMP`, - `flags` **must not** contain `VK_QUERY_RESULT_PARTIAL_BIT` -- If no bits are set in `flags`, and all requested queries are in the available - state, results are written as an array of 32-bit unsigned integer values. -- If `VK_QUERY_RESULT_64_BIT` is not set and the result overflows a 32-bit - value, the value may either wrap or saturate. Similarly, if - `VK_QUERY_RESULT_64_BIT` is set and the result overflows a 64-bit value, the - value may either wrap or saturate. -- If `VK_QUERY_RESULT_WAIT_BIT` is set, Vulkan will wait for each query to be - in the available state before retrieving the numerical results for that query. - In this case, `vkGetQueryPoolResults` is guaranteed to succeed and return - `VK_SUCCESS` if the queries become available in a finite time (i.e. if they - have been issued and not reset). If queries will never finish (e.g. due to - being reset but not issued), then `vkGetQueryPoolResults` may not return in - finite time. -- If `VK_QUERY_RESULT_WAIT_BIT` and `VK_QUERY_RESULT_PARTIAL_BIT` are both not - set then no result values are written to `pData` for queries that are in the - unavailable state at the time of the call, and `vkGetQueryPoolResults` - returns `VK_NOT_READY`. However, availability state is still written to - `pData` for those queries if `VK_QUERY_RESULT_WITH_AVAILABILITY_BIT` is set. -- If `VK_QUERY_RESULT_PARTIAL_BIT` is set, `VK_QUERY_RESULT_WAIT_BIT` is not - set, and the query’s status is unavailable, an intermediate result value - between zero and the final result value is written to `pData` for that query. -- `VK_QUERY_RESULT_PARTIAL_BIT` **must not** be used if the pool’s queryType is - `VK_QUERY_TYPE_TIMESTAMP`. -- If `VK_QUERY_RESULT_WITH_AVAILABILITY_BIT` is set, the final integer value - written for each query is non-zero if the query’s status was available or - zero if the status was unavailable. When - `VK_QUERY_RESULT_WITH_AVAILABILITY_BIT` is used, implementations must - guarantee that if they return a non-zero availability value then the - numerical results must be valid, assuming the results are not reset by a - subsequent command. - -These tests should test the following cases: -- [x] `firstQuery` of value 0 -- [x] `firstQuery` of value other than 0 -- [x] `queryCount` of value 1 -- [x] `queryCount` of value other than 1 -- [x] `stride` of value 4 -- [x] `stride` of value 8 -- [x] `stride` of value 12 -- [x] `flags` with no bit set -- [x] `flags` with `VK_QUERY_RESULT_64_BIT` set -- [x] `flags` with `VK_QUERY_RESULT_WAIT_BIT` set -- [x] `flags` with `VK_QUERY_RESULT_AVAILABILITY_BIT` set -- [x] `flags` with `VK_QUERY_RESULT_PARTIAL_BIT` set diff --git a/gapid_tests/resource_acquisition_tests/vkGetQueryPoolResults_test/main.cpp b/gapid_tests/resource_acquisition_tests/vkGetQueryPoolResults_test/main.cpp deleted file mode 100644 index 35b330ce..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetQueryPoolResults_test/main.cpp +++ /dev/null @@ -1,450 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include -#include - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -uint32_t fragment_shader[] = -#include "hardcode_pos_triangle.frag.spv" - ; - -uint32_t vertex_shader[] = -#include "hardcode_pos_triangle.vert.spv" - ; - -namespace { -vulkan::VkQueryPool QueryWithoutDrawingAnything( - const entry::EntryData* data, vulkan::VulkanApplication* app, - const VkQueryPoolCreateInfo& query_pool_create_info) { - vulkan::VkDevice& device = app->device(); - - // Create render pass. - VkAttachmentReference color_attachment = { - 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - vulkan::VkRenderPass render_pass = app->CreateRenderPass( - {{ - 0, // flags - app->swapchain().format(), // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_UNDEFINED, // initialLayout - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // finalLayout - }}, // AttachmentDescriptions - {{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment, // colorAttachment - nullptr, // pResolveAttachments - nullptr, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }}, // SubpassDescriptions - {} // SubpassDependencies - ); - - // Create shader modules. - vulkan::VkShaderModule vertex_shader_module = - app->CreateShaderModule(vertex_shader); - vulkan::VkShaderModule fragment_shader_module = - app->CreateShaderModule(fragment_shader); - VkPipelineShaderStageCreateInfo shader_stage_create_infos[2] = { - { - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_SHADER_STAGE_VERTEX_BIT, // stage - vertex_shader_module, // module - "main", // pName - nullptr // pSpecializationInfo - }, - { - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_SHADER_STAGE_FRAGMENT_BIT, // stage - fragment_shader_module, // module - "main", // pName - nullptr // pSpecializationInfo - }}; - - // Specify vertex input state. - VkPipelineVertexInputStateCreateInfo vertex_input_state = { - VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 0, // vertexBindingDescriptionCount - nullptr, // pVertexBindingDescriptions - 0, // vertexAttributeDescriptionCount - nullptr, // pVertexAttributeDescriptions - }; - - // Other fixed function stage configuration. - VkPipelineInputAssemblyStateCreateInfo input_assembly_state = { - VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, // topology - VK_FALSE // primitiveRestartEnable - }; - - VkViewport viewport = { - 0.0f, // x - 0.0f, // y - static_cast(app->swapchain().width()), // width - static_cast(app->swapchain().height()), // height - 0.0f, // minDepth - 1.0f, // maxDepth - }; - - VkRect2D scissor = {{ - 0, // offset.x - 0, // offset.y - }, - { - app->swapchain().width(), // extent.width - app->swapchain().height() // extent.height - }}; - - VkPipelineViewportStateCreateInfo viewport_state = { - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 1, // viewportCount - &viewport, // pViewports - 1, // scissorCount - &scissor, // pScissors - }; - - VkPipelineRasterizationStateCreateInfo rasterization_state = { - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_FALSE, // depthClampEnable - VK_FALSE, // rasterizerDiscardEnable - VK_POLYGON_MODE_FILL, // polygonMode - VK_CULL_MODE_BACK_BIT, // cullMode - VK_FRONT_FACE_CLOCKWISE, // frontFace - VK_FALSE, // depthBiasEnable - 0.0f, // depthBiasConstantFactor - 0.0f, // depthBiasClamp - 0.0f, // depthBiasSlopeFactor - 1.0f, // lineWidth - }; - - VkPipelineMultisampleStateCreateInfo multisample_state = { - VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_SAMPLE_COUNT_1_BIT, // rasterizationSamples - VK_FALSE, // sampleShadingEnable - 0, // minSampleShading - 0, // pSampleMask - VK_FALSE, // alphaToCoverageEnable - VK_FALSE, // alphaToOneEnable - }; - - VkPipelineColorBlendAttachmentState color_blend_attachment_state = { - VK_FALSE, // blendEnable - VK_BLEND_FACTOR_ZERO, // srcColorBlendFactor - VK_BLEND_FACTOR_ONE, // dstColorBlendFactor - VK_BLEND_OP_ADD, // colorBlendOp - VK_BLEND_FACTOR_ZERO, // srcAlphaBlendFactor - VK_BLEND_FACTOR_ONE, // dstAlphaBlendFactor - VK_BLEND_OP_ADD, // alphaBlendOp - (VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | - VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT), // colorWriteMask - }; - - VkPipelineColorBlendStateCreateInfo color_blend_state = { - VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_FALSE, // logicOpEnable - VK_LOGIC_OP_CLEAR, // logicOp - 1, // attachmentCount - &color_blend_attachment_state, // pAttachments - {1.0f, 1.0f, 1.0f, 1.0f} // blendConstants - }; - - vulkan::PipelineLayout pipeline_layout(app->CreatePipelineLayout({{}})); - - // Create the graphics pipeline. - VkGraphicsPipelineCreateInfo create_info = { - VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 2, // stageCount - shader_stage_create_infos, // pStages - &vertex_input_state, // pVertexInputState - &input_assembly_state, // pInputAssemblyState - nullptr, // pTessellationState - &viewport_state, // pViewportState - &rasterization_state, // pRasterizationState - &multisample_state, // pMultisampleState - nullptr, // pDepthStencilState - &color_blend_state, // pColorBlendState - nullptr, // pDynamicState - pipeline_layout, // layout - render_pass, // renderPass - 0, // subpass - VK_NULL_HANDLE, // basePipelineHandle - 0 // basePipelineIndex - }; - - VkPipeline raw_pipeline; - LOG_EXPECT( - ==, data->logger(), - device->vkCreateGraphicsPipelines(device, app->pipeline_cache(), 1, - &create_info, nullptr, &raw_pipeline), - VK_SUCCESS); - vulkan::VkPipeline pipeline(raw_pipeline, nullptr, &device); - - // Create image view. - VkImageViewCreateInfo image_view_create_info{ - VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - app->swapchain_images().front(), // image - VK_IMAGE_VIEW_TYPE_2D, // viewType - app->swapchain().format(), // format - { - VK_COMPONENT_SWIZZLE_IDENTITY, // components.r - VK_COMPONENT_SWIZZLE_IDENTITY, // components.g - VK_COMPONENT_SWIZZLE_IDENTITY, // components.b - VK_COMPONENT_SWIZZLE_IDENTITY, // components.a - }, - { - VK_IMAGE_ASPECT_COLOR_BIT, // subresourceRange.aspectMask - 0, // subresourceRange.baseMipLevel - 1, // subresourceRange.levelCount - 0, // subresourceRange.baseArrayLayer - 1, // subresourceRange.layerCount - }, - }; - ::VkImageView raw_image_view; - LOG_EXPECT( - ==, data->logger(), - app->device()->vkCreateImageView(app->device(), &image_view_create_info, - nullptr, &raw_image_view), - VK_SUCCESS); - vulkan::VkImageView image_view(raw_image_view, nullptr, &app->device()); - - // Create framebuffer - VkFramebufferCreateInfo framebuffer_create_info{ - VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - render_pass, // renderPass - 1, // attachmentCount - &raw_image_view, // attachments - app->swapchain().width(), // width - app->swapchain().height(), // height - 1 // layers - }; - ::VkFramebuffer raw_framebuffer; - app->device()->vkCreateFramebuffer(app->device(), &framebuffer_create_info, - nullptr, &raw_framebuffer); - vulkan::VkFramebuffer framebuffer(raw_framebuffer, nullptr, &app->device()); - - // Create query pool. - vulkan::VkQueryPool query_pool = - vulkan::CreateQueryPool(&app->device(), query_pool_create_info); - - // Create command buffer. - vulkan::VkCommandBuffer command_buffer = app->GetCommandBuffer(); - VkCommandBufferBeginInfo command_buffer_begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType - nullptr, // pNext - 0, // flags - nullptr, // pInheritanceInfo - }; - command_buffer->vkBeginCommandBuffer(command_buffer, - &command_buffer_begin_info); - VkRenderPassBeginInfo render_pass_begin_info{ - VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, // sType - nullptr, // pNext - render_pass, // renderPass - framebuffer, // framebuffer - { - {0, // renderArea.offset.x - 0}, // renderArea.offset.y - {app->swapchain().width(), // renderArea.extent.width - app->swapchain().height()}, // renderArea.extent.height - }, - 0, // clearValueCount - nullptr, // pClearValues - }; - - command_buffer->vkCmdResetQueryPool(command_buffer, query_pool, 0, 2); - - // Begin all the queries - for (uint32_t q = 0; q < query_pool_create_info.queryCount; q++) { - command_buffer->vkCmdBeginQuery(command_buffer, query_pool, q, 0); - } - - command_buffer->vkCmdBeginRenderPass(command_buffer, &render_pass_begin_info, - VK_SUBPASS_CONTENTS_INLINE); - command_buffer->vkCmdBindPipeline( - command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, raw_pipeline); - // Do not draw anything, do not call vkCmdDraw - command_buffer->vkCmdEndRenderPass(command_buffer); - - // End all the queries - for (uint32_t q = 0; q < query_pool_create_info.queryCount; q++) { - command_buffer->vkCmdEndQuery(command_buffer, query_pool, q); - } - - command_buffer->vkEndCommandBuffer(command_buffer); - - ::VkCommandBuffer raw_cmd_buf = command_buffer.get_command_buffer(); - VkSubmitInfo submit_info{VK_STRUCTURE_TYPE_SUBMIT_INFO, - nullptr, - 0, - nullptr, - nullptr, - 1, - &raw_cmd_buf, - 0, - nullptr}; - app->render_queue()->vkQueueSubmit(app->render_queue(), 1, &submit_info, - static_cast(VK_NULL_HANDLE)); - app->render_queue()->vkQueueWaitIdle(app->render_queue()); - - return query_pool; -} -} // namespace - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - - { - // 1. Get 32-bit results from all the queries in a four-query pool, - // without any result flag - const uint32_t num_queries = 4; - vulkan::VkQueryPool query_pool = QueryWithoutDrawingAnything( - data, &app, - {VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, nullptr, 0, - VK_QUERY_TYPE_OCCLUSION, num_queries, 0}); - - std::array query_results{0xFFFFFFFF, 0xFFFFFFFF, - 0xFFFFFFFF, 0xFFFFFFFF}; - - LOG_ASSERT(==, data->logger(), - app.device()->vkGetQueryPoolResults( - app.device(), // device - query_pool, // queryPool - 0, // firstQuery - num_queries, // queryCount - num_queries * sizeof(uint32_t), // dataSize - (void*)query_results.data(), // pData - sizeof(uint32_t), // stride - 0 // flags - ), - VK_SUCCESS); - - std::for_each(std::begin(query_results), std::end(query_results), - [data](uint32_t result) { - LOG_ASSERT(==, data->logger(), result, 0x0); - }); - } - - { - // 2. Get 64-bit results from the fifth to eighth query in a eight-query - // pool, with VK_QUERY_RESULT_WAIT_BIT flag - const uint32_t total_num_queries = 8; - const uint32_t get_result_num_queries = 4; - vulkan::VkQueryPool query_pool = QueryWithoutDrawingAnything( - data, &app, - {VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, nullptr, 0, - VK_QUERY_TYPE_OCCLUSION, total_num_queries, 0}); - std::array query_results{ - 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, - 0xFFFFFFFFFFFFFFFF}; - LOG_ASSERT(==, data->logger(), - app.device()->vkGetQueryPoolResults( - app.device(), // device - query_pool, // queryPool - total_num_queries - get_result_num_queries, // firstQuery - get_result_num_queries, // queryCount - query_results.size() * sizeof(uint64_t), // dataSize - (void*)query_results.data(), // pData - sizeof(uint64_t), // stride - VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT // flags - ), - VK_SUCCESS); - - std::for_each(query_results.begin(), query_results.end(), - [data](uint64_t result) { - LOG_ASSERT(==, data->logger(), result, 0x0); - }); - } - - { - // 3. Get 32-bit results from all the queries in a four-query - // pool, with VK_QUERY_RESULT_PARTIAL_BIT and - // VK_QUERY_RESULT_WITH_AVAILABILITY_BIT flag, and stride value 12 - const uint32_t num_queries = 4; - const uint32_t stride = 12; - vulkan::VkQueryPool query_pool = QueryWithoutDrawingAnything( - data, &app, - {VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, nullptr, 0, - VK_QUERY_TYPE_OCCLUSION, num_queries, 0}); - containers::vector query_results( - stride / sizeof(uint32_t) * num_queries, 0xFFFFFFFF, data->allocator()); - LOG_ASSERT(==, data->logger(), - app.device()->vkGetQueryPoolResults( - app.device(), // device - query_pool, // queryPool - 0, // firstQuery - num_queries, // queryCount - query_results.size() * sizeof(uint32_t), // dataSize - (void*)query_results.data(), // pData - stride, // stride - VK_QUERY_RESULT_WITH_AVAILABILITY_BIT | - VK_QUERY_RESULT_PARTIAL_BIT // flags - ), - VK_SUCCESS); - - for (size_t i = 0; i < query_results.size();) { - // query result - LOG_ASSERT(==, data->logger(), query_results[i], 0x0); - // availability status - LOG_ASSERT(==, data->logger(), query_results[i + 1], 0x1); - // data should not be touched. - LOG_ASSERT(==, data->logger(), query_results[i + 2], 0xFFFFFFFF); - i += 3; - } - } - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_acquisition_tests/vkGetQueryPoolResults_test/vkGetQueryPoolResults_test.py b/gapid_tests/resource_acquisition_tests/vkGetQueryPoolResults_test/vkGetQueryPoolResults_test.py deleted file mode 100644 index 8692a2d0..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetQueryPoolResults_test/vkGetQueryPoolResults_test.py +++ /dev/null @@ -1,107 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, GapitTest -from gapit_test_framework import require, require_equal, require_not_equal -from gapit_test_framework import get_write_offset_function -from vulkan_constants import * -from struct_offsets import VulkanStruct, UINT32_T, UINT64_T, ARRAY - - -@gapit_test("vkGetQueryPoolResults_test") -class AllFourQueryResultsIn32BitWithNoFlag(GapitTest): - - def expect(self): - num_queries = 4 - result_width = 4 - - architecture = self.architecture - get_query_result = require(self.nth_call_of("vkGetQueryPoolResults", 1)) - - require_not_equal(0, get_query_result.int_device) - require_not_equal(0, get_query_result.int_queryPool) - require_equal(0, get_query_result.int_firstQuery) - require_equal(num_queries, get_query_result.int_queryCount) - require_equal(num_queries * result_width, get_query_result.int_dataSize) - require_not_equal(0, get_query_result.hex_pData) - require_equal(result_width, get_query_result.int_stride) - require_equal(0, get_query_result.int_flags) - require_equal(VK_SUCCESS, int(get_query_result.return_val)) - - result_data = VulkanStruct( - architecture, [("data", ARRAY, num_queries, UINT32_T)], - get_write_offset_function(get_query_result, - get_query_result.hex_pData)) - require_equal([0 for i in range(num_queries)], result_data.data) - - -@gapit_test("vkGetQueryPoolResults_test") -class FifthToEighthQueryResultsIn64BitWithWaitBit(GapitTest): - - def expect(self): - num_queries = 8 - get_result_num_queries = 4 - result_width = 8 - - architecture = self.architecture - get_query_result = require(self.nth_call_of("vkGetQueryPoolResults", 2)) - - require_not_equal(0, get_query_result.int_device) - require_not_equal(0, get_query_result.int_queryPool) - require_equal(num_queries - get_result_num_queries, - get_query_result.int_firstQuery) - require_equal(get_result_num_queries, get_query_result.int_queryCount) - require_equal(result_width * get_result_num_queries, - get_query_result.int_dataSize) - require_not_equal(0, get_query_result.hex_pData) - require_equal(result_width, get_query_result.int_stride) - require_equal(VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT, - get_query_result.int_flags) - require_equal(VK_SUCCESS, int(get_query_result.return_val)) - - result_data = VulkanStruct( - architecture, [("data", ARRAY, get_result_num_queries, UINT64_T)], - get_write_offset_function(get_query_result, - get_query_result.hex_pData)) - require_equal([0 for i in range(get_result_num_queries)], - result_data.data) - - -@gapit_test("vkGetQueryPoolResults_test") -class AllFourQueryResultsIn32BitAnd12StrideWithPartialAndAvailabilityBit( - GapitTest): - - def expect(self): - num_queries = 4 - stride = 12 - - architecture = self.architecture - get_query_result = require(self.nth_call_of("vkGetQueryPoolResults", 3)) - - require_not_equal(0, get_query_result.int_device) - require_not_equal(0, get_query_result.int_queryPool) - require_equal(0, get_query_result.int_firstQuery) - require_equal(num_queries, get_query_result.int_queryCount) - require_equal(num_queries * stride, get_query_result.int_dataSize) - require_not_equal(0, get_query_result.hex_pData) - require_equal(stride, get_query_result.int_stride) - require_equal(VK_QUERY_RESULT_PARTIAL_BIT - | VK_QUERY_RESULT_WITH_AVAILABILITY_BIT, - get_query_result.int_flags) - require_equal(VK_SUCCESS, int(get_query_result.return_val)) - - result_data = VulkanStruct( - architecture, [("data", ARRAY, num_queries * stride / 4, UINT32_T)], - get_write_offset_function(get_query_result, - get_query_result.hex_pData)) - expected_data = [0, 1, 0xFFFFFFFF, 0, 1, 0xFFFFFFFF, 0, 1, 0xFFFFFFFF, - 0, 1, 0xFFFFFFFF] - require_equal(expected_data, result_data.data) diff --git a/gapid_tests/resource_acquisition_tests/vkGetRenderAreaGranularity_test/CMakeLists.txt b/gapid_tests/resource_acquisition_tests/vkGetRenderAreaGranularity_test/CMakeLists.txt deleted file mode 100644 index 545f2496..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetRenderAreaGranularity_test/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkGetRenderAreaGranularity_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) diff --git a/gapid_tests/resource_acquisition_tests/vkGetRenderAreaGranularity_test/README.md b/gapid_tests/resource_acquisition_tests/vkGetRenderAreaGranularity_test/README.md deleted file mode 100644 index 0f463609..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetRenderAreaGranularity_test/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# vkGetRenderAreaGranularity - -## Signatures -```c++ -void vkGetRenderAreaGranularity( - VkDevice device, - VkRenderPass renderPass, - VkExtent2D* pGranularity); -``` - -According to the Vulkan spec: -- The conditions leading to an optimal `renderArea` (in `VkRenderPassBeginInfo`) - are: - - the `offset.x` member in `renderArea` is a multiple of the `width` member - of the returned `VkExtent2D` pointed by `pGranularity`. - - the `offset.y` member in `renderArea` is a multiple of the `height` member - of the returned `VkExtent2D` pointed by `pGranularity`. - - either the `offset.width` member in `renderArea` is a multiple of the - horizontal granularity or `offset.x+offset.width` is equal to the `width` of - the `framebuffer` in the `VkRenderPassBeginInfo`. - - either the `offset.height` member in `renderArea` is a multiple of the - vertical granularity or `offset.y+offset.height` is equal to the height of - the `framebuffer` in the `VkRenderPassBeginInfo`. -- `pGranularity` **must** be a pointer to a `VkExtent2D` structure - -These tests should test the following cases: -- [x] `renderPass` of a valid renderpass -- [x] `pGranularity` of a valid pointer to `VkExtent2D` diff --git a/gapid_tests/resource_acquisition_tests/vkGetRenderAreaGranularity_test/main.cpp b/gapid_tests/resource_acquisition_tests/vkGetRenderAreaGranularity_test/main.cpp deleted file mode 100644 index 87926021..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetRenderAreaGranularity_test/main.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/queue_wrapper.h" - -uint32_t fragment_shader[] = -#include "simple_fragment.frag.spv" - ; - -uint32_t vertex_shader[] = -#include "simple_vertex.vert.spv" - ; - -vulkan::VkRenderPass CreateRenderpass(const entry::EntryData* data, - vulkan::VulkanApplication* app_ptr) { - LOG_ASSERT(!=, data->logger(), 0, (uintptr_t)app_ptr); - vulkan::VulkanApplication& app = *app_ptr; - vulkan::PipelineLayout pipeline_layout(app.CreatePipelineLayout( - {{{ - 0, // binding - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_VERTEX_BIT, // stageFlags - nullptr, // pImmutableSamplers - }, - { - 1, // binding - VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_FRAGMENT_BIT, // stageFlags - nullptr, // pImmutableSamplers - }}})); - - VkAttachmentReference color_attachment = { - 1, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - VkAttachmentReference depth_attachment = { - 0, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}; - - vulkan::VkRenderPass render_pass = app.CreateRenderPass( - {{ - 0, // flags - VK_FORMAT_D32_SFLOAT, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL // finalLayout - }, - { - 0, // flags - VK_FORMAT_R8G8B8A8_UNORM, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // finalLayout - }}, // AttachmentDescriptions - {{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment, // colorAttachment - nullptr, // pResolveAttachments - &depth_attachment, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }}, // SubpassDescriptions - {} // SubpassDependencies - ); - return render_pass; -} - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - auto render_pass = CreateRenderpass(data, &app); - VkExtent2D granularity = {0}; - app.device()->vkGetRenderAreaGranularity(app.device(), render_pass, - &granularity); - LOG_EXPECT(!=, data->logger(), 0, granularity.width); - LOG_EXPECT(!=, data->logger(), 0, granularity.height); - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_acquisition_tests/vkGetRenderAreaGranularity_test/vkGetRenderAreaGranularity_test.py b/gapid_tests/resource_acquisition_tests/vkGetRenderAreaGranularity_test/vkGetRenderAreaGranularity_test.py deleted file mode 100644 index 935103ab..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetRenderAreaGranularity_test/vkGetRenderAreaGranularity_test.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, GapitTest -from gapit_test_framework import require, require_equal, require_not_equal -from gapit_test_framework import get_write_offset_function -from vulkan_constants import * -from struct_offsets import VulkanStruct, UINT32_T, UINT64_T, ARRAY - -EXTENT_2D = [("width", UINT32_T), ("height", UINT32_T)] - - -@gapit_test("vkGetRenderAreaGranularity_test") -class GetRenderAreaGranularity(GapitTest): - - def expect(self): - architecture = self.architecture - get_granularity = require(self.next_call_of( - "vkGetRenderAreaGranularity")) - - require_not_equal(0, get_granularity.int_device) - require_not_equal(0, get_granularity.int_renderPass) - granularity = VulkanStruct( - architecture, EXTENT_2D, get_write_offset_function( - get_granularity, get_granularity.hex_pGranularity)) - require_not_equal(0, granularity.width) - require_not_equal(0, granularity.height) diff --git a/gapid_tests/resource_acquisition_tests/vkGetSwapchainImagesKHR_test/CMakeLists.txt b/gapid_tests/resource_acquisition_tests/vkGetSwapchainImagesKHR_test/CMakeLists.txt deleted file mode 100644 index e10a872e..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetSwapchainImagesKHR_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkGetSwapchainImagesKHR_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_acquisition_tests/vkGetSwapchainImagesKHR_test/README.md b/gapid_tests/resource_acquisition_tests/vkGetSwapchainImagesKHR_test/README.md deleted file mode 100644 index bd9d9da3..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetSwapchainImagesKHR_test/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# vkGetDeviceQueue - -## Signatures -```c++ -VkResult vkGetSwapchainImagesKHR( - VkDevice device, - VkSwapchainKHR swapchain, - uint32_t* pSwapchainImageCount, - VkImage* pSwapchainImages); -``` - -According to the Vulkan spec: -- `device` **must** be a valid vkDevice -- `swapchain` **must** a valid VkSwapchainKHR -- `pSwapchainImages` **may** be null -- `pSwapchainImageCount` **must** be a valid pointer - -These tests should test the following cases: -- [x] `pSwapchainImageCount` == 0 -- [x] `pSwapchainImageCount` > max returned -- [x] 0 < `pSwapchainImageCount`< max returned diff --git a/gapid_tests/resource_acquisition_tests/vkGetSwapchainImagesKHR_test/main.cpp b/gapid_tests/resource_acquisition_tests/vkGetSwapchainImagesKHR_test/main.cpp deleted file mode 100644 index df380102..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetSwapchainImagesKHR_test/main.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateDefaultInstance(data->allocator(), &wrapper)); - vulkan::VkSurfaceKHR surface(vulkan::CreateDefaultSurface(&instance, data)); - - uint32_t queues[2]; - vulkan::VkDevice device(vulkan::CreateDeviceForSwapchain( - data->allocator(), &instance, &surface, &queues[0], &queues[1], false)); - vulkan::VkSwapchainKHR swapchain(vulkan::CreateDefaultSwapchain( - &instance, &device, &surface, data->allocator(), queues[0], queues[1], - data)); - - uint32_t num_images; - - LOG_ASSERT( - ==, data->logger(), - device->vkGetSwapchainImagesKHR(device, swapchain, &num_images, nullptr), - VK_SUCCESS); - containers::vector images(data->allocator()); - images.resize(num_images); - LOG_EXPECT(==, data->logger(), - device->vkGetSwapchainImagesKHR(device, swapchain, &num_images, - images.data()), - VK_SUCCESS); - - if (num_images > 1) { - num_images -= 1; - LOG_EXPECT(==, data->logger(), - device->vkGetSwapchainImagesKHR(device, swapchain, &num_images, - images.data()), - VK_INCOMPLETE); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_acquisition_tests/vkGetSwapchainImagesKHR_test/vkGetSwapchainImagesKHR_test.py b/gapid_tests/resource_acquisition_tests/vkGetSwapchainImagesKHR_test/vkGetSwapchainImagesKHR_test.py deleted file mode 100644 index c674bfe7..00000000 --- a/gapid_tests/resource_acquisition_tests/vkGetSwapchainImagesKHR_test/vkGetSwapchainImagesKHR_test.py +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest -import gapit_test_framework -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY -from vulkan_constants import * - - -@gapit_test("vkGetSwapchainImagesKHR_test") -class GetSwapchainImages_test(GapitTest): - - def expect(self): - architecture = self.architecture - swapchain_images = require( - self.next_call_of("vkGetSwapchainImagesKHR")) - require_equal(swapchain_images.return_val, VK_SUCCESS) - - num_swapchain_images = little_endian_bytes_to_int( - require( - swapchain_images.get_write_data( - swapchain_images.hex_pSwapchainImageCount, 4))) - require_not_equal(0, num_swapchain_images) - - swapchain_images = require( - self.next_call_of("vkGetSwapchainImagesKHR")) - new_num_swapchain_images = little_endian_bytes_to_int( - require( - swapchain_images.get_write_data( - swapchain_images.hex_pSwapchainImageCount, 4))) - require_equal(num_swapchain_images, new_num_swapchain_images) - - for i in range(0, num_swapchain_images): - require( - swapchain_images.get_write_data( - swapchain_images.hex_pSwapchainImages + - i * NON_DISPATCHABLE_HANDLE_SIZE, - NON_DISPATCHABLE_HANDLE_SIZE)) - require_equal(swapchain_images.return_val, VK_SUCCESS) - - if num_swapchain_images > 1: - swapchain_images = require( - self.next_call_of("vkGetSwapchainImagesKHR")) - for i in range(0, num_swapchain_images - 1): - require( - swapchain_images.get_write_data( - swapchain_images.hex_pSwapchainImages + - i * NON_DISPATCHABLE_HANDLE_SIZE, NON_DISPATCHABLE_HANDLE_SIZE)) - require_equal(swapchain_images.return_val, VK_INCOMPLETE) diff --git a/gapid_tests/resource_binding_tests/CMakeLists.txt b/gapid_tests/resource_binding_tests/CMakeLists.txt deleted file mode 100644 index 3aaa2e2c..00000000 --- a/gapid_tests/resource_binding_tests/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_vulkan_subdirectory(vkUpdateDescriptorSets_test) diff --git a/gapid_tests/resource_binding_tests/README.md b/gapid_tests/resource_binding_tests/README.md deleted file mode 100644 index 5676f6ba..00000000 --- a/gapid_tests/resource_binding_tests/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Resource Creation Tests - -These tests are specifically for testing functionality revolving around -the binding of vulkan resources. - -# Tests - -- [vkUpdateDescriptorSets_test](vkUpdateDescriptorSets_test/README.md) diff --git a/gapid_tests/resource_binding_tests/vkUpdateDescriptorSets_test/CMakeLists.txt b/gapid_tests/resource_binding_tests/vkUpdateDescriptorSets_test/CMakeLists.txt deleted file mode 100644 index a894a0c6..00000000 --- a/gapid_tests/resource_binding_tests/vkUpdateDescriptorSets_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkUpdateDescriptorSets_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_binding_tests/vkUpdateDescriptorSets_test/README.md b/gapid_tests/resource_binding_tests/vkUpdateDescriptorSets_test/README.md deleted file mode 100644 index a3e1e3fc..00000000 --- a/gapid_tests/resource_binding_tests/vkUpdateDescriptorSets_test/README.md +++ /dev/null @@ -1,156 +0,0 @@ -# vkUpdateDescriptorSets - -## Signatures -```c++ -void vkUpdateDescriptorSets( - VkDevice device, - uint32_t descriptorWriteCount, - const VkWriteDescriptorSet* pDescriptorWrites, - uint32_t descriptorCopyCount, - const VkCopyDescriptorSet* pDescriptorCopies); -``` - -# VkWriteDescriptorSet -```c++ -typedef struct VkWriteDescriptorSet { - VkStructureType sType; - const void* pNext; - VkDescriptorSet dstSet; - uint32_t dstBinding; - uint32_t dstArrayElement; - uint32_t descriptorCount; - VkDescriptorType descriptorType; - const VkDescriptorImageInfo* pImageInfo; - const VkDescriptorBufferInfo* pBufferInfo; - const VkBufferView* pTexelBufferView; -} VkWriteDescriptorSet; - -typedef struct VkDescriptorBufferInfo { - VkBuffer buffer; - VkDeviceSize offset; - VkDeviceSize range; -} VkDescriptorBufferInfo; - -typedef struct VkDescriptorImageInfo { - VkSampler sampler; - VkImageView imageView; - VkImageLayout imageLayout; -} VkDescriptorImageInfo; - -typedef enum VkDescriptorType { - VK_DESCRIPTOR_TYPE_SAMPLER = 0, - VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 1, - VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 2, - VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 3, - VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 4, - VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 5, - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 6, - VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 7, - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 8, - VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9, - VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10, -} VkDescriptorType; -``` - -# VkCopyDescriptorSet -```c++ -typedef struct VkCopyDescriptorSet { - VkStructureType sType; - const void* pNext; - VkDescriptorSet srcSet; - uint32_t srcBinding; - uint32_t srcArrayElement; - VkDescriptorSet dstSet; - uint32_t dstBinding; - uint32_t dstArrayElement; - uint32_t descriptorCount; -} VkCopyDescriptorSet; -``` - -# Valid usage - -For `VkWriteDescriptorSet`, according to the Vulkan spec: -- `descriptorCount` must be greater than 0 -- If `descriptorType` is `VK_DESCRIPTOR_TYPE_SAMPLER`, - `VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER`, - `VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE`, `VK_DESCRIPTOR_TYPE_STORAGE_IMAGE`, - or `VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT`, `pImageInfo` must be a pointer - to an array of `descriptorCount` valid `VkDescriptorImageInfo` structures -- If `descriptorType` is `VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER` or - `VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER`, `pTexelBufferView` must be - a pointer to an array of `descriptorCount` valid `VkBufferView` handles -- If `descriptorType` is `VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER`, - `VK_DESCRIPTOR_TYPE_STORAGE_BUFFER`, - `VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC`, or - `VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC`, `pBufferInfo` must be - a pointer to an array of `descriptorCount` valid `VkDescriptorBufferInfo` - structures - -For `VkCopyDescriptorSet`, according to the Vulkan spec: -- `srcSet` **must** be a valid `VkDescriptorSet` handle -- `dstSet` **must** be a valid `VkDescriptorSet` handle -- If `srcSet` is equal to `dstSet`, then the source and destination ranges - of descriptors **must** not overlap, where the ranges may include array - elements from consecutive bindings as described by consecutive binding - updates - -# Tests - -For `vkUpdateDescriptorSets`, these tests should test the following cases: -- `descriptorWriteCount` - - [x] == 0 - - [x] != 0 -- `descriptorCopyCount` - - [x] == 0 - - [ ] != 0 -For `VkWriteDescriptorSet`, these tests should test the following cases: -- `dstArraryElement` - - [x] == 0 - - [x] > 0 -- `descriptorCount` - - [x] == 1 - - [x] > 1 -- `descriptorType` - - [x] == `VK_DESCRIPTOR_TYPE_SAMPLER` - - [ ] == `VK_DESCRIPTOR_TYPE_STORAGE_IMAGE` - - [ ] == `VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER` - - [x] == `VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER` -- `pImageInfo` - - [x] == `nullptr` - - [x] == pointer to meaningful data - - [ ] == pointer to random data -- `pBufferInfo` - - [x] == `nullptr` - - [x] == pointer to meaningful data - - [ ] == pointer to random data -- `pTexelBufferView` - - [x] == `nullptr` - - [ ] == pointer to meaningful data - - [ ] == pointer to random data - -For `VkDescriptorBufferInfo`, these tests should test the following cases: -- `range` - - [ ] == `VK_WHOLE_SIZE` - - [x] == some size - -For `VkDescriptorImageInfo`, these tests should test the following cases: -- `sampler` - - [x] used - - [ ] not used -- `imageView` - - [ ] used - - [x] not used -- `imageLayout` - - [ ] used - - [x] not used - -For `VkCopyDescriptorSet`, these tests should test the following cases: -- `srcArraryElement` - - [x] == 0 - - [x] > 0 -- `dstArraryElement` - - [x] == 0 - - [x] > 0 -- `descriptorCount` - - [x] == 1 - - [x] > 1 diff --git a/gapid_tests/resource_binding_tests/vkUpdateDescriptorSets_test/main.cpp b/gapid_tests/resource_binding_tests/vkUpdateDescriptorSets_test/main.cpp deleted file mode 100644 index bd2943d7..00000000 --- a/gapid_tests/resource_binding_tests/vkUpdateDescriptorSets_test/main.cpp +++ /dev/null @@ -1,271 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - auto allocator = data->allocator(); - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - vulkan::VkDevice& device = app.device(); - - { // 1. Zero writes and zero copies. - device->vkUpdateDescriptorSets(device, 0, nullptr, 0, nullptr); - } - - { // 2. One write and zero copies. - VkDescriptorSetLayoutBinding binding{ - 0, // binding - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, // descriptorType - 2, // descriptorCount - VK_SHADER_STAGE_VERTEX_BIT, // stageFlags - nullptr, // pImmutableSamplers - }; - auto set = app.AllocateDescriptorSet({binding}); - - auto buffer = app.CreateAndBindDefaultExclusiveDeviceBuffer( - 1024, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT); - - const VkDescriptorBufferInfo bufinfo[2] = { - { - /* buffer = */ *buffer, - /* offset = */ 0, - /* range = */ 512, - }, - { - /* buffer = */ *buffer, - /* offset = */ 512, - /* range = */ 512, - }, - }; - - const VkWriteDescriptorSet write = { - /* sType = */ VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, - /* pNext = */ nullptr, - /* dstSet = */ set, - /* dstBinding = */ 0, - /* dstArrayElement = */ 0, - /* descriptorCount = */ 2, - /* descriptorType = */ VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, - /* pImageInfo = */ nullptr, - /* pBufferInfo = */ bufinfo, - /* pTexelBufferView = */ nullptr, - }; - - device->vkUpdateDescriptorSets(device, 1, &write, 0, nullptr); - } - - { // 3. Two writes and zero copies. - VkDescriptorSetLayoutBinding binding{ - 0, // binding - VK_DESCRIPTOR_TYPE_SAMPLER, // descriptorType - 2, // descriptorCount - VK_SHADER_STAGE_FRAGMENT_BIT, // stageFlags - nullptr, // pImmutableSamplers - }; - auto set = app.AllocateDescriptorSet({binding}); - - vulkan::VkSampler sampler = vulkan::CreateDefaultSampler(&device); - ::VkSampler raw_sampler = sampler.get_raw_object(); - - const VkDescriptorImageInfo imginfo[2] = { - { - /* sampler = */ raw_sampler, - /* imageView = */ VK_NULL_HANDLE, // ignored - /* imageLayout = */ VK_IMAGE_LAYOUT_GENERAL, // ignored - }, - { - /* sampler = */ raw_sampler, - /* imageView = */ VK_NULL_HANDLE, - /* imageLayout = */ VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, - }, - }; - - const VkWriteDescriptorSet writes[2] = { - { - /* sType = */ VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, - /* pNext = */ nullptr, - /* dstSet = */ set, - /* dstBinding = */ 0, - /* dstArrayElement = */ 0, - /* descriptorCount = */ 1, - /* descriptorType = */ VK_DESCRIPTOR_TYPE_SAMPLER, - /* pImageInfo = */ &imginfo[0], - /* pBufferInfo = */ nullptr, - /* pTexelBufferView = */ nullptr, - }, - { - /* sType = */ VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, - /* pNext = */ nullptr, - /* dstSet = */ set, - /* dstBinding = */ 0, - /* dstArrayElement = */ 1, - /* descriptorCount = */ 1, - /* descriptorType = */ VK_DESCRIPTOR_TYPE_SAMPLER, - /* pImageInfo = */ &imginfo[1], - /* pBufferInfo = */ nullptr, - /* pTexelBufferView = */ nullptr, - }, - }; - - device->vkUpdateDescriptorSets(device, 2, writes, 0, nullptr); - } - - { // 4. Zero writes and two copies. - VkDescriptorSetLayoutBinding first_binding{ - 0, // binding - VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_FRAGMENT_BIT, // stageFlags - nullptr, // pImmutableSamplers - }; - auto first_set = app.AllocateDescriptorSet({first_binding}); - - VkDescriptorSetLayoutBinding second_binding{ - 0, // binding - VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, // descriptorType - 5, // descriptorCount - VK_SHADER_STAGE_FRAGMENT_BIT, // stageFlags - nullptr, // pImmutableSamplers - }; - auto second_set = app.AllocateDescriptorSet({second_binding}); - - VkImageCreateInfo image_create_info{VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - nullptr, - 0, - VK_IMAGE_TYPE_2D, - VK_FORMAT_R8G8B8A8_UNORM, - {4, 4, 1}, - 1, - 1, - VK_SAMPLE_COUNT_1_BIT, - VK_IMAGE_TILING_OPTIMAL, - VK_IMAGE_USAGE_STORAGE_BIT, - VK_SHARING_MODE_EXCLUSIVE, - 0, - nullptr, - VK_IMAGE_LAYOUT_UNDEFINED}; - auto image = app.CreateAndBindImage(&image_create_info); - VkImageViewCreateInfo image_view_create_info{ - VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, - nullptr, - 0, - *image, - VK_IMAGE_VIEW_TYPE_2D, - VK_FORMAT_R8G8B8A8_UNORM, - {VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, - VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY}, - {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, - }; - ::VkImageView raw_image_view; - device->vkCreateImageView(device, &image_view_create_info, nullptr, - &raw_image_view); - vulkan::VkImageView image_view(raw_image_view, nullptr, &device); - - const VkDescriptorImageInfo imginfo[3] = { - // One image info for the first descriptor set - { - /* sampler = */ VK_NULL_HANDLE, - /* imageView = */ image_view, - /* imageLayout = */ VK_IMAGE_LAYOUT_GENERAL, - }, - // Two image infos for the second descriptor set - { - /* sampler = */ VK_NULL_HANDLE, - /* imageView = */ image_view, - /* imageLayout = */ VK_IMAGE_LAYOUT_GENERAL, - }, - { - /* sampler = */ VK_NULL_HANDLE, - /* imageView = */ image_view, - /* imageLayout = */ VK_IMAGE_LAYOUT_GENERAL, - }, - }; - - // First, we need to write two descriptors to the descriptor set. - const VkWriteDescriptorSet writes[2] = { - // Write to first_set binding 0, array element 0. - { - /* sType = */ VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, - /* pNext = */ nullptr, - /* dstSet = */ first_set, - /* dstBinding = */ 0, - /* dstArrayElement = */ 0, - /* descriptorCount = */ 1, - /* descriptorType = */ VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, - /* pImageInfo = */ &imginfo[0], - /* pBufferInfo = */ nullptr, - /* pTexelBufferView = */ nullptr, - }, - // Write to second_set binding 0, array element 1 and 2. - { - /* sType = */ VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, - /* pNext = */ nullptr, - /* dstSet = */ second_set, - /* dstBinding = */ 0, - /* dstArrayElement = */ 1, - /* descriptorCount = */ 2, - /* descriptorType = */ VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, - /* pImageInfo = */ &imginfo[1], - /* pBufferInfo = */ nullptr, - /* pTexelBufferView = */ nullptr, - }, - }; - - device->vkUpdateDescriptorSets(device, 2, writes, 0, nullptr); - - // Then we test copying descriptors in VkUpdateDescriptorSets - const VkCopyDescriptorSet copies[2] = { - // Copy the only descriptor from set[0] to set[1]. - { - /* sType = */ VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET, - /* pNext = */ nullptr, - /* srcSet = */ first_set, - /* srcBinding = */ 0, - /* srcArrayElement = */ 0, - /* dstSet = */ second_set, - /* dstBinding = */ 0, - /* dstArrayElement = */ 0, - /* descriptorCount = */ 1, - }, - // Copy the 2nd & 3rd descriptors to the 4th & 5th. - { - /* sType = */ VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET, - /* pNext = */ nullptr, - /* srcSet = */ second_set, - /* srcBinding = */ 0, - /* srcArrayElement = */ 1, - /* dstSet = */ second_set, - /* dstBinding = */ 0, - /* dstArrayElement = */ 3, - /* descriptorCount = */ 2, - }, - }; - - device->vkUpdateDescriptorSets(device, 0, nullptr, 2, copies); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_binding_tests/vkUpdateDescriptorSets_test/vkUpdateDescriptorSets_test.py b/gapid_tests/resource_binding_tests/vkUpdateDescriptorSets_test/vkUpdateDescriptorSets_test.py deleted file mode 100644 index ad4abf72..00000000 --- a/gapid_tests/resource_binding_tests/vkUpdateDescriptorSets_test/vkUpdateDescriptorSets_test.py +++ /dev/null @@ -1,306 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, GapitTest -from gapit_test_framework import require, require_equal, require_not_equal -from gapit_test_framework import little_endian_bytes_to_int -from vulkan_constants import * -from struct_offsets import VulkanStruct, UINT32_T, HANDLE, POINTER, DEVICE_SIZE - -WRITE_DESCRIPTOR_SET_ELEMENTS = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("dstSet", HANDLE), - ("dstBinding", UINT32_T), - ("dstArrayElement", UINT32_T), - ("descriptorCount", UINT32_T), - ("descriptorType", UINT32_T), - ("pImageInfo", POINTER), - ("pBufferInfo", POINTER), - ("pTexelBufferView", POINTER), -] - -COPY_DESCRIPTOR_SET_ELEMENTS = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("srcSet", HANDLE), - ("srcBinding", UINT32_T), - ("srcArrayElement", UINT32_T), - ("dstSet", HANDLE), - ("dstBinding", UINT32_T), - ("dstArrayElement", UINT32_T), - ("descriptorCount", UINT32_T), -] - -DESCRIPTOR_BUFFER_INFO_ELEMENTS = [ - ("buffer", HANDLE), - ("offset", DEVICE_SIZE), - ("range", DEVICE_SIZE), -] - -DESCRIPTOR_IMAGE_INFO_ELEMENTS = [ - ("sampler", HANDLE), - ("imageView", HANDLE), - ("imageLayout", UINT32_T), -] - - -def get_buffer(test): - """Returns the next buffer handle created by vkCreateBuffer.""" - create = require(test.next_call_of("vkCreateBuffer")) - require_equal(VK_SUCCESS, int(create.return_val)) - buf = little_endian_bytes_to_int( - require(create.get_write_data( - create.hex_pBuffer, NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(0, buf) - return buf - - -def get_descriptor_set(test, index): - """Returns the descriptor set handle created by the |index|th - (starting from 1) vkAllocateDescriptorSet.""" - allocate = require(test.nth_call_of("vkAllocateDescriptorSets", index)) - require_equal(VK_SUCCESS, int(allocate.return_val)) - d_set = little_endian_bytes_to_int( - require(allocate.get_write_data( - allocate.hex_pDescriptorSets, NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(0, d_set) - return d_set - - -def get_write_descriptor_set(update_atom, architecture, count): - """Returns |count| VulkanStructs representing the VkWriteDescriptorSet - structs used in the given |update_atom| atom.""" - writes = [VulkanStruct(architecture, WRITE_DESCRIPTOR_SET_ELEMENTS, - lambda offset, size: little_endian_bytes_to_int( - require(update_atom.get_read_data( - update_atom.hex_pDescriptorWrites + offset, - size))))] - struct_size = writes[-1].total_size - for i in range(1, count): - writes.append( - VulkanStruct(architecture, WRITE_DESCRIPTOR_SET_ELEMENTS, - lambda offset, size: little_endian_bytes_to_int( - require(update_atom.get_read_data( - (update_atom.hex_pDescriptorWrites + - i * struct_size + offset), - size))))) - return writes - - -def get_copy_descriptor_set(update_atom, architecture, count): - """Returns |count| VulkanStructs representing the VkCopyDescriptorSet - structs used in the given |update_atom| atom.""" - copies = [VulkanStruct(architecture, COPY_DESCRIPTOR_SET_ELEMENTS, - lambda offset, size: little_endian_bytes_to_int( - require(update_atom.get_read_data( - update_atom.hex_pDescriptorCopies + offset, - size))))] - struct_size = copies[-1].total_size - for i in range(1, count): - copies.append( - VulkanStruct(architecture, COPY_DESCRIPTOR_SET_ELEMENTS, - lambda offset, size: little_endian_bytes_to_int( - require(update_atom.get_read_data( - (update_atom.hex_pDescriptorCopies + - i * struct_size + offset), - size))))) - return copies - - -def get_buffer_info(update_atom, architecture, base, count): - """Returns |count| VulkanStructs representing the VkDescriptorBufferInfo - structs used in the VkWriteDescriptorSet parameter of the given - |update_atom| atom.""" - infos = [VulkanStruct(architecture, DESCRIPTOR_BUFFER_INFO_ELEMENTS, - lambda offset, size: little_endian_bytes_to_int( - require(update_atom.get_read_data( - base + offset, size))))] - buffer_info_size = infos[-1].total_size - - for i in range(1, count): - infos.append(VulkanStruct( - architecture, DESCRIPTOR_BUFFER_INFO_ELEMENTS, - lambda offset, size: little_endian_bytes_to_int(require( - update_atom.get_read_data( - base + i * buffer_info_size + offset, size))))) - return infos - - -def get_image_info(update_atom, architecture, base): - """Returns a VulkanStruct representing the VkDescriptorImageInfo - struct used in the VkWriteDescriptorSet parameter of the given - |update_atom| atom.""" - return VulkanStruct( - architecture, DESCRIPTOR_IMAGE_INFO_ELEMENTS, - lambda offset, size: little_endian_bytes_to_int( - require(update_atom.get_read_data(base + offset, size)))) - - -def get_sampler(test): - """Returns the next VkSampler created in |test|.""" - create = require(test.next_call_of("vkCreateSampler")) - require_equal(VK_SUCCESS, int(create.return_val)) - require_not_equal(0, create.int_device) - require_not_equal(0, create.hex_pSampler) - sampler = little_endian_bytes_to_int( - require(create.get_write_data( - create.hex_pSampler, NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(0, sampler) - return sampler - - -@gapit_test("vkUpdateDescriptorSets_test") -class ZeroWritesZeroCopy(GapitTest): - - def expect(self): - """1. Zero writes and zero copies.""" - update_atom = require(self.nth_call_of("vkUpdateDescriptorSets", 1)) - require_equal(0, update_atom.descriptorWriteCount) - require_equal(0, update_atom.pDescriptorWrites) - require_equal(0, update_atom.descriptorCopyCount) - require_equal(0, update_atom.pDescriptorCopies) - - -@gapit_test("vkUpdateDescriptorSets_test") -class OneWriteZeroCopy(GapitTest): - - def expect(self): - """2. One write and zero copies.""" - - arch = self.architecture - # Get the VkDescriptorSet handle returned from the driver. - # This will also locate us to the proper position in the stream - # so we can call next_call_of() for querying the other atoms. - d_set = get_descriptor_set(self, 1) - buf = get_buffer(self) - - update_atom = require(self.next_call_of("vkUpdateDescriptorSets")) - require_equal(1, update_atom.descriptorWriteCount) - require_not_equal(0, update_atom.pDescriptorWrites) - require_equal(0, update_atom.descriptorCopyCount) - require_equal(0, update_atom.pDescriptorCopies) - - # Check VkWriteDescriptorSet - write = get_write_descriptor_set(update_atom, arch, 1)[0] - require_equal(VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, write.sType) - require_equal(0, write.pNext) - require_equal(d_set, write.dstSet) - require_equal(0, write.dstBinding) - require_equal(0, write.dstArrayElement) - require_equal(2, write.descriptorCount) - require_equal(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, write.descriptorType) - require_equal(0, write.pImageInfo) - require_not_equal(0, write.pBufferInfo) - require_equal(0, write.pTexelBufferView) - - # Check VkDescriptorBufferInfo - bufinfo = get_buffer_info(update_atom, arch, write.pBufferInfo, 2) - require_equal(buf, bufinfo[0].buffer) - require_equal(000, bufinfo[0].offset) - require_equal(512, bufinfo[0].range) - require_equal(buf, bufinfo[1].buffer) - require_equal(512, bufinfo[1].offset) - require_equal(512, bufinfo[1].range) - - -@gapit_test("vkUpdateDescriptorSets_test") -class TwoWritesZeroCopy(GapitTest): - - def expect(self): - """3. Two writes and zero copies.""" - - arch = self.architecture - # Get the VkDescriptorSet handle returned from the driver. - # This will also locate us to the proper position in the stream - # so we can call next_call_of() for querying the other atoms. - d_set = get_descriptor_set(self, 2) - sampler = get_sampler(self) - - update_atom = require(self.next_call_of("vkUpdateDescriptorSets")) - require_equal(2, update_atom.descriptorWriteCount) - require_not_equal(0, update_atom.pDescriptorWrites) - require_equal(0, update_atom.descriptorCopyCount) - require_equal(0, update_atom.pDescriptorCopies) - - # Check VkWriteDescriptorSet - writes = get_write_descriptor_set(update_atom, arch, 2) - for i in range(2): - require_equal(VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, - writes[i].sType) - require_equal(0, writes[i].pNext) - require_equal(d_set, writes[i].dstSet) - require_equal(0, writes[i].dstBinding) - require_equal(1, writes[i].descriptorCount) - require_equal(VK_DESCRIPTOR_TYPE_SAMPLER, - writes[i].descriptorType) - require_not_equal(0, writes[i].pImageInfo) - require_equal(0, writes[i].pBufferInfo) - require_equal(0, writes[i].pTexelBufferView) - require_equal(0, writes[0].dstArrayElement) - require_equal(1, writes[1].dstArrayElement) - - # Check VkDescriptorImageInfo - imginfo = get_image_info(update_atom, arch, writes[0].pImageInfo) - require_equal(sampler, imginfo.sampler) - require_equal(0, imginfo.imageView) - require_equal(VK_IMAGE_LAYOUT_GENERAL, imginfo.imageLayout) - - imginfo = get_image_info(update_atom, arch, writes[1].pImageInfo) - require_equal(sampler, imginfo.sampler) - require_equal(0, imginfo.imageView) - require_equal(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, - imginfo.imageLayout) - - -@gapit_test("vkUpdateDescriptorSets_test") -class ZeroWritesTwoCopies(GapitTest): - - def expect(self): - """4. Zero writes and two copies.""" - - arch = self.architecture - # Get the VkDescriptorSet handle returned from the driver. - # This will also locate us to the proper position in the stream - # so we can call next_call_of() for querying the other atoms. - d_set0 = get_descriptor_set(self, 3) - d_set1 = get_descriptor_set(self, 1) # the next one after the previous - - # The first call to vkUpdateDesriptorSets writes the descriptors. - require(self.next_call_of("vkUpdateDescriptorSets")) - # The second call to vkUpdateDescriptorSets copies the descriptors. - update_atom = require(self.next_call_of("vkUpdateDescriptorSets")) - require_equal(0, update_atom.descriptorWriteCount) - require_equal(0, update_atom.pDescriptorWrites) - require_equal(2, update_atom.descriptorCopyCount) - require_not_equal(0, update_atom.pDescriptorCopies) - - # Check VkCopyDescriptorSet - copies = get_copy_descriptor_set(update_atom, arch, 2) - for i in range(2): - require_equal(VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET, - copies[i].sType) - require_equal(0, copies[i].pNext) - require_equal(0, copies[i].srcBinding) - require_equal(0, copies[i].dstBinding) - require_equal(d_set0, copies[0].srcSet) - require_equal(d_set1, copies[1].srcSet) - require_equal(d_set1, copies[0].dstSet) - require_equal(d_set1, copies[1].dstSet) - require_equal(0, copies[0].srcArrayElement) - require_equal(1, copies[1].srcArrayElement) - require_equal(0, copies[0].dstArrayElement) - require_equal(3, copies[1].dstArrayElement) - require_equal(1, copies[0].descriptorCount) - require_equal(2, copies[1].descriptorCount) diff --git a/gapid_tests/resource_creation_tests/AllocateFreeDescriptorSets_test/AllocateFreeDescriptorSets_test.py b/gapid_tests/resource_creation_tests/AllocateFreeDescriptorSets_test/AllocateFreeDescriptorSets_test.py deleted file mode 100644 index 7b88c78c..00000000 --- a/gapid_tests/resource_creation_tests/AllocateFreeDescriptorSets_test/AllocateFreeDescriptorSets_test.py +++ /dev/null @@ -1,190 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, GapitTest, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from vulkan_constants import * -from struct_offsets import VulkanStruct, UINT32_T, HANDLE, POINTER - -DESCRIPTOR_SET_ALLOCATE_INFO_ELEMENTS = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("descriptorPool", HANDLE), - ("descriptorSetCount", UINT32_T), - ("pSetLayouts", POINTER), -] - - -def check_alloc_descriptor_set(test, architecture): - """Gets the next vkAllocateDescriptorSets call atom, and checks its return - value and arguments. Also checks the returned pointer to descriptor set - handles is not null. Returns the checked vkAllocateDescriptorSets atom, - device and pointer to descriptor set handles. This method does not check - the content of the VkDescriptorSetAllocateInfo struct used in the - vkAllocateDescriptorSets call. - """ - alloc_descriptor_set = require( - test.next_call_of("vkAllocateDescriptorSets")) - require_equal(VK_SUCCESS, int(alloc_descriptor_set.return_val)) - device = alloc_descriptor_set.int_device - require_not_equal(0, device) - require_not_equal(0, alloc_descriptor_set.hex_pAllocateInfo) - p_sets = alloc_descriptor_set.hex_pDescriptorSets - require_not_equal(0, p_sets) - return alloc_descriptor_set, device, p_sets - - -def check_free_descriptor_set(test, device, pool, sets): - """Checks that the next vkFreeDescriptorSets command call atom is used to - free the given descriptor |sets| from the given descriptor |pool| on the - given |device|. - """ - free_descriptor_set = require( - test.next_call_of("vkFreeDescriptorSets")) - require_equal(device, free_descriptor_set.int_device) - require_equal(pool, free_descriptor_set.int_descriptorPool) - require_equal(len(sets), free_descriptor_set.int_descriptorSetCount) - p_sets = free_descriptor_set.hex_pDescriptorSets - for i, expected_set in enumerate(sets): - actual_set = little_endian_bytes_to_int( - require(free_descriptor_set.get_read_data( - p_sets + NON_DISPATCHABLE_HANDLE_SIZE * i, - NON_DISPATCHABLE_HANDLE_SIZE))) - require_equal(expected_set, actual_set) - - -def get_descriptor_set_alloc_info(alloc_descriptor_set, architecture): - """Returns a VulkanStruct representing the VkDescriptorSetAllocateInfo - struct used in the given |alloc_descriptor_set| command.""" - return VulkanStruct( - architecture, DESCRIPTOR_SET_ALLOCATE_INFO_ELEMENTS, - lambda offset, size: little_endian_bytes_to_int(require( - alloc_descriptor_set.get_read_data( - alloc_descriptor_set.hex_pAllocateInfo + offset, size)))) - - -def get_descriptor_pool(test, index): - """Returns the handle of the |index|th (starting from 1) descriptor pool - created from vkCreateDescriptorPool.""" - create = require(test.nth_call_of("vkCreateDescriptorPool", index)) - require_equal(VK_SUCCESS, int(create.return_val)) - pool = little_endian_bytes_to_int( - require(create.get_write_data( - create.hex_pDescriptorPool, NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(0, pool) - return pool - - -def get_descriptor_set_layout(test): - """Returns the handle of the next descriptor set layout created from - vkCreateDescriptorSetLayout.""" - create = require(test.next_call_of("vkCreateDescriptorSetLayout")) - require_equal(VK_SUCCESS, int(create.return_val)) - layout = little_endian_bytes_to_int( - require(create.get_write_data( - create.hex_pSetLayout, NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(0, layout) - return layout - - -@gapit_test("AllocateFreeDescriptorSets_test") -class OneDescriptorSet(GapitTest): - - def expect(self): - """1. One descriptor set.""" - - arch = self.architecture - # Get the VkDescriptorPool handle returned from the driver. - # This will also locate us to the proper position in the stream - # so we can call next_call_of() for querying the other atoms. - pool = get_descriptor_pool(self, 1) - # Get the VkDescriptorSetLayout handle returned from the driver. - set_layout = get_descriptor_set_layout(self) - - alloc_descriptor_set, device, p_sets = \ - check_alloc_descriptor_set(self, arch) - info = get_descriptor_set_alloc_info(alloc_descriptor_set, arch) - require_equal(info.sType, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO) - require_equal(0, info.pNext) - require_equal(pool, info.descriptorPool) - require_equal(1, info.descriptorSetCount) - - # Read the VkDescriptorSetLayout conveyed in the alloc info. - layout = little_endian_bytes_to_int( - require(alloc_descriptor_set.get_read_data( - info.pSetLayouts, NON_DISPATCHABLE_HANDLE_SIZE))) - require_equal(set_layout, layout) - - # Get the real VkDescriptorSet returned form the driver. - actual_set = little_endian_bytes_to_int( - require(alloc_descriptor_set.get_write_data( - alloc_descriptor_set.hex_pDescriptorSets, - NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(0, actual_set) - - check_free_descriptor_set(self, device, pool, [actual_set]) - - -@gapit_test("AllocateFreeDescriptorSets_test") -class ThreeDescriptorSet(GapitTest): - - def expect(self): - """2. Three descriptor sets.""" - - arch = self.architecture - # Get the VkDescriptorPool handle returned from the driver. - # This will also locate us to the proper position in the stream - # so we can call next_call_of() for querying the other atoms. - pool = get_descriptor_pool(self, 2) - # Get the VkDescriptorSetLayout handle returned from the driver. - set_layout = get_descriptor_set_layout(self) - - alloc_descriptor_set, device, p_sets = \ - check_alloc_descriptor_set(self, arch) - info = get_descriptor_set_alloc_info(alloc_descriptor_set, arch) - require_equal(info.sType, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO) - require_equal(0, info.pNext) - require_equal(pool, info.descriptorPool) - require_equal(3, info.descriptorSetCount) - - for i in range(3): - # Read the VkDescriptorSetLayout conveyed in the alloc info. - layout = little_endian_bytes_to_int( - require(alloc_descriptor_set.get_read_data( - info.pSetLayouts + NON_DISPATCHABLE_HANDLE_SIZE * i, - NON_DISPATCHABLE_HANDLE_SIZE))) - require_equal(set_layout, layout) - - actual_set = [] - for i in range(3): - # Get the real VkDescriptorSet returned form the driver. - actual_set.append(little_endian_bytes_to_int( - require(alloc_descriptor_set.get_write_data( - (alloc_descriptor_set.hex_pDescriptorSets + - NON_DISPATCHABLE_HANDLE_SIZE * i), - NON_DISPATCHABLE_HANDLE_SIZE)))) - require_not_equal(0, actual_set[-1]) - - check_free_descriptor_set(self, device, pool, actual_set) - - -@gapit_test("AllocateFreeDescriptorSets_test") -class FreeNullDescriptorSets(GapitTest): - - def expect(self): - """3. Free null descriptor sets.""" - device_properties = require( - self.next_call_of("vkGetPhysicalDeviceProperties")) diff --git a/gapid_tests/resource_creation_tests/AllocateFreeDescriptorSets_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/AllocateFreeDescriptorSets_test/CMakeLists.txt deleted file mode 100644 index 1551e1b2..00000000 --- a/gapid_tests/resource_creation_tests/AllocateFreeDescriptorSets_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(AllocateFreeDescriptorSets_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/AllocateFreeDescriptorSets_test/README.md b/gapid_tests/resource_creation_tests/AllocateFreeDescriptorSets_test/README.md deleted file mode 100644 index a5c20339..00000000 --- a/gapid_tests/resource_creation_tests/AllocateFreeDescriptorSets_test/README.md +++ /dev/null @@ -1,67 +0,0 @@ -# vkAllocateDescriptorSets / vkFreeDescriptorSets - -## Signatures -```c++ -VkResult vkAllocateDescriptorSets( - VkDevice device, - const VkDescriptorSetAllocateInfo* pAllocateInfo, - VkDescriptorSet* pDescriptorSets); - -VkResult vkFreeDescriptorSets( - VkDevice device, - VkDescriptorPool descriptorPool, - uint32_t descriptorSetCount, - const VkDescriptorSet* pDescriptorSets); -``` - -# VkDescriptorSetAllocateInfo -```c++ -typedef struct VkDescriptorSetAllocateInfo { - VkStructureType sType; - const void* pNext; - VkDescriptorPool descriptorPool; - uint32_t descriptorSetCount; - const VkDescriptorSetLayout* pSetLayouts; -} VkDescriptorSetAllocateInfo; -``` - -# Valid usage - -For `vkAllocateDescriptorSets`, according to the Vulkan spec: -- `pDescriptorSets` **must** be a pointer to an array of `descriptorSetCount` - `VkDescriptorSet` handles -- `descriptorSetCount` **must** be greater than 0 -- `descriptorSetCount` **must** not be greater than the number of sets that - are currently available for allocation in `descriptorPool` -- `pSetLayouts` **must** be a pointer to an array of `descriptorSetCount` - valid `VkDescriptorSetLayout` handles - -For `vkFreeDescriptorSets`, according to the Vulkan spec: -- `descriptorPool` **must** be a valid `VkDescriptorPool` handle -- `descriptorPool` **must** have been created with the - `VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT` flag -- `descriptorSetCount` **must** be greater than 0 -- `pDescriptorSets` **must** be a pointer to an array of `descriptorSetCount` - `VkDescriptorSet` handles, each element of which **must** either be a valid - handle or `VK_NULL_HANDLE` - -# Tests - -For `vkAllocateDescriptorSets`, these tests should test the following cases: -- `descriptorSetCount` of valid values: - - [x] 1 - - [x] 3 -- `pSetLayouts` of valid values - - [x] pointer to 1 `VkDescriptorSetLayout` handle - - [x] pointer to 3 `VkDescriptorSetLayout` handles -- `pDescriptorSets` of valid values - - [x] pointer to 1 element - - [x] pointer to 3 elements - -For `vkFreeDescriptorSets`, these tests should test the following cases: -- `descriptorSetCount` of valid values - - [x] 1 - - [x] 3 -- `pDescriptorSets` contains `VK_NULL_HANDLE` - - [x] yes - - [x] no diff --git a/gapid_tests/resource_creation_tests/AllocateFreeDescriptorSets_test/main.cpp b/gapid_tests/resource_creation_tests/AllocateFreeDescriptorSets_test/main.cpp deleted file mode 100644 index b635143d..00000000 --- a/gapid_tests/resource_creation_tests/AllocateFreeDescriptorSets_test/main.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - auto allocator = data->allocator(); - vulkan::LibraryWrapper wrapper(allocator, data->logger()); - vulkan::VkInstance instance(vulkan::CreateEmptyInstance(allocator, &wrapper)); - vulkan::VkDevice device(vulkan::CreateDefaultDevice(allocator, instance)); - - { // 1. One descriptor set. - VkDescriptorPoolSize pool_size = {VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 3}; - vulkan::VkDescriptorPool pool = - CreateDescriptorPool(&device, 1, &pool_size, 1); - ::VkDescriptorPool raw_pool = pool.get_raw_object(); - - vulkan::VkDescriptorSetLayout layout = - CreateDescriptorSetLayout(&device, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 3); - ::VkDescriptorSetLayout raw_layout = layout.get_raw_object(); - - VkDescriptorSetAllocateInfo alloc_info{ - /* sType = */ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO, - /* pNext = */ nullptr, - /* descriptorPool = */ raw_pool, - /* descriptorSetCount = */ 1, - /* pSetLayouts = */ &raw_layout, - }; - ::VkDescriptorSet set; - device->vkAllocateDescriptorSets(device, &alloc_info, &set); - data->logger()->LogInfo(" descriptor set: ", set); - device->vkFreeDescriptorSets(device, raw_pool, 1, &set); - } - - { // 2. Three descriptor sets. - const uint32_t kNumSets = 3; - - VkDescriptorPoolSize pool_size = {VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, - kNumSets}; - vulkan::VkDescriptorPool pool = - CreateDescriptorPool(&device, 1, &pool_size, kNumSets); - ::VkDescriptorPool raw_pool = pool.get_raw_object(); - - vulkan::VkDescriptorSetLayout layout = CreateDescriptorSetLayout( - &device, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1); - ::VkDescriptorSetLayout raw_layout = layout.get_raw_object(); - ::VkDescriptorSetLayout raw_layouts[kNumSets] = {raw_layout, raw_layout, - raw_layout}; - - VkDescriptorSetAllocateInfo alloc_info{ - /* sType = */ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO, - /* pNext = */ nullptr, - /* descriptorPool = */ raw_pool, - /* descriptorSetCount = */ kNumSets, - /* pSetLayouts = */ raw_layouts, - }; - ::VkDescriptorSet sets[kNumSets]; - device->vkAllocateDescriptorSets(device, &alloc_info, - (::VkDescriptorSet*)sets); - for (int i = 0; i < kNumSets; ++i) { - data->logger()->LogInfo(" descriptor set: ", sets[i]); - } - device->vkFreeDescriptorSets(device, raw_pool, kNumSets, sets); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/AllocateResetFreeCommandBuffer/AllocateResetFreeCommandBuffer.py b/gapid_tests/resource_creation_tests/AllocateResetFreeCommandBuffer/AllocateResetFreeCommandBuffer.py deleted file mode 100644 index fcb6dbb1..00000000 --- a/gapid_tests/resource_creation_tests/AllocateResetFreeCommandBuffer/AllocateResetFreeCommandBuffer.py +++ /dev/null @@ -1,100 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function, get_write_offset_function -import gapit_test_framework -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY, DEVICE_SIZE, INT32_T -from vulkan_constants import * - -COMMAND_BUFFER_ALLOCATE_INFO = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("commandPool", HANDLE), - ("level", UINT32_T), - ("commandBufferCount", UINT32_T), -] - -MAX_COUNT = 5 - - -@gapit_test("AllocateResetFreeCommandBuffer") -class AllocateAndFreeCommandBuffers(GapitTest): - - def expect(self): - """Check the arguments to vkAllocateCommandBuffers""" - architecture = self.architecture - for level in [VK_COMMAND_BUFFER_LEVEL_PRIMARY, - VK_COMMAND_BUFFER_LEVEL_SECONDARY]: - for count in [1, 2, MAX_COUNT]: - allocate = require(self.next_call_of( - "vkAllocateCommandBuffers")) - require_not_equal(0, allocate.int_device) - require_not_equal(0, allocate.hex_pAllocateInfo) - require_not_equal(0, allocate.hex_pCommandBuffers) - require_equal(VK_SUCCESS, int(allocate.return_val)) - - allocate_info = VulkanStruct( - architecture, COMMAND_BUFFER_ALLOCATE_INFO, - get_read_offset_function(allocate, - allocate.hex_pAllocateInfo)) - require_equal(VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, - allocate_info.sType) - command_pool = allocate_info.commandPool - require_not_equal(0, command_pool) - require_equal(level, allocate_info.level) - require_equal(count, allocate_info.commandBufferCount) - - allocated_buffers = [] - if count > 0: - command_buffers = VulkanStruct( - architecture, [("handles", ARRAY, count, POINTER)], - get_write_offset_function(allocate, - allocate.hex_pCommandBuffers)) - for i in range(count): - require_not_equal(0, command_buffers.handles[i]) - allocated_buffers.append(command_buffers.handles[i]) - - free = require(self.next_call_of("vkFreeCommandBuffers")) - require_not_equal(0, free.int_device) - require_equal(command_pool, free.int_commandPool) - require_equal(count, free.int_commandBufferCount) - freed_buffers = [] - if count > 0: - command_buffers = VulkanStruct( - architecture, [("handles", ARRAY, count, POINTER)], - get_read_offset_function(free, - free.hex_pCommandBuffers)) - for i in range(count): - require_not_equal(0, command_buffers.handles[i]) - freed_buffers.append(command_buffers.handles[i]) - - require_equal(allocated_buffers, freed_buffers) - - -@gapit_test("AllocateResetFreeCommandBuffer") -class ResetCommandBuffer(GapitTest): - - def expect(self): - """Check the arguments to vkResetCommandBuffer""" - first_reset = require(self.next_call_of("vkResetCommandBuffer")) - require_not_equal(0, first_reset.int_commandBuffer) - require_equal(VK_SUCCESS, int(first_reset.return_val)) - - second_reset = require(self.next_call_of("vkResetCommandBuffer")) - require_not_equal(0, second_reset.int_commandBuffer) - require_equal(VK_SUCCESS, int(second_reset.return_val)) - - # As the |flags| is used in a circular way, the flags used for the first - # and the second call to vkResetCommandBuffer must be different. - require_not_equal(first_reset.int_flags, second_reset.int_flags) diff --git a/gapid_tests/resource_creation_tests/AllocateResetFreeCommandBuffer/CMakeLists.txt b/gapid_tests/resource_creation_tests/AllocateResetFreeCommandBuffer/CMakeLists.txt deleted file mode 100644 index 3bce08ae..00000000 --- a/gapid_tests/resource_creation_tests/AllocateResetFreeCommandBuffer/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(AllocateResetFreeCommandBuffer - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/AllocateResetFreeCommandBuffer/README.md b/gapid_tests/resource_creation_tests/AllocateResetFreeCommandBuffer/README.md deleted file mode 100644 index 2070657c..00000000 --- a/gapid_tests/resource_creation_tests/AllocateResetFreeCommandBuffer/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# vkAllocateCommandBuffer / vkResetCommandBuffer / vkFreeCommandBuffer - -## Signatures -```c++ -VkResult vkAllocateCommandBuffers( - VkDevice device, - const VkCommandBufferAllocateInfo* pAllocateInfo, - VkCommandBuffer* pCommandBuffers); - -VkResult vkResetCommandBuffer( - VkCommandBuffer commandBuffer, - VkCommandBufferResetFlags flags); - -void vkFreeCommandBuffers( - VkDevice device, - VkCommandPool commandPool, - uint32_t commandBufferCount, - const VkCommandBuffer* pCommandBuffers); -``` - -# VkCommandBufferAllocateInfo -```c++ -typedef struct VkCommandBufferAllocateInfo { - VkStructureType sType; - const void* pNext; - VkCommandPool commandPool; - VkCommandBufferLevel level; - uint32_t commandBufferCount; -} VkCommandBufferAllocateInfo; -``` - -These tests should test the following cases: -- [x] all possible `VkCommandBufferLevel` values -- [x] all possible `VkCommandBufferResetFlags` values -- [x] `commandBufferCount` == 0, == 1, > 1 - - [x] `vkAllocateCommandBuffers` - - [x] `vkFreeCommandBuffers` -- [x] combinations of the above diff --git a/gapid_tests/resource_creation_tests/AllocateResetFreeCommandBuffer/main.cpp b/gapid_tests/resource_creation_tests/AllocateResetFreeCommandBuffer/main.cpp deleted file mode 100644 index e45a02b6..00000000 --- a/gapid_tests/resource_creation_tests/AllocateResetFreeCommandBuffer/main.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - auto allocator = data->allocator(); - vulkan::LibraryWrapper wrapper(allocator, data->logger()); - vulkan::VkInstance instance( - vulkan::CreateEmptyInstance(data->allocator(), &wrapper)); - vulkan::VkDevice device(vulkan::CreateDefaultDevice(allocator, instance)); - vulkan::VkCommandPool pool( - vulkan::CreateDefaultCommandPool(allocator, device, false)); - - const uint32_t max_count = 5; - - containers::vector<::VkCommandBufferResetFlags> reset_flags = - vulkan::AllVkCommandBufferResetFlagCombinations(allocator); - uint32_t reset_flag_index = reset_flags.size() - 1; - - containers::vector<::VkCommandBuffer> command_buffers(allocator); - command_buffers.resize(max_count); - for (VkCommandBufferLevel level : - vulkan::AllVkCommandBufferLevels(allocator)) { - for (uint32_t count : {uint32_t(1), uint32_t(2), max_count}) { - data->logger()->LogInfo("commandBufferLevel: ", level); - data->logger()->LogInfo("commandBufferCount: ", count); - - data->logger()->LogInfo(" API: vkAllocateCommandBuffers"); - const VkCommandBufferAllocateInfo create_info = { - /* sType = */ VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, - /* pNext = */ nullptr, - /* commandPool = */ pool.get_raw_object(), - /* level = */ level, - /* commandBufferCount = */ count, - }; - LOG_EXPECT(==, data->logger(), - device->vkAllocateCommandBuffers(device, &create_info, - command_buffers.data()), - VK_SUCCESS); - for (uint32_t i = 0; i < count; ++i) { - data->logger()->LogInfo(" handle: ", command_buffers[i]); - } - - data->logger()->LogInfo(" API: vkResetCommandBuffer"); - for (uint32_t i = 0; i < count; ++i) { - LOG_EXPECT(==, data->logger(), - device->command_buffer_functions()->vkResetCommandBuffer( - command_buffers[i], - // Use reset flags in a circular way. - (reset_flag_index = - (reset_flag_index + 1) % reset_flags.size())), - VK_SUCCESS); - } - - data->logger()->LogInfo(" API: vkFreeCommandBuffers"); - device->vkFreeCommandBuffers(device, pool.get_raw_object(), count, - command_buffers.data()); - } - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/BindMapUnmapBuffer_test/BindMapUnmapBuffer_test.py b/gapid_tests/resource_creation_tests/BindMapUnmapBuffer_test/BindMapUnmapBuffer_test.py deleted file mode 100644 index 2b547c71..00000000 --- a/gapid_tests/resource_creation_tests/BindMapUnmapBuffer_test/BindMapUnmapBuffer_test.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from gapit_test_framework import get_write_offset_function -import gapit_test_framework -from struct_offsets import VulkanStruct, UINT32_T, DEVICE_SIZE, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY -from vulkan_constants import * - - -@gapit_test("BindMapUnmapBuffer_test") -class BindUnbindWholeMemoryRange(GapitTest): - - def expect(self): - architecture = self.architecture - bind_buffer_memory = require(self.next_call_of("vkBindBufferMemory")) - map_memory = require(self.next_call_of("vkMapMemory")) - unmap_memory = require(self.next_call_of("vkUnmapMemory")) - - require_not_equal(0, bind_buffer_memory.int_device) - require_not_equal(0, bind_buffer_memory.int_buffer) - require_not_equal(0, bind_buffer_memory.int_memory) - require_equal(0, bind_buffer_memory.int_memoryOffset) - - require_equal(bind_buffer_memory.int_device, map_memory.int_device) - require_equal(bind_buffer_memory.int_memory, map_memory.int_memory) - require_equal(0, map_memory.int_offset) - require_equal(VK_WHOLE_SIZE, map_memory.int_size) - require_equal(0, map_memory.int_flags) - require_not_equal(0, map_memory.hex_ppData) - - written_pointer = little_endian_bytes_to_int( - require( - map_memory.get_write_data(map_memory.hex_ppData, - architecture.int_pointerSize))) - - require_not_equal(0, written_pointer) - - require_equal(bind_buffer_memory.int_device, unmap_memory.int_device) - require_equal(bind_buffer_memory.int_memory, unmap_memory.int_memory) diff --git a/gapid_tests/resource_creation_tests/BindMapUnmapBuffer_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/BindMapUnmapBuffer_test/CMakeLists.txt deleted file mode 100644 index 4014cacb..00000000 --- a/gapid_tests/resource_creation_tests/BindMapUnmapBuffer_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(BindMapUnmapBuffer_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/BindMapUnmapBuffer_test/README.md b/gapid_tests/resource_creation_tests/BindMapUnmapBuffer_test/README.md deleted file mode 100644 index c622925c..00000000 --- a/gapid_tests/resource_creation_tests/BindMapUnmapBuffer_test/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# vkBindBufferMemory / vkMapMemory / vkUnmapMemory - -## Signatures -```c++ -VkResult vkBindBufferMemory( - VkDevice device, - VkBuffer buffer, - VkDeviceMemory memory, - VkDeviceSize memoryOffset); - -VkResult vkMapMemory( - VkDevice device, - VkDeviceMemory memory, - VkDeviceSize offset, - VkDeviceSize size, - VkMemoryMapFlags flags, - void** ppData); - -void vkUnmapMemory( - VkDevice device, - VkDeviceMemory memory); -``` - -According to the Vulkan spec: -- `vkBindBufferMemory` - - `device` **must** be valid - - `buffer` **must** be valid - - `memory` **must** be valid - - `memoryOffset` **must** be < the size of `memory` - the size retured by - `vkGetBufferMemoryRequirements` - - `memoryOffset` **must** be a multiple `alignment` from - `vkGetBufferMemoryRequirements` -- `vkMapMemory` - - `device` **must** be valid - - `memory` **must** be valid - - `offset` **must** be <= than the size of the memory - - If `size` is not `VK_WHOLE_SIZE` then `size + offset` **must** be <= the - size of the memory - - `flags` **must** be 0 - - `ppData` **must** be a valid pointer to a `void*` -- `vkUnmapMemory` - - `device` **must** be valid - - `memory` **must** be valid - -These tests should test the following cases: -- [x] `memoryOffset` == 0 -- [ ] `memoryOffset` != 0 -- [x] `size` == `VK_WHOLE_SIZE` -- [ ] `size` != `VK_WHOLE_SIZE` -- [x] `vkMapMemory.memoryOffset` == 0 -- [ ] `vkMapMemory.memoryOffset` != 0 \ No newline at end of file diff --git a/gapid_tests/resource_creation_tests/BindMapUnmapBuffer_test/main.cpp b/gapid_tests/resource_creation_tests/BindMapUnmapBuffer_test/main.cpp deleted file mode 100644 index 9658fdf4..00000000 --- a/gapid_tests/resource_creation_tests/BindMapUnmapBuffer_test/main.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - auto allocator = data->allocator(); - vulkan::LibraryWrapper wrapper(allocator, data->logger()); - vulkan::VkInstance instance( - vulkan::CreateEmptyInstance(data->allocator(), &wrapper)); - vulkan::VkDevice device(vulkan::CreateDefaultDevice(allocator, instance)); - - { // First test - VkBufferCreateInfo create_info = { - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // createFlags - 1024, // size - VK_BUFFER_USAGE_TRANSFER_SRC_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr // pQueueFamilyIndices - }; - - VkBuffer raw_buffer; - - LOG_ASSERT(==, data->logger(), device->vkCreateBuffer(device, &create_info, - nullptr, &raw_buffer), - VK_SUCCESS); - vulkan::VkBuffer buffer(raw_buffer, nullptr, &device); - VkMemoryRequirements requirements; - device->vkGetBufferMemoryRequirements(device, buffer, &requirements); - - uint32_t memory_index = vulkan::GetMemoryIndex( - &device, data->logger(), requirements.memoryTypeBits, - VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT); - - VkMemoryAllocateInfo allocate_info{ - VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, // sType - nullptr, // pNext - requirements.size, // allocationSize - memory_index}; - - ::VkDeviceMemory raw_device_memory; - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkAllocateMemory(device, &allocate_info, nullptr, - &raw_device_memory)); - vulkan::VkDeviceMemory device_memory(raw_device_memory, nullptr, &device); - - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkBindBufferMemory(device, buffer, device_memory, 0)); - void* pData = nullptr; - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkMapMemory(device, device_memory, 0, VK_WHOLE_SIZE, 0, - &pData)); - LOG_ASSERT(!=, data->logger(), pData, static_cast(nullptr)); - - // Make sure that we could write to the new pData pointer. - for (size_t i = 0; i < 1024; ++i) { - static_cast(pData)[i] = i % 256; - } - - device->vkUnmapMemory(device, device_memory); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/BufferCreationMemory_test/BufferCreationMemory_test.py b/gapid_tests/resource_creation_tests/BufferCreationMemory_test/BufferCreationMemory_test.py deleted file mode 100644 index 84eb8996..00000000 --- a/gapid_tests/resource_creation_tests/BufferCreationMemory_test/BufferCreationMemory_test.py +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from gapit_test_framework import get_write_offset_function -from struct_offsets import VulkanStruct, UINT32_T, DEVICE_SIZE, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY -from vulkan_constants import * - -BUFFER_CREATE_INFO = [ - ("sType", UINT32_T), ("pNext", POINTER), ("createFlags", UINT32_T), - ("size", DEVICE_SIZE), ("usage", UINT32_T), ("sharingMode", UINT32_T), - ("queueFamilyIndexCount", UINT32_T), ("pQueueFamilyIndices", POINTER) -] - -MEMORY_REQUIREMENTS = [ - ("size", DEVICE_SIZE), ("alignment", DEVICE_SIZE), - ("memoryTypeBits", UINT32_T) -] - - -@gapit_test("BufferCreationMemory_test") -class BufferCreationDestroy(GapitTest): - - def expect(self): - architecture = self.architecture - device_properties = require( - self.next_call_of("vkGetPhysicalDeviceProperties")) - - create_buffer = require(self.next_call_of("vkCreateBuffer")) - - buffer_create_info = VulkanStruct(architecture, BUFFER_CREATE_INFO, - get_read_offset_function( - create_buffer, - create_buffer.hex_pCreateInfo)) - - written_buffer = little_endian_bytes_to_int( - require( - create_buffer.get_write_data(create_buffer.hex_pBuffer, - NON_DISPATCHABLE_HANDLE_SIZE))) - - require_not_equal(0, written_buffer) - - require_equal(buffer_create_info.sType, - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO) - require_equal(buffer_create_info.pNext, 0) - require_equal(buffer_create_info.createFlags, 0) - require_equal(buffer_create_info.size, 1024) - require_equal(buffer_create_info.usage, - VK_BUFFER_USAGE_TRANSFER_SRC_BIT) - require_equal( - buffer_create_info.sharingMode, VK_SHARING_MODE_EXCLUSIVE) - require_equal(buffer_create_info.queueFamilyIndexCount, 0) - require_equal(buffer_create_info.pQueueFamilyIndices, 0) - - get_buffer_memory_requirements = require( - self.next_call_of("vkGetBufferMemoryRequirements")) - require_not_equal(0, get_buffer_memory_requirements.int_device) - require_equal( - written_buffer, get_buffer_memory_requirements.int_buffer) - require_not_equal( - 0, get_buffer_memory_requirements.hex_pMemoryRequirements) - - memory_requirements = VulkanStruct( - architecture, MEMORY_REQUIREMENTS, get_write_offset_function( - get_buffer_memory_requirements, - get_buffer_memory_requirements.hex_pMemoryRequirements)) - - require_equal(True, memory_requirements.size >= 1) - require_not_equal(0, memory_requirements.alignment) - require_not_equal(0, memory_requirements.memoryTypeBits) - - destroy_buffer = require(self.next_call_of("vkDestroyBuffer")) - require_equal(destroy_buffer.int_device, - get_buffer_memory_requirements.int_device) - require_equal(written_buffer, destroy_buffer.int_buffer) diff --git a/gapid_tests/resource_creation_tests/BufferCreationMemory_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/BufferCreationMemory_test/CMakeLists.txt deleted file mode 100644 index 6733be45..00000000 --- a/gapid_tests/resource_creation_tests/BufferCreationMemory_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(BufferCreationMemory_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/BufferCreationMemory_test/README.md b/gapid_tests/resource_creation_tests/BufferCreationMemory_test/README.md deleted file mode 100644 index bbc7e643..00000000 --- a/gapid_tests/resource_creation_tests/BufferCreationMemory_test/README.md +++ /dev/null @@ -1,59 +0,0 @@ -# vkCreateBuffer / vkGetBufferMemoryRequirements / vkDestroyBuffer - -## Signatures -```c++ -VkResult vkCreateBuffer( - VkDevice device, - const VkBufferCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkBuffer* pBuffer); - -void vkDestroyBuffer( - VkDevice device, - VkBuffer buffer, - const VkAllocationCallbacks* pAllocator); - -void vkGetBufferMemoryRequirements( - VkDevice device, - VkBuffer buffer, - VkMemoryRequirements* pMemoryRequirements); -``` - -# VkBufferCreateInfo -```c++ -typedef struct VkBufferCreateInfo { - VkStructureType sType; - const void* pNext; - VkBufferCreateFlags flags; - VkDeviceSize size; - VkBufferUsageFlags usage; - VkSharingMode sharingMode; - uint32_t queueFamilyIndexCount; - const uint32_t* pQueueFamilyIndices; -} VkBufferCreateInfo; -``` -# VkMemoryRequirements -```c++ -typedef struct VkMemoryRequirements { - VkDeviceSize size; - VkDeviceSize alignment; - uint32_t memoryTypeBits; -} VkMemoryRequirements; -``` - -According to the Vulkan spec: -- `sType` **must** be `VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO` -- `pNext` **must** be `nullptr` -- `flags` is a bitmask it **may** be 0 -- `size` **must** be > 0 -- `usage` is a bitmask and **must** have at least one set -- if `sharingMode` is `VK_SHARING_MODE_EXCLUSIVE` pQueueFamilyIndices must be 0 -- if `sharingMode` is `VK_SHARING_MODE_CONCURRENT` pQueueFamilyIndices must be > 1 - -These tests should test the following cases: -- [x] `flags` == 0 -- [ ] `flags` != 0 #note: This requires -- [x] `usage` == 1 bit -- [ ] `usage` > 1 bit -- [x] `sharingMode` == `VK_SHARING_MODE_EXCLUSIVE` -- [ ] `sharingMode` == `VK_SHARING_MODE_CONCURRENT` diff --git a/gapid_tests/resource_creation_tests/BufferCreationMemory_test/main.cpp b/gapid_tests/resource_creation_tests/BufferCreationMemory_test/main.cpp deleted file mode 100644 index e118b4a9..00000000 --- a/gapid_tests/resource_creation_tests/BufferCreationMemory_test/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - auto allocator = data->allocator(); - vulkan::LibraryWrapper wrapper(allocator, data->logger()); - vulkan::VkInstance instance( - vulkan::CreateEmptyInstance(data->allocator(), &wrapper)); - vulkan::VkDevice device(vulkan::CreateDefaultDevice(allocator, instance)); - - { // First test - VkBufferCreateInfo create_info = { - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // createFlags - 1024, // size - VK_BUFFER_USAGE_TRANSFER_SRC_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr // pQueueFamilyIndices - }; - - VkBuffer buffer; - LOG_ASSERT(==, data->logger(), - device->vkCreateBuffer(device, &create_info, nullptr, &buffer), - VK_SUCCESS); - - VkMemoryRequirements requirements; - device->vkGetBufferMemoryRequirements(device, buffer, &requirements); - - device->vkDestroyBuffer(device, buffer, nullptr); - data->logger()->LogInfo("Memory requirements for 1024 byte buffer:"); - data->logger()->LogInfo(" Size :", requirements.size); - data->logger()->LogInfo(" Alignment :", requirements.alignment); - data->logger()->LogInfo(" TypeBits :", requirements.memoryTypeBits); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/CMakeLists.txt b/gapid_tests/resource_creation_tests/CMakeLists.txt deleted file mode 100644 index d466709f..00000000 --- a/gapid_tests/resource_creation_tests/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 2017 Google 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. -# - - -add_vulkan_subdirectory(AllocateResetFreeCommandBuffer) -add_vulkan_subdirectory(AllocateFreeDescriptorSets_test) -add_vulkan_subdirectory(BindMapUnmapBuffer_test) -add_vulkan_subdirectory(BufferCreationMemory_test) -add_vulkan_subdirectory(CreateDestroyBufferView_test) -add_vulkan_subdirectory(CreateDestroyDescriptorSetLayout_test) -add_vulkan_subdirectory(CreateDestroyImage_test) -add_vulkan_subdirectory(CreateDestroyImageView_test) -add_vulkan_subdirectory(CreateDestroyQueryPool_test) -add_vulkan_subdirectory(CreateDestroySampler_test) -add_vulkan_subdirectory(CreateResetDestroyDescriptorPool_test) -add_vulkan_subdirectory(FlushAndInvalidateRanges_test) -add_vulkan_subdirectory(ImageMemory_test) -add_vulkan_subdirectory(PipelineCache_test) -add_vulkan_subdirectory(SurfaceCreation_test) -add_vulkan_subdirectory(SyncCreationDestruction_test) -add_vulkan_subdirectory(CreateResetDestroyCommandPool_test) -add_vulkan_subdirectory(vkCreateComputePipelines_test) -add_vulkan_subdirectory(vkCreateFramebuffer_test) -add_vulkan_subdirectory(vkCreateGraphicsPipelines_test) -add_vulkan_subdirectory(vkCreatePipelineLayout_test) -add_vulkan_subdirectory(vkCreateRenderPass_test) -add_vulkan_subdirectory(vkCreateShaderModule_test) -add_vulkan_subdirectory(vkCreateSwapchainKHR_test) diff --git a/gapid_tests/resource_creation_tests/CreateDestroyBufferView_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/CreateDestroyBufferView_test/CMakeLists.txt deleted file mode 100644 index d0034604..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyBufferView_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(CreateDestroyBufferView_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/CreateDestroyBufferView_test/CreateDestroyBufferView_test.py b/gapid_tests/resource_creation_tests/CreateDestroyBufferView_test/CreateDestroyBufferView_test.py deleted file mode 100644 index f069ebae..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyBufferView_test/CreateDestroyBufferView_test.py +++ /dev/null @@ -1,112 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, GapitTest -from gapit_test_framework import get_read_offset_function, get_write_offset_function -from vulkan_constants import * -from struct_offsets import VulkanStruct, UINT32_T, POINTER, HANDLE, DEVICE_SIZE -from struct_offsets import ARRAY, CHAR - -BUFFER_VIEW_CREATE_INFO = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("buffer", HANDLE), - ("format", UINT32_T), - ("offset", DEVICE_SIZE), - ("range", DEVICE_SIZE), -] - -BUFFER_VIEW = [("handle", HANDLE)] - - -@gapit_test("CreateDestroyBufferView_test") -class ZeroOffsetWholeSizeBufferViewOfUniformBuffer(GapitTest): - - def expect(self): - """1. Expects a buffer view created with zero offset and VK_WHOLE_SIZE - range for a uniform texel buffer.""" - - architecture = self.architecture - device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - - create_buffer_view = require(self.nth_call_of("vkCreateBufferView", 1)) - device = create_buffer_view.int_device - require_not_equal(0, device) - require_not_equal(0, create_buffer_view.hex_pCreateInfo) - require_equal(0, create_buffer_view.hex_pAllocator) - require_not_equal(0, create_buffer_view.hex_pView) - require_equal(VK_SUCCESS, int(create_buffer_view.return_val)) - - create_info = VulkanStruct( - architecture, BUFFER_VIEW_CREATE_INFO, get_read_offset_function( - create_buffer_view, create_buffer_view.hex_pCreateInfo)) - require_equal(VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO, - create_info.sType) - require_equal(0, create_info.pNext) - require_equal(0, create_info.flags) - require_not_equal(0, create_info.buffer) - require_equal(VK_FORMAT_R8G8B8A8_UNORM, create_info.format) - require_equal(0, create_info.offset) - require_equal(VK_WHOLE_SIZE, create_info.range) - - view = VulkanStruct( - architecture, BUFFER_VIEW, get_write_offset_function( - create_buffer_view, create_buffer_view.hex_pView)) - require_not_equal(0, view.handle) - - destroy_buffer_view = require(self.next_call_of("vkDestroyBufferView")) - require_equal(device, destroy_buffer_view.int_device) - require_equal(view.handle, destroy_buffer_view.int_bufferView) - - -@gapit_test("CreateDestroyBufferView_test") -class NonZeroOffsetNonWholeSizeBufferViewOfStorageBuffer(GapitTest): - - def expect(self): - """2. Expects a buffer view created with non-zero offset and - non-VK_WHOLE_SIZE range for a storage texel buffer.""" - - architecture = self.architecture - device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - - create_buffer_view = require(self.nth_call_of("vkCreateBufferView", 2)) - device = create_buffer_view.int_device - require_not_equal(0, device) - require_not_equal(0, create_buffer_view.hex_pCreateInfo) - require_equal(0, create_buffer_view.hex_pAllocator) - require_not_equal(0, create_buffer_view.hex_pView) - require_equal(VK_SUCCESS, int(create_buffer_view.return_val)) - - create_info = VulkanStruct( - architecture, BUFFER_VIEW_CREATE_INFO, get_read_offset_function( - create_buffer_view, create_buffer_view.hex_pCreateInfo)) - require_equal(VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO, - create_info.sType) - require_equal(0, create_info.pNext) - require_equal(0, create_info.flags) - require_not_equal(0, create_info.buffer) - require_equal(VK_FORMAT_R8G8B8A8_UNORM, create_info.format) - - view = VulkanStruct( - architecture, BUFFER_VIEW, get_write_offset_function( - create_buffer_view, create_buffer_view.hex_pView)) - require_not_equal(0, view.handle) - - destroy_buffer_view = require(self.next_call_of("vkDestroyBufferView")) - require_equal(device, destroy_buffer_view.int_device) - require_equal(view.handle, destroy_buffer_view.int_bufferView) diff --git a/gapid_tests/resource_creation_tests/CreateDestroyBufferView_test/README.md b/gapid_tests/resource_creation_tests/CreateDestroyBufferView_test/README.md deleted file mode 100644 index 0d90ec3d..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyBufferView_test/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# vkCreateBufferView / vkDestroyBufferView - -## Signatures -```c++ -VkResult vkCreateBufferView( - VkDevice device, - const VkBufferViewCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkBufferView* pView); - -void vkDestroyBufferView( - VkDevice device, - VkBufferView bufferView, - const VkAllocationCallbacks* pAllocator); -``` - -# VkBufferViewCreateInfo -```c++ -typedef struct VkBufferViewCreateInfo { - VkStructureType sType; - const void* pNext; - VkBufferViewCreateFlags flags; - VkBuffer buffer; - VkFormat format; - VkDeviceSize offset; - VkDeviceSize range; -} VkBufferViewCreateInfo; -``` - -According to the Vulkan spec: -- `sType` **must** be `VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO` -- `pNext` **must** be `NULL` -- `flags` **must** be 0 -- `buffer` **must** be a valid `VkBuffer` handle -- `format` **must** be a valid `VkFormat` value -- `offset` is an offset in bytes from the **base address of the buffer**. - Accesses to the buffer view from shaders use addressing that is relative to - this starting offset -- `offset` **must** be a multiple of - `VkPhysicalDeviceLimits::minTexelBufferOffsetAlignment` -- `offset` **must** be less than the size of `buffer` -- `range` is a size in bytes of the buffer view. If `range` is equal to - `VK_WHOLE_SIZE`, the range from `offset` to the end of the buffer is used. - If `VK_WHOLE_SIZE` is used an the remaining size of the buffer is **not** a - multiple of the element size of `format`, the nearest smaller multiple is - used -- If `range` is not equal to `VK_WHOLE_SIZE`, `range` **must** be greater than - 0, **must** be a multiple of the element size of `format`, `range` divided by - the element size of `format`, **must** be less than or equal to - `VkPhysicalDeviceLimits::maxTexelBufferElements` and the sum of `offset` and - `range` **must** be less than or equal to the size of `buffer` -- `buffer` **must** have been created with a `usage` value containing at least - one of `VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT` or - `VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT` -- If `buffer` was created with `usage` containing - `VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT`, `format` **must** be supported - for uniform texel buffers -- If `buffer` was created with `usage` containing - `VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT`, `format` **must** be supported - for storage texel buffers -- If `buffer` is non-sparse then it **must** be bound completely and - contiguously to a single `VkDeviceMemory` object - -These tests should test the following cases: -- [x] `buffer` created with usage bit `VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT` -- [x] `buffer` created with usage bit `VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT` -- [x] `offset` of value zero -- [x] `offset` of value non-zero -- [x] `range` of value `VK_WHOLE_SIZE` -- [x] `range` of value other than `VK_WHOLE_SIZE` diff --git a/gapid_tests/resource_creation_tests/CreateDestroyBufferView_test/main.cpp b/gapid_tests/resource_creation_tests/CreateDestroyBufferView_test/main.cpp deleted file mode 100644 index f4f4cb4b..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyBufferView_test/main.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/vulkan_application.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication application(data->allocator(), data->logger(), - data, - vulkan::VulkanApplicationOptions()); - vulkan::VkDevice& device = application.device(); - - VkPhysicalDeviceProperties properties; - application.instance()->vkGetPhysicalDeviceProperties( - device.physical_device(), &properties); - const VkDeviceSize min_alignment = - properties.limits.minTexelBufferOffsetAlignment; - const VkDeviceSize buffer_size = min_alignment * 4; - const VkFormat format = VK_FORMAT_R8G8B8A8_UNORM; - const VkDeviceSize element_size = - (VkDeviceSize)std::get<0>(vulkan::GetElementAndTexelBlockSize(format)); - - { - // 1. Create a buffer view with zero offset and VK_WHOLE_SIZE range for a - // non-sparse buffer created with VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT. - VkBufferCreateInfo buffer_create_info = { - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // createFlags - buffer_size, // size - VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr, // pQueueFamilyIndices - }; - vulkan::BufferPointer buffer = - application.CreateAndBindHostBuffer(&buffer_create_info); - - VkBufferViewCreateInfo view_create_info = { - VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - *buffer, // buffer - format, // format - 0, // offset - VK_WHOLE_SIZE, // range - }; - - ::VkBufferView buffer_view; - device->vkCreateBufferView(device, &view_create_info, nullptr, - &buffer_view); - device->vkDestroyBufferView(device, buffer_view, nullptr); - } - - { - // 2. Create a buffer view with non-zero offset and range value other than - // VK_WHOLE_SIZE, for a non-sparse buffer created with - // VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT. - VkBufferCreateInfo buffer_create_info = { - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // createFlags - buffer_size, // size - VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr, // pQueueFamilyIndices - }; - vulkan::BufferPointer buffer = - application.CreateAndBindHostBuffer(&buffer_create_info); - - VkBufferViewCreateInfo view_create_info = { - VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - *buffer, // buffer - format, // format - min_alignment * 1, // offset - min_alignment * 3, // range - }; - - ::VkBufferView buffer_view; - device->vkCreateBufferView(device, &view_create_info, nullptr, - &buffer_view); - device->vkDestroyBufferView(device, buffer_view, nullptr); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/CreateDestroyDescriptorSetLayout_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/CreateDestroyDescriptorSetLayout_test/CMakeLists.txt deleted file mode 100644 index 1aa56b29..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyDescriptorSetLayout_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(CreateDestroyDescriptorSetLayout_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/CreateDestroyDescriptorSetLayout_test/CreateDestroyDescriptorSetLayout_test.py b/gapid_tests/resource_creation_tests/CreateDestroyDescriptorSetLayout_test/CreateDestroyDescriptorSetLayout_test.py deleted file mode 100644 index 176969ce..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyDescriptorSetLayout_test/CreateDestroyDescriptorSetLayout_test.py +++ /dev/null @@ -1,245 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest -from vulkan_constants import * -from struct_offsets import VulkanStruct, UINT32_T, FLOAT, POINTER - -DESCRIPTOR_SET_LAYOUT_CREATE_INFO_ELEMENTS = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("bindingCount", UINT32_T), - ("pBindings", POINTER), -] - -BINDING_ELEMENTS = [ - ("binding", UINT32_T), - ("descriptorType", UINT32_T), - ("descriptorCount", UINT32_T), - ("stageFlags", UINT32_T), - ("pImmutableSamplers", POINTER), -] - - -def check_create_descriptor_set_layout(test, index): - """Gets the |index|'th vkCreateDescriptorSetLayout call atom, and checks its - return value and arguments. Also checks the returned descriptor set layout - handle is not null. Returns the checked vkCreateDescriptorSetLayout atom, - device and descriptor set layout handle. This method does not check the - content of the VkDescriptorSetLayoutCreateInfo struct used in the - vkCreateDescriptorSetLayout call. - """ - create_descriptor_set_layout = require(test.nth_call_of( - "vkCreateDescriptorSetLayout", index)) - require_equal(VK_SUCCESS, int(create_descriptor_set_layout.return_val)) - device = create_descriptor_set_layout.int_device - require_not_equal(0, device) - p_create_info = create_descriptor_set_layout.hex_pCreateInfo - require_not_equal(0, p_create_info) - p_set_layout = create_descriptor_set_layout.hex_pSetLayout - require_not_equal(0, p_set_layout) - descriptor_set_layout = little_endian_bytes_to_int(require( - create_descriptor_set_layout.get_write_data( - p_set_layout, NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(0, descriptor_set_layout) - return create_descriptor_set_layout, device, descriptor_set_layout - - -def check_destroy_descriptor_set_layout(test, device, descriptor_set_layout): - """Checks that the next vkDestroyDescriptorSetLayout command call atom has - the passed-in |device| and |descriptor_set_layout| handle value. - """ - destroy_descriptor_set_layout = require(test.next_call_of( - "vkDestroyDescriptorSetLayout")) - require_equal(device, destroy_descriptor_set_layout.int_device) - require_equal(descriptor_set_layout, - destroy_descriptor_set_layout.int_descriptorSetLayout) - - -def get_descriptor_set_layout_create_info(create_descriptor_set_layout, - architecture): - """Returns a VulkanStruct representing the VkDescriptorSetLayoutCreateInfo - struct used in the given |create_descriptor_set_layout| command.""" - return VulkanStruct( - architecture, DESCRIPTOR_SET_LAYOUT_CREATE_INFO_ELEMENTS, - lambda offset, size: little_endian_bytes_to_int(require(create_descriptor_set_layout.get_read_data(create_descriptor_set_layout.hex_pCreateInfo + offset, size)))) - - -def get_binding(create_descriptor_set_layout, architecture, create_info, index): - """Returns a VulkanStruct representing the |index|'th (starting from 0) - VkDescriptorSetLayoutBinding struct baked in |create_info| for the - |create_descriptor_set_layout| atom.""" - binding_offset = create_info.pBindings + index * ( - # Ok, this is a little bit tricky. We have 4 32-bit integers and a - # pointer in VkDescriptorSetLayoutBinding struct. On 32-bit - # architecture, pointer size is 4, so alignement should be fine. - # On 64-bit architecture, pointer size is 8, the struct totally - # occupies (4 * 4 + 8) bytes, so alignment should also be fine. - 4 * 4 + int(architecture.int_pointerSize)) - return VulkanStruct( - architecture, BINDING_ELEMENTS, - lambda offset, size: little_endian_bytes_to_int(require(create_descriptor_set_layout.get_read_data(binding_offset + offset, size)))) - - -def get_samplers(test, count): - """Returns the next |count| VkSamplers created in test.""" - samplers = [] - for i in range(count): - create = require(test.next_call_of("vkCreateSampler")) - require_equal(VK_SUCCESS, int(create.return_val)) - require_not_equal(0, create.int_device) - require_not_equal(0, create.hex_pSampler) - sampler = little_endian_bytes_to_int(require(create.get_write_data( - create.hex_pSampler, NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(0, sampler) - samplers.append(sampler) - return samplers - - -def get_bound_sampler(create_descriptor_set_layout, architecture, binding_info, - index): - """Returns the |index|'th sampler contained in the |binding_info| - VkDescriptorSetLayoutBinding struct's pImmutableSamplers field.""" - offset = ( - binding_info.pImmutableSamplers + index * NON_DISPATCHABLE_HANDLE_SIZE) - return little_endian_bytes_to_int(require( - create_descriptor_set_layout.get_read_data( - offset, NON_DISPATCHABLE_HANDLE_SIZE))) - - -@gapit_test("CreateDestroyDescriptorSetLayout_test") -class ZeroBindings(GapitTest): - - def expect(self): - """1. Zero bindings.""" - - architecture = self.architecture - - create_descriptor_set_layout, device, descriptor_set_layout = \ - check_create_descriptor_set_layout(self, 1) - info = get_descriptor_set_layout_create_info( - create_descriptor_set_layout, architecture) - require_equal(info.sType, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO) - require_equal(info.pNext, 0) - require_equal(info.flags, 0) - require_equal(info.bindingCount, 0) - require_equal(info.pBindings, 0) - - check_destroy_descriptor_set_layout( - self, device, descriptor_set_layout) - - -@gapit_test("CreateDestroyDescriptorSetLayout_test") -class ThreeBindings(GapitTest): - - def expect(self): - """2. Three bindings.""" - - arch = self.architecture - - create_descriptor_set_layout, device, descriptor_set_layout = \ - check_create_descriptor_set_layout(self, 2) - info = get_descriptor_set_layout_create_info( - create_descriptor_set_layout, arch) - require_equal(info.sType, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO) - require_equal(info.pNext, 0) - require_equal(info.flags, 0) - require_equal(info.bindingCount, 3) - require_not_equal(info.pBindings, 0) - - # The 1st binding. - binding = get_binding(create_descriptor_set_layout, arch, info, 0) - require_equal(binding.binding, 0) - require_equal(binding.descriptorType, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) - require_equal(binding.descriptorCount, 6) - require_equal(binding.stageFlags, (VK_SHADER_STAGE_VERTEX_BIT - | VK_SHADER_STAGE_FRAGMENT_BIT)) - require_equal(binding.pImmutableSamplers, 0) - - # The 2nd binding. - binding = get_binding(create_descriptor_set_layout, arch, info, 1) - require_equal(binding.binding, 2) - require_equal(binding.descriptorType, - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) - require_equal(binding.descriptorCount, 1) - require_equal(binding.stageFlags, VK_SHADER_STAGE_VERTEX_BIT) - require_equal(binding.pImmutableSamplers, 0) - - # The 3rd binding. - binding = get_binding(create_descriptor_set_layout, arch, info, 2) - require_equal(binding.binding, 5) - require_equal(binding.descriptorType, - VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) - require_equal(binding.descriptorCount, 0) - require_equal(binding.stageFlags, 0xdeadbeef) - require_equal(binding.pImmutableSamplers, 0) - - check_destroy_descriptor_set_layout( - self, device, descriptor_set_layout) - - -@gapit_test("CreateDestroyDescriptorSetLayout_test") -class TwoBindingsWithSamplers(GapitTest): - - def expect(self): - """3. Two bindings with samplers.""" - - arch = self.architecture - - # Get the actual sampler handles returned by the driver. - expected_samplers = get_samplers(self, 3) - - create_descriptor_set_layout, device, descriptor_set_layout = \ - check_create_descriptor_set_layout(self, 1) - info = get_descriptor_set_layout_create_info( - create_descriptor_set_layout, arch) - require_equal(info.sType, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO) - require_equal(info.pNext, 0) - require_equal(info.flags, 0) - require_equal(info.bindingCount, 2) - require_not_equal(info.pBindings, 0) - - # The 1st binding. - binding = get_binding(create_descriptor_set_layout, arch, info, 0) - require_equal(binding.binding, 2) - require_equal(binding.descriptorType, VK_DESCRIPTOR_TYPE_SAMPLER) - require_equal(binding.descriptorCount, 3) - require_equal(binding.stageFlags, VK_SHADER_STAGE_ALL) - # We gave it a nullptr for this binding. - require_equal(binding.pImmutableSamplers, 0) - - # The 2nd binding. - binding = get_binding(create_descriptor_set_layout, arch, info, 1) - require_equal(binding.binding, 7) - require_equal(binding.descriptorType, VK_DESCRIPTOR_TYPE_SAMPLER) - require_equal(binding.descriptorCount, 3) - require_equal(binding.stageFlags, VK_SHADER_STAGE_ALL) - # We gave it a valid pointer for this binding. - require_not_equal(binding.pImmutableSamplers, 0) - - # Let's check that the atom actually captures all sampler handles - # generated by the driver. - for i in range(3): - sampler = get_bound_sampler(create_descriptor_set_layout, arch, - binding, i) - require_equal(expected_samplers[i], sampler) - - check_destroy_descriptor_set_layout( - self, device, descriptor_set_layout) diff --git a/gapid_tests/resource_creation_tests/CreateDestroyDescriptorSetLayout_test/README.md b/gapid_tests/resource_creation_tests/CreateDestroyDescriptorSetLayout_test/README.md deleted file mode 100644 index 41e4cffc..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyDescriptorSetLayout_test/README.md +++ /dev/null @@ -1,81 +0,0 @@ -# vkCreateDescriptorSetLayout / vkDestroyDescriptorSetLayout - -## Signatures -```c++ -VkResult vkCreateDescriptorSetLayout( - VkDevice device, - const VkDescriptorSetLayoutCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkDescriptorSetLayout* pSetLayout); - -void vkDestroyDescriptorSetLayout( - VkDevice device, - VkDescriptorSetLayout descriptorSetLayout, - const VkAllocationCallbacks* pAllocator); -``` - -# VkDescriptorSetLayoutCreateInfo -```c++ -typedef struct VkDescriptorSetLayoutCreateInfo { - VkStructureType sType; - const void* pNext; - VkDescriptorSetLayoutCreateFlags flags; - uint32_t bindingCount; - const VkDescriptorSetLayoutBinding* pBindings; -} VkDescriptorSetLayoutCreateInfo; - -typedef struct VkDescriptorSetLayoutBinding { - uint32_t binding; - VkDescriptorType descriptorType; - uint32_t descriptorCount; - VkShaderStageFlags stageFlags; - const VkSampler* pImmutableSamplers; -} VkDescriptorSetLayoutBinding; -``` - -According to the Vulkan spec: -- `flags` **must** be 0 -- If `bindingCount` is not 0, `pBindings` **must** be a pointer to an array of - `bindingCount` valid `VkDescriptorSetLayoutBinding` structures -- If `descriptorType` is `VK_DESCRIPTOR_TYPE_SAMPLER` or - `VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER`, and `descriptorCount` is not 0 - and `pImmutableSamplers` is not `NULL`, `pImmutableSamplers` **must** be a - pointer to an array of `descriptorCount` valid `VkSampler` handles -- If `descriptorCount` is not 0, `stageFlags` **must** be a valid combination of - `VkShaderStageFlagBits` values - -For `vkCreateDescriptorSetLayout`, these tests should test the following cases: -- `bindingCount` of valid values: - - [x] 0 - - [x] 2 - - [x] 3 -- `pBindings` of valid values: - - [x] == `nullptr` - - [x] != `nullptr` -- `bounding` of valid values: - - [x] 0 - - [x] 2 - - [x] 5 - - [x] 7 -- `descriptorType` of valid `VkDescriptorType` values: - - [x] `VK_DESCRIPTOR_TYPE_SAMPLER` - - [x] `VK_DESCRIPTOR_TYPE_STORAGE_IMAGE` - - [x] `VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER` - - [x] `VK_DESCRIPTOR_TYPE_STORAGE_BUFFER` -- `descriptorCount` of valid values: - - [x] 0 - - [x] 1 - - [x] 3 - - [x] 6 -- `stageFlags` of values: - - [x] `VK_SHADER_STAGE_VERTEX_BIT` - - [x] `VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT` - - [x] `VK_SHADER_STAGE_ALL` - - [x] `0xdeadbeef` -- `pImmutableSamplers` of valid values: - - [x] == `nullptr` - - [x] != `nullptr` - -For `vkDestroyDescriptorSetLayout`, these tests should test the following cases: -- [x] `descriptorSetLayout` == `nullptr` -- [x] `descriptorSetLayout` != `nullptr` diff --git a/gapid_tests/resource_creation_tests/CreateDestroyDescriptorSetLayout_test/main.cpp b/gapid_tests/resource_creation_tests/CreateDestroyDescriptorSetLayout_test/main.cpp deleted file mode 100644 index 39887046..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyDescriptorSetLayout_test/main.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - auto allocator = data->allocator(); - vulkan::LibraryWrapper wrapper(allocator, data->logger()); - vulkan::VkInstance instance(vulkan::CreateEmptyInstance(allocator, &wrapper)); - vulkan::VkDevice device(vulkan::CreateDefaultDevice(allocator, instance)); - - { // 1. Zero bindings. - VkDescriptorSetLayoutCreateInfo create_info{ - /* sType = */ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* bindingCount = */ 0, - /* pBindings = */ nullptr, - }; - - ::VkDescriptorSetLayout layout; - device->vkCreateDescriptorSetLayout(device, &create_info, nullptr, &layout); - data->logger()->LogInfo(" layout: ", layout); - device->vkDestroyDescriptorSetLayout(device, layout, nullptr); - } - - { // 2. Three bindings. - VkDescriptorSetLayoutBinding bindings[3] = { - { - /* binding = */ 0, - /* descriptorType = */ VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, - /* descriptorCount = */ 6, - /* stageFlags = */ - (VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT), - /* pImmutableSamplers = */ nullptr, - }, - { - /* binding = */ 2, - /* descriptorType = */ VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, - /* descriptorCount = */ 1, - /* stageFlags = */ VK_SHADER_STAGE_VERTEX_BIT, - /* pImmutableSamplers = */ nullptr, - }, - { - /* binding = */ 5, - /* descriptorType = */ VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, - /* descriptorCount = */ 0, - /* stageFlags = */ 0xdeadbeef, - /* pImmutableSamplers = */ nullptr, - }, - }; - - VkDescriptorSetLayoutCreateInfo create_info{ - /* sType = */ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* bindingCount = */ 3, - /* pBindings = */ bindings, - }; - - ::VkDescriptorSetLayout layout; - device->vkCreateDescriptorSetLayout(device, &create_info, nullptr, &layout); - data->logger()->LogInfo(" layout: ", layout); - device->vkDestroyDescriptorSetLayout(device, layout, nullptr); - } - - { // 3. Two bindings with samplers. - containers::vector samplers(allocator); - ::VkSampler raw_samplers[3]; - samplers.reserve(3); - for (int i = 0; i < 3; ++i) { - samplers.emplace_back(CreateDefaultSampler(&device)); - raw_samplers[i] = samplers.back().get_raw_object(); - } - - VkDescriptorSetLayoutBinding bindings[2] = { - { - /* binding = */ 2, - /* descriptorType = */ VK_DESCRIPTOR_TYPE_SAMPLER, - /* descriptorCount = */ 3, - /* stageFlags = */ VK_SHADER_STAGE_ALL, - /* pImmutableSamplers = */ nullptr, - }, - { - /* binding = */ 7, - /* descriptorType = */ VK_DESCRIPTOR_TYPE_SAMPLER, - /* descriptorCount = */ 3, - /* stageFlags = */ VK_SHADER_STAGE_ALL, - /* pImmutableSamplers = */ raw_samplers, - }, - }; - - VkDescriptorSetLayoutCreateInfo create_info{ - /* sType = */ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* bindingCount = */ 2, - /* pBindings = */ bindings, - }; - - ::VkDescriptorSetLayout layout; - device->vkCreateDescriptorSetLayout(device, &create_info, nullptr, &layout); - data->logger()->LogInfo(" layout: ", layout); - device->vkDestroyDescriptorSetLayout(device, layout, nullptr); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/CreateDestroyImageView_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/CreateDestroyImageView_test/CMakeLists.txt deleted file mode 100644 index 29e139a1..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyImageView_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(CreateDestroyImageView_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/CreateDestroyImageView_test/CreateDestroyImageView_test.py b/gapid_tests/resource_creation_tests/CreateDestroyImageView_test/CreateDestroyImageView_test.py deleted file mode 100644 index ace2dc03..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyImageView_test/CreateDestroyImageView_test.py +++ /dev/null @@ -1,140 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest -from gapit_test_framework import get_read_offset_function -from vulkan_constants import * -from struct_offsets import VulkanStruct, UINT32_T, POINTER, HANDLE, BOOL32 - -SWAPCHAIN_CREATE_INFO_ELEMENTS = [ - ("stype", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("surface", HANDLE), - ("minImageCount", UINT32_T), - ("imageFormat", UINT32_T), - ("imageColorSpace", UINT32_T), - ("imageExtent_width", UINT32_T), - ("imageExtent_height", UINT32_T), - ("imageArrayLayers", UINT32_T), - ("imageUsage", UINT32_T), - ("imageSharingMode", UINT32_T), - ("queueFamilyIndexCount", UINT32_T), - ("pQueueFamilyIndices", POINTER), - ("preTransform", UINT32_T), - ("compositeAlpha", UINT32_T), - ("presentMode", UINT32_T), - ("clipped", BOOL32), - ("oldSwapchain", HANDLE), -] - -IMAGE_VIEW_CREATE_INFO_ELEMENTS = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("image", HANDLE), - ("viewType", UINT32_T), - ("format", UINT32_T), - # These nested struct offsets are correct because all of the alignments - # are trivially satisfied. - ("components_r", UINT32_T), - ("components_g", UINT32_T), - ("components_b", UINT32_T), - ("components_a", UINT32_T), - ("subresourceRange_aspectMask", UINT32_T), - ("subresourceRange_baseMipLevel", UINT32_T), - ("subresourceRange_levelCount", UINT32_T), - ("subresourceRange_baseArrayLayer", UINT32_T), - ("subresourceRange_layerCount", UINT32_T), -] - - -def check_create_image_view(test, index): - """Gets the |index|'th vkCreateImageView command call atom, checks its - return value and arguments. Also checks the image view handler value pointed - by the image view pointer. This method does not check the content of the - VkImageViewCreateInfo struct pointed by the create info pointer. Returns the - checked vkCreateImageView atom, device handler value and image view handler - value. """ - create_image_view = require(test.nth_call_of("vkCreateImageView", index)) - require_equal(VK_SUCCESS, int(create_image_view.return_val)) - device = create_image_view.int_device - require_not_equal(0, device) - p_create_info = create_image_view.hex_pCreateInfo - require_not_equal(0, p_create_info) - p_image_view = create_image_view.hex_pView - require_not_equal(0, p_image_view) - image_view = little_endian_bytes_to_int(require( - create_image_view.get_write_data(p_image_view, - NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(0, image_view) - return create_image_view, device, image_view - - -def check_destroy_image_view(test, device, image_view, device_properties): - """Checks the |index|'th vkDestroyImageView command call atom, including the - device handler value and the image view handler value. - """ - destroy_image_view = require(test.next_call_of("vkDestroyImageView")) - require_equal(device, destroy_image_view.int_device) - require_equal(image_view, destroy_image_view.int_imageView) - - -def get_image_view_create_info(create_image_view, architecture): - """Returns a VulkanStruct which is built to represent the image view create - info struct used in the given create image view command.""" - - def get_data(offset, size): - return little_endian_bytes_to_int(require( - create_image_view.get_read_data(create_image_view.hex_pCreateInfo + - offset, size))) - - return VulkanStruct(architecture, IMAGE_VIEW_CREATE_INFO_ELEMENTS, get_data) - - -@gapit_test("CreateDestroyImageView_test") -class ColorAttachmentImage(GapitTest): - - def expect(self): - """1. Expects a normal image view for a normal 2D color attachement - image created in swapchain.""" - - architecture = self.architecture - device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - create_swapchain = require(self.next_call_of("vkCreateSwapchainKHR")) - image_format = VulkanStruct(architecture, SWAPCHAIN_CREATE_INFO_ELEMENTS, - get_read_offset_function( - create_swapchain, create_swapchain.hex_pCreateInfo)).imageFormat - create_image_view, device, image = check_create_image_view(self, 1) - info = get_image_view_create_info(create_image_view, architecture) - check_destroy_image_view(self, device, image, device_properties) - - require_equal(info.sType, VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO) - require_equal(info.pNext, 0) - require_equal(info.flags, 0) - require_equal(info.viewType, VK_IMAGE_VIEW_TYPE_2D) - require_equal(info.format, image_format) - require_equal(info.components_r, VK_COMPONENT_SWIZZLE_IDENTITY) - require_equal(info.components_g, VK_COMPONENT_SWIZZLE_IDENTITY) - require_equal(info.components_b, VK_COMPONENT_SWIZZLE_IDENTITY) - require_equal(info.components_a, VK_COMPONENT_SWIZZLE_IDENTITY) - require_equal(info.subresourceRange_aspectMask, - VK_IMAGE_ASPECT_COLOR_BIT) - require_equal(info.subresourceRange_baseMipLevel, 0) - require_equal(info.subresourceRange_levelCount, 1) - require_equal(info.subresourceRange_baseArrayLayer, 0) - require_equal(info.subresourceRange_layerCount, 1) diff --git a/gapid_tests/resource_creation_tests/CreateDestroyImageView_test/README.md b/gapid_tests/resource_creation_tests/CreateDestroyImageView_test/README.md deleted file mode 100644 index ff44a65b..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyImageView_test/README.md +++ /dev/null @@ -1,98 +0,0 @@ -# vkCreateImageView / vkDestroyImageView - -## Signatures -```c++ -VkResult vkCreateImageView( - VkDevice device, - const VkImageViewCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkImageView* pView); - -void vkDestroyImageView( - VkDevice device, - VkImageView imageView, - const VkAllocationCallbacks* pAllocator); -``` - -# VkImageViewCreateInfo -```c++ -typedef struct VkImageViewCreateInfo { - VkStructureType sType; - const void* pNext; - VkImageViewCreateFlags flags; - VkImage image; - VkImageViewType viewType; - VkFormat format; - VkComponentMapping components; - VkImageSubresourceRange subresourceRange; -} VkImageViewCreateInfo; -``` - -# VkComponentMapping -```c++ -typedef struct VkComponentMapping { - VkComponentSwizzle r; - VkComponentSwizzle g; - VkComponentSwizzle b; - VkComponentSwizzle a; -} VkComponentMapping; -``` - -# VkImageSubresourceRange -```c++ -typedef struct VkImageSubresourceRange { - VkImageAspectFlags aspectMask; - uint32_t baseMipLevel; - uint32_t levelCount; - uint32_t baseArrayLayer; - uint32_t layerCount; -} VkImageSubresourceRange; -``` - -According to the Vulkan spec: -- `sType` **must** be `VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO` -- `pNext` **must** be `NULL` -- `flags` **must** be 0 -- `image` **must** be a valid `VkImage` handle -- `viewType` **must** be a valid `VKImageViewType` value and compaitable with - the `image` -- `format` **must** be a valid `VkFormat` value and compaitable with the `image` -- `components` **must** be a valid `VkImageSubresourceRange` structure, in - which each member (e.g. `r`) **must** be a valid `VkComponentSwizzle` value - and compatible with the `image` and `format`. -- `subresourceRange` **must** be a valid `VkImageSubresourceRange` structure. - - `aspectMask` **must** be a valid combination of `VkImageAspectFlagBits` and - compatible with `format`. Its value **must not** be 0. - - If `levelCount` is not `VK_REMAINING_MIP_LEVELS`, (`baseMipLevel` + - `levelCount`) **must** be less than or equal to the `mipLevels` specified in - `VkImageCreateInfo` when `image` was created - - If `layerCount` is not `VK_REMAINING_ARRAY_LAYERS`, (`baseArrayLayer` + - `layerCount`) **must** be less than or equal to the `arrayLayers` specified - in `VkImageCreateInfo` when `image` was created - -These tests should test the following cases: -- `image` created in different approach - - [ ] Through `vkCreateImage` - - [x] Through `vkCreateSwapchainKHR` -- `viewType` of valid values - - [x] `VK_IMAGE_VIEW_TYPE_2D` - - [ ] `VK_IMAGE_VIEW_TYPE_CUBE` -- `format` of valid `VkFormat` values - - [x] `VK_FORMAT_R8G8B8A8_UNORM` - - [ ] `VK_FORMAT_D16_UNORM` - - [ ] `VK_FORMAT_R32_SINT` -- `components` memeber with different `VkComponentSwizzle` value - - [x] `VK_COMPONENT_SWIZZLE_IDENTITY` - - [ ] `VK_COMPONENT_SWIZZLE_R` - - [ ] `VK_COMPONENT_SWIZZLE_G` - - [ ] `VK_COMPONENT_SWIZZLE_B` - - [ ] `VK_COMPONENT_SWIZZLE_A` -- `aspectMask` of valid `VkImageAspectFlags` values - - [x] `VK_IMAGE_ASPECT_COLOR_BIT` - - [ ] `VK_IMAGE_ASPECT_DEPTH_BIT` -- `baseMipLevel` and `levelCount` of valid values - - [x] `baseMipLevel` of value 0 and `levelCount` of value 1 - - [ ] `baseMipLevel` of value 1 and `levelCount` of value 4 -- `baseArrayLayer` and `layerCount` of valid values - - [x] `baseArrayLayer` of value 0 and `layerCount` of value 1 - - [ ] `baseArrayLayer` of value 4 and `layerCount` of value 2 diff --git a/gapid_tests/resource_creation_tests/CreateDestroyImageView_test/main.cpp b/gapid_tests/resource_creation_tests/CreateDestroyImageView_test/main.cpp deleted file mode 100644 index 85f39fff..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyImageView_test/main.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - auto allocator = data->allocator(); - vulkan::LibraryWrapper wrapper(allocator, data->logger()); - vulkan::VkInstance instance( - vulkan::CreateDefaultInstance(data->allocator(), &wrapper)); - - vulkan::VkSurfaceKHR surface(vulkan::CreateDefaultSurface(&instance, data)); - - { - // 1. Test creating a image view for a swapchain image - // prepare swapchain - uint32_t queues[2]; - vulkan::VkDevice device(vulkan::CreateDeviceForSwapchain( - data->allocator(), &instance, &surface, &queues[0], &queues[1], false)); - vulkan::VkSwapchainKHR swapchain(vulkan::CreateDefaultSwapchain( - &instance, &device, &surface, allocator, queues[0], queues[1], data)); - - // get images - uint32_t num_images; - - LOG_ASSERT(==, data->logger(), - device->vkGetSwapchainImagesKHR(device, swapchain, &num_images, - nullptr), - VK_SUCCESS); - containers::vector<::VkImage> images(allocator); - images.resize(num_images); - LOG_EXPECT(==, data->logger(), - device->vkGetSwapchainImagesKHR(device, swapchain, &num_images, - images.data()), - VK_SUCCESS); - LOG_ASSERT(!=, data->logger(), images.size(), 0); - - // prepare image view create info - VkImageViewCreateInfo image_view_create_info{ - /* sType = */ VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* image = */ images.front(), // uses the first image - /* viewType = */ VK_IMAGE_VIEW_TYPE_2D, - /* format = */ swapchain.format(), - /* components = */ - { - /* r = */ VK_COMPONENT_SWIZZLE_IDENTITY, - /* g = */ VK_COMPONENT_SWIZZLE_IDENTITY, - /* b = */ VK_COMPONENT_SWIZZLE_IDENTITY, - /* a = */ VK_COMPONENT_SWIZZLE_IDENTITY, - }, - /* subresourceRange = */ - { - /* aspectMask = */ VK_IMAGE_ASPECT_COLOR_BIT, - /* baseMipLevel = */ 0, - /* levelCount = */ 1, - /* baseArrayLayer = */ 0, - /* layerCount = */ 1, - }, - }; - ::VkImageView image_view; - LOG_EXPECT(==, data->logger(), - device->vkCreateImageView(device, &image_view_create_info, - nullptr, &image_view), - VK_SUCCESS); - - device->vkDestroyImageView(device, image_view, nullptr); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/CreateDestroyImage_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/CreateDestroyImage_test/CMakeLists.txt deleted file mode 100644 index 91ae4382..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyImage_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(CreateDestroyImage_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/CreateDestroyImage_test/CreateDestroyImage_test.py b/gapid_tests/resource_creation_tests/CreateDestroyImage_test/CreateDestroyImage_test.py deleted file mode 100644 index 353fb66e..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyImage_test/CreateDestroyImage_test.py +++ /dev/null @@ -1,307 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest -from vulkan_constants import * -from struct_offsets import VulkanStruct, UINT32_T, POINTER - -IMAGE_CREATE_INFO_ELEMENTS = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("imageType", UINT32_T), - ("format", UINT32_T), - ("extent_width", UINT32_T), - ("extent_height", UINT32_T), - ("extent_depth", UINT32_T), - ("mipLevels", UINT32_T), - ("arrayLayers", UINT32_T), - ("samples", UINT32_T), - ("tiling", UINT32_T), - ("usage", UINT32_T), - ("sharingMode", UINT32_T), - ("queueFamilyIndexCount", UINT32_T), - ("pQueueFamilyIndices", POINTER), - ("initialLayout", UINT32_T), -] - - -def check_create_image(test, index): - """Gets the |index|'th vkCreateImage command call atom, checks its return - value and arguments. Also checks the image handler value pointed by the - image pointer. This method does not check the content of the - VkImageCreateInfo struct pointed by the create info pointer. Returns the - checked vkCreateImage atom, device handler value and image handler value. - """ - create_image = require(test.nth_call_of("vkCreateImage", index)) - require_equal(VK_SUCCESS, int(create_image.return_val)) - device = create_image.int_device - require_not_equal(0, device) - p_create_info = create_image.hex_pCreateInfo - require_not_equal(0, p_create_info) - p_image = create_image.hex_pImage - require_not_equal(0, p_image) - image = little_endian_bytes_to_int(require(create_image.get_write_data( - p_image, NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(0, image) - return create_image, device, image - - -def check_destroy_image(test, device, image, device_properties): - """Checks the |index|'th vkDestroyImage command call atom, including the - device handler value and the image handler value. - """ - destroy_image = require(test.next_call_of("vkDestroyImage")) - require_equal(device, destroy_image.int_device) - require_equal(image, destroy_image.int_image) - - -def get_image_create_info(create_image, architecture): - """Returns a VulkanStruct which is built to represent the image create info - struct used in the given create image command.""" - def get_data(offset, size): - return little_endian_bytes_to_int(require(create_image.get_read_data( - create_image.hex_pCreateInfo + offset, size))) - - return VulkanStruct(architecture, IMAGE_CREATE_INFO_ELEMENTS, get_data) - - -@gapit_test("CreateDestroyImage_test") -class ColorAttachmentImage(GapitTest): - - def expect(self): - """1. Expects a normal 2D color attachement image.""" - - architecture = self.architecture - device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - create_image, device, image = check_create_image(self, 1) - info = get_image_create_info(create_image, architecture) - check_destroy_image(self, device, image, device_properties) - - require_equal(info.sType, VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO) - require_equal(info.pNext, 0) - require_equal(info.flags, 0) - require_equal(info.imageType, VK_IMAGE_TYPE_2D) - require_equal(info.format, VK_FORMAT_R8G8B8A8_UNORM) - require_equal(info.extent_width, 32) - require_equal(info.extent_height, 32) - require_equal(info.extent_depth, 1) - require_equal(info.mipLevels, 1) - require_equal(info.arrayLayers, 1) - require_equal(info.samples, VK_SAMPLE_COUNT_1_BIT) - require_equal(info.tiling, VK_IMAGE_TILING_OPTIMAL) - require_equal(info.usage, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) - require_equal(info.sharingMode, VK_SHARING_MODE_EXCLUSIVE) - require_equal(info.queueFamilyIndexCount, 0) - require_equal(info.pQueueFamilyIndices, 0) - require_equal(info.initialLayout, VK_IMAGE_LAYOUT_UNDEFINED) - - -@gapit_test("CreateDestroyImage_test") -class DepthImage(GapitTest): - - def expect(self): - """2. Expects a normal depth image.""" - - architecture = self.architecture - device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - create_image, device, image = check_create_image(self, 2) - info = get_image_create_info(create_image, architecture) - check_destroy_image(self, device, image, device_properties) - - require_equal(info.sType, VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO) - require_equal(info.pNext, 0) - require_equal(info.flags, 0) - require_equal(info.imageType, VK_IMAGE_TYPE_2D) - require_equal(info.format, VK_FORMAT_D16_UNORM) - require_equal(info.extent_width, 32) - require_equal(info.extent_height, 32) - require_equal(info.extent_depth, 1) - require_equal(info.mipLevels, 1) - require_equal(info.arrayLayers, 1) - require_equal(info.samples, VK_SAMPLE_COUNT_1_BIT) - require_equal(info.tiling, VK_IMAGE_TILING_OPTIMAL) - require_equal(info.usage, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) - require_equal(info.sharingMode, VK_SHARING_MODE_EXCLUSIVE) - require_equal(info.queueFamilyIndexCount, 0) - require_equal(info.pQueueFamilyIndices, 0) - require_equal(info.initialLayout, VK_IMAGE_LAYOUT_UNDEFINED) - - -@gapit_test("CreateDestroyImage_test") -class CubeCompatibleAndMutableImage(GapitTest): - - def expect(self): - """3. Expects a cube compatible image with mutable format support.""" - - architecture = self.architecture - device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - create_image, device, image = check_create_image(self, 3) - info = get_image_create_info(create_image, architecture) - check_destroy_image(self, device, image, device_properties) - - require_equal(info.sType, VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO) - require_equal(info.pNext, 0) - require_equal(info.flags, VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT - | VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) - require_equal(info.imageType, VK_IMAGE_TYPE_2D) - require_equal(info.format, VK_FORMAT_R8G8B8A8_UNORM) - require_equal(info.extent_width, 32) - require_equal(info.extent_height, 32) - require_equal(info.extent_depth, 1) - require_equal(info.mipLevels, 1) - require_equal(info.arrayLayers, 6) - require_equal(info.samples, VK_SAMPLE_COUNT_1_BIT) - require_equal(info.tiling, VK_IMAGE_TILING_OPTIMAL) - require_equal(info.usage, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) - require_equal(info.sharingMode, VK_SHARING_MODE_EXCLUSIVE) - require_equal(info.queueFamilyIndexCount, 0) - require_equal(info.pQueueFamilyIndices, 0) - require_equal(info.initialLayout, VK_IMAGE_LAYOUT_UNDEFINED) - - -@gapit_test("CreateDestroyImage_test") -class LinearTilingImageWithSrcDstTransferUsage(GapitTest): - - def expect(self): - """4. Expects an image with linear tiling and can be used as the source - and destination of a transfer command.""" - - architecture = self.architecture - device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - create_image, device, image = check_create_image(self, 4) - info = get_image_create_info(create_image, architecture) - check_destroy_image(self, device, image, device_properties) - - require_equal(info.sType, VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO) - require_equal(info.pNext, 0) - require_equal(info.flags, 0) - require_equal(info.imageType, VK_IMAGE_TYPE_2D) - require_equal(info.format, VK_FORMAT_R8G8B8A8_UNORM) - require_equal(info.extent_width, 32) - require_equal(info.extent_height, 32) - require_equal(info.extent_depth, 1) - require_equal(info.mipLevels, 1) - require_equal(info.arrayLayers, 1) - require_equal(info.samples, VK_SAMPLE_COUNT_1_BIT) - require_equal(info.tiling, VK_IMAGE_TILING_LINEAR) - require_equal(info.usage, VK_IMAGE_USAGE_TRANSFER_SRC_BIT - | VK_IMAGE_USAGE_TRANSFER_DST_BIT) - require_equal(info.sharingMode, VK_SHARING_MODE_EXCLUSIVE) - require_equal(info.queueFamilyIndexCount, 0) - require_equal(info.pQueueFamilyIndices, 0) - require_equal(info.initialLayout, VK_IMAGE_LAYOUT_UNDEFINED) - - -@gapit_test("CreateDestroyImage_test") -class ColorAttachment3DImage(GapitTest): - - def expect(self): - """5. Expects a 3D image with extent values and mipLevels value changed. - """ - - architecture = self.architecture - device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - create_image, device, image = check_create_image(self, 5) - info = get_image_create_info(create_image, architecture) - check_destroy_image(self, device, image, device_properties) - - require_equal(info.sType, VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO) - require_equal(info.pNext, 0) - require_equal(info.flags, 0) - require_equal(info.imageType, VK_IMAGE_TYPE_3D) - require_equal(info.format, VK_FORMAT_R8G8B8A8_UNORM) - require_equal(info.extent_width, 8) - require_equal(info.extent_height, 8) - require_equal(info.extent_depth, 16) - require_equal(info.mipLevels, 5) - require_equal(info.arrayLayers, 1) - require_equal(info.samples, VK_SAMPLE_COUNT_1_BIT) - require_equal(info.tiling, VK_IMAGE_TILING_OPTIMAL) - require_equal(info.usage, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) - require_equal(info.sharingMode, VK_SHARING_MODE_EXCLUSIVE) - require_equal(info.queueFamilyIndexCount, 0) - require_equal(info.pQueueFamilyIndices, 0) - require_equal(info.initialLayout, VK_IMAGE_LAYOUT_UNDEFINED) - - -@gapit_test("CreateDestroyImage_test") -class MultiSampledImageWithPreinitializedLayout(GapitTest): - - def expect(self): - """6. Expects a preinitialized image that support multi-sample.""" - - architecture = self.architecture - device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - create_image, device, image = check_create_image(self, 6) - info = get_image_create_info(create_image, architecture) - check_destroy_image(self, device, image, device_properties) - - require_equal(info.sType, VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO) - require_equal(info.pNext, 0) - require_equal(info.flags, 0) - require_equal(info.imageType, VK_IMAGE_TYPE_2D) - require_equal(info.format, VK_FORMAT_R8G8B8A8_UNORM) - require_equal(info.extent_width, 32) - require_equal(info.extent_height, 32) - require_equal(info.extent_depth, 1) - require_equal(info.mipLevels, 1) - require_equal(info.arrayLayers, 1) - require_equal(info.samples, VK_SAMPLE_COUNT_4_BIT) - require_equal(info.tiling, VK_IMAGE_TILING_OPTIMAL) - require_equal(info.usage, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) - require_equal(info.sharingMode, VK_SHARING_MODE_EXCLUSIVE) - require_equal(info.queueFamilyIndexCount, 0) - require_equal(info.pQueueFamilyIndices, 0) - require_equal(info.initialLayout, VK_IMAGE_LAYOUT_PREINITIALIZED) - - -@gapit_test("CreateDestroyImage_test") -class ColorAttachment1DImage(GapitTest): - - def expect(self): - """7. Expects a 1D color attachement image.""" - - architecture = self.architecture - device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - create_image, device, image = check_create_image(self, 7) - info = get_image_create_info(create_image, architecture) - check_destroy_image(self, device, image, device_properties) - - require_equal(info.sType, VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO) - require_equal(info.pNext, 0) - require_equal(info.flags, 0) - require_equal(info.imageType, VK_IMAGE_TYPE_1D) - require_equal(info.format, VK_FORMAT_R8G8B8A8_UNORM) - require_equal(info.extent_width, 32) - require_equal(info.extent_height, 1) - require_equal(info.extent_depth, 1) - require_equal(info.mipLevels, 1) - require_equal(info.arrayLayers, 1) - require_equal(info.samples, VK_SAMPLE_COUNT_1_BIT) - require_equal(info.tiling, VK_IMAGE_TILING_OPTIMAL) - require_equal(info.usage, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) - require_equal(info.sharingMode, VK_SHARING_MODE_EXCLUSIVE) - require_equal(info.queueFamilyIndexCount, 0) - require_equal(info.pQueueFamilyIndices, 0) - require_equal(info.initialLayout, VK_IMAGE_LAYOUT_UNDEFINED) diff --git a/gapid_tests/resource_creation_tests/CreateDestroyImage_test/README.md b/gapid_tests/resource_creation_tests/CreateDestroyImage_test/README.md deleted file mode 100644 index 30475d0b..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyImage_test/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# vkCreateImage / vkDestroyImage - -## Signatures -```c++ -VkResult vkCreateImage( - VkDevice device, - const VkImageCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkImage* pImage); - -void vkDestroyImage( - VkDevice device, - VkImage image, - const VkAllocationCallbacks* pAllocator); -``` - -# VkImageCreateInfo -```c++ -typedef struct VkImageCreateInfo { - VkStructureType sType; - const void* pNext; - VkImageCreateFlags flags; - VkImageType imageType; - VkFormat format; - VkExtent3D extent; - uint32_t mipLevels; - uint32_t arrayLayers; - VkSampleCountFlagBits samples; - VkImageTiling tiling; - VkImageUsageFlags usage; - VkSharingMode sharingMode; - uint32_t queueFamilyIndexCount; - const uint32_t* pQueueFamilyIndices; - VkImageLayout initialLayout; -} VkImageCreateInfo; -``` - -According to the Vulkan spec: -- `sType` **must** be `VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO` -- `pNext` **must** be `NULL` -- `flags` **must** be a valid combination of `VkImageCreateFlagBits` values -- `usage` **must not** be 0 -- `format` **must not** be `VK_FORMAT_UNDEFINED` -- `width`, `height` and `depth` members of `extent` must all be greater than 0 -- `mipLevels` **must** be greater than 0 and less than or equal to - `floor(log(max(extent.width, extent.height, extent.depth))/log(2)) + 1` -- `arrayLayers` **must** be greater than 0 -- `initialLayout` **must** be `VK_IMAGE_LAYOUT_UNDEFINED` or - `VK_IMAGE_LAYOUT_PREINITIALIZED` -- The combination of `format`, `imageType`, `flags`, `samples`, `usage` and - `tiling` **must** be valid, refer to Vulkan spec for details. - -These tests should test the following cases: -- `flags` of valid `VkImageCreateFlagBits` values - - [x] zero value (0) - - [x] `VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT | VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT` -- [x] `imageType` of `VK_IMAGE_TYPE_1D`, `VK_IMAGE_TYPE_2D` or `VK_IMAGE_TYPE_3D` -- `format` of valid `VkFormat` values - - [x] `VK_FORMAT_R8G8B8A8_UNORM` - - [x] `VK_FORMAT_D16_UNORM` -- `extent` of valid `VkExtent3D` values - - [x] 1D type image - - [x] 2D type image - - [x] 3D type image -- `mipLevels` 1 or greater - - [x] of value 1 - - [x] of value 5 -- `arrayLayers` of valid values - - [x] of value 1 - - [x] of value 6 -- `samples` of valid `VkSampleCountFlagBits` values - - [x] `VK_SAMPLE_COUNT_1_BIT` - - [x] `VK_SAMPLE_COUNT_4_BIT` -- [x] `tiling` of `VK_IMAGE_TILING_OPTIMAL` or `VK_IMAGE_TILING_LINEAR` -- `usage` of valid `VkImageUsageFlagBits` values - - [x] `VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT` - - [x] `VK_IMAGE_USAGE_DEPTH_STENCIL_ATTAChMENT_BIT` - - [x] `VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT` -- `sharingMode` of valid mode with vaild values of `queueFamilyIndexCount` and - `pQueueFamilyIndices` - - [x] `sharingMode` is set to `VK_SHARING_MODE_CONCURRENT` - - [ ] `sharingMode` is set to `VK_SHARING_MODE_EXCLUSIVE` -- [x] `vkDestroyImage` can be called correctly diff --git a/gapid_tests/resource_creation_tests/CreateDestroyImage_test/main.cpp b/gapid_tests/resource_creation_tests/CreateDestroyImage_test/main.cpp deleted file mode 100644 index d150dd9e..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyImage_test/main.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - auto allocator = data->allocator(); - vulkan::LibraryWrapper wrapper(allocator, data->logger()); - vulkan::VkInstance instance( - vulkan::CreateEmptyInstance(data->allocator(), &wrapper)); - vulkan::VkDevice device(vulkan::CreateDefaultDevice(allocator, instance)); - - { - // 1. Test a normal color attachment image - VkImageCreateInfo image_create_info{ - /* sType = */ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* imageType = */ VK_IMAGE_TYPE_2D, - /* format = */ VK_FORMAT_R8G8B8A8_UNORM, - /* extent = */ - { - /* width = */ 32, - /* height = */ 32, - /* depth = */ 1, - }, - /* mipLevels = */ 1, - /* arrayLayers = */ 1, - /* samples = */ VK_SAMPLE_COUNT_1_BIT, - /* tiling = */ VK_IMAGE_TILING_OPTIMAL, - /* usage = */ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, - /* sharingMode = */ VK_SHARING_MODE_EXCLUSIVE, - /* queueFamilyIndexCount = */ 0, - /* pQueueFamilyIndices = */ nullptr, - /* initialLayout = */ VK_IMAGE_LAYOUT_UNDEFINED, - }; - ::VkImage image; - device->vkCreateImage(device, &image_create_info, nullptr, &image); - device->vkDestroyImage(device, image, nullptr); - } - - { - // 2. Test a normal depth image - VkImageCreateInfo image_create_info{ - /* sType = */ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* imageType = */ VK_IMAGE_TYPE_2D, - /* format = */ VK_FORMAT_D16_UNORM, - /* extent = */ - { - /* width = */ 32, - /* height = */ 32, - /* depth = */ 1, - }, - /* mipLevels = */ 1, - /* arrayLayers = */ 1, - /* samples = */ VK_SAMPLE_COUNT_1_BIT, - /* tiling = */ VK_IMAGE_TILING_OPTIMAL, - /* usage = */ VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, - /* sharingMode = */ VK_SHARING_MODE_EXCLUSIVE, - /* queueFamilyIndexCount = */ 0, - /* pQueueFamilyIndices = */ nullptr, - /* initialLayout = */ VK_IMAGE_LAYOUT_UNDEFINED, - }; - ::VkImage image; - device->vkCreateImage(device, &image_create_info, nullptr, &image); - device->vkDestroyImage(device, image, nullptr); - } - - { - // 3. Test a cube compatible image with mutable format support - VkImageCreateInfo image_create_info{ - /* sType = */ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT | - VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT, - /* imageType = */ VK_IMAGE_TYPE_2D, - /* format = */ VK_FORMAT_R8G8B8A8_UNORM, - /* extent = */ - { - /* width = */ 32, - /* height = */ 32, - /* depth = */ 1, - }, - /* mipLevels = */ 1, - /* arrayLayers = */ 6, - /* samples = */ VK_SAMPLE_COUNT_1_BIT, - /* tiling = */ VK_IMAGE_TILING_OPTIMAL, - /* usage = */ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, - /* sharingMode = */ VK_SHARING_MODE_EXCLUSIVE, - /* queueFamilyIndexCount = */ 0, - /* pQueueFamilyIndices = */ nullptr, - /* initialLayout = */ VK_IMAGE_LAYOUT_UNDEFINED, - }; - ::VkImage image; - device->vkCreateImage(device, &image_create_info, nullptr, &image); - device->vkDestroyImage(device, image, nullptr); - } - { - // 4. Test creating an image with linear tiling that can be used as the - // source and destination of a transfer command. - VkImageCreateInfo image_create_info{ - /* sType = */ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* imageType = */ VK_IMAGE_TYPE_2D, - /* format = */ VK_FORMAT_R8G8B8A8_UNORM, - /* extent = */ - { - /* width = */ 32, - /* height = */ 32, - /* depth = */ 1, - }, - /* mipLevels = */ 1, - /* arrayLayers = */ 1, - /* samples = */ VK_SAMPLE_COUNT_1_BIT, - /* tiling = */ VK_IMAGE_TILING_LINEAR, - /* usage = */ VK_IMAGE_USAGE_TRANSFER_SRC_BIT | - VK_IMAGE_USAGE_TRANSFER_DST_BIT, - /* sharingMode = */ VK_SHARING_MODE_EXCLUSIVE, - /* queueFamilyIndexCount = */ 0, - /* pQueueFamilyIndices = */ nullptr, - /* initialLayout = */ VK_IMAGE_LAYOUT_UNDEFINED, - }; - ::VkImage image; - device->vkCreateImage(device, &image_create_info, nullptr, &image); - device->vkDestroyImage(device, image, nullptr); - } - { - // 5. Test an image of 3D type with different extent values and - // mip levels - VkImageCreateInfo image_create_info{ - /* sType = */ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* imageType = */ VK_IMAGE_TYPE_3D, - /* format = */ VK_FORMAT_R8G8B8A8_UNORM, - /* extent = */ - { - /* width = */ 8, - /* height = */ 8, - /* depth = */ 16, - }, - /* mipLevels = */ 5, - /* arrayLayers = */ 1, - /* samples = */ VK_SAMPLE_COUNT_1_BIT, - /* tiling = */ VK_IMAGE_TILING_OPTIMAL, - /* usage = */ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, - /* sharingMode = */ VK_SHARING_MODE_EXCLUSIVE, - /* queueFamilyIndexCount = */ 0, - /* pQueueFamilyIndices = */ nullptr, - /* initialLayout = */ VK_IMAGE_LAYOUT_UNDEFINED, - }; - ::VkImage image; - device->vkCreateImage(device, &image_create_info, nullptr, &image); - device->vkDestroyImage(device, image, nullptr); - } - { - // 6. Test creating an preinitialized image with multi-sample - VkImageCreateInfo image_create_info{ - /* sType = */ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* imageType = */ VK_IMAGE_TYPE_2D, - /* format = */ VK_FORMAT_R8G8B8A8_UNORM, - /* extent = */ - { - /* width = */ 32, - /* height = */ 32, - /* depth = */ 1, - }, - /* mipLevels = */ 1, - /* arrayLayers = */ 1, - /* samples = */ VK_SAMPLE_COUNT_4_BIT, - /* tiling = */ VK_IMAGE_TILING_OPTIMAL, - /* usage = */ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, - /* sharingMode = */ VK_SHARING_MODE_EXCLUSIVE, - /* queueFamilyIndexCount = */ 0, - /* pQueueFamilyIndices = */ nullptr, - /* initialLayout = */ VK_IMAGE_LAYOUT_PREINITIALIZED, - }; - ::VkImage image; - device->vkCreateImage(device, &image_create_info, nullptr, &image); - device->vkDestroyImage(device, image, nullptr); - } - { - // 7. Test a 1D image - VkImageCreateInfo image_create_info{ - /* sType = */ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* imageType = */ VK_IMAGE_TYPE_1D, - /* format = */ VK_FORMAT_R8G8B8A8_UNORM, - /* extent = */ - { - /* width = */ 32, - /* height = */ 1, - /* depth = */ 1, - }, - /* mipLevels = */ 1, - /* arrayLayers = */ 1, - /* samples = */ VK_SAMPLE_COUNT_1_BIT, - /* tiling = */ VK_IMAGE_TILING_OPTIMAL, - /* usage = */ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, - /* sharingMode = */ VK_SHARING_MODE_EXCLUSIVE, - /* queueFamilyIndexCount = */ 0, - /* pQueueFamilyIndices = */ nullptr, - /* initialLayout = */ VK_IMAGE_LAYOUT_UNDEFINED, - }; - ::VkImage image; - device->vkCreateImage(device, &image_create_info, nullptr, &image); - device->vkDestroyImage(device, image, nullptr); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/CMakeLists.txt deleted file mode 100644 index c53f5ee4..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(CreateDestroyQueryPool_test - SOURCES main.cpp - LIBS - vulkan_helpers -) - -add_gapid_test(QueryPipelineStats_test - SOURCES pipeline_statistic.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/CreateDestroyQueryPool_test.py b/gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/CreateDestroyQueryPool_test.py deleted file mode 100644 index 29678225..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/CreateDestroyQueryPool_test.py +++ /dev/null @@ -1,160 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, GapitTest -from gapit_test_framework import get_read_offset_function, get_write_offset_function -from gapit_test_framework import GapidUnsupportedException -from vulkan_constants import * -from struct_offsets import VulkanStruct, UINT32_T, POINTER, HANDLE, DEVICE_SIZE -from struct_offsets import ARRAY, CHAR - -QUERY_POOL_CREATE_INFO = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("queryType", UINT32_T), - ("queryCount", UINT32_T), - ("pipelineStatistics", UINT32_T), -] - -QUERY_POOL = [("handle", HANDLE)] - - -@gapit_test("CreateDestroyQueryPool_test") -class OneQueryOcclusionQueryPool(GapitTest): - - def expect(self): - """1. Expects a query pool to be created with queryCount: 1 and - queryType: VK_QUERY_TYPE_OCCLUSION.""" - - architecture = self.architecture - device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - - create_query_pool = require(self.nth_call_of("vkCreateQueryPool", 1)) - device = create_query_pool.int_device - require_not_equal(0, device) - require_not_equal(0, create_query_pool.hex_pCreateInfo) - require_equal(0, create_query_pool.hex_pAllocator) - require_not_equal(0, create_query_pool.hex_pQueryPool) - require_equal(VK_SUCCESS, int(create_query_pool.return_val)) - - create_info = VulkanStruct( - architecture, QUERY_POOL_CREATE_INFO, get_read_offset_function( - create_query_pool, create_query_pool.hex_pCreateInfo)) - require_equal(VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, - create_info.sType) - require_equal(0, create_info.pNext) - require_equal(0, create_info.flags) - require_equal(VK_QUERY_TYPE_OCCLUSION, create_info.queryType) - require_equal(1, create_info.queryCount) - require_equal(0, create_info.pipelineStatistics) - - view = VulkanStruct( - architecture, QUERY_POOL, get_write_offset_function( - create_query_pool, create_query_pool.hex_pQueryPool)) - require_not_equal(0, view.handle) - - destroy_query_pool = require(self.next_call_of("vkDestroyQueryPool")) - require_equal(device, destroy_query_pool.int_device) - require_equal(view.handle, destroy_query_pool.int_queryPool) - - -@gapit_test("CreateDestroyQueryPool_test") -class SevenQueriesTimeStampQueryPool(GapitTest): - - def expect(self): - """2. Expects a query pool to be created with queryCount: 7 and - queryType: VK_QUERY_TYPE_TIMESTAMP.""" - - architecture = self.architecture - device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - - create_query_pool = require(self.nth_call_of("vkCreateQueryPool", 2)) - device = create_query_pool.int_device - require_not_equal(0, device) - require_not_equal(0, create_query_pool.hex_pCreateInfo) - require_equal(0, create_query_pool.hex_pAllocator) - require_not_equal(0, create_query_pool.hex_pQueryPool) - require_equal(VK_SUCCESS, int(create_query_pool.return_val)) - - create_info = VulkanStruct( - architecture, QUERY_POOL_CREATE_INFO, get_read_offset_function( - create_query_pool, create_query_pool.hex_pCreateInfo)) - require_equal(VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, - create_info.sType) - require_equal(0, create_info.pNext) - require_equal(0, create_info.flags) - require_equal(VK_QUERY_TYPE_TIMESTAMP, create_info.queryType) - require_equal(7, create_info.queryCount) - require_equal(0, create_info.pipelineStatistics) - - view = VulkanStruct( - architecture, QUERY_POOL, get_write_offset_function( - create_query_pool, create_query_pool.hex_pQueryPool)) - require_not_equal(0, view.handle) - - destroy_query_pool = require(self.next_call_of("vkDestroyQueryPool")) - require_equal(device, destroy_query_pool.int_device) - require_equal(view.handle, destroy_query_pool.int_queryPool) - - -@gapit_test("QueryPipelineStats_test") -class FourQueriesPipelineStatisticsQueryPool(GapitTest): - - def expect(self): - """3. Expects a query pool to be created with queryCount: 4 and - queryType: VK_QUERY_TYPE_PIPELINE_STATISTICS and pipelineStatistics: - VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT.""" - - architecture = self.architecture - device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - - create_device = self.nth_call_of("vkCreateDevice", 1) - if create_device[0] is None: - raise GapidUnsupportedException( - "physical device feature: pipelineStatistics not supported") - - create_query_pool = require(self.next_call_of("vkCreateQueryPool")) - device = create_query_pool.int_device - require_not_equal(0, device) - require_not_equal(0, create_query_pool.hex_pCreateInfo) - require_equal(0, create_query_pool.hex_pAllocator) - require_not_equal(0, create_query_pool.hex_pQueryPool) - require_equal(VK_SUCCESS, int(create_query_pool.return_val)) - - create_info = VulkanStruct( - architecture, QUERY_POOL_CREATE_INFO, get_read_offset_function( - create_query_pool, create_query_pool.hex_pCreateInfo)) - require_equal(VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, - create_info.sType) - require_equal(0, create_info.pNext) - require_equal(0, create_info.flags) - require_equal(VK_QUERY_TYPE_PIPELINE_STATISTICS, create_info.queryType) - require_equal(4, create_info.queryCount) - require_equal( - VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT, - create_info.pipelineStatistics) - - view = VulkanStruct( - architecture, QUERY_POOL, get_write_offset_function( - create_query_pool, create_query_pool.hex_pQueryPool)) - require_not_equal(0, view.handle) - - destroy_query_pool = require(self.next_call_of("vkDestroyQueryPool")) - require_equal(device, destroy_query_pool.int_device) - require_equal(view.handle, destroy_query_pool.int_queryPool) diff --git a/gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/README.md b/gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/README.md deleted file mode 100644 index e4aaa15d..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# vkCreateQueryPool / vkDestroyQueryPool - -## Signatures -```c++ -VkResult vkCreateQueryPool( - VkDevice device, - const VkQueryPoolCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkQueryPool* pQueryPool); - -void vkDestroyQueryPool( - VkDevice device, - VkQueryPool queryPool, - const VkAllocationCallbacks* pAllocator); -``` - -# VkQueryPoolCreateInfo -```c++ -typedef struct VkQueryPoolCreateInfo { - VkStructureType sType; - const void* pNext; - VkQueryPoolCreateFlags flags; - VkQueryType queryType; - uint32_t queryCount; - VkQueryPipelineStatisticFlags pipelineStatistics; -} VkQueryPoolCreateInfo; -``` - -# VkQueryType -```c++ -typedef enum VkQueryType { - VK_QUERY_TYPE_OCCLUSION = 0, - VK_QUERY_TYPE_PIPELINE_STATISTICS = 1, - VK_QUERY_TYPE_TIMESTAMP = 2, -} VkQueryType; -``` - -According to the Vulkan spec: -- `sType` **must** be `VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO` -- `pNext` **must** be `NULL` -- `flags` **must** be 0 -- If the pipeline statistics queries feature is not enabled, `queryType` - **must not** be `VK_QUERY_TYPE_PIPELINE_STATISTICS` -- If `queryType` is `VK_QUERY_TYPE_PIPELINE_STATISTICS`, `pipelineStatistics` - **must** be a valid combination of `VkQueryPipelineStatisticFlagBits` values - -These tests should test the following cases: -- [x] `queryCount` of value 1 -- [x] `queryCount` of value other than 1 -- [x] `queryType` of value `VK_QUERY_TYPE_OCCLUSION` -- [x] `queryType` of value `VK_QUERY_TYPE_PIPELINE_STATISTICS`, with - `pipelineStatistics` of value - `VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT` -- [x] `queryType` of value `VK_QUERY_TYPE_TIMESTAMP` diff --git a/gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/main.cpp b/gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/main.cpp deleted file mode 100644 index 867020b6..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/main.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/vulkan_application.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::VulkanApplication application(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - - { - // 1. A query pool with queryCount of value 1, queryType of value - // VK_QUERY_TYPE_OCCLUSION. - vulkan::VkDevice& device = application.device(); - VkQueryPoolCreateInfo query_pool_create_info = { - VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_QUERY_TYPE_OCCLUSION, // queryType - 1, // queryCount - 0, // pipelineStatistics - }; - ::VkQueryPool query_pool; - LOG_EXPECT(==, data->logger(), - device->vkCreateQueryPool(device, &query_pool_create_info, - nullptr, &query_pool), - VK_SUCCESS); - device->vkDestroyQueryPool(device, query_pool, nullptr); - } - - { - // 2. A query pool with queryCount of value 7, queryType of value - // VK_QUERY_TYPE_TIMESTAMP. - vulkan::VkDevice& device = application.device(); - VkQueryPoolCreateInfo query_pool_create_info = { - VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_QUERY_TYPE_TIMESTAMP, // queryType - 7, // queryCount - 0, // pipelineStatistics - }; - ::VkQueryPool query_pool; - LOG_EXPECT(==, data->logger(), - device->vkCreateQueryPool(device, &query_pool_create_info, - nullptr, &query_pool), - VK_SUCCESS); - device->vkDestroyQueryPool(device, query_pool, nullptr); - } - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/pipeline_statistic.cpp b/gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/pipeline_statistic.cpp deleted file mode 100644 index fcb62e0d..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroyQueryPool_test/pipeline_statistic.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/vulkan_application.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - { - // A query pool with queryCount of value 4, queryType of value - // VK_QUERY_TYPE_PIPELINE_STATISTICS, and pipelineStatistics of value - // VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT. - - // Create a new device with pipeline statistics feature enabled from the - // same physical device. - VkPhysicalDeviceFeatures request_features = {0}; - request_features.pipelineStatisticsQuery = VK_TRUE; - vulkan::VulkanApplication application( - data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions(), {}, {}, request_features); - if (application.device().is_valid()) { - vulkan::VkDevice& device = application.device(); - VkQueryPoolCreateInfo query_pool_create_info = { - VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_QUERY_TYPE_PIPELINE_STATISTICS, // queryType - 4, // queryCount - VkQueryPipelineStatisticFlags( - VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT), // pipelineStatistics - }; - ::VkQueryPool query_pool; - LOG_EXPECT(==, data->logger(), - device->vkCreateQueryPool(device, &query_pool_create_info, - nullptr, &query_pool), - VK_SUCCESS); - device->vkDestroyQueryPool(device, query_pool, nullptr); - } else { - data->logger()->LogInfo( - "Disabled test due to missing physical device feature: " - "pipelineStatisticsQuery"); - } - } - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/CreateDestroySampler_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/CreateDestroySampler_test/CMakeLists.txt deleted file mode 100644 index bf22d4ca..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroySampler_test/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(CreateDestroySampler_test - SOURCES main.cpp - LIBS - vulkan_helpers -) - -add_gapid_test(UnnormalizedSampler_test - SOURCES unnormalized.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/CreateDestroySampler_test/CreateDestroySampler_test.py b/gapid_tests/resource_creation_tests/CreateDestroySampler_test/CreateDestroySampler_test.py deleted file mode 100644 index 7cbc692c..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroySampler_test/CreateDestroySampler_test.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_true, require_false -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest -from vulkan_constants import * -from struct_offsets import VulkanStruct, UINT32_T, FLOAT, POINTER - -SAMPLER_CREATE_INFO_ELEMENTS = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("magFilter", UINT32_T), - ("minFilter", UINT32_T), - ("mipmapMode", UINT32_T), - ("addressModeU", UINT32_T), - ("addressModeV", UINT32_T), - ("addressModeW", UINT32_T), - ("mipLodBias", FLOAT), - ("anisotropyEnable", UINT32_T), - ("maxAnisotropy", FLOAT), - ("compareEnable", UINT32_T), - ("compareOp", UINT32_T), - ("minLod", FLOAT), - ("maxLod", FLOAT), - ("borderColor", UINT32_T), - ("unnormalizedCoordinates", UINT32_T), -] - - -def check_create_sampler(test): - """Gets the next vkCreateSampler call atom, and checks its return value and - arguments. Also checks the returned sampler handle is not null. Returns the - checked vkCreateSampler atom, device and sampler handle. This method does - not check the content of the VkSamplerCreateInfo struct used in the - vkCreateSampler call. - """ - create_sampler = require(test.next_call_of("vkCreateSampler")) - require_equal(VK_SUCCESS, int(create_sampler.return_val)) - device = create_sampler.int_device - require_not_equal(0, device) - p_create_info = create_sampler.hex_pCreateInfo - require_not_equal(0, p_create_info) - p_sampler = create_sampler.hex_pSampler - require_not_equal(0, p_sampler) - sampler = little_endian_bytes_to_int(require(create_sampler.get_write_data( - p_sampler, NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(0, sampler) - return create_sampler, device, sampler - - -def check_destroy_sampler(test, device, sampler): - """Checks that the next vkDestroySampler command call atom has the - passed-in |device| and |sampler| handle value. - """ - destroy_sampler = require(test.next_call_of("vkDestroySampler")) - require_equal(device, destroy_sampler.int_device) - require_equal(sampler, destroy_sampler.int_sampler) - - -def get_sampler_create_info(create_sampler, architecture): - """Returns a VulkanStruct representing the VkSamplerCreateInfo struct - used in the given create_sampler command.""" - return VulkanStruct( - architecture, SAMPLER_CREATE_INFO_ELEMENTS, - lambda offset, size: little_endian_bytes_to_int(require( - create_sampler.get_read_data( - create_sampler.hex_pCreateInfo + offset, size)))) - - -@gapit_test("CreateDestroySampler_test") -class NormalizedCoordinates(GapitTest): - - def expect(self): - """1. Expects a sampler with normalized coordinates.""" - - architecture = self.architecture - device_properties = require( - self.nth_call_of("vkGetPhysicalDeviceProperties", 1)) - - create_sampler, device, sampler = check_create_sampler(self) - info = get_sampler_create_info(create_sampler, architecture) - require_equal(info.sType, VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO) - require_equal(info.pNext, 0) - require_equal(info.flags, 0) - require_equal(info.magFilter, VK_FILTER_NEAREST) - require_equal(info.minFilter, VK_FILTER_LINEAR) - require_equal(info.mipmapMode, VK_SAMPLER_MIPMAP_MODE_LINEAR) - require_equal(info.addressModeU, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE) - require_equal(info.addressModeV, VK_SAMPLER_ADDRESS_MODE_REPEAT) - require_equal(info.addressModeW, - VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) - require_equal(info.mipLodBias, -1.) - require_false(info.anisotropyEnable) - require_equal(info.maxAnisotropy, 1.) - require_false(info.compareEnable) - require_equal(info.compareOp, VK_COMPARE_OP_ALWAYS) - require_equal(info.minLod, 1.) - require_equal(info.maxLod, 2.) - require_equal(info.borderColor, VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK) - require_false(info.unnormalizedCoordinates) - - check_destroy_sampler(self, device, sampler) - - -@gapit_test("UnnormalizedSampler_test") -class UnnormalizedCoordinates(GapitTest): - - def expect(self): - """2. Expects a sampler with unnormalized coordinates.""" - - architecture = self.architecture - device_properties = require( - self.nth_call_of("vkGetPhysicalDeviceProperties", 1)) - create_device = self.next_call_of("vkCreateDevice") - if create_device[0] is None: - raise GapidUnsupportedException( - "physical device feature: samplerAnisotropy not supported") - - create_sampler, device, sampler = check_create_sampler(self) - info = get_sampler_create_info(create_sampler, architecture) - require_equal(info.sType, VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO) - require_equal(info.pNext, 0) - require_equal(info.flags, 0) - require_equal(info.magFilter, VK_FILTER_NEAREST) - require_equal(info.minFilter, VK_FILTER_NEAREST) - require_equal(info.mipmapMode, VK_SAMPLER_MIPMAP_MODE_NEAREST) - require_equal(info.addressModeU, - VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) - require_equal(info.addressModeV, - VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) - require_equal(info.addressModeW, - VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) - require_equal(info.mipLodBias, .0) - require_false(info.anisotropyEnable) - require_equal(info.maxAnisotropy, .0) - require_false(info.compareEnable) - require_equal(info.compareOp, VK_COMPARE_OP_LESS) - require_equal(info.minLod, 0.) - require_equal(info.maxLod, 0.) - require_equal(info.borderColor, VK_BORDER_COLOR_INT_OPAQUE_WHITE) - require_true(info.unnormalizedCoordinates) - - check_destroy_sampler(self, device, sampler) diff --git a/gapid_tests/resource_creation_tests/CreateDestroySampler_test/README.md b/gapid_tests/resource_creation_tests/CreateDestroySampler_test/README.md deleted file mode 100644 index ad814bdf..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroySampler_test/README.md +++ /dev/null @@ -1,140 +0,0 @@ -# vkCreateSampler / vkDestroySampler - -## Signatures -```c++ -VkResult vkCreateSampler( - VkDevice device, - const VkSamplerCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkSampler* pSampler); - -void vkDestroySampler( - VkDevice device, - VkSampler sampler, - const VkAllocationCallbacks* pAllocator); -``` - -## Valid Usage - -For `vkCreateSampler`, according to the Vulkan spec: -- `sType` **must** be `VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO` -- `pNext` **must** be `NULL` -- `flags` **must** be `0` -- `magFilter` **must** be a valid `VkFilter` value -- `minFilter` **must** be a valid `VkFilter` value -- `mipmapMode` **must** be a valid `VkSamplerMipmapMode` value -- `addressModeU` **must** be a valid `VkSamplerAddressMode` value -- `addressModeV` **must** be a valid `VkSamplerAddressMode` value -- `addressModeW` **must** be a valid `VkSamplerAddressMode` value -- The absolute value of `mipLodBias` **must** be less than or equal to - `VkPhysicalDeviceLimits::maxSamplerLodBias` -- If the anisotropic sampling feature is not enabled, `anisotropyEnable` - **must** be `VK_FALSE` -- If `anisotropyEnable` is `VK_TRUE`, `maxAnisotropy` **must** be between - 1.0 and `VkPhysicalDeviceLimits::maxSamplerAnisotropy`, inclusive -- If `unnormalizedCoordinates` is `VK_TRUE`, `minFilter` and `magFilter` - **must** be equal -- If `unnormalizedCoordinates` is `VK_TRUE`, `mipmapMode` **must** be - `VK_SAMPLER_MIPMAP_MODE_NEAREST` -- If `unnormalizedCoordinates` is `VK_TRUE`, `minLod` and `maxLod` - **must** be zero -- If `unnormalizedCoordinates` is `VK_TRUE`, `addressModeU` and `addressModeV` - **must** each be either `VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE` or - `VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER` -- If `unnormalizedCoordinates` is `VK_TRUE`, `anisotropyEnable` - **must** be `VK_FALSE` -- If `unnormalizedCoordinates` is `VK_TRUE`, `compareEnable` **must** be - `VK_FALSE` -- If any of `addressModeU`, `addressModeV` or `addressModeW` are - `VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER`, `borderColor` **must** be a valid - `VkBorderColor` value -- If the `VK_KHR_sampler_mirror_clamp_to_edge` extension is not enabled, - `addressModeU`, `addressModeV` and `addressModeW` **must** not be - `VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE` -- If `compareEnable` is `VK_TRUE`, `compareOp` **must** be a valid - `VkCompareOp` value - -For `vkDestroySampler`, according to the Vulkan spec: -- `device` **must** be a valid `VkDevice` handle -- If `sampler` is not `VK_NULL_HANDLE`, sampler **must** be a valid - `VkSampler` handle -- If `pAllocator` is not `NULL`, `pAllocator` **must** be a pointer to a valid - `VkAllocationCallbacks` structure -- If `sampler` is a valid handle, it **must** have been created, allocated, - or retrieved from `device` - -# VkSamplerCreateInfo -```c++ -typedef struct VkSamplerCreateInfo { - VkStructureType sType; - const void* pNext; - VkSamplerCreateFlags flags; - VkFilter magFilter; - VkFilter minFilter; - VkSamplerMipmapMode mipmapMode; - VkSamplerAddressMode addressModeU; - VkSamplerAddressMode addressModeV; - VkSamplerAddressMode addressModeW; - float mipLodBias; - VkBool32 anisotropyEnable; - float maxAnisotropy; - VkBool32 compareEnable; - VkCompareOp compareOp; - float minLod; - float maxLod; - VkBorderColor borderColor; - VkBool32 unnormalizedCoordinates; -} VkSamplerCreateInfo; -``` - -# Tests - -These tests should test the following cases for `vkCreateSampler`: -- `magFilter` of valid `VkFilter` values - - [x] `VK_FILTER_NEAREST` -- `minFilter` of valid `VkFilter` values - - [x] `VK_FILTER_NEAREST` - - [x] `VK_FILTER_LINEAR` -- `mipmapMode` of valid `VkSamplerMipmapMode` values - - [x] `VK_SAMPLER_MIPMAP_MODE_NEAREST` - - [x] `VK_SAMPLER_MIPMAP_MODE_LINEAR` -- `addressModeU` of valid `VkSamplerAddressMode` values - - [x] `VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE` - - [x] `VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER` -- `addressModeV` of valid `VkSamplerAddressMode` values - - [x] `VK_SAMPLER_ADDRESS_MODE_REPEAT` - - [x] `VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER` -- `addressModeW` of valid `VkSamplerAddressMode` values - - [x] `VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER` -- `mipLodBias` of valid values - - [x] -1.f - - [x] 0.f - - [ ] == `VkPhysicalDeviceLimits::maxSamplerLodBias` -- `anisotropyEnable` of valid values - - [ ] `VK_TRUE` - - [x] `VK_FALSE` -- `maxAnisotropy` of valid values - - [x] 0.f - - [x] 4.f -- `compareEnable` of valid values - - [ ] `VK_TRUE` - - [x] `VK_FALSE` -- `compareOp` of valid `VkCompareOp` values - - [x] `VK_COMPARE_OP_LESS` - - [x] `VK_COMPARE_OP_ALWAYS` -- `minLod` of valid values - - [x] 0.f - - [x] 1.f -- `maxLod` of valid values - - [x] equal to `minLod` - - [x] geater than `minLod` -- `borderColor` of valid `VkBorderColor` values - - [x] `VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK` - - [x] `VK_BORDER_COLOR_INT_OPAQUE_WHITE` -- `unnormalizedCoordinates` of valid values - - [x] `VK_TRUE` - - [x] `VK_FALSE` - -These tests should test the following cases for `vkDestroySampler`: -- [x] `sampler` == `VK_NULL_HANDLE` -- [x] `sampler` != `VK_NULL_HANDLE` diff --git a/gapid_tests/resource_creation_tests/CreateDestroySampler_test/main.cpp b/gapid_tests/resource_creation_tests/CreateDestroySampler_test/main.cpp deleted file mode 100644 index 523aa2f8..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroySampler_test/main.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - auto allocator = data->allocator(); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - { // 1. Sampler using normalized coordinates - vulkan::VkDevice& device = app.device(); - VkSamplerCreateInfo create_info{ - /* sType = */ VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* magFilter = */ VK_FILTER_NEAREST, - /* minFilter = */ VK_FILTER_LINEAR, - /* mipmapMode = */ VK_SAMPLER_MIPMAP_MODE_LINEAR, - /* addressModeU = */ VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, - /* addressModeV = */ VK_SAMPLER_ADDRESS_MODE_REPEAT, - /* addressModeW = */ VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, - /* mipLodBias = */ -1.f, - /* anisotropyEnable = */ false, - /* maxAnisotropy = */ 1.f, - /* compareEnable = */ false, - /* compareOp = */ VK_COMPARE_OP_ALWAYS, - /* minLod = */ 1.f, - /* maxLod = */ 2.f, - /* borderColor = */ VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK, - /* unnormalizedCoordinates = */ false, - }; - ::VkSampler sampler; - device->vkCreateSampler(device, &create_info, nullptr, &sampler); - data->logger()->LogInfo(" sampler: ", sampler); - device->vkDestroySampler(device, sampler, nullptr); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/CreateDestroySampler_test/unnormalized.cpp b/gapid_tests/resource_creation_tests/CreateDestroySampler_test/unnormalized.cpp deleted file mode 100644 index 38ab64fb..00000000 --- a/gapid_tests/resource_creation_tests/CreateDestroySampler_test/unnormalized.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - auto allocator = data->allocator(); - - { // Sampler using unnormalized coordinates - VkPhysicalDeviceFeatures requested_features = {0}; - requested_features.samplerAnisotropy = VK_TRUE; - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions(), {}, {}, - requested_features); - if (app.device().is_valid()) { - vulkan::VkDevice& device = app.device(); - VkSamplerCreateInfo create_info{ - /* sType = */ VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* magFilter = */ VK_FILTER_NEAREST, - /* minFilter = */ VK_FILTER_NEAREST, - /* mipmapMode = */ VK_SAMPLER_MIPMAP_MODE_NEAREST, - /* addressModeU = */ VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, - /* addressModeV = */ VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, - /* addressModeW = */ VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, - /* mipLodBias = */ 0.f, - /* anisotropyEnable = */ false, - /* maxAnisotropy = */ 0.f, - /* compareEnable = */ false, - /* compareOp = */ VK_COMPARE_OP_LESS, - /* minLod = */ 0.f, - /* maxLod = */ 0.f, - /* borderColor = */ VK_BORDER_COLOR_INT_OPAQUE_WHITE, - /* unnormalizedCoordinates = */ true, - }; - ::VkSampler sampler; - device->vkCreateSampler(device, &create_info, nullptr, &sampler); - data->logger()->LogInfo(" sampler: ", sampler); - device->vkDestroySampler(device, sampler, nullptr); - } else { - data->logger()->LogInfo( - "Disabled test due to missing physical device feature: " - "samplerAnisotropy"); - } - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/CMakeLists.txt deleted file mode 100644 index 86650578..00000000 --- a/gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(CreateResetDestroyCommandPool_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/CreateResetDestroyCommandPool_test.py b/gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/CreateResetDestroyCommandPool_test.py deleted file mode 100644 index f0e3c8cd..00000000 --- a/gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/CreateResetDestroyCommandPool_test.py +++ /dev/null @@ -1,208 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, GapitTest -from gapit_test_framework import get_read_offset_function, get_write_offset_function -from vulkan_constants import * -from struct_offsets import VulkanStruct, UINT32_T, POINTER, HANDLE, DEVICE_SIZE -from struct_offsets import ARRAY, CHAR - -COMMAND_POOL_CREATE_INFO = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("queueFamilyIndex", UINT32_T), -] - -COMMAND_POOL = [("handle", HANDLE)] - - -@gapit_test("CreateResetDestroyCommandPool_test") -class TransientBitCommandPool(GapitTest): - - def expect(self): - """1. Expects a command pool created with - VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, then reseted with flag of value 0, - and finally destroyed""" - - architecture = self.architecture - create_command_pool = require(self.nth_call_of("vkCreateCommandPool", - 1)) - device = create_command_pool.int_device - require_not_equal(0, device) - require_not_equal(0, create_command_pool.hex_pCreateInfo) - require_equal(0, create_command_pool.hex_pAllocator) - require_not_equal(0, create_command_pool.hex_pCommandPool) - require_equal(VK_SUCCESS, int(create_command_pool.return_val)) - - create_info = VulkanStruct( - architecture, COMMAND_POOL_CREATE_INFO, get_read_offset_function( - create_command_pool, create_command_pool.hex_pCreateInfo)) - require_equal(VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, - create_info.sType) - require_equal(0, create_info.pNext) - require_equal(VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, create_info.flags) - require_equal(0, create_info.queueFamilyIndex) - - command_pool = VulkanStruct( - architecture, COMMAND_POOL, get_write_offset_function( - create_command_pool, create_command_pool.hex_pCommandPool)) - require_not_equal(0, command_pool.handle) - - reset_pool = require(self.next_call_of("vkResetCommandPool")) - require_equal(device, reset_pool.int_device) - require_equal(command_pool.handle, reset_pool.int_commandPool) - require_equal(0, reset_pool.flags) - - destroy_command_pool = require(self.next_call_of( - "vkDestroyCommandPool")) - require_equal(device, destroy_command_pool.int_device) - require_equal( - command_pool.handle, destroy_command_pool.int_commandPool) - - -@gapit_test("CreateResetDestroyCommandPool_test") -class ResetCommandBufferBitCommandPool(GapitTest): - - def expect(self): - """2. Expects a command pool created with - VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, then reseted with flag - of value 0, and finally destroyed""" - - architecture = self.architecture - create_command_pool = require(self.nth_call_of("vkCreateCommandPool", - 2)) - device = create_command_pool.int_device - require_not_equal(0, device) - require_not_equal(0, create_command_pool.hex_pCreateInfo) - require_equal(0, create_command_pool.hex_pAllocator) - require_not_equal(0, create_command_pool.hex_pCommandPool) - require_equal(VK_SUCCESS, int(create_command_pool.return_val)) - - create_info = VulkanStruct( - architecture, COMMAND_POOL_CREATE_INFO, get_read_offset_function( - create_command_pool, create_command_pool.hex_pCreateInfo)) - require_equal(VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, - create_info.sType) - require_equal(0, create_info.pNext) - require_equal(VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, - create_info.flags) - require_equal(0, create_info.queueFamilyIndex) - - command_pool = VulkanStruct( - architecture, COMMAND_POOL, get_write_offset_function( - create_command_pool, create_command_pool.hex_pCommandPool)) - require_not_equal(0, command_pool.handle) - - reset_pool = require(self.next_call_of("vkResetCommandPool")) - require_equal(device, reset_pool.int_device) - require_equal(command_pool.handle, reset_pool.int_commandPool) - require_equal(0, reset_pool.flags) - - destroy_command_pool = require(self.next_call_of( - "vkDestroyCommandPool")) - require_equal(device, destroy_command_pool.int_device) - require_equal( - command_pool.handle, destroy_command_pool.int_commandPool) - - -@gapit_test("CreateResetDestroyCommandPool_test") -class ResetCommandBufferBitTransientBitCommandPool(GapitTest): - - def expect(self): - """3. Expects a command pool created with - VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT | - VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, then reset with flag of value - VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT, and finally destroyed""" - - architecture = self.architecture - create_command_pool = require(self.nth_call_of("vkCreateCommandPool", - 3)) - device = create_command_pool.int_device - require_not_equal(0, device) - require_not_equal(0, create_command_pool.hex_pCreateInfo) - require_equal(0, create_command_pool.hex_pAllocator) - require_not_equal(0, create_command_pool.hex_pCommandPool) - require_equal(VK_SUCCESS, int(create_command_pool.return_val)) - - create_info = VulkanStruct( - architecture, COMMAND_POOL_CREATE_INFO, get_read_offset_function( - create_command_pool, create_command_pool.hex_pCreateInfo)) - require_equal(VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, - create_info.sType) - require_equal(0, create_info.pNext) - require_equal(VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT - | VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, create_info.flags) - require_equal(0, create_info.queueFamilyIndex) - - command_pool = VulkanStruct( - architecture, COMMAND_POOL, get_write_offset_function( - create_command_pool, create_command_pool.hex_pCommandPool)) - require_not_equal(0, command_pool.handle) - - reset_pool = require(self.next_call_of("vkResetCommandPool")) - require_equal(device, reset_pool.int_device) - require_equal(command_pool.handle, reset_pool.int_commandPool) - require_equal(VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT, reset_pool.flags) - - destroy_command_pool = require(self.next_call_of( - "vkDestroyCommandPool")) - require_equal(device, destroy_command_pool.int_device) - require_equal( - command_pool.handle, destroy_command_pool.int_commandPool) - - -@gapit_test("CreateResetDestroyCommandPool_test") -class EmptyBitCommandPool(GapitTest): - - def expect(self): - """4. Expects a command pool created with empty flag bit, then reseted - with VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT, and finally - destroyed""" - - architecture = self.architecture - create_command_pool = require(self.nth_call_of("vkCreateCommandPool", - 4)) - device = create_command_pool.int_device - require_not_equal(0, device) - require_not_equal(0, create_command_pool.hex_pCreateInfo) - require_equal(0, create_command_pool.hex_pAllocator) - require_not_equal(0, create_command_pool.hex_pCommandPool) - require_equal(VK_SUCCESS, int(create_command_pool.return_val)) - - create_info = VulkanStruct( - architecture, COMMAND_POOL_CREATE_INFO, get_read_offset_function( - create_command_pool, create_command_pool.hex_pCreateInfo)) - require_equal(VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, - create_info.sType) - require_equal(0, create_info.pNext) - require_equal(0, create_info.flags) - require_equal(0, create_info.queueFamilyIndex) - - command_pool = VulkanStruct( - architecture, COMMAND_POOL, get_write_offset_function( - create_command_pool, create_command_pool.hex_pCommandPool)) - require_not_equal(0, command_pool.handle) - - reset_pool = require(self.next_call_of("vkResetCommandPool")) - require_equal(device, reset_pool.int_device) - require_equal(command_pool.handle, reset_pool.int_commandPool) - require_equal(VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT, reset_pool.flags) - - destroy_command_pool = require(self.next_call_of( - "vkDestroyCommandPool")) - require_equal(device, destroy_command_pool.int_device) - require_equal( - command_pool.handle, destroy_command_pool.int_commandPool) diff --git a/gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/README.md b/gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/README.md deleted file mode 100644 index c82e1b57..00000000 --- a/gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# vkCreateCommandPool / vkDestroyCommandPool - -## Signatures -```c++ -VkResult vkCreateCommandPool( - VkDevice device, - const VkCommandPoolCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkCommandPool* pCommandPool); - -VkResult vkResetCommandPool( - VkDevice device, - VkCommandPool commandPool, - VkCommandPoolResetFlags flags); - -void vkDestroyCommandPool( - VkDevice device, - VkCommandPool commandPool, - const VkAllocationCallbacks* pAllocator); -``` - -# VkCommandPoolCreateInfo -```c++ -typedef struct VkCommandPoolCreateInfo { - VkStructureType sType; - const void* pNext; - VkCommandPoolCreateFlags flags; - uint32_t queueFamilyIndex; -} VkCommandPoolCreateInfo; -``` -According to the Vulkan spec: -- `vkResetCommandPool` - - All `VkCommandBuffer` objects allocated from `commandPool` **must** not be - in the *pending state* - -These tests should test the following cases: -- vkCreateCommandPool - - [x] VK\_COMMAND\_POOL\_CREATE\_TRANSIENT\_BIT - - [x] VK\_COMMAND\_POOL\_CREATE\_RESET\_COMMAND\_BUFFER\_BIT - - [x] VK\_COMMAND\_POOL\_CREATE\_TRANSIENT\_BIT | VK\_COMMAND\_POOL\_CREATE\_RESET\_COMMAND\_BUFFER\_BIT - - [x] No bits set - - [ ] Varying QueueFamilyIndices -- vkResetCommandPool - - [x] `flags` of value 0 - - [x] `flags` of value `VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT` diff --git a/gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/main.cpp b/gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/main.cpp deleted file mode 100644 index a5dd92ed..00000000 --- a/gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/main.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateEmptyInstance(data->allocator(), &wrapper)); - vulkan::VkDevice device( - vulkan::CreateDefaultDevice(data->allocator(), instance)); - - { - VkCommandPoolCreateInfo pool_info{ - VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, nullptr, - VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, 0}; - - ::VkCommandPool raw_command_pool; - LOG_ASSERT(==, data->logger(), - device->vkCreateCommandPool(device, &pool_info, nullptr, - &raw_command_pool), - VK_SUCCESS); - vulkan::VkCommandPool command_pool(raw_command_pool, nullptr, &device); - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkResetCommandPool(device, command_pool, 0)); - } - - { - VkCommandPoolCreateInfo pool_info{ - VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, nullptr, - VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, 0}; - - ::VkCommandPool raw_command_pool; - LOG_ASSERT(==, data->logger(), - device->vkCreateCommandPool(device, &pool_info, nullptr, - &raw_command_pool), - VK_SUCCESS); - vulkan::VkCommandPool command_pool(raw_command_pool, nullptr, &device); - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkResetCommandPool(device, command_pool, 0)); - } - - { - VkCommandPoolCreateInfo pool_info{ - VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, nullptr, - VK_COMMAND_POOL_CREATE_TRANSIENT_BIT | - VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, - 0}; - - ::VkCommandPool raw_command_pool; - LOG_ASSERT(==, data->logger(), - device->vkCreateCommandPool(device, &pool_info, nullptr, - &raw_command_pool), - VK_SUCCESS); - vulkan::VkCommandPool command_pool(raw_command_pool, nullptr, &device); - LOG_ASSERT( - ==, data->logger(), VK_SUCCESS, - device->vkResetCommandPool(device, command_pool, - VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT)); - } - - { - VkCommandPoolCreateInfo pool_info{ - VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, nullptr, 0, 0}; - - ::VkCommandPool raw_command_pool; - LOG_ASSERT(==, data->logger(), - device->vkCreateCommandPool(device, &pool_info, nullptr, - &raw_command_pool), - VK_SUCCESS); - vulkan::VkCommandPool command_pool(raw_command_pool, nullptr, &device); - LOG_ASSERT( - ==, data->logger(), VK_SUCCESS, - device->vkResetCommandPool(device, command_pool, - VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT)); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/CreateResetDestroyDescriptorPool_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/CreateResetDestroyDescriptorPool_test/CMakeLists.txt deleted file mode 100644 index 430dffdf..00000000 --- a/gapid_tests/resource_creation_tests/CreateResetDestroyDescriptorPool_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(CreateResetDestroyDescriptorPool_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/CreateResetDestroyDescriptorPool_test/CreateResetDestroyDescriptorSet_test.py b/gapid_tests/resource_creation_tests/CreateResetDestroyDescriptorPool_test/CreateResetDestroyDescriptorSet_test.py deleted file mode 100644 index d99c364a..00000000 --- a/gapid_tests/resource_creation_tests/CreateResetDestroyDescriptorPool_test/CreateResetDestroyDescriptorSet_test.py +++ /dev/null @@ -1,160 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest -from vulkan_constants import * -from struct_offsets import VulkanStruct, UINT32_T, POINTER - -DESCRIPTOR_POOL_CREATE_INFO_ELEMENTS = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("maxSets", UINT32_T), - ("poolSizeCount", UINT32_T), - ("pPoolSizes", POINTER), -] - -DESCRIPTOR_POOL_SIZE_ELEMENTS = [ - ("type", UINT32_T), - ("descriptorCount", UINT32_T), -] - - -def check_create_descriptor_pool(test, index): - """Gets the |index|'th vkCreateDescriptorPool call atom, and checks its - return value and arguments. Also checks the returned descriptor pool handle - is not null. Returns the checked vkCreateDescriptorPool atom, device and - descriptor pool handle. This method does not check the content of the - VkDescriptorPoolCreateInfo struct used in the vkCreateDescriptorPool call. - """ - create_descriptor_pool = require( - test.nth_call_of("vkCreateDescriptorPool", index)) - require_equal(VK_SUCCESS, int(create_descriptor_pool.return_val)) - device = create_descriptor_pool.int_device - require_not_equal(0, device) - p_create_info = create_descriptor_pool.hex_pCreateInfo - require_not_equal(0, p_create_info) - p_descriptor_pool = create_descriptor_pool.hex_pDescriptorPool - require_not_equal(0, p_descriptor_pool) - descriptor_pool = little_endian_bytes_to_int( - require(create_descriptor_pool.get_write_data( - p_descriptor_pool, NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(0, descriptor_pool) - return create_descriptor_pool, device, descriptor_pool - - -def check_reset_descriptor_pool(test, device, descriptor_pool): - """Checks that the next vkResetDescriptorPool command call atom has the - passed-in |device| and |descriptor_pool| handle value. - """ - reset_descriptor_pool = require( - test.next_call_of("vkResetDescriptorPool")) - require_equal(device, reset_descriptor_pool.int_device) - require_equal(descriptor_pool, reset_descriptor_pool.int_descriptorPool) - require_equal(0, reset_descriptor_pool.int_flags) - - -def check_destroy_descriptor_pool(test, device, descriptor_pool): - """Checks that the next vkDestroyDescriptorPool command call atom has the - passed-in |device| and |descriptor_pool| handle value. - """ - destroy_descriptor_pool = require( - test.next_call_of("vkDestroyDescriptorPool")) - require_equal(device, destroy_descriptor_pool.int_device) - require_equal(descriptor_pool, destroy_descriptor_pool.int_descriptorPool) - - -def get_descriptor_pool_create_info(create_descriptor_pool, architecture): - """Returns a VulkanStruct representing the VkDescriptorPoolCreateInfo struct - used in the given create_descriptor_pool command.""" - return VulkanStruct( - architecture, DESCRIPTOR_POOL_CREATE_INFO_ELEMENTS, - lambda offset, size: little_endian_bytes_to_int(require( - create_descriptor_pool.get_read_data( - create_descriptor_pool.hex_pCreateInfo + offset, size)))) - - -def get_pool_size(create_descriptor_pool, architecture, create_info, index): - """Returns a VulkanStruct representing the VkDescriptorPoolSize struct.""" - pool_size_offset = (create_info.pPoolSizes + - # (4 + 4) is the size of a VkDescriptorPoolSize struct. - index * (4 + 4)) - return VulkanStruct( - architecture, DESCRIPTOR_POOL_SIZE_ELEMENTS, - lambda offset, size: little_endian_bytes_to_int(require( - create_descriptor_pool.get_read_data( - pool_size_offset + offset, size)))) - - -@gapit_test("CreateResetDestroyDescriptorPool_test") -class NoFlagOneDescriptorType(GapitTest): - - def expect(self): - """1. No create flags, max two sets, one descriptor type""" - - arch = self.architecture - - create_atom, device, descriptor_pool = \ - check_create_descriptor_pool(self, 1) - info = get_descriptor_pool_create_info(create_atom, arch) - require_equal( - info.sType, VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO) - require_equal(info.pNext, 0) - require_equal(info.flags, 0) - require_equal(info.maxSets, 1) - require_equal(info.poolSizeCount, 1) - - pool_size = get_pool_size(create_atom, arch, info, 0) - require_equal(pool_size.type, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) - require_equal(pool_size.descriptorCount, 1) - - check_reset_descriptor_pool(self, device, descriptor_pool) - check_destroy_descriptor_pool(self, device, descriptor_pool) - - -@gapit_test("CreateResetDestroyDescriptorPool_test") -class WithFlagMoreDescriptorTypes(GapitTest): - - def expect(self): - """2. With create flags, max ten sets, more descriptor types""" - - arch = self.architecture - - create_atom, device, descriptor_pool = \ - check_create_descriptor_pool(self, 2) - info = get_descriptor_pool_create_info(create_atom, arch) - require_equal( - info.sType, VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO) - require_equal(info.pNext, 0) - require_equal(info.flags, - VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT) - require_equal(info.maxSets, 10) - require_equal(info.poolSizeCount, 3) - - pool_size = get_pool_size(create_atom, arch, info, 0) - require_equal(pool_size.type, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) - require_equal(pool_size.descriptorCount, 42) - - pool_size = get_pool_size(create_atom, arch, info, 1) - require_equal(pool_size.type, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) - require_equal(pool_size.descriptorCount, 5) - - pool_size = get_pool_size(create_atom, arch, info, 2) - require_equal(pool_size.type, VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT) - require_equal(pool_size.descriptorCount, 8) - - check_reset_descriptor_pool(self, device, descriptor_pool) - check_destroy_descriptor_pool(self, device, descriptor_pool) diff --git a/gapid_tests/resource_creation_tests/CreateResetDestroyDescriptorPool_test/README.md b/gapid_tests/resource_creation_tests/CreateResetDestroyDescriptorPool_test/README.md deleted file mode 100644 index 4f2fc2f8..00000000 --- a/gapid_tests/resource_creation_tests/CreateResetDestroyDescriptorPool_test/README.md +++ /dev/null @@ -1,75 +0,0 @@ -# vkCreateDescriptorPool / vkResetDescriptorPool / vkDestroyDescriptorPool - -## Signatures -```c++ -VkResult vkCreateDescriptorPool( - VkDevice device, - const VkDescriptorPoolCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkDescriptorPool* pDescriptorPool); - -VkResult vkResetDescriptorPool( - VkDevice device, - VkDescriptorPool descriptorPool, - VkDescriptorPoolResetFlags flags); - -void vkDestroyDescriptorPool( - VkDevice device, - VkDescriptorPool descriptorPool, - const VkAllocationCallbacks* pAllocator); -``` - -## Valid Usage - -For `vkCreateDescriptorPool`, according to the Vulkan spec: -- `maxSets` **must** be greater than 0 -- `poolSizeCount` **must** be greater than 0 -- `descriptorCount` **must** be greater than 0 - -For `vkResetDescriptorPool`, according to the Vulkan spec: -- `descriptorPool` **must** be a valid `VkDescriptorPool` handle -- `flags` **must** be 0 - -# VkDescriptorPoolCreateInfo -```c++ -typedef struct VkDescriptorPoolCreateInfo { - VkStructureType sType; - const void* pNext; - VkDescriptorPoolCreateFlags flags; - uint32_t maxSets; - uint32_t poolSizeCount; - const VkDescriptorPoolSize* pPoolSizes; -} VkDescriptorPoolCreateInfo; - -typedef struct VkDescriptorPoolSize { - VkDescriptorType type; - uint32_t descriptorCount; -} VkDescriptorPoolSize; -``` - -# Tests - -These tests should test the following cases for `vkCreateDescriptorPool`: -- `flags` of valid `VkDescriptorPoolCreateFlagBits` values: - - [x] no bits set - - [x] `VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT` -- `maxSets` of valid values: - - [x] 1 - - [x] 10 -- `poolSizeCount` of valid values: - - [x] 1 - - [x] 3 -- `type` of valid `VkDescriptorType` values: - - [x] `VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE` - - [x] `VK_DESCRIPTOR_TYPE_STORAGE_IMAGE` - - [x] `VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER` - - [x] `VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT` -- `descriptorCount` of valid values - - [x] 1 - - [x] 5 - - [x] 8 - - [x] 42 - -These tests should test the following cases for `vkDestroyDescriptorPool`: -- [x] `descriptorPool` == null -- [x] `descriptorPool` != null diff --git a/gapid_tests/resource_creation_tests/CreateResetDestroyDescriptorPool_test/main.cpp b/gapid_tests/resource_creation_tests/CreateResetDestroyDescriptorPool_test/main.cpp deleted file mode 100644 index 635248bf..00000000 --- a/gapid_tests/resource_creation_tests/CreateResetDestroyDescriptorPool_test/main.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - auto allocator = data->allocator(); - vulkan::LibraryWrapper wrapper(allocator, data->logger()); - vulkan::VkInstance instance(vulkan::CreateEmptyInstance(allocator, &wrapper)); - vulkan::VkDevice device(vulkan::CreateDefaultDevice(allocator, instance)); - - { // 1. No create flags, max two sets, one descriptor type - VkDescriptorPoolSize pool_size{ - /* type = */ VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, - /* descriptorCount = */ 1, - }; - VkDescriptorPoolCreateInfo create_info{ - /* sType = */ VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* maxSets = */ 1, - /* poolSizeCount = */ 1, - /* pPoolSizes = */ &pool_size}; - - ::VkDescriptorPool pool; - device->vkCreateDescriptorPool(device, &create_info, nullptr, &pool); - data->logger()->LogInfo(" pool: ", pool); - device->vkResetDescriptorPool(device, pool, 0); - device->vkDestroyDescriptorPool(device, pool, nullptr); - } - - { // 2. With create flags, max ten sets, more descriptor types - VkDescriptorPoolSize pool_size[3] = { - { - /* type = */ VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, - /* descriptorCount = */ 42, - }, - { - /* type = */ VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, - /* descriptorCount = */ 5, - }, - { - /* type = */ VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, - /* descriptorCount = */ 8, - }, - }; - VkDescriptorPoolCreateInfo create_info{ - /* sType = */ VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, - /* maxSets = */ 10, - /* poolSizeCount = */ 3, - /* pPoolSizes = */ pool_size}; - - ::VkDescriptorPool pool; - device->vkCreateDescriptorPool(device, &create_info, nullptr, &pool); - data->logger()->LogInfo(" pool: ", pool); - device->vkResetDescriptorPool(device, pool, 0); - device->vkDestroyDescriptorPool(device, pool, nullptr); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/FlushAndInvalidateRanges_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/FlushAndInvalidateRanges_test/CMakeLists.txt deleted file mode 100644 index db3e3baa..00000000 --- a/gapid_tests/resource_creation_tests/FlushAndInvalidateRanges_test/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(FlushAndInvalidateRanges_test - SOURCES main.cpp - LIBS - vulkan_helpers -) - diff --git a/gapid_tests/resource_creation_tests/FlushAndInvalidateRanges_test/FlushAndInvalidateRanges_test.py b/gapid_tests/resource_creation_tests/FlushAndInvalidateRanges_test/FlushAndInvalidateRanges_test.py deleted file mode 100644 index f1957ae7..00000000 --- a/gapid_tests/resource_creation_tests/FlushAndInvalidateRanges_test/FlushAndInvalidateRanges_test.py +++ /dev/null @@ -1,238 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from gapit_test_framework import get_write_offset_function -from struct_offsets import VulkanStruct, ARRAY, UINT32_T, DEVICE_SIZE -from struct_offsets import CHAR, POINTER, HANDLE -from vulkan_constants import VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, VK_WHOLE_SIZE - -NON_COHERENT_ATOM_SIZE = 256 -BUFFER_SIZE = NON_COHERENT_ATOM_SIZE * 2 -FLUSH_INVALIDATE_SIZE = NON_COHERENT_ATOM_SIZE -SRC_BUFFER_FLUSH_INVALIDATE_OFFSET = NON_COHERENT_ATOM_SIZE * 2 -DST_BUFFER_FLUSH_INVALIDATE_OFFSET = NON_COHERENT_ATOM_SIZE * 5 - -MAPPED_MEMORY_RANGE = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("memory", HANDLE), - ("offset", DEVICE_SIZE), - ("size", DEVICE_SIZE), -] - - -@gapit_test("FlushAndInvalidateRanges_test") -class FlushMappedMemoryRangesNonZeroOffsetNotWholeSize(GapitTest): - - def expect(self): - """Check the arguments and the VkMappedMemoryRange structs used in - vkFlushMappedMemoryRanges(). The flushed memory starts at offset 768 and - has size 256""" - MAP_OFFSET = 512 - FLUSH_OFFSET = MAP_OFFSET + 256 - FLUSH_SIZE = 256 - MEMORY_DATA = [("data", ARRAY, FLUSH_SIZE, CHAR)] - EXPECTED_MEMORY_DATA = [i for i in range(FLUSH_SIZE)] - - architecture = self.architecture - # The first and second vkMapMemory() result is managed in - # VulkanApplication and is not used here, the third is the one we need - # here. - map_memory = require(self.nth_call_of("vkMapMemory", 3)) - require_not_equal(0, map_memory.hex_ppData) - # The flushed data starts at mapped offset + 256 - flushed_data_ptr = little_endian_bytes_to_int(require( - map_memory.get_write_data(map_memory.hex_ppData, - architecture.int_sizeSize))) + 256 - - # Check arguments - flush_mapped_memory_ranges = require(self.nth_call_of( - "vkFlushMappedMemoryRanges", 1)) - require_equal(1, flush_mapped_memory_ranges.int_memoryRangeCount) - require_not_equal(0, flush_mapped_memory_ranges.hex_pMemoryRanges) - - # Check the memory range struct content - mapped_memory_range = VulkanStruct( - architecture, MAPPED_MEMORY_RANGE, get_read_offset_function( - flush_mapped_memory_ranges, - flush_mapped_memory_ranges.hex_pMemoryRanges)) - require_equal(VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, - mapped_memory_range.sType) - require_equal(0, mapped_memory_range.pNext) - require_not_equal(0, mapped_memory_range.memory) - require_equal(FLUSH_OFFSET, mapped_memory_range.offset) - require_equal(FLUSH_SIZE, mapped_memory_range.size) - - # check the flushed memory data - memory_data = VulkanStruct( - architecture, MEMORY_DATA, get_read_offset_function( - flush_mapped_memory_ranges, flushed_data_ptr)) - require_equal(EXPECTED_MEMORY_DATA, memory_data.data) - - -@gapit_test("FlushAndInvalidateRanges_test") -class InvalidateMappedMemoryRangesZeroOffsetWholeSize(GapitTest): - - def expect(self): - """Check the arguments and the VkMappedMemoryRange structs used in - vkInvalidateMappedMemoryRanges(). The invalidate memory covers the whole - dst buffer which starts at offset 0 and has size VK_WHOLE_SIZE. Only the - second half of the buffer has the data copied from the previously - flushed memory""" - MAP_OFFSET = 0 - INVALIDATE_OFFSET = MAP_OFFSET - INVALIDATE_SIZE = VK_WHOLE_SIZE - DATA_SIZE = 256 - MEMORY_DATA = [("data", ARRAY, DATA_SIZE, CHAR)] - EXPECTED_MEMORY_DATA = [i for i in range(DATA_SIZE)] - - architecture = self.architecture - # The first and second vkMapMemory() result is managed in - # VulkanApplication and is not used here, the fourth is the one we need - # here. - map_memory = require(self.nth_call_of("vkMapMemory", 4)) - require_not_equal(0, map_memory.hex_ppData) - # The invalidated data offset is equal to the mapped offset, but the - # flushed data starts at mapped offset + 256 - invalidate_data_ptr = little_endian_bytes_to_int(require( - map_memory.get_write_data(map_memory.hex_ppData, - architecture.int_sizeSize))) + 256 - - # Check arguments - invalidate_mapped_memory_ranges = require(self.nth_call_of( - "vkInvalidateMappedMemoryRanges", 1)) - require_equal(1, invalidate_mapped_memory_ranges.int_memoryRangeCount) - require_not_equal(0, invalidate_mapped_memory_ranges.hex_pMemoryRanges) - - # Check the memory range struct contents - mapped_memory_range = VulkanStruct( - architecture, MAPPED_MEMORY_RANGE, get_read_offset_function( - invalidate_mapped_memory_ranges, - invalidate_mapped_memory_ranges.hex_pMemoryRanges)) - require_equal(VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, - mapped_memory_range.sType) - require_equal(0, mapped_memory_range.pNext) - require_not_equal(0, mapped_memory_range.memory) - require_equal(INVALIDATE_OFFSET, mapped_memory_range.offset) - require_equal(INVALIDATE_SIZE, mapped_memory_range.size) - - # Check data of the invalidated memory - memory_data = VulkanStruct( - architecture, MEMORY_DATA, get_write_offset_function( - invalidate_mapped_memory_ranges, invalidate_data_ptr)) - require_equal(EXPECTED_MEMORY_DATA, memory_data.data) - - -@gapit_test("FlushAndInvalidateRanges_test") -class FlushMappedMemoryRangesZeroOffsetWholeSize(GapitTest): - - def expect(self): - """Check the arguments and the VkMappedMemoryRange structs used in - vkFlushMappedMemoryRanges(). The flushed memory starts at offset 0 and - has size VK_WHOLE_SIZE""" - MAP_OFFSET = 0 - FLUSH_OFFSET = MAP_OFFSET - FLUSH_SIZE = VK_WHOLE_SIZE - DATA_SIZE = 512 - MEMORY_DATA = [("data", ARRAY, DATA_SIZE, CHAR)] - EXPECTED_MEMORY_DATA = [min(i, 512 - i) & 0xFF - for i in range(DATA_SIZE)] - - architecture = self.architecture - # The first and second vkMapMemory() result is managed in - # VulkanApplication and is not used here, the fifth is the one we need - # here. - map_memory = require(self.nth_call_of("vkMapMemory", 5)) - require_not_equal(0, map_memory.hex_ppData) - # The flushed data starts at mapped offset - flushed_data_ptr = little_endian_bytes_to_int(require( - map_memory.get_write_data(map_memory.hex_ppData, - architecture.int_sizeSize))) - - # Check arguments - flush_mapped_memory_ranges = require(self.nth_call_of( - "vkFlushMappedMemoryRanges", 1)) - require_equal(1, flush_mapped_memory_ranges.int_memoryRangeCount) - require_not_equal(0, flush_mapped_memory_ranges.hex_pMemoryRanges) - - # Check the memory range struct content - mapped_memory_range = VulkanStruct( - architecture, MAPPED_MEMORY_RANGE, get_read_offset_function( - flush_mapped_memory_ranges, - flush_mapped_memory_ranges.hex_pMemoryRanges)) - require_equal(VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, - mapped_memory_range.sType) - require_equal(0, mapped_memory_range.pNext) - require_not_equal(0, mapped_memory_range.memory) - require_equal(FLUSH_OFFSET, mapped_memory_range.offset) - require_equal(FLUSH_SIZE, mapped_memory_range.size) - - # check the flushed memory data - memory_data = VulkanStruct( - architecture, MEMORY_DATA, get_read_offset_function( - flush_mapped_memory_ranges, flushed_data_ptr)) - require_equal(EXPECTED_MEMORY_DATA, memory_data.data) - - -@gapit_test("FlushAndInvalidateRanges_test") -class InvalidateMappedMemoryRangesNonZeroOffsetNotWholeSize(GapitTest): - - def expect(self): - """Check the arguments and the VkMappedMemoryRange structs used in - vkInvalidateMappedMemoryRanges(). The invalidate memory covers the - second half of the dst buffer which starts at offset 1024 and has size - 512. Only the second half of the buffer has the data is invalidated to - be host accessible.""" - MAP_OFFSET = 1024 - INVALIDATE_OFFSET = MAP_OFFSET + 256 - INVALIDATE_SIZE = 256 - MEMORY_DATA = [("data", ARRAY, INVALIDATE_SIZE, CHAR)] - EXPECTED_MEMORY_DATA = [(512 - i) & 0xFF - for i in range(INVALIDATE_SIZE, 512)] - - architecture = self.architecture - # The first and second vkMapMemory() result is managed in - # VulkanApplication and is not used here, the sixth is the one we need - # here. - map_memory = require(self.nth_call_of("vkMapMemory", 6)) - require_not_equal(0, map_memory.hex_ppData) - # The invalidated data offset is equal to the mapped offset, but the - # flushed data starts at mapped offset + 256 - invalidate_data_ptr = little_endian_bytes_to_int(require( - map_memory.get_write_data(map_memory.hex_ppData, - architecture.int_sizeSize))) + 256 - - # Check arguments - invalidate_mapped_memory_ranges = require(self.nth_call_of( - "vkInvalidateMappedMemoryRanges", 1)) - require_equal(1, invalidate_mapped_memory_ranges.int_memoryRangeCount) - require_not_equal(0, invalidate_mapped_memory_ranges.hex_pMemoryRanges) - - # Check the memory range struct contents - mapped_memory_range = VulkanStruct( - architecture, MAPPED_MEMORY_RANGE, get_read_offset_function( - invalidate_mapped_memory_ranges, - invalidate_mapped_memory_ranges.hex_pMemoryRanges)) - require_equal(VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, - mapped_memory_range.sType) - require_equal(0, mapped_memory_range.pNext) - require_not_equal(0, mapped_memory_range.memory) - require_equal(INVALIDATE_OFFSET, mapped_memory_range.offset) - require_equal(INVALIDATE_SIZE, mapped_memory_range.size) - - # Check data of the invalidated memory - memory_data = VulkanStruct( - architecture, MEMORY_DATA, get_write_offset_function( - invalidate_mapped_memory_ranges, invalidate_data_ptr)) - require_equal(EXPECTED_MEMORY_DATA, memory_data.data) diff --git a/gapid_tests/resource_creation_tests/FlushAndInvalidateRanges_test/README.md b/gapid_tests/resource_creation_tests/FlushAndInvalidateRanges_test/README.md deleted file mode 100644 index 94788797..00000000 --- a/gapid_tests/resource_creation_tests/FlushAndInvalidateRanges_test/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# vkFlushMappedMemoryRanges / vkInvalidateMappedMemoryRanges - -## Signatures -```c++ -VkResult vkFlushMappedMemoryRanges( - VkDevice device, - uint32_t memoryRangeCount, - const VkMappedMemoryRange* pMemoryRanges); - -VkResult vkInvalidateMappedMemoryRanges( - VkDevice device, - uint32_t memoryRangeCount, - const VkMappedMemoryRange* pMemoryRanges); -``` - -# VkMappedMemoryRange -```c++ -typedef struct VkMappedMemoryRange { - VkStructureType sType; - const void* pNext; - VkDeviceMemory memory; - VkDeviceSize offset; - VkDeviceSize size; -} VkMappedMemoryRange; -``` - -According to the Vulkan spec: -- vkFlushMappedMemoryRanges / vkInvalidateMappedMemoryRanges - - `device` **must** be a valid `VkDevice` handle - - `pMemoryRanges` **must** be a pointer to an array of `memoryRangeCount` - valid `VkMappedMemoryRange` structures - - `memoryRangeCount` **must** be greater than 0 -- VkMappedMemoryRange - - `pNext` **must** be `NULL` - - `memory` **must** be a valid `VkDeviceMemory` handle and **must** currently - be mapped - - If `size` is not equal to `VK_WHOLE_SIZE`, `offset` and `size` **must** - specify a range contained within the current mapped range of `memory` - - If `size` is equal to `VK_WHOLE_SIZE`, `offset` **must** be within the - currently mapped range of `memory` - - `offset` **must** be a multiple of - `VkPhysicalDeviceLimits::nonCoherentAtomSize` - - If `size` is not equal to `VK_WHOLE_SIZE`, `size` **must** be a multiple - of `VkPhysicalDeviceLimits::nonCoherentAtomSize` - - -These tests should test the following cases: -- [x] `size` not equal to `VK_WHOLE_SIZE` -- [x] `size` eqaul to `VK_WHOLE_SIZE` -- [x] `offset` of value non-zero -- [x] `offset` of value 0 -- [x] single VkMappedMemoryRange -- [ ] multiple VkMappedMemoryRange's diff --git a/gapid_tests/resource_creation_tests/FlushAndInvalidateRanges_test/main.cpp b/gapid_tests/resource_creation_tests/FlushAndInvalidateRanges_test/main.cpp deleted file mode 100644 index ca42eeef..00000000 --- a/gapid_tests/resource_creation_tests/FlushAndInvalidateRanges_test/main.cpp +++ /dev/null @@ -1,325 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/command_buffer_wrapper.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - vulkan::VkDevice& device = app.device(); - vulkan::VkCommandBuffer cmd_buf = app.GetCommandBuffer(); - ::VkCommandBuffer raw_cmd_buf = cmd_buf.get_command_buffer(); - vulkan::VkQueue& queue = app.render_queue(); - - // Create a tiny buffer to determine the memory flags - VkBufferCreateInfo buffer_create_info{ - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 1, // size - VK_BUFFER_USAGE_TRANSFER_SRC_BIT | - VK_BUFFER_USAGE_TRANSFER_DST_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr, // pQueueFamilyIndices - }; - ::VkBuffer tiny_buffer; - device->vkCreateBuffer(device, &buffer_create_info, nullptr, &tiny_buffer); - VkMemoryRequirements requirements; - device->vkGetBufferMemoryRequirements(device, tiny_buffer, &requirements); - device->vkDestroyBuffer(device, tiny_buffer, nullptr); - uint32_t memory_type_index = - GetMemoryIndex(&device, data->logger(), requirements.memoryTypeBits, - VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT); - // Allocate memory space for 2048 bytes - // Mapped memories must be aligned to kNonCoherentAtomSize and all the sizes - // used for memory mapping, flushing and invalidating must be a multiple of - // kNonCoherentAtomSize - const uint64_t kNonCoherentAtomSize = 256; - VkMemoryAllocateInfo memory_allocate_info{ - VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, // sType - nullptr, // pNext - kNonCoherentAtomSize * 8, // allocationSize - memory_type_index, // memoryTypeIndex - }; - ::VkDeviceMemory raw_device_memory; - device->vkAllocateMemory(device, &memory_allocate_info, nullptr, - &raw_device_memory); - vulkan::VkDeviceMemory device_memory(raw_device_memory, nullptr, &device); - - // Create 512-byte src and dst buffer for copying. - const VkDeviceSize kBufferSize = kNonCoherentAtomSize * 2; - buffer_create_info.size = kBufferSize; - - { - // Create src and dst buffer, flush data to a src buffer, copy the buffer - // content to dst buffer and invalidate the dst buffer to fetch the same - // data again. - ::VkBuffer raw_src_buffer; - ::VkBuffer raw_dst_buffer; - device->vkCreateBuffer(device, &buffer_create_info, nullptr, - &raw_src_buffer); - device->vkCreateBuffer(device, &buffer_create_info, nullptr, - &raw_dst_buffer); - vulkan::VkBuffer src_buffer(raw_src_buffer, nullptr, &device); - vulkan::VkBuffer dst_buffer(raw_dst_buffer, nullptr, &device); - - { - // 1. Flush a mapped memory range to the src buffer. Only flush the - // second 256-byte block, i.e. the flush offset is not equal to the - // mapped offset, and flush size is not VK_WHOLE_SIZE. - - // Bind the src buffer to offset 512 - const VkDeviceSize kSrcBufferOffset = kNonCoherentAtomSize * 2; - device->vkBindBufferMemory(device, src_buffer, device_memory, - kSrcBufferOffset); - const VkDeviceSize map_offset = kSrcBufferOffset; - const VkDeviceSize flush_offset = kSrcBufferOffset + kNonCoherentAtomSize; - const VkDeviceSize map_size = kBufferSize; - const VkDeviceSize flush_size = kNonCoherentAtomSize; - char* buf_data; - device->vkMapMemory(device, // device - device_memory, // memory - map_offset, // offset - map_size, // size - 0, // flags - reinterpret_cast(&buf_data) // ppData - ); - for (size_t i = 0; i < map_size; i++) { - buf_data[i] = i & 0xFF; - } - VkMappedMemoryRange flush_range{ - VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, // sType - nullptr, // pNext - device_memory, // memory - flush_offset, // offset - flush_size, // size - }; - device->vkFlushMappedMemoryRanges(device, 1, &flush_range); - device->vkUnmapMemory(device, device_memory); - } - - { - // 2. Copy the content from the src buffer to a dst buffer which starts - // at offset 0. Then map the memory corresponding to the dst buffer and - // invalidate the whole buffer with size of value VK_WHOLE_SIZE. - - // Bind the dst buffer to offset 0 - const VkDeviceSize kDstBufferOffset = 0; - device->vkBindBufferMemory(device, dst_buffer, device_memory, - kDstBufferOffset); - - // Copy data from src buffer to dst buffer - VkCommandBufferBeginInfo cmd_begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, - nullptr, - 0, - nullptr, - }; - cmd_buf->vkBeginCommandBuffer(cmd_buf, &cmd_begin_info); - VkMemoryBarrier flush_barrier{VK_STRUCTURE_TYPE_MEMORY_BARRIER, nullptr, - VK_ACCESS_HOST_WRITE_BIT, - VK_ACCESS_TRANSFER_READ_BIT}; - cmd_buf->vkCmdPipelineBarrier(cmd_buf, VK_PIPELINE_STAGE_HOST_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 1, - &flush_barrier, 0, nullptr, 0, nullptr); - VkBufferCopy copy_region{0, 0, kBufferSize}; - cmd_buf->vkCmdCopyBuffer(cmd_buf, src_buffer, dst_buffer, 1, - ©_region); - VkMemoryBarrier copy_barrier{VK_STRUCTURE_TYPE_MEMORY_BARRIER, nullptr, - VK_ACCESS_TRANSFER_READ_BIT, - VK_ACCESS_HOST_READ_BIT}; - cmd_buf->vkEndCommandBuffer(cmd_buf); - VkSubmitInfo submit_info{VK_STRUCTURE_TYPE_SUBMIT_INFO, - nullptr, - 0, - nullptr, - nullptr, - 1, - &raw_cmd_buf, - 0, - nullptr}; - queue->vkQueueSubmit(queue, 1, &submit_info, - static_cast(VK_NULL_HANDLE)); - queue->vkQueueWaitIdle(queue); - - // Invalidate the memory range of the dst buffer. The second 256-byte - // block - // of the dst buffer should have the data copied from src buffer's second - // 256-byte block. - const VkDeviceSize map_offset = kDstBufferOffset; - const VkDeviceSize invalidate_offset = kDstBufferOffset; - const VkDeviceSize map_size = kBufferSize; - const VkDeviceSize invalidate_size = VK_WHOLE_SIZE; - char* buf_data; - device->vkMapMemory(device, // device - device_memory, // memory - map_offset, // offset - map_size, // size - 0, // flags - reinterpret_cast(&buf_data) // ppData - ); - VkMappedMemoryRange invalidate_range{ - VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, // sType - nullptr, // pNext - device_memory, // memory - invalidate_offset, // offset - invalidate_size, // size - }; - device->vkInvalidateMappedMemoryRanges(device, 1, &invalidate_range); - // Only the second 256-byte block of the dst buffer has the data flushed - // before. - for (size_t i = kNonCoherentAtomSize; i < map_size; i++) { - LOG_ASSERT(==, data->logger(), (i & 0xFF), (unsigned char)buf_data[i]); - } - device->vkUnmapMemory(device, device_memory); - } - } - - { - // Create another src and dst buffer, flush and invalidate buffer again. - ::VkBuffer raw_src_buffer; - ::VkBuffer raw_dst_buffer; - device->vkCreateBuffer(device, &buffer_create_info, nullptr, - &raw_src_buffer); - device->vkCreateBuffer(device, &buffer_create_info, nullptr, - &raw_dst_buffer); - vulkan::VkBuffer src_buffer(raw_src_buffer, nullptr, &device); - vulkan::VkBuffer dst_buffer(raw_dst_buffer, nullptr, &device); - - { - // 3. Flush the whole src buffer which starts at offset 0, i.e. the flush - // offset is equal to the mapped offset, and flush size is VK_WHOLE_SIZE. - - // Bind the src buffer to offset 0 - const VkDeviceSize kSrcBufferOffset = 0; - device->vkBindBufferMemory(device, src_buffer, device_memory, - kSrcBufferOffset); - const VkDeviceSize map_offset = kSrcBufferOffset; - const VkDeviceSize flush_offset = kSrcBufferOffset; - const VkDeviceSize map_size = kBufferSize; - const VkDeviceSize flush_size = VK_WHOLE_SIZE; - char* buf_data; - device->vkMapMemory(device, // device - device_memory, // memory - map_offset, // offset - map_size, // size - 0, // flags - reinterpret_cast(&buf_data) // ppData - ); - for (size_t i = 0; i < map_size; i++) { - if (i < 512 - i) { - buf_data[i] = i & 0xFF; - } else { - buf_data[i] = (512 - i) & 0xFF; - } - } - VkMappedMemoryRange flush_range{ - VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, // sType - nullptr, // pNext - device_memory, // memory - flush_offset, // offset - flush_size, // size - }; - device->vkFlushMappedMemoryRanges(device, 1, &flush_range); - device->vkUnmapMemory(device, device_memory); - } - - { - // 4. Copy the content from the src buffer to the dst buffer. Then map - // the memory corresponding to the dst buffer and invalidate the second - // half of the buffer, i.e. invalidate offset is not equal to the mapped - // offset and the size is not equal to VK_WHOLE_SIZE. - - // Bind the dst buffer to offset 1024 - const VkDeviceSize kDstBufferOffset = kBufferSize * 2; - device->vkBindBufferMemory(device, dst_buffer, device_memory, - kDstBufferOffset); - - // Copy data from src buffer to dst buffer - VkCommandBufferBeginInfo cmd_begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, - nullptr, - 0, - nullptr, - }; - cmd_buf->vkBeginCommandBuffer(cmd_buf, &cmd_begin_info); - VkMemoryBarrier flush_barrier{VK_STRUCTURE_TYPE_MEMORY_BARRIER, nullptr, - VK_ACCESS_HOST_WRITE_BIT, - VK_ACCESS_TRANSFER_READ_BIT}; - cmd_buf->vkCmdPipelineBarrier(cmd_buf, VK_PIPELINE_STAGE_HOST_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 1, - &flush_barrier, 0, nullptr, 0, nullptr); - VkBufferCopy copy_region{0, 0, kBufferSize}; - cmd_buf->vkCmdCopyBuffer(cmd_buf, src_buffer, dst_buffer, 1, - ©_region); - VkMemoryBarrier copy_barrier{VK_STRUCTURE_TYPE_MEMORY_BARRIER, nullptr, - VK_ACCESS_TRANSFER_READ_BIT, - VK_ACCESS_HOST_READ_BIT}; - cmd_buf->vkEndCommandBuffer(cmd_buf); - VkSubmitInfo submit_info{VK_STRUCTURE_TYPE_SUBMIT_INFO, - nullptr, - 0, - nullptr, - nullptr, - 1, - &raw_cmd_buf, - 0, - nullptr}; - queue->vkQueueSubmit(queue, 1, &submit_info, - static_cast(VK_NULL_HANDLE)); - queue->vkQueueWaitIdle(queue); - - // Invalidate the memory range of the second half of dst buffer. - const VkDeviceSize map_offset = kDstBufferOffset; - const VkDeviceSize invalidate_offset = - kDstBufferOffset + kNonCoherentAtomSize; - const VkDeviceSize map_size = kBufferSize; - const VkDeviceSize invalidate_size = kNonCoherentAtomSize; - char* buf_data; - device->vkMapMemory(device, // device - device_memory, // memory - map_offset, // offset - map_size, // size - 0, // flags - reinterpret_cast(&buf_data) // ppData - ); - VkMappedMemoryRange invalidate_range{ - VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, // sType - nullptr, // pNext - device_memory, // memory - invalidate_offset, // offset - invalidate_size, // size - }; - device->vkInvalidateMappedMemoryRanges(device, 1, &invalidate_range); - for (size_t i = kNonCoherentAtomSize; i < map_size; i++) { - LOG_ASSERT(==, data->logger(), ((512 - i) & 0xFF), - (unsigned char)buf_data[i]); - } - device->vkUnmapMemory(device, device_memory); - } - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/ImageMemory_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/ImageMemory_test/CMakeLists.txt deleted file mode 100644 index 9776bce6..00000000 --- a/gapid_tests/resource_creation_tests/ImageMemory_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(ImageMemory_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/ImageMemory_test/ImageMemory_test.py b/gapid_tests/resource_creation_tests/ImageMemory_test/ImageMemory_test.py deleted file mode 100644 index 19522319..00000000 --- a/gapid_tests/resource_creation_tests/ImageMemory_test/ImageMemory_test.py +++ /dev/null @@ -1,90 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_write_offset_function -from gapit_test_framework import get_read_offset_function -from vulkan_constants import * -from struct_offsets import VulkanStruct, UINT32_T, POINTER, DEVICE_SIZE - -MEMORY_REQUIREMENTS = [ - ("size", DEVICE_SIZE), ("alignment", DEVICE_SIZE), - ("memoryTypeBits", UINT32_T) -] - -MEMORY_ALLOCATE_INFO = [ - ("sType", UINT32_T), ("pNext", POINTER), ("allocationSize", DEVICE_SIZE), - ("memoryTypeIndex", UINT32_T) -] - - -@gapit_test("ImageMemory_test") -class GetImageMemoryRequirements(GapitTest): - - def expect(self): - architecture = self.architecture - get_image_memory_requirements = require( - self.next_call_of("vkGetImageMemoryRequirements")) - require_not_equal(0, get_image_memory_requirements.int_device) - require_not_equal(0, get_image_memory_requirements.int_image) - require_not_equal(0, - get_image_memory_requirements.hex_pMemoryRequirements) - - memory_requirements = VulkanStruct( - architecture, MEMORY_REQUIREMENTS, get_write_offset_function( - get_image_memory_requirements, - get_image_memory_requirements.hex_pMemoryRequirements)) - - require_equal(True, memory_requirements.size >= 1) - require_not_equal(0, memory_requirements.alignment) - require_not_equal(0, memory_requirements.memoryTypeBits) - - -@gapit_test("ImageMemory_test") -class AllocateBindFreeMemory(GapitTest): - - def expect(self): - architecture = self.architecture - device_properties = require( - self.next_call_of("vkGetPhysicalDeviceProperties")) - - get_image_memory_requirements = require( - self.next_call_of("vkGetImageMemoryRequirements")) - memory_requirements = VulkanStruct( - architecture, MEMORY_REQUIREMENTS, get_write_offset_function( - get_image_memory_requirements, - get_image_memory_requirements.hex_pMemoryRequirements)) - - allocate_memory = require(self.next_call_of("vkAllocateMemory")) - require_not_equal(0, allocate_memory.int_device) - require_not_equal(0, allocate_memory.hex_pAllocateInfo) - require_equal(0, allocate_memory.hex_pAllocator) - require_not_equal(0, allocate_memory.hex_pMemory) - - allocate_memory_info = VulkanStruct( - architecture, MEMORY_ALLOCATE_INFO, - get_read_offset_function(allocate_memory, - allocate_memory.hex_pAllocateInfo)) - - require_equal(VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, - allocate_memory_info.sType) - require_equal(0, allocate_memory_info.pNext) - require_equal(memory_requirements.size, - allocate_memory_info.allocationSize) - - free_memory = require(self.next_call_of("vkFreeMemory")) - require_not_equal(0, free_memory.int_device) - require_not_equal(0, free_memory.int_memory) - require_equal(0, free_memory.hex_pAllocator) diff --git a/gapid_tests/resource_creation_tests/ImageMemory_test/README.md b/gapid_tests/resource_creation_tests/ImageMemory_test/README.md deleted file mode 100644 index 295afc66..00000000 --- a/gapid_tests/resource_creation_tests/ImageMemory_test/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# vkGetImageMemoryRequirements vkAllocateMemory vkFreeMemory - -## Signatures -```c++ -void vkGetImageMemoryRequirements( - VkDevice device, - VkImage image, - VkMemoryRequirements* pMemoryRequirements); -VkResult vkAllocateMemory( - VkDevice device, - const VkMemoryAllocateInfo* pAllocateInfo, - const VkAllocationCallbacks* pAllocator, - VkDeviceMemory* pMemory); -void vkFreeMemory( - VkDevice device, - VkDeviceMemory memory, - const VkAllocationCallbacks* pAllocator); -VkResult vkBindImageMemory( - VkDevice device, - VkImage image, - VkDeviceMemory memory, - VkDeviceSize memoryOffset); -``` - -# VkMemoryRequirements -```c++ -typedef struct VkMemoryRequirements { - VkDeviceSize size; - VkDeviceSize alignment; - uint32_t memoryTypeBits; -} VkMemoryRequirements; -typedef struct VkMemoryAllocateInfo { - VkStructureType sType; - const void* pNext; - VkDeviceSize allocationSize; - uint32_t memoryTypeIndex; -} VkMemoryAllocateInfo; -``` - -According to the Vulkan spec: -- `device` **must** be a valid device -- `image` **must** have come from device -- `VkMemoryRequirements` **must** be a pointer to a VkMemoryRequirements -structure -- `allocationSize` must be > 0 -- `memoryOffset` must be a multiple of `alignment` - - -These tests should test the following cases: -- [x] Valid usage -- [x] Valid memory allocation -- [x] `memoryOffset` of 0 -- [ ] `memoryOffset` > 0 diff --git a/gapid_tests/resource_creation_tests/ImageMemory_test/main.cpp b/gapid_tests/resource_creation_tests/ImageMemory_test/main.cpp deleted file mode 100644 index 8361439b..00000000 --- a/gapid_tests/resource_creation_tests/ImageMemory_test/main.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - auto allocator = data->allocator(); - vulkan::LibraryWrapper wrapper(allocator, data->logger()); - vulkan::VkInstance instance( - vulkan::CreateEmptyInstance(data->allocator(), &wrapper)); - vulkan::VkDevice device(vulkan::CreateDefaultDevice(allocator, instance)); - { - VkImageCreateInfo image_create_info{ - VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_IMAGE_TYPE_2D, // imageType - VK_FORMAT_R8G8B8A8_UNORM, // format - { - 32, // extent.width - 32, // extent.height - 1, // depth - }, - 1, // mipLevels - 1, // arrayLayers - VK_SAMPLE_COUNT_1_BIT, // samples - VK_IMAGE_TILING_OPTIMAL, // tiling - VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, // usage - VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0, // queueFamilyIndexCount - nullptr, // pQueueFamilyIndices - VK_IMAGE_LAYOUT_UNDEFINED, // initialLayout - }; - ::VkImage raw_image; - device->vkCreateImage(device, &image_create_info, nullptr, &raw_image); - vulkan::VkImage image(raw_image, nullptr, &device); - - VkMemoryRequirements image_memory_requirements = {}; - device->vkGetImageMemoryRequirements(device, image, - &image_memory_requirements); - data->logger()->LogInfo("Memory Requirements: "); - data->logger()->LogInfo(" size : ", image_memory_requirements.size); - data->logger()->LogInfo(" alignment : ", image_memory_requirements.alignment); - data->logger()->LogInfo(" memoryTypeBits : ", - image_memory_requirements.memoryTypeBits); - - uint32_t memory_index = vulkan::GetMemoryIndex( - &device, data->logger(), image_memory_requirements.memoryTypeBits, - VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); - - data->logger()->LogInfo("Using memory index: ", memory_index); - - VkMemoryAllocateInfo allocate_info{ - VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, // sType - nullptr, // pNext - image_memory_requirements.size, // allocationSize - memory_index}; - - VkDeviceMemory device_memory; - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkAllocateMemory(device, &allocate_info, nullptr, - &device_memory)); - - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkBindImageMemory(device, image, device_memory, 0)); - - device->vkFreeMemory(device, device_memory, nullptr); - - } - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/PipelineCache_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/PipelineCache_test/CMakeLists.txt deleted file mode 100644 index 45df7b9a..00000000 --- a/gapid_tests/resource_creation_tests/PipelineCache_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(PipelineCache_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/PipelineCache_test/PipelineCache_test.py b/gapid_tests/resource_creation_tests/PipelineCache_test/PipelineCache_test.py deleted file mode 100644 index ef6f8c2c..00000000 --- a/gapid_tests/resource_creation_tests/PipelineCache_test/PipelineCache_test.py +++ /dev/null @@ -1,104 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY -from vulkan_constants import * - -PIPELINE_CACHE_CREATE_INFO = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("initialDataSize", SIZE_T), - ("pInitialData", POINTER), -] - - -@gapit_test("PipelineCache_test") -class EmptyPipelineCache(GapitTest): - - def expect(self): - architecture = self.architecture - device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - - create_pipeline_cache = require(self.nth_call_of( - "vkCreatePipelineCache", 1)) - destroy_pipeline_cache = require(self.next_call_of( - "vkDestroyPipelineCache")) - - require_equal(VK_SUCCESS, int(create_pipeline_cache.return_val)) - require_not_equal(0, create_pipeline_cache.int_device) - require_not_equal(0, create_pipeline_cache.hex_pCreateInfo) - require_not_equal(0, create_pipeline_cache.hex_pPipelineCache) - cache = little_endian_bytes_to_int(require( - create_pipeline_cache.get_write_data( - create_pipeline_cache.hex_pPipelineCache, - NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(0, cache) - - pipeline_cache_create_info = VulkanStruct( - architecture, PIPELINE_CACHE_CREATE_INFO, get_read_offset_function( - create_pipeline_cache, create_pipeline_cache.hex_pCreateInfo)) - - require_equal(VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO, - pipeline_cache_create_info.sType) - require_equal(0, pipeline_cache_create_info.pNext) - require_equal(0, pipeline_cache_create_info.flags) - require_equal(0, pipeline_cache_create_info.initialDataSize) - require_equal(0, pipeline_cache_create_info.pInitialData) - - require_not_equal(0, destroy_pipeline_cache.int_device) - require_not_equal(0, destroy_pipeline_cache.int_pipelineCache) - - -@gapit_test("PipelineCache_test") -class MergePipelineCaches(GapitTest): - - def expect(self): - first_create_cache = require(self.nth_call_of("vkCreatePipelineCache", - 2)) - second_create_cache = require(self.next_call_of( - "vkCreatePipelineCache",)) - third_create_cache = require(self.next_call_of( - "vkCreatePipelineCache",)) - - first_cache = little_endian_bytes_to_int(require( - first_create_cache.get_write_data( - first_create_cache.hex_pPipelineCache, - NON_DISPATCHABLE_HANDLE_SIZE))) - second_cache = little_endian_bytes_to_int(require( - second_create_cache.get_write_data( - second_create_cache.hex_pPipelineCache, - NON_DISPATCHABLE_HANDLE_SIZE))) - third_cache = little_endian_bytes_to_int(require( - third_create_cache.get_write_data( - third_create_cache.hex_pPipelineCache, - NON_DISPATCHABLE_HANDLE_SIZE))) - - require_not_equal(0, first_cache) - require_not_equal(0, second_cache) - require_not_equal(0, third_cache) - - merge = require(self.next_call_of("vkMergePipelineCaches")) - require_equal(VK_SUCCESS, int(merge.return_val)) - require_equal(first_cache, merge.int_dstCache) - require_equal(2, merge.int_srcCacheCount) - first_src = little_endian_bytes_to_int(require(merge.get_read_data( - merge.hex_pSrcCaches, NON_DISPATCHABLE_HANDLE_SIZE))) - second_src = little_endian_bytes_to_int(require(merge.get_read_data( - merge.hex_pSrcCaches + NON_DISPATCHABLE_HANDLE_SIZE, - NON_DISPATCHABLE_HANDLE_SIZE))) - require_equal(second_cache, first_src) - require_equal(third_cache, second_src) diff --git a/gapid_tests/resource_creation_tests/PipelineCache_test/README.md b/gapid_tests/resource_creation_tests/PipelineCache_test/README.md deleted file mode 100644 index 8d7a533b..00000000 --- a/gapid_tests/resource_creation_tests/PipelineCache_test/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# vkCreatePipelineCache / vkDestroyPipelineCache / vkMergePipelineCaches - -## Signatures -```c++ -VkResult vkCreatePipelineCache( - VkDevice device, - const VkPipelineCacheCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkPipelineCache* pPipelineCache); -void vkDestroyPipelineCache( - VkDevice device, - VkPipelineCache pipelineCache, - const VkAllocationCallbacks* pAllocator); -VkResult vkMergePipelineCaches( - VkDevice device, - VkPipelineCache dstCache, - uint32_t srcCacheCount, - const VkPipelineCache* pSrcCaches); -``` - -## VkPipelineCacheCreateInfo -```c++ -typedef struct VkPipelineCacheCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineCacheCreateFlags flags; - size_t initialDataSize; - const void* pInitialData; -} VkPipelineCacheCreateInfo; -``` -According to the Vulkan spec: -- `device` **must** be a valid VkDevice -- `pCreateInfo` **must** point to a vliad VkPipelineCacheCreateInfo -- `sType` **must** be `VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO` -- `pNext` **must** be nullptr -- `flags` **must** be 0 -- `initialDataSize` **may** be 0 or >0 -- `pInitialData` is a pointer to `initialDataSize` bytes. -- `dstCache` **must** NOT appear in the list of source caches (`pSrcCaches`) -- `srcCacheCount` **must** be greater than `0` -- `dstCache` and each element of `pSrcCaches` **must** have been created, - allocated, or retrieved from `device` - - -These tests should test the following cases: -- [x] `initialDataSize` == 0 -- [ ] `initialDataSize` > 0 -- [x] `dstCache` of valid value -- [x] `srcCacheCount` > 0 -- [x] `pSrcCaches` of valid value diff --git a/gapid_tests/resource_creation_tests/PipelineCache_test/main.cpp b/gapid_tests/resource_creation_tests/PipelineCache_test/main.cpp deleted file mode 100644 index a91bec28..00000000 --- a/gapid_tests/resource_creation_tests/PipelineCache_test/main.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateDefaultInstance(data->allocator(), &wrapper)); - vulkan::VkDevice device( - vulkan::CreateDefaultDevice(data->allocator(), instance, false)); - - { // Empty cache - VkPipelineCacheCreateInfo create_info{ - VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 0, // initialDataSize - nullptr // pInitialData - }; - - VkPipelineCache cache; - LOG_ASSERT( - ==, data->logger(), - device->vkCreatePipelineCache(device, &create_info, nullptr, &cache), - VK_SUCCESS); - device->vkDestroyPipelineCache(device, cache, nullptr); - } - - { // Merge pipeline caches - VkPipelineCacheCreateInfo create_info{ - VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 0, // initialDataSize - nullptr // pInitialData - }; - VkPipelineCache caches[3]; - LOG_ASSERT( - ==, data->logger(), - device->vkCreatePipelineCache(device, &create_info, nullptr, &caches[0]), - VK_SUCCESS); - LOG_ASSERT( - ==, data->logger(), - device->vkCreatePipelineCache(device, &create_info, nullptr, &caches[1]), - VK_SUCCESS); - LOG_ASSERT( - ==, data->logger(), - device->vkCreatePipelineCache(device, &create_info, nullptr, &caches[2]), - VK_SUCCESS); - LOG_ASSERT( - ==, data->logger(), - device->vkMergePipelineCaches(device, caches[0], 2, &caches[1]), - VK_SUCCESS); - device->vkDestroyPipelineCache(device, caches[0], nullptr); - device->vkDestroyPipelineCache(device, caches[1], nullptr); - device->vkDestroyPipelineCache(device, caches[2], nullptr); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/README.md b/gapid_tests/resource_creation_tests/README.md deleted file mode 100644 index 9e460f74..00000000 --- a/gapid_tests/resource_creation_tests/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# Resource Creation Tests - -These tests are specifically for testing functionality revolving around -the creation and destruction of vulkan resources. - -# Tests -- [AllocateResetFreeCommandBuffer](AllocateResetFreeCommandBuffer/README.md) -- [AllocateFreeDescriptorSets](AllocateFreeDescriptorSets_test/README.md) -- [BindMapUnmapBuffer_test](BindMapUnmapBuffer_test/README.md) -- [BufferCreationMemory_test](BufferCreationMemory_test/README.md) -- [CreateDestroyBufferView_test](CreateDestroyBufferView_test/README.md) -- [CreateDestroyDescriptorSetLayout_test](CreateDestroyDescriptorSetLayout_test/README.md) -- [CreateDestroyImage_test](CreateDestroyImage_test/README.md) -- [CreateDestroyImageView_test](CreateDestroyImageView_test/README.md) -- [CreateDestroyQueryPool_test](CreateDestroyQueryPool_test/README.md) -- [CreateDestroySampler_test](CreateDestroySampler_test/README.md) -- [CreateResetDestroyDescriptorPool_test](CreateResetDestroyDescriptorPool_test/README.md) -- [FlushAndInvalidateMappedMemoryRanges_test](FlushAndInvalidateMappedMemoryRanges_test/README.md) -- [ImageMemory_test](ImageMemory_test/README.md) -- [PipelineCache_test](PipelineCache_test/README.md) -- [SurfaceCreation_test](SurfaceCreation_test/README.md) -- [SynchronizationCreationDestruction_test](SynchronizationCreationDestruction_test/README.md) -- [CreateResetDestroyCommandPool_test](CreateResetDestroyCommandPool_test/README.md) -- [vkCreateComputePipelines_test](vkCreateComputePipelines_test/README.md) -- [vkCreateFramebuffer_test](vkCreateFramebuffer_test/README.md) -- [vkCreateGraphicsPipelines_test](vkCreateGraphicsPipelines_test/README.md) -- [vkCreatePipelineLayout_test](vkCreatePipelineLayout_test/README.md) -- [vkCreateRenderPass_test](vkCreateRenderPass_test/README.md) -- [vkCreateShaderModule_test](vkCreateShaderModule_test/README.md) -- [vkCreateSwapchainKHR_test](vkCreateSwapchainKHR_test/README.md) diff --git a/gapid_tests/resource_creation_tests/SurfaceCreation_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/SurfaceCreation_test/CMakeLists.txt deleted file mode 100644 index 334dfb48..00000000 --- a/gapid_tests/resource_creation_tests/SurfaceCreation_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(SurfaceCreation_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/SurfaceCreation_test/README.md b/gapid_tests/resource_creation_tests/SurfaceCreation_test/README.md deleted file mode 100644 index dac5208e..00000000 --- a/gapid_tests/resource_creation_tests/SurfaceCreation_test/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# vkCreateAndroidSurfaceKHR / vkDestroySurfaceKHR - -## Signatures -```c++ -VkResult vkCreateAndroidSurfaceKHR( - VkInstance instance, - const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkSurfaceKHR* pSurface); - -void vkDestroySurfaceKHR( - VkInstance instance, - VkSurfaceKHR surface, - const VkAllocationCallbacks* pAllocator); -``` - -# VkAndroidSurfaceCreateInfoKHR -```c++ -typedef struct VkAndroidSurfaceCreateInfoKHR { - VkStructureType sType; - const void* pNext; - VkAndroidSurfaceCreateFlagsKHR flags; - ANativeWindow* window; -} VkAndroidSurfaceCreateInfoKHR; -``` - - -According to the Vulkan spec: -- `pCreateInfo` **must** be a pointer to a valid `VkAndroidSurfaceCreateInfoKHR` -structure -- `flags` **must** be 0 -- `pNext` **must** be 0 -- `window` **must** be a pointer to the `ANativeWindow` - - -These tests should test the following cases: -- [x] Valid `vkCreateAndroidSurfaceKHR` -- [x] `vkDestroySurfaceKHR` with `VK_NULL_HANDLE` \ No newline at end of file diff --git a/gapid_tests/resource_creation_tests/SurfaceCreation_test/main.cpp b/gapid_tests/resource_creation_tests/SurfaceCreation_test/main.cpp deleted file mode 100644 index b20cb070..00000000 --- a/gapid_tests/resource_creation_tests/SurfaceCreation_test/main.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - auto allocator = data->allocator(); - vulkan::LibraryWrapper wrapper(allocator, data->logger()); - vulkan::VkInstance instance( - vulkan::CreateDefaultInstance(allocator, &wrapper)); - VkSurfaceKHR surface; - - data->logger()->LogInfo("Instance: ", (VkInstance)instance); - -#if defined __ANDROID__ - VkAndroidSurfaceCreateInfoKHR create_info{ - VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR, 0, 0, - data->native_window_handle()}; - - instance->vkCreateAndroidSurfaceKHR(instance, &create_info, nullptr, - &surface); -#elif defined __ggp__ // Keep this line before __linux__ - VkStreamDescriptorSurfaceCreateInfoGGP create_info{ - VK_STRUCTURE_TYPE_STREAM_DESCRIPTOR_SURFACE_CREATE_INFO_GGP, nullptr, 1}; - - instance->vkCreateStreamDescriptorSurfaceGGP(instance, &create_info, nullptr, - &surface); -#elif defined __linux__ - VkXcbSurfaceCreateInfoKHR create_info{ - VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR, 0, 0, - data->native_connection(), data->native_window_handle()}; - - instance->vkCreateXcbSurfaceKHR(instance, &create_info, nullptr, &surface); -#elif defined _WIN32 - VkWin32SurfaceCreateInfoKHR create_info{ - VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR, 0, 0, - data->native_hinstance(), data->native_window_handle()}; - - instance->vkCreateWin32SurfaceKHR(instance, &create_info, nullptr, &surface); -#endif - - // TODO(awoloszyn): Other platforms - - instance->vkDestroySurfaceKHR(instance, surface, nullptr); - - instance->vkDestroySurfaceKHR( - instance, static_cast(VK_NULL_HANDLE), nullptr); - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/SurfaceCreation_test/vkCreateSurface_test.py b/gapid_tests/resource_creation_tests/SurfaceCreation_test/vkCreateSurface_test.py deleted file mode 100644 index 1194c3e2..00000000 --- a/gapid_tests/resource_creation_tests/SurfaceCreation_test/vkCreateSurface_test.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, ANDROID -from vulkan_constants import * - - -@gapit_test("SurfaceCreation_test") -class SurfaceCreateTest(GapitTest): - - def expect(self): - """Expect that the applicationInfoPointer is null for the first - vkCreateInstance""" - - if self.device.Configuration.OS.Kind != ANDROID: - return - - architecture = self.architecture - create_surface = require( - self.next_call_of("vkCreateAndroidSurfaceKHR")) - - # Make sure the parameters are valid - require_not_equal(create_surface.int_instance, 0) - require_not_equal(create_surface.hex_pCreateInfo, 0) - require_equal(create_surface.hex_pAllocator, 0) - require_not_equal(create_surface.hex_pSurface, 0) - - create_surface_structure_type_memory = require( - create_surface.get_read_data(create_surface.hex_pCreateInfo, - architecture.int_integerSize)) - create_surface_pNext_memory = require( - create_surface.get_read_data(create_surface.hex_pCreateInfo + - architecture.int_pointerSize, - architecture.int_pointerSize)) - create_surface_flags_memory = require( - create_surface.get_read_data(create_surface.hex_pCreateInfo + 2 * - architecture.int_pointerSize, - architecture.int_integerSize)) - create_surface_native_window_memory = require( - create_surface.get_read_data(create_surface.hex_pCreateInfo + 3 * - architecture.int_pointerSize, - architecture.int_pointerSize)) - - # The struct should look like - # {VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR, 0, 0, window} - require_equal( - little_endian_bytes_to_int(create_surface_structure_type_memory), - VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR) - require_equal( - little_endian_bytes_to_int(create_surface_pNext_memory), 0) - require_equal( - little_endian_bytes_to_int(create_surface_flags_memory), 0) - require_not_equal( - little_endian_bytes_to_int(create_surface_native_window_memory), 0) - - # pSemaphore is filled in by the call, should be a write observation - surface = require( - create_surface.get_write_data(create_surface.hex_pSurface, - NON_DISPATCHABLE_HANDLE_SIZE)) - - # We should have called destroy_semaphore with the same one - destroy_surface = require(self.next_call_of("vkDestroySurfaceKHR")) - require_equal( - little_endian_bytes_to_int(surface), destroy_surface.int_surface) - - destroy_surface_2 = require(self.next_call_of("vkDestroySurfaceKHR")) - require_equal(0, destroy_surface_2.int_surface) diff --git a/gapid_tests/resource_creation_tests/SyncCreationDestruction_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/SyncCreationDestruction_test/CMakeLists.txt deleted file mode 100644 index 4722aee2..00000000 --- a/gapid_tests/resource_creation_tests/SyncCreationDestruction_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(SyncCreationDestruction_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/SyncCreationDestruction_test/README.md b/gapid_tests/resource_creation_tests/SyncCreationDestruction_test/README.md deleted file mode 100644 index 2b995162..00000000 --- a/gapid_tests/resource_creation_tests/SyncCreationDestruction_test/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# vkCreateSemaphore / vkDestroySemaphore - -## Signatures -```c++ -VkResult vkCreateSemaphore( - VkDevice device, - const VkSemaphoreCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkSemaphore* pSemaphore); - -void vkDestroySemaphore( - VkDevice device, - VkSemaphore semaphore, - const VkAllocationCallbacks* pAllocator); -``` - -# VkSemaphoreCreateInfo -```c++ -typedef struct VkSemaphoreCreateInfo { - VkStructureType sType; - const void* pNext; - VkSemaphoreCreateFlags flags; -} VkSemaphoreCreateInfo; -``` - - -According to the Vulkan spec: -- `pCreateInfo` **must** be a pointer to a valid `VkSemaphoreCreateInfo` structure -- `flags` **must** be 0 -- `pNext` **must** be 0 - - -These tests should test the following cases: -- [x] Valid vkCreateSemaphore -- [x] vkDestroySemaphore is `VK_NULL_HANDLE` diff --git a/gapid_tests/resource_creation_tests/SyncCreationDestruction_test/main.cpp b/gapid_tests/resource_creation_tests/SyncCreationDestruction_test/main.cpp deleted file mode 100644 index 0d6e1693..00000000 --- a/gapid_tests/resource_creation_tests/SyncCreationDestruction_test/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - auto allocator = data->allocator(); - vulkan::LibraryWrapper wrapper(allocator, data->logger()); - vulkan::VkInstance instance(vulkan::CreateEmptyInstance(allocator, &wrapper)); - vulkan::VkDevice device(vulkan::CreateDefaultDevice(allocator, instance)); - - VkSemaphoreCreateInfo info{VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, 0, 0}; - VkSemaphore semaphore; - device->vkCreateSemaphore(device, &info, nullptr, &semaphore); - - device->vkDestroySemaphore(device, semaphore, nullptr); - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/SyncCreationDestruction_test/vkCreateSemaphore_test.py b/gapid_tests/resource_creation_tests/SyncCreationDestruction_test/vkCreateSemaphore_test.py deleted file mode 100644 index 2224b422..00000000 --- a/gapid_tests/resource_creation_tests/SyncCreationDestruction_test/vkCreateSemaphore_test.py +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest -from vulkan_constants import * - - -@gapit_test("SyncCreationDestruction_test") -class SemaphoreCreateDestroyTest(GapitTest): - - def expect(self): - architecture = self.architecture - device_properties = require( - self.next_call_of("vkGetPhysicalDeviceProperties")) - - create_semaphore = require(self.next_call_of("vkCreateSemaphore")) - - # Make sure the parameters are valid - require_not_equal(create_semaphore.hex_pCreateInfo, 0) - require_not_equal(create_semaphore.int_device, 0) - require_not_equal(create_semaphore.hex_pSemaphore, 0) - require_equal(create_semaphore.hex_pAllocator, 0) - - create_info_structure_type_memory = require( - create_semaphore.get_read_data(create_semaphore.hex_pCreateInfo, - architecture.int_integerSize)) - create_info_pNext_memory = require( - create_semaphore.get_read_data(create_semaphore.hex_pCreateInfo + - architecture.int_pointerSize, - architecture.int_pointerSize)) - create_info_flags_memory = require( - create_semaphore.get_read_data(create_semaphore.hex_pCreateInfo + 2 - * architecture.int_pointerSize, - architecture.int_integerSize)) - - # The struct should look like - # {VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, 0, 0} - require_equal( - little_endian_bytes_to_int(create_info_structure_type_memory), - VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO) - require_equal(little_endian_bytes_to_int(create_info_pNext_memory), 0) - require_equal(little_endian_bytes_to_int(create_info_flags_memory), 0) - - # pSemaphore is filled in by the call, should be a write observation - returned_semaphore = require( - create_semaphore.get_write_data(create_semaphore.hex_pSemaphore, 8)) - - # We should have called destroy_semaphore with the same one - destroy_semaphore = require(self.next_call_of("vkDestroySemaphore")) - require_equal( - little_endian_bytes_to_int(returned_semaphore), - destroy_semaphore.int_semaphore) diff --git a/gapid_tests/resource_creation_tests/vkCreateComputePipelines_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/vkCreateComputePipelines_test/CMakeLists.txt deleted file mode 100644 index 95eb4cb4..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateComputePipelines_test/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCreateComputePipelines_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) diff --git a/gapid_tests/resource_creation_tests/vkCreateComputePipelines_test/README.md b/gapid_tests/resource_creation_tests/vkCreateComputePipelines_test/README.md deleted file mode 100644 index 15b04bf4..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateComputePipelines_test/README.md +++ /dev/null @@ -1,73 +0,0 @@ -# vkCreateComputePipelines - -## Signature - -```c++ -VkResult vkCreateComputePipelines( - VkDevice device, - VkPipelineCache pipelineCache, - uint32_t createInfoCount, - const VkComputePipelineCreateInfo* pCreateInfos, - const VkAllocationCallbacks* pAllocator, - VkPipeline* pPipelines); -``` - -## VkComputePipelineCreateInfo - -```c++ -typedef struct VkComputePipelineCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineCreateFlags flags; - VkPipelineShaderStageCreateInfo stage; - VkPipelineLayout layout; - VkPipeline basePipelineHandle; - int32_t basePipelineIndex; -} VkComputePipelineCreateInfo; -``` - -## VkPipelineShaderStageCreateInfo - -```c++ -typedef struct VkPipelineShaderStageCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineShaderStageCreateFlags flags; - VkShaderStageFlagBits stage; - VkShaderModule module; - const char* pName; - const VkSpecializationInfo* pSpecializationInfo; -} VkPipelineShaderStageCreateInfo; -``` - -According to the Vulkan spec: -- If `flags` contains the `VK_PIPELINE_CREATE_DERIVATIVE_BIT` flag, - and `basePipelineIndex` is not -1, `basePipelineHandle` **must** be - `VK_NULL_HANDLE` -- If `flags` contains the `VK_PIPELINE_CREATE_DERIVATIVE_BIT` flag, - and `basePipelineIndex` is not -1, it **must** be a valid index into the - calling command’s `pCreateInfos` parameter -- If `flags` contains the `VK_PIPELINE_CREATE_DERIVATIVE_BIT` flag, - and `basePipelineHandle` is not `VK_NULL_HANDLE`, `basePipelineIndex` - **must** be -1 -- If `flags` contains the `VK_PIPELINE_CREATE_DERIVATIVE_BIT` flag, - and `basePipelineHandle` is not `VK_NULL_HANDLE`, `basePipelineHandle` - **must** be a valid `VkPipeline` handle -- If `flags` contains the `VK_PIPELINE_CREATE_DERIVATIVE_BIT` flag, - and `basePipelineHandle` is not `VK_NULL_HANDLE`, it **must** be a valid - handle to a compute `VkPipeline` -- The `stage` member of `stage` **must** be `VK_SHADER_STAGE_COMPUTE_BIT` - -## Tests - -These tests should test the following cases: -- [x] `createInfoCount` == 1 -- [ ] `createInfoCount` > 1 -- [x] `flags` == 0 -- [ ] `flags` == `VK_PIPELINE_CREATE_DERIVATIVE_BIT` -- [x] `basePipelineHandle` == `VK_NULL_HANDLE` -- [ ] `basePipelineHandle` != `VK_NULL_HANDLE` -- [x] `basePipelineIndex` == 0 -- [ ] `basePipelineIndex` != 0 -- [x] `pSpecializationInfo` == `nullptr` -- [ ] `pSpecializationInfo` != `nullptr` diff --git a/gapid_tests/resource_creation_tests/vkCreateComputePipelines_test/main.cpp b/gapid_tests/resource_creation_tests/vkCreateComputePipelines_test/main.cpp deleted file mode 100644 index 5c6fc165..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateComputePipelines_test/main.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -const uint32_t kComputeShader[] = -#include "double_numbers.comp.spv" - ; - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - auto alloc = data->allocator(); - - vulkan::LibraryWrapper wrapper(alloc, data->logger()); - vulkan::VkInstance instance(vulkan::CreateDefaultInstance(alloc, &wrapper)); - vulkan::VkDevice device(vulkan::CreateDefaultDevice(alloc, instance, true)); - const ::VkPhysicalDevice pdev = device.physical_device(); - const uint32_t queue_index = - GetGraphicsAndComputeQueueFamily(alloc, instance, pdev, false); - vulkan::VkQueue queue(GetQueue(&device, queue_index)); - - // Query memory properties and allocate memory. - - const uint32_t kNumElements = 512; - const uint32_t buffer_size = kNumElements * sizeof(uint32_t); - const ::VkDeviceSize memory_size = buffer_size * 2; - - ::VkPhysicalDeviceMemoryProperties properties; - instance->vkGetPhysicalDeviceMemoryProperties(pdev, &properties); - - uint32_t memory_type_index = VK_MAX_MEMORY_TYPES; - for (uint32_t i = 0; i < properties.memoryTypeCount; ++i) { - const auto& current_type = properties.memoryTypes[i]; - if ((VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT & current_type.propertyFlags) && - (memory_size < properties.memoryHeaps[current_type.heapIndex].size)) { - memory_type_index = i; - break; - } - } - LOG_ASSERT(!=, data->logger(), VK_MAX_MEMORY_TYPES, memory_type_index); - - vulkan::VkDeviceMemory memory( - AllocateDeviceMemory(&device, memory_type_index, memory_size)); - - // Populate the memory with data. - - void* payload = nullptr; - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkMapMemory(device, memory, 0, memory_size, 0, &payload)); - for (uint32_t i = 0; i < kNumElements; ++i) { - // Only fill the first half. Zero out the second half. The second half will - // be used to store the result from the compute shader. - static_cast(payload)[i] = 42; - static_cast(payload)[i + kNumElements] = 0; - } - device->vkUnmapMemory(device, memory); - - // Create two consecutive buffers from the memory. - - const ::VkBufferCreateInfo buf_create_info = { - /* sType = */ VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* size = */ buffer_size, - /* usage = */ VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, - /* sharingMode = */ VK_SHARING_MODE_EXCLUSIVE, - /* queueFamilyIndexCount = */ 1, - /* pQueueFamilyIndices = */ &queue_index, - }; - ::VkBuffer raw_in_buffer; - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkCreateBuffer(device, &buf_create_info, nullptr, - &raw_in_buffer)); - vulkan::VkBuffer in_buffer(raw_in_buffer, nullptr, &device); - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkBindBufferMemory(device, raw_in_buffer, memory, 0)); - ::VkBuffer raw_out_buffer; - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkCreateBuffer(device, &buf_create_info, nullptr, - &raw_out_buffer)); - vulkan::VkBuffer out_buffer(raw_out_buffer, nullptr, &device); - LOG_ASSERT( - ==, data->logger(), VK_SUCCESS, - device->vkBindBufferMemory(device, raw_out_buffer, memory, buffer_size)); - - // Create descriptor set and pipeline layout. - - vulkan::VkDescriptorSetLayout dset_layout(CreateDescriptorSetLayout( - alloc, &device, { - {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, - VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - {1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, - VK_SHADER_STAGE_COMPUTE_BIT, nullptr}, - })); - ::VkDescriptorSetLayout raw_dset_layout = dset_layout.get_raw_object(); - - const ::VkPipelineLayoutCreateInfo pipeline_layout_create_info = { - /* sType = */ VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* setLayoutCount = */ 1, - /* pSetLayouts */ &raw_dset_layout, - /* pushConstantRangeCount = */ 0, - /* pPushConstantRanges = */ nullptr, - }; - ::VkPipelineLayout raw_pipeline_layout; - LOG_ASSERT( - ==, data->logger(), VK_SUCCESS, - device->vkCreatePipelineLayout(device, &pipeline_layout_create_info, - nullptr, &raw_pipeline_layout)); - vulkan::VkPipelineLayout pipeline_layout(raw_pipeline_layout, nullptr, - &device); - - // Create shader module and compute pipeline. - - vulkan::VkShaderModule shader_module( - CreateShaderModule(&device, kComputeShader)); - - const ::VkComputePipelineCreateInfo compute_pipeline_create_info = { - /* sType = */ VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* stage = */ { - /* sType = */ VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* stage = */ VK_SHADER_STAGE_COMPUTE_BIT, - /* module = */ shader_module.get_raw_object(), - /* pName = */ "main", - /* pSpecializationInfo = */ nullptr, - }, - /* layout = */ raw_pipeline_layout, - /* basePipelineHandle = */ VK_NULL_HANDLE, - /* basePipelineIndex = */ 0, - }; - ::VkPipeline raw_pipeline; - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkCreateComputePipelines( - device, static_cast<::VkPipelineCache>(VK_NULL_HANDLE), 1, - &compute_pipeline_create_info, nullptr, &raw_pipeline)); - vulkan::VkPipeline pipeline(raw_pipeline, nullptr, &device); - - // Create descriptor pool and allocate and update descriptor set. - - const ::VkDescriptorPoolSize descriptor_pool_size = { - /* type = */ VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, - /* descriptorCount = */ 2, - }; - vulkan::VkDescriptorPool descriptor_pool( - CreateDescriptorPool(&device, 1, &descriptor_pool_size, 1)); - vulkan::VkDescriptorSet dset( - AllocateDescriptorSet(&device, descriptor_pool, dset_layout)); - ::VkDescriptorSet raw_dset = dset.get_raw_object(); - - const ::VkDescriptorBufferInfo in_buffer_info = { - /* buffer = */ raw_in_buffer, - /* offset = */ 0, - /* range = */ VK_WHOLE_SIZE, - }; - const ::VkDescriptorBufferInfo out_buffer_info = { - /* buffer = */ raw_out_buffer, - /* offset = */ 0, - /* range = */ VK_WHOLE_SIZE, - }; - const ::VkWriteDescriptorSet write_descriptor_set[2] = { - { - /* sType = */ VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, - /* pNext = */ nullptr, - /* dstSet = */ raw_dset, - /* dstBinding = */ 0, - /* dstArrayElement = */ 0, - /* descriptorCount = */ 1, - /* descriptorType = */ VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, - /* pImageInfo = */ nullptr, - /* pBufferInfo = */ &in_buffer_info, - /* pTexelBufferView = */ nullptr, - }, - { - /* sType = */ VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, - /* pNext = */ nullptr, - /* dstSet = */ raw_dset, - /* dstBinding = */ 1, - /* dstArrayElement = */ 0, - /* descriptorCount = */ 1, - /* descriptorType = */ VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, - /* pImageInfo = */ nullptr, - /* pBufferInfo = */ &out_buffer_info, - /* pTexelBufferView = */ nullptr, - }, - }; - device->vkUpdateDescriptorSets(device, 2, write_descriptor_set, 0, nullptr); - - // Create command pool and allocate command buffer. - - const ::VkCommandPoolCreateInfo command_pool_create_info = { - /* sType = */ VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, - /* pNext = */ nullptr, - /* flags = */ 0, - /* queueFamilyIndex = */ queue_index, - }; - ::VkCommandPool raw_command_pool; - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkCreateCommandPool(device, &command_pool_create_info, - nullptr, &raw_command_pool)); - vulkan::VkCommandPool command_pool(raw_command_pool, nullptr, &device); - - vulkan::VkCommandBuffer command_buffer( - CreateDefaultCommandBuffer(&command_pool, &device)); - ::VkCommandBuffer raw_command_buffer = command_buffer.get_command_buffer(); - - // Record command buffer. - - const ::VkCommandBufferBeginInfo cmdbuf_begin_info = { - /* sType = */ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, - /* pNext = */ nullptr, - /* flags = */ VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, - /* pInheritanceInfo = */ nullptr, - }; - LOG_ASSERT( - ==, data->logger(), VK_SUCCESS, - command_buffer->vkBeginCommandBuffer(command_buffer, &cmdbuf_begin_info)); - command_buffer->vkCmdBindPipeline( - command_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, raw_pipeline); - command_buffer->vkCmdBindDescriptorSets( - command_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, raw_pipeline_layout, 0, 1, - &raw_dset, 0, nullptr); - command_buffer->vkCmdDispatch(command_buffer, kNumElements, 1, 1); - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - command_buffer->vkEndCommandBuffer(command_buffer)); - - // Submit. - - const ::VkSubmitInfo submit_info = { - /* sType = */ VK_STRUCTURE_TYPE_SUBMIT_INFO, - /* pNext = */ nullptr, - /* waitSemaphoreCount = */ 0, - /* pWaitSemaphores = */ nullptr, - /* pWaitDstStageMask = */ nullptr, - /* commandBufferCount = */ 1, - /* pCommandBuffers = */ &raw_command_buffer, - /* signalSemaphoreCount = */ 0, - /* pSignalSemaphores = */ nullptr, - }; - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - queue->vkQueueSubmit(queue, 1, &submit_info, - static_cast<::VkFence>(VK_NULL_HANDLE))); - LOG_ASSERT(==, data->logger(), VK_SUCCESS, queue->vkQueueWaitIdle(queue)); - - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkMapMemory(device, memory, 0, memory_size, 0, &payload)); - for (uint32_t i = 0; i < kNumElements; ++i) { - LOG_EXPECT(==, data->logger(), 84, - static_cast(payload)[i + kNumElements]); - } - device->vkUnmapMemory(device, memory); - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/vkCreateComputePipelines_test/vkCreateComputePipelines_test.py b/gapid_tests/resource_creation_tests/vkCreateComputePipelines_test/vkCreateComputePipelines_test.py deleted file mode 100644 index 921f91e6..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateComputePipelines_test/vkCreateComputePipelines_test.py +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, GapitTest -from gapit_test_framework import require, require_equal, require_not_equal -from gapit_test_framework import get_read_offset_function -from struct_offsets import VulkanStruct, UINT32_T, POINTER, HANDLE -from vulkan_constants import * - -COMPUTE_PIPELINE_CREATE_INFO_32 = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("__pad0__", UINT32_T), - # Start expanding VkPipelineShaderStageCreateInfo - ("stage_sType", UINT32_T), - ("stage_pNext", POINTER), - ("stage_flags", UINT32_T), - ("stage_stage", UINT32_T), - ("stage_module", HANDLE), - ("stage_pName", POINTER), - ("stage_pSpecializationInfo", POINTER), - # End - ("layout", HANDLE), - ("basePipelineHandle", HANDLE), - ("basePipelineIndex", UINT32_T), -] - - -@gapit_test("vkCreateComputePipelines_test") -class DoubleNumbers(GapitTest): - - def expect(self): - arch = self.architecture - - create_compute_pipelines = require( - self.next_call_of("vkCreateComputePipelines")) - require_not_equal(0, create_compute_pipelines.int_device) - require_equal(0, create_compute_pipelines.int_pipelineCache) - require_equal(1, create_compute_pipelines.int_createInfoCount) - require_not_equal(0, create_compute_pipelines.hex_pCreateInfos) - require_equal(0, create_compute_pipelines.hex_pAllocator) - require_not_equal(0, create_compute_pipelines.hex_pPipelines) - - self.check_create_info(arch, create_compute_pipelines, - COMPUTE_PIPELINE_CREATE_INFO_32) - - def check_create_info(self, arch, atom, create_info_scheme): - create_info = VulkanStruct( - arch, create_info_scheme, - get_read_offset_function(atom, atom.hex_pCreateInfos)) - - require_equal(VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - create_info.sType) - require_equal(0, create_info.pNext) - require_equal(0, create_info.flags) - - require_equal(VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - create_info.stage_sType) - require_equal(0, create_info.stage_pNext) - require_equal(0, create_info.stage_flags) - require_equal(VK_SHADER_STAGE_COMPUTE_BIT, create_info.stage_stage) - require_not_equal(0, create_info.stage_module) - require_equal("main", - require(atom.get_read_string(create_info.stage_pName))) - require_equal(0, create_info.stage_pSpecializationInfo) - - require_not_equal(0, create_info.layout) - require_equal(0, create_info.basePipelineHandle) - require_equal(0, create_info.basePipelineIndex) diff --git a/gapid_tests/resource_creation_tests/vkCreateFramebuffer_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/vkCreateFramebuffer_test/CMakeLists.txt deleted file mode 100644 index 58d1285d..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateFramebuffer_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCreateFramebuffer_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/vkCreateFramebuffer_test/README.md b/gapid_tests/resource_creation_tests/vkCreateFramebuffer_test/README.md deleted file mode 100644 index 065940f7..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateFramebuffer_test/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# vkCreateFramebuffer / vkDestroyFramebuffer - -## Signatures -```c++ -VkResult vkCreateFramebuffer( - VkDevice device, - const VkFramebufferCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkFramebuffer* pFramebuffer); -void vkDestroyFramebuffer( - VkDevice device, - VkFramebuffer framebuffer, - const VkAllocationCallbacks* pAllocator); -``` - -## VkFramebufferCreateInfo -```c++ -typedef struct VkFramebufferCreateInfo { - VkStructureType sType; - const void* pNext; - VkFramebufferCreateFlags flags; - VkRenderPass renderPass; - uint32_t attachmentCount; - const VkImageView* pAttachments; - uint32_t width; - uint32_t height; - uint32_t layers; -} VkFramebufferCreateInfo; -``` - -According to the Vulkan spec: -- `device` **must** be vald -- `pCreateInfo` **must** point to a valid `VkFramebufferCreateInfo` structure. -- `sType` **must** be `VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO` -- `pNext` **must** be null -- `flags` **must** be 0 -- `renderPass` is a valid renderPass -- `attachmentCount` can be 0 or > 0 -- `renderPass` and `Attachments` must have come from the same device -- `attachmentCount` must be the same as specified in `renderPass` - - -These tests should test the following cases: -- [ ] `attachmentCount` == 0 -- [x] `attachmentCount` == 1 -- [ ] `attachmentCount` > 1 diff --git a/gapid_tests/resource_creation_tests/vkCreateFramebuffer_test/main.cpp b/gapid_tests/resource_creation_tests/vkCreateFramebuffer_test/main.cpp deleted file mode 100644 index 0f9f46e1..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateFramebuffer_test/main.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateDefaultInstance(data->allocator(), &wrapper)); - vulkan::VkSurfaceKHR surface(vulkan::CreateDefaultSurface(&instance, data)); - - uint32_t queues[2]; - vulkan::VkDevice device(vulkan::CreateDeviceForSwapchain( - data->allocator(), &instance, &surface, &queues[0], &queues[1], false)); - - vulkan::VkSwapchainKHR swapchain(vulkan::CreateDefaultSwapchain( - &instance, &device, &surface, data->allocator(), queues[0], queues[1], - data)); - - containers::vector images(data->allocator()); - vulkan::LoadContainer(data->logger(), device->vkGetSwapchainImagesKHR, - &images, device, swapchain); - - { - VkAttachmentDescription color_attachment{ - 0, // flags - swapchain.format(), // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, // initialLayout - VK_IMAGE_LAYOUT_PRESENT_SRC_KHR // finalLayout - }; - - VkAttachmentReference color_attachment_reference{ - 0, // attachment - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - - VkSubpassDescription subpass{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment_reference, // pColorAttachments - nullptr, // pResolveAttachments - nullptr, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }; - - VkRenderPassCreateInfo render_pass_create_info = { - VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 1, // attachmentCount - &color_attachment, // pAttachments - 1, // subpassCount - &subpass, // pSubpasses - 0, // dependencyCount - nullptr // pDependencies - }; - - VkRenderPass raw_render_pass; - LOG_ASSERT(==, data->logger(), - device->vkCreateRenderPass(device, &render_pass_create_info, - nullptr, &raw_render_pass), - VK_SUCCESS); - vulkan::VkRenderPass render_pass(raw_render_pass, nullptr, &device); - - VkImageViewCreateInfo image_view_create_info{ - VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - images.front(), // image - VK_IMAGE_VIEW_TYPE_2D, // viewType - swapchain.format(), // format - { - VK_COMPONENT_SWIZZLE_IDENTITY, // components.r - VK_COMPONENT_SWIZZLE_IDENTITY, // components.g - VK_COMPONENT_SWIZZLE_IDENTITY, // components.b - VK_COMPONENT_SWIZZLE_IDENTITY, // components.a - }, - { - VK_IMAGE_ASPECT_COLOR_BIT, // subresourceRange.aspectMask - 0, // subresourceRange.baseMipLevel - 1, // subresourceRange.levelCount - 0, // subresourceRange.baseArrayLayer - 1, // subresourceRange.layerCount - }, - }; - - VkImageView raw_image_view; - LOG_EXPECT(==, data->logger(), - device->vkCreateImageView(device, &image_view_create_info, - nullptr, &raw_image_view), - VK_SUCCESS); - vulkan::VkImageView image_view(raw_image_view, nullptr, &device); - - VkImageView image_views[1] = {image_view}; - - VkFramebufferCreateInfo framebuffer_create_info{ - VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - render_pass, // renderPass - 1, // attachmentCount - image_views, // attachments - swapchain.width(), // width - swapchain.height(), // height - 1 // layers - }; - VkFramebuffer framebuffer; - device->vkCreateFramebuffer(device, &framebuffer_create_info, nullptr, - &framebuffer); - device->vkDestroyFramebuffer(device, framebuffer, nullptr); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/vkCreateFramebuffer_test/vkCreateFramebuffer_test.py b/gapid_tests/resource_creation_tests/vkCreateFramebuffer_test/vkCreateFramebuffer_test.py deleted file mode 100644 index f208f86a..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateFramebuffer_test/vkCreateFramebuffer_test.py +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY -from vulkan_constants import * - -FRAMEBUFFER_CREATE_INFO = [ - ("sType", UINT32_T), ("pNext", POINTER), ("flags", UINT32_T), - ("renderPass", HANDLE), ("attachmentCount", UINT32_T), - ("pAttachments", POINTER), ("width", UINT32_T), ("height", UINT32_T), - ("layers", UINT32_T) -] - - -@gapit_test("vkCreateFramebuffer_test") -class SingleAttachment(GapitTest): - - def expect(self): - architecture = self.architecture - device_properties = require( - self.next_call_of("vkGetPhysicalDeviceProperties")) - - create_framebuffer = require(self.next_call_of("vkCreateFramebuffer")) - require_not_equal(0, create_framebuffer.int_device) - require_equal(0, create_framebuffer.hex_pAllocator) - - framebuffer_create_info = VulkanStruct( - architecture, FRAMEBUFFER_CREATE_INFO, - get_read_offset_function(create_framebuffer, - create_framebuffer.hex_pCreateInfo)) - require_equal(VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, - framebuffer_create_info.sType) - require_equal(0, framebuffer_create_info.pNext) - require_equal(0, framebuffer_create_info.flags) - require_not_equal(0, framebuffer_create_info.renderPass) - require_equal(1, framebuffer_create_info.attachmentCount) - require_not_equal(0, framebuffer_create_info.pAttachments) - require_not_equal(0, framebuffer_create_info.width) - require_not_equal(0, framebuffer_create_info.height) - require_equal(1, framebuffer_create_info.layers) - - _ = require( - create_framebuffer.get_read_data( - framebuffer_create_info.pAttachments, - NON_DISPATCHABLE_HANDLE_SIZE)) - _ = require( - create_framebuffer.get_write_data( - create_framebuffer.hex_pFramebuffer, - NON_DISPATCHABLE_HANDLE_SIZE)) - - destroy_framebuffer = require( - self.next_call_of("vkDestroyFramebuffer")) - require_not_equal(0, destroy_framebuffer.int_framebuffer) - require_not_equal(0, destroy_framebuffer.int_device) - require_equal(0, destroy_framebuffer.hex_pAllocator) diff --git a/gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/CMakeLists.txt deleted file mode 100644 index 1ef1bd74..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2017 Google 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. -# - -# Intentionally empty, add all of the test executables here. - -add_gapid_test(vkCreateGraphicsPipelines_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) diff --git a/gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/README.md b/gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/README.md deleted file mode 100644 index e408de0a..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/README.md +++ /dev/null @@ -1,337 +0,0 @@ -# vkCreateGraphicsPipelines / vkDestroyPipeline - -## Signatures -```c++ -VkResult vkCreateGraphicsPipelines( - VkDevice device, - VkPipelineCache pipelineCache, - uint32_t createInfoCount, - const VkGraphicsPipelineCreateInfo* pCreateInfos, - const VkAllocationCallbacks* pAllocator, - VkPipeline* pPipelines); - -void vkDestroyPipeline( - VkDevice device, - VkPipeline pipeline, - const VkAllocationCallbacks* pAllocator); -``` - -## VkGraphicsPipelineCreateInfo -```c++ -typedef struct VkGraphicsPipelineCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineCreateFlags flags; - uint32_t stageCount; - const VkPipelineShaderStageCreateInfo* pStages; - const VkPipelineVertexInputStateCreateInfo* pVertexInputState; - const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState; - const VkPipelineTessellationStateCreateInfo* pTessellationState; - const VkPipelineViewportStateCreateInfo* pViewportState; - const VkPipelineRasterizationStateCreateInfo* pRasterizationState; - const VkPipelineMultisampleStateCreateInfo* pMultisampleState; - const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState; - const VkPipelineColorBlendStateCreateInfo* pColorBlendState; - const VkPipelineDynamicStateCreateInfo* pDynamicState; - VkPipelineLayout layout; - VkRenderPass renderPass; - uint32_t subpass; - VkPipeline basePipelineHandle; - int32_t basePipelineIndex; -} VkGraphicsPipelineCreateInfo; -``` - -## VkPipelineShaderStageCreateInfo -```c++ -typedef struct VkPipelineShaderStageCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineShaderStageCreateFlags flags; - VkShaderStageFlagBits stage; - VkShaderModule module; - const char* pName; - const VkSpecializationInfo* pSpecializationInfo; -} VkPipelineShaderStageCreateInfo; -``` - -## VkSpecializationInfo -```c++ -typedef struct VkSpecializationInfo { - uint32_t mapEntryCount; - const VkSpecializationMapEntry* pMapEntries; - size_t dataSize; - const void* pData; -} VkSpecializationInfo; -``` - -## VkSpecializationMapEntry -```c++ -typedef struct VkSpecializationMapEntry { - uint32_t constantID; - uint32_t offset; - size_t size; -} VkSpecializationMapEntry; -``` - -## VkPipelineVertexInputStateCreateInfo -```c++ -typedef struct VkPipelineVertexInputStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineVertexInputStateCreateFlags flags; - uint32_t vertexBindingDescriptionCount; - const VkVertexInputBindingDescription* pVertexBindingDescriptions; - uint32_t vertexAttributeDescriptionCount; - const VkVertexInputAttributeDescription* pVertexAttributeDescriptions; -} VkPipelineVertexInputStateCreateInfo; -``` - -## VkVertexInputBindingDescription -```c++ -typedef struct VkVertexInputBindingDescription { - uint32_t binding; - uint32_t stride; - VkVertexInputRate inputRate; -} VkVertexInputBindingDescription; -``` - -## VkVertexInputAttributeDescription -```c++ -typedef struct VkVertexInputAttributeDescription { - uint32_t location; - uint32_t binding; - VkFormat format; - uint32_t offset; -} VkVertexInputAttributeDescription; -``` - -## VkPipelineInputAssemblyStateCreateInfo -```c++ -typedef struct VkPipelineInputAssemblyStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineInputAssemblyStateCreateFlags flags; - VkPrimitiveTopology topology; - VkBool32 primitiveRestartEnable; -} VkPipelineInputAssemblyStateCreateInfo; -``` - -## VkPipelineTessellationStateCreateInfo -```c++ -typedef struct VkPipelineTessellationStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineTessellationStateCreateFlags flags; - uint32_t patchControlPoints; -} VkPipelineTessellationStateCreateInfo; -``` - -## VkPipelineViewportStateCreateInfo -```c++ -typedef struct VkPipelineViewportStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineViewportStateCreateFlags flags; - uint32_t viewportCount; - const VkViewport* pViewports; - uint32_t scissorCount; - const VkRect2D* pScissors; -} VkPipelineViewportStateCreateInfo; -``` - -## VkViewport -```c++ -typedef struct VkViewport { - float x; - float y; - float width; - float height; - float minDepth; - float maxDepth; -} VkViewport; -``` - -## VkPipelineRasterizationStateCreateInfo -```c++ -typedef struct VkPipelineRasterizationStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineRasterizationStateCreateFlags flags; - VkBool32 depthClampEnable; - VkBool32 rasterizerDiscardEnable; - VkPolygonMode polygonMode; - VkCullModeFlags cullMode; - VkFrontFace frontFace; - VkBool32 depthBiasEnable; - float depthBiasConstantFactor; - float depthBiasClamp; - float depthBiasSlopeFactor; - float lineWidth; -} VkPipelineRasterizationStateCreateInfo; -``` - -## VkPipelineMultisampleStateCreateInfo -```c++ -typedef struct VkPipelineMultisampleStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineMultisampleStateCreateFlags flags; - VkSampleCountFlagBits rasterizationSamples; - VkBool32 sampleShadingEnable; - float minSampleShading; - const VkSampleMask* pSampleMask; - VkBool32 alphaToCoverageEnable; - VkBool32 alphaToOneEnable; -} VkPipelineMultisampleStateCreateInfo; -``` - -## VkPipelineDepthStencilStateCreateInfo -```c++ -typedef struct VkPipelineDepthStencilStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineDepthStencilStateCreateFlags flags; - VkBool32 depthTestEnable; - VkBool32 depthWriteEnable; - VkCompareOp depthCompareOp; - VkBool32 depthBoundsTestEnable; - VkBool32 stencilTestEnable; - VkStencilOpState front; - VkStencilOpState back; - float minDepthBounds; - float maxDepthBounds; -} VkPipelineDepthStencilStateCreateInfo; -``` - -## VkPipelineColorBlendStateCreateInfo -```c++ -typedef struct VkPipelineColorBlendStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineColorBlendStateCreateFlags flags; - VkBool32 logicOpEnable; - VkLogicOp logicOp; - uint32_t attachmentCount; - const VkPipelineColorBlendAttachmentState* pAttachments; - float blendConstants[4]; -} VkPipelineColorBlendStateCreateInfo; -``` - -## VkPipelineColorBlendAttachmentState -```c++ -typedef struct VkPipelineColorBlendAttachmentState { - VkBool32 blendEnable; - VkBlendFactor srcColorBlendFactor; - VkBlendFactor dstColorBlendFactor; - VkBlendOp colorBlendOp; - VkBlendFactor srcAlphaBlendFactor; - VkBlendFactor dstAlphaBlendFactor; - VkBlendOp alphaBlendOp; - VkColorComponentFlags colorWriteMask; -} VkPipelineColorBlendAttachmentState; -``` - -## VkPipelineDynamicStateCreateInfo -```c++ -typedef struct VkPipelineDynamicStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineDynamicStateCreateFlags flags; - uint32_t dynamicStateCount; - const VkDynamicState* pDynamicStates; -} VkPipelineDynamicStateCreateInfo; -``` - -According to the Vulkan spec: -- `flags` may be non-0 -- `stages` may be 0 or > 0 -- `pStages` must all be unique -- `pVertexInputState` **must** point to a valid - `VkPipelineVertexInputStateCreateInfo` -- `pInputAssemblyState` **must** point to a valid - `VkPipelineInputAssemblyStateCreateInfo` -- `pTessellationState` **may** be nullptr if the pipeline does not contain - tessellation -- `pRasterizationState` **must** point to a valid - `VkPipelineRasterizationStateCreateInfo` -- The following **must** be valid if rasterization is enabled, NULL otherwise - - `pViewportState` - - `pMultisampleState` -- `pDepthStencilState` **must** be valid if rasterization is enabled and the - subpass uses depth/stencil. NULL otherwise. -- `pColorBlendState` **must** be valid if rasterization is enabled and the - subpass uses color attachments, NULL otherwise. -- `pDynamicState` **can** be nullptr -- The other parameters must point to valid objects. -- `VkPipelineShaderStageCreateInfo` - - `flags` **must** be 0 - - `stage` **must** have one bit set. - - `pName` **must** be a null-terminated utf-8 string to a name in the given - shader module - - `pSpecializationInfo` **may** be null or a pointer to a specialization - struct - - `VkSpecializationInfo` - - `pMapEntries` points to and array of `mapEntryCount` - `VkSpecializationMapEntry` structures - - `pData` points to `dataSize` bytes of data. -- `VkPipelineVertexInputStateCreateInfo` - - `flags` **must** be 0 - - `pVertexBindingDescriptions` points to an array of - `vertexBindingDescriptionCount` `VkVertexInputBindingDescription` structures - - `pVertexAttributeDescriptions` points to an array of - `vertexAttributeDescriptionCount` `VkVertexInputAttributeDescription` structures - - `VkVertexInputBindingDescription` - - All values must be valid - - `VkVertexInputAttributeDescription` - - All values must be valid -- `VkPipelineInputAssemblyStateCreateInfo` - - `flags` **must** be 0 -- `VkPipelineTessellationStateCreateInfo` - - `flags` **must** be 0 -- `VkPipelineViewportStateCreateInfo` - - `flags` **must** be 0 - - `pViewports` points to an array of `viewportCount` `VkViewport` structures - - `pScissors` points to an array of `scissorCount` `VkRect2D` structures - - `viewportCount` **must** be >= 1 (> 1 only if multiViewport is enabled) - - `scissorCount` **must** be >= 1 (> 1 only if multiViewport is enabled) - - `scissorCount` must == `viewportCount` - - `VkViewport` - - ... something about fixed point? - - `width, height` must be between 0 and - `VkPhysicalDeviceLimits::maxViewportDimensions` - - `x, y, x+width, y+width` must be in `viewportBoundsRange` - // TODO(awoloszyn): WHAT IS VIEWPORTBOUNDSRANGE? -- `VkPipelineRasterizationStateCreateInfo` - - `flags` **must** be 0 - - `depthClamp` must be VK_FALSE unless the `depthClamp` is enabled - - `polygonMode` must be `VK_POLYGON_MODE_FILL` unless `fillModeNonSolid` - is enabled -- `VkPipelineMultisampleStateCreateInfo` - - `flags` **must** be 0 - - `pSampleMask` is either null or a pointer to `ceil(rasterizationSamples/32)` - `VkSampleMask` structures - - `sampleShadingEnable` **must** be `VK_FALSE` unless `sampleRateShading` is - enabled - - `alphaToOneEnable` **must** be `VK_FALSE` unless `alphaToOne` is enabled -- `VkPipelineDepthStencilStateCreateInfo` - - `flags` **must** be 0 - - `depthBoundsTestEnable` **must** be 0 unless `depthBounds` is enabled -- `VkPipelineColorBlendStateCreateInfo` - - `flags` **must** be 0 - - `pAttachments` points to an array of `attachmentCount` - `VkPipelineColorBlendAttachmentState` structures - - `VkPipelineColorBlendAttachmentState` - - all parameters must be valid - - If `dualSrcBlend` is not enabled then the following cannot be used - - `VK_BLEND_FACTOR_SRC1_COLOR` - - `VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR` - - `VK_BLEND_FACTOR_SRC1_ALPHA` - - `VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA` -- `VkPipelineDynamicStateCreateInfo` - - `flags` **must** be 0 - - `pDynamicStates` points to an array of `dynamicStateCount` `VkDynamicState` - values - - `dynamicStateCount` **must** be `>0` - -## Tests in their own README files -- [simple_vertex_fragment](simple_vertex_fragment.md) \ No newline at end of file diff --git a/gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/main.cpp b/gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/main.cpp deleted file mode 100644 index 5069c2b1..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/main.cpp +++ /dev/null @@ -1,307 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -uint32_t fragment_shader[] = -#include "simple_fragment.frag.spv" - ; - -uint32_t vertex_shader[] = -#include "simple_vertex.vert.spv" - ; - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - // So we don't have to type app.device every time. - vulkan::VkDevice& device = app.device(); - - { - vulkan::PipelineLayout pipeline_layout(app.CreatePipelineLayout( - {{{ - 0, // binding - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_VERTEX_BIT, // stageFlags - nullptr, // pImmutableSamplers - }, - { - 1, // binding - VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, // descriptorType - 1, // descriptorCount - VK_SHADER_STAGE_FRAGMENT_BIT, // stageFlags - nullptr, // pImmutableSamplers - }}})); - - VkAttachmentReference color_attachment = { - 1, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - VkAttachmentReference depth_attachment = { - 0, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}; - - vulkan::VkRenderPass render_pass = app.CreateRenderPass( - {{ - 0, // flags - VK_FORMAT_D32_SFLOAT, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL // finalLayout - }, - { - 0, // flags - VK_FORMAT_R8G8B8A8_UNORM, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // initialLayout - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // finalLayout - }}, // AttachmentDescriptions - {{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment, // colorAttachment - nullptr, // pResolveAttachments - &depth_attachment, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }}, // SubpassDescriptions - {} // SubpassDependencies - ); - - vulkan::VkShaderModule vertex_shader_module = - app.CreateShaderModule(vertex_shader); - vulkan::VkShaderModule fragment_shader_module = - app.CreateShaderModule(fragment_shader); - VkPipelineShaderStageCreateInfo shader_stage_create_infos[2] = { - { - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_SHADER_STAGE_VERTEX_BIT, // stage - vertex_shader_module, // module - "main", // pName - nullptr // pSpecializationInfo - }, - { - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_SHADER_STAGE_FRAGMENT_BIT, // stage - fragment_shader_module, // module - "main", // pName - nullptr // pSpecializationInfo - }}; - - VkVertexInputBindingDescription vertex_binding_description = { - 0, // binding - 4 * 6, /* vec4 + vec2 */ // stride - VK_VERTEX_INPUT_RATE_VERTEX // inputRate - }; - - VkVertexInputAttributeDescription vertex_attribute_descriptions[2] = { - { - 0, // location - 0, // binding - VK_FORMAT_R32G32B32A32_SFLOAT, // format - 0 // offset - }, - { - 1, // location - 0, // binding - VK_FORMAT_R32G32_SFLOAT, // format - 4 * 4 // offset - }}; - - VkPipelineVertexInputStateCreateInfo vertex_input_state = { - VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 1, // vertexBindingDescriptionCount - &vertex_binding_description, // pVertexBindingDescriptions - 2, // vertexAttributeDescriptionCount - vertex_attribute_descriptions // pVertexAttributeDescriptions - }; - - VkPipelineInputAssemblyStateCreateInfo input_assembly_state = { - VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, // topology - VK_FALSE // primitiveRestartEnable - }; - - VkViewport viewport = { - 0.0f, // x - 0.0f, // y - static_cast(app.swapchain().width()), // width - static_cast(app.swapchain().height()), // height - 0.0f, // minDepth - 1.0f, // maxDepth - }; - - VkRect2D scissor = {{ - 0, // offset.x - 0, // offset.y - }, - { - app.swapchain().width(), // extent.width - app.swapchain().height() // extent.height - }}; - - VkPipelineViewportStateCreateInfo viewport_state = { - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 1, // viewportCount - &viewport, // pViewports - 1, // scissorCount - &scissor, // pScissors - }; - - VkPipelineRasterizationStateCreateInfo rasterization_state = { - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_FALSE, // depthClampEnable - VK_FALSE, // rasterizerDiscardEnable - VK_POLYGON_MODE_FILL, // polygonMode - VK_CULL_MODE_BACK_BIT, // cullMode - VK_FRONT_FACE_CLOCKWISE, // frontFace - VK_FALSE, // depthBiasEnable - 0.0f, // depthBiasConstantFactor - 0.0f, // depthBiasClamp - 0.0f, // depthBiasSlopeFactor - 1.0f, // lineWidth - }; - - VkPipelineMultisampleStateCreateInfo multisample_state = { - VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_SAMPLE_COUNT_1_BIT, // rasterizationSamples - VK_FALSE, // sampleShadingEnable - 0, // minSampleShading - 0, // pSampleMask - VK_FALSE, // alphaToCoverageEnable - VK_FALSE, // alphaToOneEnable - }; - - VkPipelineDepthStencilStateCreateInfo depth_stencil_state = { - VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_TRUE, // depthTestEnable - VK_TRUE, // depthWriteEnable - VK_COMPARE_OP_LESS, // depthCompareOp - VK_FALSE, // depthBoundsTestEnable - VK_FALSE, // stencilTestEnable - { - VK_STENCIL_OP_KEEP, // front.failOp - VK_STENCIL_OP_KEEP, // front.passOp - VK_STENCIL_OP_KEEP, // front.depthFailOp - VK_COMPARE_OP_NEVER, // front.compareOp - 0x0, // front.compareMask - 0x0, // front.writeMask - 0 // front.reference - }, - { - VK_STENCIL_OP_KEEP, // back.failOp - VK_STENCIL_OP_KEEP, // back.passOp - VK_STENCIL_OP_KEEP, // back.depthFailOp - VK_COMPARE_OP_NEVER, // back.compareOp - 0x0, // back.compareMask - 0x0, // back.writeMask - 0 // back.reference - }, - 0.0f, // minDepthBounds - 1.0f // maxDepthBounds - }; - - VkPipelineColorBlendAttachmentState color_blend_attachment_state = { - VK_FALSE, // blendEnable - VK_BLEND_FACTOR_ZERO, // srcColorBlendFactor - VK_BLEND_FACTOR_ONE, // dstColorBlendFactor - VK_BLEND_OP_ADD, // colorBlendOp - VK_BLEND_FACTOR_ZERO, // srcAlphaBlendFactor - VK_BLEND_FACTOR_ONE, // dstAlphaBlendFactor - VK_BLEND_OP_ADD, // alphaBlendOp - VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | - VK_COLOR_COMPONENT_B_BIT | - VK_COLOR_COMPONENT_A_BIT, // colorWriteMask - }; - - VkPipelineColorBlendStateCreateInfo color_blend_state = { - VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - VK_FALSE, // logicOpEnable - VK_LOGIC_OP_CLEAR, // logicOp - 1, // attachmentCount - &color_blend_attachment_state, // pAttachments - {1.0f, 1.0f, 1.0f, 1.0f} // blendConstants - }; - - VkGraphicsPipelineCreateInfo create_info = { - VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 2, // stageCount - shader_stage_create_infos, // pStages - &vertex_input_state, // pVertexInputState - &input_assembly_state, // pInputAssemblyState - nullptr, // pTessellationState - &viewport_state, // pViewportState - &rasterization_state, // pRasterizationState - &multisample_state, // pMultisampleState - &depth_stencil_state, // pDepthStencilState - &color_blend_state, // pColorBlendState - nullptr, // pDynamicState - pipeline_layout, // layout - render_pass, // renderPass - 0, // subpass - VK_NULL_HANDLE, // basePipelineHandle - 0 // basePipelineIndex - }; - - VkPipeline raw_pipeline; - - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkCreateGraphicsPipelines(device, app.pipeline_cache(), - 1, &create_info, nullptr, - &raw_pipeline)); - device->vkDestroyPipeline(device, raw_pipeline, nullptr); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/simple_vertex_fragment.md b/gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/simple_vertex_fragment.md deleted file mode 100644 index cd0725ec..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/simple_vertex_fragment.md +++ /dev/null @@ -1,10 +0,0 @@ -# Test -- [x] `flags` == 0 -- [x] `stageCount` == 2 -- [x] `pTessellation` == nullptr -- [x] `pColorBlendState` != nullptr -- [x] `pDepthStencilState` != nullptr -- [x] `pDynamicState` == nullptr -- [x] `subpass` = 0 -- [x] `basePipelineHandle` == `VK_NULL_HANDLE` - diff --git a/gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/vkCreateGraphicsPipelines_test.py b/gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/vkCreateGraphicsPipelines_test.py deleted file mode 100644 index ecab8124..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateGraphicsPipelines_test/vkCreateGraphicsPipelines_test.py +++ /dev/null @@ -1,495 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from struct_offsets import * -from vulkan_constants import * - -GRAPHICS_PIPELINE_CREATE_INFO = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("stageCount", UINT32_T), - ("pStages", POINTER), - ("pVertexInputState", POINTER), - ("pInputAssemblyState", POINTER), - ("pTessellationState", POINTER), - ("pViewportState", POINTER), - ("pRasterizationState", POINTER), - ("pMultisampleState", POINTER), - ("pDepthStencilState", POINTER), - ("pColorBlendState", POINTER), - ("pDynamicState", POINTER), - ("layout", POINTER), - ("renderPass", HANDLE), - ("subpass", UINT32_T), - ("basePipelineHandle", HANDLE), - ("basePipelineIndex", INT32_T) -] - -PIPELINE_SHADER_STAGE_CREATE_INFO = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("stage", UINT32_T), - ("module", HANDLE), - ("pName", POINTER), - ("pSpecializationInfo", POINTER) -] - -SPECIALIZATION_INFO = [ - ("mapEntryCount", UINT32_T), - ("pMapEntries", POINTER), - ("dataSize", SIZE_T), - ("pData", POINTER) -] - -VERTEX_INPUT_STATE_CREATE_INFO = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("vertexBindingDescriptionCount", UINT32_T), - ("pVertexBindingDescriptions", POINTER), - ("vertexAttributeDescriptionCount", UINT32_T), - ("pVertexAttributeDescriptions", POINTER) -] - -VERTEX_INPUT_BINDING_DESCRIPTION = [ - ("binding", UINT32_T), - ("stride", UINT32_T), - ("inputRate", UINT32_T) -] - -VERTEX_INPUT_ATTRIBUTE_DESCRIPTION = [ - ("location", UINT32_T), - ("binding", UINT32_T), - ("format", UINT32_T), - ("offset", UINT32_T) -] - -PIPELINE_TESSELLATION_STATE_CREATE_INFO = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("patchControlPoints", UINT32_T) -] - -INPUT_ASSEMBLY_STATE = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("topology", UINT32_T), - ("primitiveRestartEnable", BOOL32) -] - -VIEWPORT_STATE_CREATE_INFO = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("viewportCount", UINT32_T), - ("pViewports", POINTER), - ("scissorCount", UINT32_T), - ("pScissors", POINTER) -] - -VIEWPORT = [ - ("x", FLOAT), - ("y", FLOAT), - ("width", FLOAT), - ("height", FLOAT), - ("minDepth", FLOAT), - ("maxDepth", FLOAT) -] - -RECT2D = [ - ("offset_x", INT32_T), - ("offset_y", INT32_T), - ("extent_width", INT32_T), - ("extent_height", INT32_T) -] - -PIPELINE_RASERIZATION_STATE = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("depthClampEnable", BOOL32), - ("rasterizerDiscardEnable", BOOL32), - ("polygonMode", UINT32_T), - ("cullMode", UINT32_T), - ("frontFace", UINT32_T), - ("depthBiasEnable", BOOL32), - ("depthBiasConstantFactor", FLOAT), - ("depthBiasClamp", FLOAT), - ("depthBiasSlopeFactor", FLOAT), - ("lineWidth", FLOAT) -] - -MULTISAMPLE_STATE = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("rasterizationSamples", UINT32_T), - ("sampleShadingEnable", BOOL32), - ("minSampleShading", FLOAT), - ("pSampleMask", POINTER), - ("alphaToCoverageEnable", BOOL32), - ("alphaToOneEnable", BOOL32) -] - -DEPTH_STENCIL_STATE = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("depthTestEnable", BOOL32), - ("depthWriteEnable", BOOL32), - ("depthCompareOp", UINT32_T), - ("depthBoundsTestEnable", BOOL32), - ("stencilTestEnable", BOOL32), - ("front_failOp", UINT32_T), - ("front_passOp", UINT32_T), - ("front_depthFailOp", UINT32_T), - ("front_compareOp", UINT32_T), - ("front_compareMask", UINT32_T), - ("front_writeMask", UINT32_T), - ("front_reference", UINT32_T), - ("back_failOp", UINT32_T), - ("back_passOp", UINT32_T), - ("back_depthFailOp", UINT32_T), - ("back_compareOp", UINT32_T), - ("back_compareMask", UINT32_T), - ("back_writeMask", UINT32_T), - ("back_reference", UINT32_T), - ("minDepthBounds", FLOAT), - ("maxDepthBounds", FLOAT) -] - -PIPELINE_COLOR_BLEND_STATE = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("logicOpEnable", BOOL32), - ("logicOp", UINT32_T), - ("attachmentCount", UINT32_T), - ("pAttachments", POINTER), - ("blendConstant0", FLOAT), - ("blendConstant1", FLOAT), - ("blendConstant2", FLOAT), - ("blendConstant3", FLOAT) -] - -PIPELINE_COLOR_BLEND_ATTACHMENT_STATE = [ - ("blendEnable", BOOL32), - ("srcColorBlendFactor", UINT32_T), - ("dstColorBlendFactor", UINT32_T), - ("colorBlendOp", UINT32_T), - ("srcAlphaBlendFactor", UINT32_T), - ("dstAlphaBlendFactor", UINT32_T), - ("alphaBlendOp", UINT32_T), - ("colorWriteMask", UINT32_T) -] - -DYNAMIC_STATE = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("dynamicStateCount", UINT32_T), - ("pDynamicStates", POINTER) -] - -@gapit_test("vkCreateGraphicsPipelines_test") -class SimpleVertexFragment(GapitTest): - - def expect(self): - architecture = self.architecture - create_graphics_pipelines = require(self.next_call_of( - "vkCreateGraphicsPipelines")) - require_not_equal(0, create_graphics_pipelines.int_device) - require_not_equal(0, create_graphics_pipelines.int_pipelineCache) - require_equal(1, create_graphics_pipelines.int_createInfoCount) - require_not_equal(0, create_graphics_pipelines.hex_pCreateInfos) - require_equal(0, create_graphics_pipelines.hex_pAllocator) - require_not_equal(0, create_graphics_pipelines.hex_pPipelines) - - create_info = VulkanStruct( - architecture, GRAPHICS_PIPELINE_CREATE_INFO, - get_read_offset_function(create_graphics_pipelines, - create_graphics_pipelines.hex_pCreateInfos)) - require_equal(VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, - create_info.sType) - require_equal(0, create_info.pNext) - require_equal(0, create_info.flags) - require_equal(2, create_info.stageCount) - require_not_equal(0, create_info.pStages) - require_not_equal(0, create_info.pVertexInputState) - require_not_equal(0, create_info.pInputAssemblyState) - require_equal(0, create_info.pTessellationState) - require_not_equal(0, create_info.pViewportState) - require_not_equal(0, create_info.pRasterizationState) - require_not_equal(0, create_info.pMultisampleState) - require_not_equal(0, create_info.pDepthStencilState) - require_not_equal(0, create_info.pColorBlendState) - require_equal(0, create_info.pDynamicState) - require_not_equal(0, create_info.layout) - require_not_equal(0, create_info.renderPass) - require_equal(0, create_info.subpass) - require_equal(0, create_info.basePipelineHandle) - require_equal(0, create_info.basePipelineIndex) - - shader_stage_create_info_0 = VulkanStruct( - architecture, PIPELINE_SHADER_STAGE_CREATE_INFO, - get_read_offset_function(create_graphics_pipelines, - create_info.pStages)) - require_equal(VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - shader_stage_create_info_0.sType) - require_equal(0, shader_stage_create_info_0.pNext) - require_equal(0, shader_stage_create_info_0.flags) - require_equal(VK_SHADER_STAGE_VERTEX_BIT, - shader_stage_create_info_0.stage) - require_not_equal(0, shader_stage_create_info_0.module) - require_equal("main", require( - create_graphics_pipelines.get_read_string( - shader_stage_create_info_0.pName))) - require_equal(0, shader_stage_create_info_0.pSpecializationInfo) - - shader_stage_create_info_1 = VulkanStruct( - architecture, PIPELINE_SHADER_STAGE_CREATE_INFO, - get_read_offset_function(create_graphics_pipelines, - create_info.pStages + - shader_stage_create_info_0.total_size)) - - require_equal(VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - shader_stage_create_info_1.sType) - require_equal(0, shader_stage_create_info_1.pNext) - require_equal(0, shader_stage_create_info_1.flags) - require_equal(VK_SHADER_STAGE_FRAGMENT_BIT, - shader_stage_create_info_1.stage) - require_not_equal(0, shader_stage_create_info_1.module) - require_equal("main", require( - create_graphics_pipelines.get_read_string( - shader_stage_create_info_1.pName))) - require_equal(0, shader_stage_create_info_1.pSpecializationInfo) - - vertex_input_state = VulkanStruct( - architecture, VERTEX_INPUT_STATE_CREATE_INFO, - get_read_offset_function(create_graphics_pipelines, - create_info.pVertexInputState)) - require_equal(VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, - vertex_input_state.sType) - require_equal(0, vertex_input_state.pNext) - require_equal(0, vertex_input_state.flags) - require_equal(1, vertex_input_state.vertexBindingDescriptionCount) - require_not_equal(0, vertex_input_state.pVertexBindingDescriptions) - require_equal(2, vertex_input_state.vertexAttributeDescriptionCount) - require_not_equal(0, vertex_input_state.pVertexAttributeDescriptions) - - vertex_binding_description = VulkanStruct( - architecture, VERTEX_INPUT_BINDING_DESCRIPTION, - get_read_offset_function( - create_graphics_pipelines, - vertex_input_state.pVertexBindingDescriptions)) - require_equal(0, vertex_binding_description.binding) - require_equal(24, vertex_binding_description.stride) - require_equal(VK_VERTEX_INPUT_RATE_VERTEX, - vertex_binding_description.inputRate) - - vertex_attribute_description_0 = VulkanStruct( - architecture, VERTEX_INPUT_ATTRIBUTE_DESCRIPTION, - get_read_offset_function( - create_graphics_pipelines, - vertex_input_state.pVertexAttributeDescriptions)) - - require_equal(0, vertex_attribute_description_0.location) - require_equal(0, vertex_attribute_description_0.binding) - require_equal(VK_FORMAT_R32G32B32A32_SFLOAT, - vertex_attribute_description_0.format) - require_equal(0, vertex_attribute_description_0.offset) - - vertex_attribute_description_1 = VulkanStruct( - architecture, VERTEX_INPUT_ATTRIBUTE_DESCRIPTION, - get_read_offset_function( - create_graphics_pipelines, - vertex_input_state.pVertexAttributeDescriptions + - vertex_attribute_description_0.total_size)) - require_equal(1, vertex_attribute_description_1.location) - require_equal(0, vertex_attribute_description_1.binding) - require_equal(VK_FORMAT_R32G32_SFLOAT, - vertex_attribute_description_1.format) - require_equal(16, vertex_attribute_description_1.offset) - - input_assembly_state = VulkanStruct( - architecture, INPUT_ASSEMBLY_STATE, - get_read_offset_function(create_graphics_pipelines, - create_info.pInputAssemblyState)) - - require_equal( - VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, - input_assembly_state.sType) - require_equal(0, input_assembly_state.pNext) - require_equal(0, input_assembly_state.flags) - require_equal(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, - input_assembly_state.topology) - require_equal(0, input_assembly_state.primitiveRestartEnable) - - viewport_state = VulkanStruct( - architecture, VIEWPORT_STATE_CREATE_INFO, - get_read_offset_function(create_graphics_pipelines, - create_info.pViewportState)) - require_equal( - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, - viewport_state.sType - ) - require_equal(0, viewport_state.pNext) - require_equal(0, viewport_state.flags) - require_equal(1, viewport_state.viewportCount) - require_not_equal(0, viewport_state.pViewports) - require_equal(1, viewport_state.scissorCount) - require_not_equal(0, viewport_state.pScissors) - - viewport = VulkanStruct( - architecture, VIEWPORT, - get_read_offset_function(create_graphics_pipelines, - viewport_state.pViewports)) - require_equal(0.0, viewport.x) - require_equal(0.0, viewport.y) - require_not_equal(0.0, viewport.width) - require_not_equal(0.0, viewport.height) - require_equal(0.0, viewport.minDepth) - require_equal(1.0, viewport.maxDepth) - - scissor = VulkanStruct( - architecture, RECT2D, - get_read_offset_function(create_graphics_pipelines, - viewport_state.pScissors)) - require_equal(0, scissor.offset_x) - require_equal(0, scissor.offset_y) - require_not_equal(0, scissor.extent_width) - require_not_equal(0, scissor.extent_height) - - rasterization_state = VulkanStruct( - architecture, PIPELINE_RASERIZATION_STATE, - get_read_offset_function(create_graphics_pipelines, - create_info.pRasterizationState)) - require_equal( - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, - rasterization_state.sType) - require_equal(0, rasterization_state.pNext) - require_equal(0, rasterization_state.flags) - require_equal(0, rasterization_state.depthClampEnable) - require_equal(0, rasterization_state.rasterizerDiscardEnable) - require_equal(VK_POLYGON_MODE_FILL, rasterization_state.polygonMode) - require_equal(VK_CULL_MODE_BACK_BIT, rasterization_state.cullMode) - require_equal(VK_FRONT_FACE_CLOCKWISE, rasterization_state.frontFace) - require_equal(0, rasterization_state.depthBiasEnable) - require_equal(0.0, rasterization_state.depthBiasConstantFactor) - require_equal(0.0, rasterization_state.depthBiasClamp) - require_equal(0.0, rasterization_state.depthBiasSlopeFactor) - require_equal(1.0, rasterization_state.lineWidth) - - multisample_state = VulkanStruct(architecture, - MULTISAMPLE_STATE, get_read_offset_function( - create_graphics_pipelines, - create_info.pMultisampleState)) - require_equal(VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, - multisample_state.sType) - require_equal(0, multisample_state.pNext) - require_equal(0, multisample_state.flags) - require_equal(VK_SAMPLE_COUNT_1_BIT, - multisample_state.rasterizationSamples) - require_equal(0, multisample_state.sampleShadingEnable) - require_equal(0.0, multisample_state.minSampleShading) - require_equal(0, multisample_state.pSampleMask) - require_equal(0, multisample_state.alphaToCoverageEnable) - require_equal(0, multisample_state.alphaToOneEnable) - - depth_stencil_state = VulkanStruct(architecture, - DEPTH_STENCIL_STATE, get_read_offset_function( - create_graphics_pipelines, - create_info.pDepthStencilState)) - require_equal( - VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO, - depth_stencil_state.sType) - require_equal(0, depth_stencil_state.pNext) - require_equal(0, depth_stencil_state.flags) - require_equal(1, depth_stencil_state.depthTestEnable) - require_equal(1, depth_stencil_state.depthWriteEnable) - require_equal(VK_COMPARE_OP_LESS, depth_stencil_state.depthCompareOp) - require_equal(0, depth_stencil_state.depthBoundsTestEnable) - require_equal(0, depth_stencil_state.stencilTestEnable) - require_equal(VK_STENCIL_OP_KEEP, depth_stencil_state.front_failOp) - require_equal(VK_STENCIL_OP_KEEP, depth_stencil_state.front_passOp) - require_equal(VK_STENCIL_OP_KEEP, depth_stencil_state.front_depthFailOp) - require_equal(VK_COMPARE_OP_NEVER, depth_stencil_state.front_compareOp) - require_equal(0, depth_stencil_state.front_compareMask) - require_equal(0, depth_stencil_state.front_writeMask) - require_equal(0, depth_stencil_state.front_reference) - require_equal(VK_STENCIL_OP_KEEP, depth_stencil_state.back_failOp) - require_equal(VK_STENCIL_OP_KEEP, depth_stencil_state.back_passOp) - require_equal(VK_STENCIL_OP_KEEP, depth_stencil_state.back_depthFailOp) - require_equal(VK_COMPARE_OP_NEVER, depth_stencil_state.back_compareOp) - require_equal(0, depth_stencil_state.back_compareMask) - require_equal(0, depth_stencil_state.back_writeMask) - require_equal(0, depth_stencil_state.back_reference) - require_equal(0.0, depth_stencil_state.minDepthBounds) - require_equal(1.0, depth_stencil_state.maxDepthBounds) - - color_blend_state = VulkanStruct(architecture, - PIPELINE_COLOR_BLEND_STATE, get_read_offset_function( - create_graphics_pipelines, - create_info.pColorBlendState)) - require_equal(VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, - color_blend_state.sType) - require_equal(0, color_blend_state.pNext) - require_equal(0, color_blend_state.flags) - require_equal(0, color_blend_state.logicOpEnable) - require_equal(VK_LOGIC_OP_CLEAR, color_blend_state.logicOp) - require_equal(1, color_blend_state.attachmentCount) - require_not_equal(0, color_blend_state.pAttachments) - require_equal(1.0, color_blend_state.blendConstant0) - require_equal(1.0, color_blend_state.blendConstant1) - require_equal(1.0, color_blend_state.blendConstant2) - require_equal(1.0, color_blend_state.blendConstant3) - - color_blend_attachment_state = VulkanStruct( - architecture, PIPELINE_COLOR_BLEND_ATTACHMENT_STATE, - get_read_offset_function( - create_graphics_pipelines, color_blend_state.pAttachments)) - require_equal(0, color_blend_attachment_state.blendEnable) - require_equal(VK_BLEND_FACTOR_ZERO, - color_blend_attachment_state.srcColorBlendFactor) - require_equal(VK_BLEND_FACTOR_ONE, - color_blend_attachment_state.dstColorBlendFactor) - require_equal(VK_BLEND_OP_ADD, - color_blend_attachment_state.colorBlendOp) - require_equal(VK_BLEND_FACTOR_ZERO, - color_blend_attachment_state.srcAlphaBlendFactor) - require_equal(VK_BLEND_FACTOR_ONE, - color_blend_attachment_state.dstAlphaBlendFactor) - require_equal(VK_BLEND_OP_ADD, - color_blend_attachment_state.alphaBlendOp) - - require_equal( - VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | - VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT, - color_blend_attachment_state.colorWriteMask) - - destroy_pipeline = require(self.next_call_of( - "vkDestroyPipeline")) - require_equal(create_graphics_pipelines.int_device, - destroy_pipeline.int_device) - require_equal(0, destroy_pipeline.hex_pAllocator) - - created_pipeline = little_endian_bytes_to_int(require( - create_graphics_pipelines.get_write_data( - create_graphics_pipelines.hex_pPipelines, - NON_DISPATCHABLE_HANDLE_SIZE))) - require_equal(created_pipeline, destroy_pipeline.int_pipeline) diff --git a/gapid_tests/resource_creation_tests/vkCreatePipelineLayout_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/vkCreatePipelineLayout_test/CMakeLists.txt deleted file mode 100644 index 8f7cf783..00000000 --- a/gapid_tests/resource_creation_tests/vkCreatePipelineLayout_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCreatePipelineLayout_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/vkCreatePipelineLayout_test/README.md b/gapid_tests/resource_creation_tests/vkCreatePipelineLayout_test/README.md deleted file mode 100644 index 38502625..00000000 --- a/gapid_tests/resource_creation_tests/vkCreatePipelineLayout_test/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# vkCreatePipelineLayout / vkDestroyPipelineLayout - -## Signatures -```c++ -VkResult vkCreatePipelineLayout( - VkDevice device, - const VkPipelineLayoutCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkPipelineLayout* pPipelineLayout); - -void vkDestroyPipelineLayout( - VkDevice device, - VkPipelineLayout pipelineLayout, - const VkAllocationCallbacks* pAllocator); -``` - -## VkPipelineLayoutCreateInfo -```c++ -typedef struct VkPipelineLayoutCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineLayoutCreateFlags flags; - uint32_t setLayoutCount; - const VkDescriptorSetLayout* pSetLayouts; - uint32_t pushConstantRangeCount; - const VkPushConstantRange* pPushConstantRanges; -} VkPipelineLayoutCreateInfo; -``` - -According to the Vulkan spec: -- `device` **must** be vald -- `pCreateInfo` **must** point to a valid `VkPipelineLayoutCreateInfo` structure. -- `sType` **must** be `VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO` -- `pNext` **must** be null -- `flags` **must** be 0 -- `pSetLayouts` is a pointer to an array of `setLayoutCount` - `VkDescriptorSetLayout` structures. -- `pPushConstantRanges` is a pointer to an array of `pushConstantRangeCount` - `VkPushConstantRange` structures. - - -These tests should test the following cases: -- `vkCreatePipelineLayout` - - [x] `pSetLayouts` == 0 - - [x] `pSetLayouts` == 1 - - [x] `pSetLayouts` > 1 - - [x] `pPushConstantRanges` == 0 - - [ ] `pPushConstantRanges` == 1 - - [ ] `pPushConstantRanges` > 1 -- `vkDestroyPipelineLayout` - - [x] `pipelineLayout` == `VK_NULL_HANDLE` - - [x] `pipelineLayout` != `VK_NULL_HANDE` diff --git a/gapid_tests/resource_creation_tests/vkCreatePipelineLayout_test/main.cpp b/gapid_tests/resource_creation_tests/vkCreatePipelineLayout_test/main.cpp deleted file mode 100644 index a647f37d..00000000 --- a/gapid_tests/resource_creation_tests/vkCreatePipelineLayout_test/main.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - // So we don't have to type app.device every time. - vulkan::VkDevice& device = app.device(); - - { - // Empty pipeline layout - VkPipelineLayoutCreateInfo create_info{ - VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 0, // setLayoutCount - nullptr, // pSetLayouts - 0, // pushConstantRangeCount - nullptr // pPushConstantRanges - }; - VkPipelineLayout raw_pipeline_layout; - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkCreatePipelineLayout(device, &create_info, nullptr, - &raw_pipeline_layout)); - device->vkDestroyPipelineLayout(device, raw_pipeline_layout, nullptr); - } - - { - // Single layout - vulkan::VkDescriptorSetLayout layout = vulkan::CreateDescriptorSetLayout( - data->allocator(), &device, - {{0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, - nullptr}}); - VkDescriptorSetLayout raw_layouts[1] = {layout}; - VkPipelineLayoutCreateInfo create_info{ - VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 1, // setLayoutCount - raw_layouts, // pSetLayouts - 0, // pushConstantRangeCount - nullptr // pPushConstantRanges - }; - VkPipelineLayout raw_pipeline_layout; - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkCreatePipelineLayout(device, &create_info, nullptr, - &raw_pipeline_layout)); - device->vkDestroyPipelineLayout(device, raw_pipeline_layout, nullptr); - } - - { - // Two layouts - vulkan::VkDescriptorSetLayout layout = vulkan::CreateDescriptorSetLayout( - data->allocator(), &device, - {{0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, - nullptr}}); - vulkan::VkDescriptorSetLayout layout2 = vulkan::CreateDescriptorSetLayout( - data->allocator(), &device, - {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, - nullptr}}); - VkDescriptorSetLayout raw_layouts[2] = {layout, layout2}; - - VkPipelineLayoutCreateInfo create_info{ - VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 2, // setLayoutCount - raw_layouts, // pSetLayouts - 0, // pushConstantRangeCount - nullptr // pPushConstantRanges - }; - VkPipelineLayout raw_pipeline_layout; - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkCreatePipelineLayout(device, &create_info, nullptr, - &raw_pipeline_layout)); - device->vkDestroyPipelineLayout(device, raw_pipeline_layout, nullptr); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/vkCreatePipelineLayout_test/vkCreatePipelineLayout_test.py b/gapid_tests/resource_creation_tests/vkCreatePipelineLayout_test/vkCreatePipelineLayout_test.py deleted file mode 100644 index 0fdbf832..00000000 --- a/gapid_tests/resource_creation_tests/vkCreatePipelineLayout_test/vkCreatePipelineLayout_test.py +++ /dev/null @@ -1,174 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY -from vulkan_constants import * - -PIPELINE_LAYOUT_CREATE_INFO = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("setLayoutCount", UINT32_T), - ("pSetLayouts", POINTER), - ("pushConstantRangeCount", UINT32_T), - ("pPushConstantRanges", POINTER) -] - - -@gapit_test("vkCreatePipelineLayout_test") -class EmptyLayout(GapitTest): - - def expect(self): - architecture = self.architecture - create_pipeline = require( - self.nth_call_of("vkCreatePipelineLayout", 1)) - - require_not_equal(0, create_pipeline.int_device) - require_not_equal(0, create_pipeline.hex_pCreateInfo) - require_equal(0, create_pipeline.hex_pAllocator) - require_not_equal(0, create_pipeline.hex_pPipelineLayout) - - created_pipeline = little_endian_bytes_to_int( - require(create_pipeline.get_write_data( - create_pipeline.hex_pPipelineLayout, - NON_DISPATCHABLE_HANDLE_SIZE))) - - pipeline_layout_create_info = VulkanStruct( - architecture, PIPELINE_LAYOUT_CREATE_INFO, - get_read_offset_function(create_pipeline, - create_pipeline.hex_pCreateInfo)) - - require_equal(VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, - pipeline_layout_create_info.sType) - require_equal(0, pipeline_layout_create_info.pNext) - require_equal(0, pipeline_layout_create_info.flags) - require_equal(0, pipeline_layout_create_info.setLayoutCount) - require_equal(0, pipeline_layout_create_info.pSetLayouts) - require_equal(0, pipeline_layout_create_info.pushConstantRangeCount) - require_equal(0, pipeline_layout_create_info.pPushConstantRanges) - - destroy_pipeline = require( - self.next_call_of("vkDestroyPipelineLayout")) - require_equal(created_pipeline, destroy_pipeline.int_pipelineLayout) - require_equal(create_pipeline.int_device, destroy_pipeline.int_device) - require_equal(0, destroy_pipeline.hex_pAllocator) - - -@gapit_test("vkCreatePipelineLayout_test") -class SingleLayout(GapitTest): - - def expect(self): - architecture = self.architecture - create_pipeline = require( - self.nth_call_of("vkCreatePipelineLayout", 2)) - - require_not_equal(0, create_pipeline.int_device) - require_not_equal(0, create_pipeline.hex_pCreateInfo) - require_equal(0, create_pipeline.hex_pAllocator) - require_not_equal(0, create_pipeline.hex_pPipelineLayout) - - created_pipeline = little_endian_bytes_to_int(require( - create_pipeline.get_write_data( - create_pipeline.hex_pPipelineLayout, - NON_DISPATCHABLE_HANDLE_SIZE))) - - pipeline_layout_create_info = VulkanStruct( - architecture, PIPELINE_LAYOUT_CREATE_INFO, - get_read_offset_function(create_pipeline, - create_pipeline.hex_pCreateInfo)) - - require_equal(VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, - pipeline_layout_create_info.sType) - require_equal(0, pipeline_layout_create_info.pNext) - require_equal(0, pipeline_layout_create_info.flags) - require_equal(1, pipeline_layout_create_info.setLayoutCount) - require_not_equal(0, pipeline_layout_create_info.pSetLayouts) - require_equal(0, pipeline_layout_create_info.pushConstantRangeCount) - require_equal(0, pipeline_layout_create_info.pPushConstantRanges) - - set_layout = little_endian_bytes_to_int(require( - create_pipeline.get_read_data( - pipeline_layout_create_info.pSetLayouts, - NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(VK_NULL_HANDLE, set_layout) - - destroy_pipeline = require( - self.next_call_of("vkDestroyPipelineLayout")) - require_equal(created_pipeline, destroy_pipeline.int_pipelineLayout) - require_equal(create_pipeline.int_device, destroy_pipeline.int_device) - require_equal(0, destroy_pipeline.hex_pAllocator) - - -@gapit_test("vkCreatePipelineLayout_test") -class TwoLayouts(GapitTest): - - def expect(self): - architecture = self.architecture - create_pipeline = require( - self.nth_call_of("vkCreatePipelineLayout", 3)) - - require_not_equal(0, create_pipeline.int_device) - require_not_equal(0, create_pipeline.hex_pCreateInfo) - require_equal(0, create_pipeline.hex_pAllocator) - require_not_equal(0, create_pipeline.hex_pPipelineLayout) - - created_pipeline = little_endian_bytes_to_int(require( - create_pipeline.get_write_data( - create_pipeline.hex_pPipelineLayout, - NON_DISPATCHABLE_HANDLE_SIZE))) - - pipeline_layout_create_info = VulkanStruct( - architecture, PIPELINE_LAYOUT_CREATE_INFO, - get_read_offset_function(create_pipeline, - create_pipeline.hex_pCreateInfo)) - - require_equal(VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, - pipeline_layout_create_info.sType) - require_equal(0, pipeline_layout_create_info.pNext) - require_equal(0, pipeline_layout_create_info.flags) - require_equal(2, pipeline_layout_create_info.setLayoutCount) - require_not_equal(0, pipeline_layout_create_info.pSetLayouts) - require_equal(0, pipeline_layout_create_info.pushConstantRangeCount) - require_equal(0, pipeline_layout_create_info.pPushConstantRanges) - - _ = require(create_pipeline.get_read_data( - pipeline_layout_create_info.pSetLayouts, - NON_DISPATCHABLE_HANDLE_SIZE - )) - - _ = require(create_pipeline.get_read_data( - pipeline_layout_create_info.pSetLayouts + - NON_DISPATCHABLE_HANDLE_SIZE, - NON_DISPATCHABLE_HANDLE_SIZE - )) - - set_layout = little_endian_bytes_to_int(require( - create_pipeline.get_read_data( - pipeline_layout_create_info.pSetLayouts, - NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(VK_NULL_HANDLE, set_layout) - - set_layout2 = little_endian_bytes_to_int(require( - create_pipeline.get_read_data( - pipeline_layout_create_info.pSetLayouts + - NON_DISPATCHABLE_HANDLE_SIZE, - NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(VK_NULL_HANDLE, set_layout2) - - destroy_pipeline = require( - self.next_call_of("vkDestroyPipelineLayout")) - require_equal(created_pipeline, destroy_pipeline.int_pipelineLayout) - require_equal(create_pipeline.int_device, destroy_pipeline.int_device) - require_equal(0, destroy_pipeline.hex_pAllocator) diff --git a/gapid_tests/resource_creation_tests/vkCreateRenderPass_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/vkCreateRenderPass_test/CMakeLists.txt deleted file mode 100644 index 1cad87c1..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateRenderPass_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCreateRenderPass_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/vkCreateRenderPass_test/README.md b/gapid_tests/resource_creation_tests/vkCreateRenderPass_test/README.md deleted file mode 100644 index 04cfa62b..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateRenderPass_test/README.md +++ /dev/null @@ -1,141 +0,0 @@ -# vkCreateRenderPass / vkDestroyRenderPass - -## Signatures -```c++ -VkResult vkCreateRenderPass( - VkDevice device, - const VkRenderPassCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkRenderPass* pRenderPass); -void vkDestroyRenderPass( - VkDevice device, - VkRenderPass renderPass, - const VkAllocationCallbacks* pAllocator); -``` - -## VkRenderPassCreateInfo -```c++ -typedef struct VkRenderPassCreateInfo { - VkStructureType sType; - const void* pNext; - VkRenderPassCreateFlags flags; - uint32_t attachmentCount; - const VkAttachmentDescription* pAttachments; - uint32_t subpassCount; - const VkSubpassDescription* pSubpasses; - uint32_t dependencyCount; - const VkSubpassDependency* pDependencies; -} VkRenderPassCreateInfo; -``` -## VkAttachmentDescription -```c++ -typedef struct VkAttachmentDescription { - VkAttachmentDescriptionFlags flags; - VkFormat format; - VkSampleCountFlagBits samples; - VkAttachmentLoadOp loadOp; - VkAttachmentStoreOp storeOp; - VkAttachmentLoadOp stencilLoadOp; - VkAttachmentStoreOp stencilStoreOp; - VkImageLayout initialLayout; - VkImageLayout finalLayout; -} VkAttachmentDescription; -``` - -## VkSubpassDescription -```c++ -typedef struct VkSubpassDescription { - VkSubpassDescriptionFlags flags; - VkPipelineBindPoint pipelineBindPoint; - uint32_t inputAttachmentCount; - const VkAttachmentReference* pInputAttachments; - uint32_t colorAttachmentCount; - const VkAttachmentReference* pColorAttachments; - const VkAttachmentReference* pResolveAttachments; - const VkAttachmentReference* pDepthStencilAttachment; - uint32_t preserveAttachmentCount; - const uint32_t* pPreserveAttachments; -} VkSubpassDescription; -``` - -## VkAttachmentReference -```c++ -typedef struct VkAttachmentReference { - uint32_t attachment; - VkImageLayout layout; -} VkAttachmentReference; -``` - -## VkSubpassDependency -```c++ -typedef struct VkSubpassDependency { - uint32_t srcSubpass; - uint32_t dstSubpass; - VkPipelineStageFlags srcStageMask; - VkPipelineStageFlags dstStageMask; - VkAccessFlags srcAccessMask; - VkAccessFlags dstAccessMask; - VkDependencyFlags dependencyFlags; -} VkSubpassDependency; -``` - -According to the Vulkan spec: -- `device` **must** be vald -- `pCreateInfo` **must** point to a valid `VkRenderPassCreateInfo` structure. -- `sType` **must** be `VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO` -- `pNext` **must** be null -- `flags` **must** be 0 -- `attachmentCount` is the number of attachments -- `pAttachments` is a pointer to `attachmentCount` structures or `NULL` if -attachmentCount is 0 -- `subpassCount` is the number of subpasses to create must be >= 1 -- `pSubpasses` is a pointer to `subpassCount` `vkSubpassDescription` structs. -- `dependencyCount` is the number of dependencies between subpasses -- `pDependencies` is a pointer to `dependencyCount` `VkSubpassDependency` -structs. -- `VkAttachmentDescription` - - all parameters must be valid -- `VkSubpassDescription` - - flags **must** be 0 - - `pipelineBindPoint` must be a valid `VkPipelineBindPoint` - - `pInputAttachments` points to `inputAttachmentCount` - `VkAttachmentReference` structures - - `pColorAttachments` points to `colorAttachmentCount` - `VkAttachmentReference` structures - - `pResolveAttachments` is either `NULL` or points to `colorAttachmentCount` - `VkAttachmentReference` structures - - `pDepthStencilAttachment` is either `NULL` or points to a - `VkAttachmentReference` structure - - `pPreserveAttachments` is either `NULL` or points to - `preserveAttachmentCount` `uint32_t*` -- `VkSubpassDependency` - - `srcSubpass` **must** be an index of a valid subpass (< subpassCount) - - `dstSubpass` **must** be an index of a valid subpass (< subpassCount) - - `srcStageMask` **must not** be 0 - - `dstStageMask` **must not** be 0 - - `srcAccessMask` **must** be a combination of `VkAccessFlagsBits` - - `dstAccessMask` **must** be a combination of `VkAccessFlagsBits` - - `dependencyFlags` **must** be a valid combination of `VkDependencyFlagBits` - - -These tests should test the following cases: -- [x] `attachmentCount` == 0 -- [x] `attachmentCount` > 0 -- [x] `subPassCount` == 1 -- [ ] `subPassCount` > 1 -- [ ] `dependencyCount` == 0 -- [ ] `dependencyCount` > 0 -- [ ] `inputAttachmentCount` == 0 -- [ ] `inputAttachmentCount` > 0 -- [x] `colorAttachmentCount` == 0 -- [x] `colorAttachmentCount` > 0 -- [ ] `pResolveAttachments` == nullptr && colorAttachmentCount == 0 -- [ ] `pResolveAttachments` == nullptr && colorAttachmentCount != 0 -- [ ] `pResolveAttachments` != nullptr && colorAttachmentCount > 0 -- [ ] `pDepthStencilAttachment` == nullptr -- [ ] `pDepthStencilAttachment` != nullptr -- [ ] `preserveAttachmentCount` == 0 -- [ ] `preserveAttachmentCount` > 0 -- [x] `srcSubpass` == 0 -- [ ] `srcSubpass` == MaxSubpass - diff --git a/gapid_tests/resource_creation_tests/vkCreateRenderPass_test/main.cpp b/gapid_tests/resource_creation_tests/vkCreateRenderPass_test/main.cpp deleted file mode 100644 index 9aa7040a..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateRenderPass_test/main.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateDefaultInstance(data->allocator(), &wrapper)); - vulkan::VkSurfaceKHR surface(vulkan::CreateDefaultSurface(&instance, data)); - - uint32_t queues[2]; - vulkan::VkDevice device(vulkan::CreateDeviceForSwapchain( - data->allocator(), &instance, &surface, &queues[0], &queues[1], false)); - - vulkan::VkSwapchainKHR swapchain(vulkan::CreateDefaultSwapchain( - &instance, &device, &surface, data->allocator(), queues[0], queues[1], - data)); - - containers::vector images(data->allocator()); - vulkan::LoadContainer(data->logger(), device->vkGetSwapchainImagesKHR, - &images, device, swapchain); - - { // Test1 0 attachments - VkSubpassDescription subpass{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 0, // colorAttachmentCount - nullptr, // pColorAttachments - nullptr, // pResolveAttachments - nullptr, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }; - - VkRenderPassCreateInfo render_pass_create_info = { - VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 0, // attachmentCount - nullptr, // pAttachments - 1, // subpassCount - &subpass, // pSubpasses - 0, // dependencyCount - nullptr // pDependencies - }; - - VkRenderPass raw_render_pass; - LOG_ASSERT(==, data->logger(), - device->vkCreateRenderPass(device, &render_pass_create_info, - nullptr, &raw_render_pass), - VK_SUCCESS); - // So that it can automatically get cleaned up. - device->vkDestroyRenderPass(device, raw_render_pass, nullptr); - } - { // Test2 1 attachment - - VkAttachmentDescription color_attachment{ - 0, // flags - VK_FORMAT_R8G8B8A8_UNORM, // format - VK_SAMPLE_COUNT_1_BIT, // samples - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // loadOp - VK_ATTACHMENT_STORE_OP_STORE, // storeOp - VK_ATTACHMENT_LOAD_OP_DONT_CARE, // stencilLoadOp - VK_ATTACHMENT_STORE_OP_DONT_CARE, // stencilStoreOp - VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, // initialLayout - VK_IMAGE_LAYOUT_PRESENT_SRC_KHR // finalLayout - }; - - VkAttachmentReference color_attachment_reference{ - 0, // attachment - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; - - VkSubpassDescription subpass{ - 0, // flags - VK_PIPELINE_BIND_POINT_GRAPHICS, // pipelineBindPoint - 0, // inputAttachmentCount - nullptr, // pInputAttachments - 1, // colorAttachmentCount - &color_attachment_reference, // pColorAttachments - nullptr, // pResolveAttachments - nullptr, // pDepthStencilAttachment - 0, // preserveAttachmentCount - nullptr // pPreserveAttachments - }; - - VkRenderPassCreateInfo render_pass_create_info = { - VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - 1, // attachmentCount - &color_attachment, // pAttachments - 1, // subpassCount - &subpass, // pSubpasses - 0, // dependencyCount - nullptr // pDependencies - }; - - VkRenderPass raw_render_pass; - LOG_ASSERT(==, data->logger(), - device->vkCreateRenderPass(device, &render_pass_create_info, - nullptr, &raw_render_pass), - VK_SUCCESS); - device->vkDestroyRenderPass(device, raw_render_pass, nullptr); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/vkCreateRenderPass_test/vkCreateRenderPass_test.py b/gapid_tests/resource_creation_tests/vkCreateRenderPass_test/vkCreateRenderPass_test.py deleted file mode 100644 index e1e49aaf..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateRenderPass_test/vkCreateRenderPass_test.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY -from vulkan_constants import * - -RENDER_PASS_CREATE_INFO = [ - ("sType", UINT32_T), ("pNext", POINTER), ("flags", UINT32_T), - ("attachmentCount", UINT32_T), ("pAttachments", POINTER), - ("subpassCount", UINT32_T), ("pSubpasses", POINTER), - ("dependencyCount", UINT32_T), ("pDependencies", POINTER) -] - -ATTACHMENT_DESCRIPTION = [ - ("flags", UINT32_T), ("format", UINT32_T), ("samples", UINT32_T), - ("loadOp", UINT32_T), ("storeOp", UINT32_T), ("stencilLoadOp", UINT32_T), - ("stencilStoreOp", UINT32_T), ("initialLayout", UINT32_T), - ("finalLayout", UINT32_T) -] - -SUBPASS_DESCRIPTION = [ - ("flags", UINT32_T), ("pipelineBindPoint", UINT32_T), - ("inputAttachmentCount", UINT32_T), ("pInputAttachments", POINTER), - ("colorAttachmentCount", UINT32_T), ("pColorAttachments", POINTER), - ("pResolveAttachments", POINTER), ("pDepthStencilAttachment", POINTER), - ("preserveAttachmentCount", UINT32_T), ("pPreserveAttachments", POINTER) -] - -ATTACHMENT_REFERENCE = [("attachment", UINT32_T), ("layout", UINT32_T)] - - -@gapit_test("vkCreateRenderPass_test") -class EmptyPass(GapitTest): - - def expect(self): - architecture = self.architecture - - create_render_pass = require(self.nth_call_of("vkCreateRenderPass", 1)) - destroy_render_pass = require(self.next_call_of("vkDestroyRenderPass")) - - render_pass_create_info = VulkanStruct( - architecture, RENDER_PASS_CREATE_INFO, - get_read_offset_function(create_render_pass, - create_render_pass.hex_pCreateInfo)) - - subpass_info = VulkanStruct(architecture, SUBPASS_DESCRIPTION, - get_read_offset_function( - create_render_pass, - render_pass_create_info.pSubpasses)) - - require_equal(VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, - render_pass_create_info.sType) - require_equal(0, render_pass_create_info.pNext) - require_equal(0, render_pass_create_info.flags) - require_equal(0, render_pass_create_info.attachmentCount) - require_equal(0, render_pass_create_info.pAttachments) - require_equal(1, render_pass_create_info.subpassCount) - require_not_equal(0, render_pass_create_info.pSubpasses) - require_equal(0, render_pass_create_info.dependencyCount) - require_equal(0, render_pass_create_info.pDependencies) - - require_equal(0, subpass_info.flags) - require_equal(VK_PIPELINE_BIND_POINT_GRAPHICS, - subpass_info.pipelineBindPoint) - require_equal(0, subpass_info.inputAttachmentCount) - require_equal(0, subpass_info.pInputAttachments) - require_equal(0, subpass_info.colorAttachmentCount) - require_equal(0, subpass_info.pColorAttachments) - require_equal(0, subpass_info.pResolveAttachments) - require_equal(0, subpass_info.pDepthStencilAttachment) - require_equal(0, subpass_info.preserveAttachmentCount) - require_equal(0, subpass_info.pPreserveAttachments) - - require_not_equal(0, destroy_render_pass.int_renderPass) - require_not_equal(0, destroy_render_pass.int_device) - - -@gapit_test("vkCreateRenderPass_test") -class SingleAttachment(GapitTest): - - def expect(self): - architecture = self.architecture - device_properties = require( - self.next_call_of("vkGetPhysicalDeviceProperties")) - - create_render_pass = require(self.nth_call_of("vkCreateRenderPass", 2)) - destroy_render_pass = require(self.next_call_of("vkDestroyRenderPass")) - - render_pass_create_info = VulkanStruct( - architecture, RENDER_PASS_CREATE_INFO, - get_read_offset_function(create_render_pass, - create_render_pass.hex_pCreateInfo)) - subpass_info = VulkanStruct(architecture, SUBPASS_DESCRIPTION, - get_read_offset_function( - create_render_pass, - render_pass_create_info.pSubpasses)) - - attachment_description = VulkanStruct( - architecture, ATTACHMENT_DESCRIPTION, - get_read_offset_function(create_render_pass, - render_pass_create_info.pAttachments)) - - attachment_reference = VulkanStruct(architecture, ATTACHMENT_REFERENCE, - get_read_offset_function( - create_render_pass, - subpass_info.pColorAttachments)) - - require_equal(VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, - render_pass_create_info.sType) - require_equal(0, render_pass_create_info.pNext) - require_equal(0, render_pass_create_info.flags) - require_equal(1, render_pass_create_info.attachmentCount) - require_not_equal(0, render_pass_create_info.pAttachments) - require_equal(1, render_pass_create_info.subpassCount) - require_not_equal(0, render_pass_create_info.pSubpasses) - require_equal(0, render_pass_create_info.dependencyCount) - require_equal(0, render_pass_create_info.pDependencies) - - require_equal(0, subpass_info.flags) - require_equal(VK_PIPELINE_BIND_POINT_GRAPHICS, - subpass_info.pipelineBindPoint) - require_equal(0, subpass_info.inputAttachmentCount) - require_equal(0, subpass_info.pInputAttachments) - require_equal(1, subpass_info.colorAttachmentCount) - require_not_equal(0, subpass_info.pColorAttachments) - require_equal(0, subpass_info.pResolveAttachments) - require_equal(0, subpass_info.pDepthStencilAttachment) - require_equal(0, subpass_info.preserveAttachmentCount) - require_equal(0, subpass_info.pPreserveAttachments) - - require_equal(0, attachment_description.flags) - require_equal(VK_FORMAT_R8G8B8A8_UNORM, attachment_description.format) - require_equal(VK_SAMPLE_COUNT_1_BIT, attachment_description.samples) - require_equal(VK_ATTACHMENT_LOAD_OP_DONT_CARE, - attachment_description.loadOp) - require_equal(VK_ATTACHMENT_STORE_OP_STORE, - attachment_description.storeOp) - require_equal(VK_ATTACHMENT_LOAD_OP_DONT_CARE, - attachment_description.stencilLoadOp) - require_equal(VK_ATTACHMENT_STORE_OP_DONT_CARE, - attachment_description.stencilStoreOp) - require_equal(VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, - attachment_description.initialLayout) - require_equal(VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, - attachment_description.finalLayout) - - require_equal(0, attachment_reference.attachment) - require_equal(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, - attachment_reference.layout) - - require_not_equal(0, destroy_render_pass.int_renderPass) - require_not_equal(0, destroy_render_pass.int_device) diff --git a/gapid_tests/resource_creation_tests/vkCreateShaderModule_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/vkCreateShaderModule_test/CMakeLists.txt deleted file mode 100644 index 72f6bc64..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateShaderModule_test/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCreateShaderModule_test - SOURCES main.cpp - LIBS - vulkan_helpers - SHADERS - shader_library -) diff --git a/gapid_tests/resource_creation_tests/vkCreateShaderModule_test/README.md b/gapid_tests/resource_creation_tests/vkCreateShaderModule_test/README.md deleted file mode 100644 index 0a14a1e0..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateShaderModule_test/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# vkCreateShadermodule / vkDestroyShaderModule - -## Signatures -```c++ -VkResult vkCreateShaderModule( - VkDevice device, - const VkShaderModuleCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkShaderModule* pShaderModule); - -void vkDestroyShaderModule( - VkDevice device, - VkShaderModule shaderModule, - const VkAllocationCallbacks* pAllocator); -``` - -# VkSwapchainCreateInfoKHR -```c++ -typedef struct VkShaderModuleCreateInfo { - VkStructureType sType; - const void* pNext; - VkShaderModuleCreateFlags flags; - size_t codeSize; - const uint32_t* pCode; -} VkShaderModuleCreateInfo; -``` - - -According to the Vulkan spec: -- `pCreateInfo` **must** be a pointer to a valid `VkShaderModuleCreateInfo` -structure -- `pNext` **must** be `nullptr` -- `flags` **must** be `0` -- `pCode` is a pointer to `codeSize/4` uint32_t values representing the spirv. - -These tests should test the following cases: -- [x] Valid usage \ No newline at end of file diff --git a/gapid_tests/resource_creation_tests/vkCreateShaderModule_test/main.cpp b/gapid_tests/resource_creation_tests/vkCreateShaderModule_test/main.cpp deleted file mode 100644 index fb903454..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateShaderModule_test/main.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -uint32_t test_shader[] = -#include "test.vert.spv" - ; - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateDefaultInstance(data->allocator(), &wrapper)); - vulkan::VkDevice device( - vulkan::CreateDefaultDevice(data->allocator(), instance, true)); - - { // Valid usage - - VkShaderModuleCreateInfo create_info{ - VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO, // sType - nullptr, // pNext - 0, // flags - sizeof(test_shader), // codeSize - test_shader // pCode - }; - - VkShaderModule shader_module; - LOG_ASSERT(==, data->logger(), - device->vkCreateShaderModule(device, &create_info, nullptr, - &shader_module), - VK_SUCCESS); - device->vkDestroyShaderModule(device, shader_module, nullptr); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/vkCreateShaderModule_test/vkCreateShaderModule_test.py b/gapid_tests/resource_creation_tests/vkCreateShaderModule_test/vkCreateShaderModule_test.py deleted file mode 100644 index ecae8a2c..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateShaderModule_test/vkCreateShaderModule_test.py +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY -from vulkan_constants import * - - -@gapit_test("vkCreateShaderModule_test") -class ShaderModuleTest(GapitTest): - - def expect(self): - architecture = self.architecture - device_properties = require( - self.next_call_of("vkGetPhysicalDeviceProperties")) - - create_shader_module = require( - self.next_call_of("vkCreateShaderModule")) - destroy_shader_module = require( - self.next_call_of("vkDestroyShaderModule")) - - shader_module_create_info = VulkanStruct( - architecture, [("sType", UINT32_T), ("pNext", POINTER), - ("flags", UINT32_T), ("codeSize", SIZE_T), - ("pCode", POINTER)], - get_read_offset_function(create_shader_module, - create_shader_module.hex_pCreateInfo)) - - require_equal(shader_module_create_info.sType, - VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO) - require_equal(shader_module_create_info.pNext, 0) - require_equal(shader_module_create_info.flags, 0) - require_not_equal(shader_module_create_info.codeSize, 0) - require_not_equal(0, shader_module_create_info.pCode) - - _ = require( - create_shader_module.get_read_data( - shader_module_create_info.pCode, - shader_module_create_info.codeSize)) - - require_not_equal(0, destroy_shader_module.int_device) - require_not_equal(0, destroy_shader_module.int_shaderModule) diff --git a/gapid_tests/resource_creation_tests/vkCreateSwapchainKHR_test/CMakeLists.txt b/gapid_tests/resource_creation_tests/vkCreateSwapchainKHR_test/CMakeLists.txt deleted file mode 100644 index 380c8815..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateSwapchainKHR_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCreateSwapchainKHR_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/resource_creation_tests/vkCreateSwapchainKHR_test/README.md b/gapid_tests/resource_creation_tests/vkCreateSwapchainKHR_test/README.md deleted file mode 100644 index 5de5193c..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateSwapchainKHR_test/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# vkCreateSwapchainKHR / vkDestroySwapchainKHR - -## Signatures -```c++ -VkResult vkCreateSwapchainKHR( - VkDevice device, - const VkSwapchainCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkSwapchainKHR* pSwapchain); - -void vkDestroySwapchainKHR( - VkDevice device, - VkSwapchainKHR swapchain, - const VkAllocationCallbacks* pAllocator); -``` - -# VkSwapchainCreateInfoKHR -```c++ -typedef struct VkSwapchainCreateInfoKHR { - VkStructureType sType; - const void* pNext; - VkSwapchainCreateFlagsKHR flags; - VkSurfaceKHR surface; - uint32_t minImageCount; - VkFormat imageFormat; - VkColorSpaceKHR imageColorSpace; - VkExtent2D imageExtent; - uint32_t imageArrayLayers; - VkImageUsageFlags imageUsage; - VkSharingMode imageSharingMode; - uint32_t queueFamilyIndexCount; - const uint32_t* pQueueFamilyIndices; - VkSurfaceTransformFlagBitsKHR preTransform; - VkCompositeAlphaFlagBitsKHR compositeAlpha; - VkPresentModeKHR presentMode; - VkBool32 clipped; - VkSwapchainKHR oldSwapchain; -} VkSwapchainCreateInfoKHR; -``` - - -According to the Vulkan spec: -- `pCreateInfo` **must** be a pointer to a valid `VkSwapchainCreateInfoKHR` -structure -- `flags` **must** be 0 -- `imageFormat` **must** be valid -- `imageColorSpace` **must** be valid -- `imageUsage` **must** be a valid combination of `VkImageUsageFlagBits` values -- `preTransform` **must** be valid -- `compositeAlpha` **must** be valid -- `oldSwapchain` is either null OR a valid `VkSwapchainKHR` -- `surface` **must** be a supported device as given by -`vkGetPhysicalDeviceSurfaceSupportKHR` -- The native window that `surface` **must not** be associated with a swapchain -that is not `oldSwapchain` -- `minImageCount` **must** be >= `minImageCount` from `VkSurfaceCapabilitiesKHR` -- `minImageCount` **must** be <= `maxImageCount` from `VkSurfaceCapabilitiesKHR` -- `imageFormat` and `imageColorSpace` **must** match at least one - of `vkGetPhysicalDeviceSurfaceFormatsKHR` -- `imageExtent` **must** be between `minImageExtent` and `maxImageExtent` from - `VkSurfaceCapabilitiesKHR` -- `imageArrayLayers` **must** > 0 && < `maxImageLayers` from - `VkSurfaceCapabilitiesKHR` -- `imageUsage` **must** a subset of `supportedUsageFlags` of - `VkSurfaceCapabilitiesKHR` -- If `imageSharingMode` is `VK_SHARING_MODE_CONCURRENT` `pQueueFamilyIndices` && - `queueFamilyIndexCount` **must** be valid -- `preTransform` **must** be one of the `supportedTransforms` in - `VkSurfaceCapabilitiesKHR` -- `compositeAlpha` **must** be one of the `supportedCompositeAlpha` in - `VkSurfaceCapabilitiesKHR` -- `presentMode` **must** be one of the values returned by - `vkGetPhysicalDeviceSurfacePresentModesKHR` - - -These tests should test the following cases: -- [x] `oldSwapchain` is null -- [ ] `oldSwapchain` is not null -- [ ] `minImageCount` is min or > min -- [x] `queueFamilyIndexCount` > 0 -- [ ] `imageFormat` is first or not first format -- [ ] `imageExtent` is min or maxImageCount -- [x] `imageSharingMode` > 1 queue. -- [ ] `preTransform` is identity or not -- [ ] `presentMode` is first or != first present mode \ No newline at end of file diff --git a/gapid_tests/resource_creation_tests/vkCreateSwapchainKHR_test/main.cpp b/gapid_tests/resource_creation_tests/vkCreateSwapchainKHR_test/main.cpp deleted file mode 100644 index 1bd50cf1..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateSwapchainKHR_test/main.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateDefaultInstance(data->allocator(), &wrapper)); - vulkan::VkSurfaceKHR surface(vulkan::CreateDefaultSurface(&instance, data)); - - uint32_t queues[2]; - vulkan::VkDevice device(vulkan::CreateDeviceForSwapchain( - data->allocator(), &instance, &surface, &queues[0], &queues[1], false)); - bool has_multiple_queues = queues[0] != queues[1]; - - VkSurfaceCapabilitiesKHR surface_caps; - LOG_ASSERT(==, data->logger(), - instance->vkGetPhysicalDeviceSurfaceCapabilitiesKHR( - device.physical_device(), surface, &surface_caps), - VK_SUCCESS); - - uint32_t num_formats = 0; - LOG_ASSERT(==, data->logger(), - instance->vkGetPhysicalDeviceSurfaceFormatsKHR( - device.physical_device(), surface, &num_formats, nullptr), - VK_SUCCESS); - - containers::vector surface_formats(data->allocator()); - surface_formats.resize(num_formats); - LOG_ASSERT(==, data->logger(), - instance->vkGetPhysicalDeviceSurfaceFormatsKHR( - device.physical_device(), surface, &num_formats, - surface_formats.data()), - VK_SUCCESS); - - uint32_t num_present_modes = 0; - - LOG_ASSERT( - ==, data->logger(), - instance->vkGetPhysicalDeviceSurfacePresentModesKHR( - device.physical_device(), surface, &num_present_modes, nullptr), - VK_SUCCESS); - containers::vector present_modes(data->allocator()); - present_modes.resize(num_present_modes); - LOG_ASSERT(==, data->logger(), - instance->vkGetPhysicalDeviceSurfacePresentModesKHR( - device.physical_device(), surface, &num_present_modes, - present_modes.data()), - VK_SUCCESS); - - data->logger()->LogInfo("Created device for rendering to a swapchain"); - data->logger()->LogInfo(" Graphics Queue: ", queues[0]); - data->logger()->LogInfo(" Present Queue: ", queues[1]); - - uint32_t chosenAlpha = - static_cast(surface_caps.supportedCompositeAlpha); - - chosenAlpha = vulkan::GetLSB(chosenAlpha); - - VkExtent2D image_extent(surface_caps.currentExtent); - if (image_extent.width == 0xFFFFFFFF) { - image_extent = VkExtent2D{100, 100}; - } - - VkSwapchainCreateInfoKHR swapchainCreateInfo{ - VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR, // sType - nullptr, // pNext - 0, // flags - surface, // surface - surface_caps.minImageCount, // minImageCount - surface_formats[0].format, // surfaceFormat - surface_formats[0].colorSpace, // colorSpace - image_extent, // imageExtent - 1, // imageArrayLayers - VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, // imageUsage - has_multiple_queues ? VK_SHARING_MODE_CONCURRENT - : VK_SHARING_MODE_EXCLUSIVE, // sharingMode - has_multiple_queues ? 2u : 0u, - has_multiple_queues ? queues : nullptr, // pQueueFamilyIndices - surface_caps.currentTransform, // preTransform, - static_cast(chosenAlpha), // compositeAlpha - present_modes.front(), // presentModes - false, // clipped - VK_NULL_HANDLE // oldSwapchain - }; - - VkSwapchainKHR swapchain; - - LOG_ASSERT(==, data->logger(), - device->vkCreateSwapchainKHR(device, &swapchainCreateInfo, nullptr, - &swapchain), - VK_SUCCESS); - - device->vkDestroySwapchainKHR(device, swapchain, nullptr); - - data->logger()->LogInfo("Device ID: ", device.device_id()); - data->logger()->LogInfo("Vendor ID: ", device.vendor_id()); - data->logger()->LogInfo("driver version: ", device.driver_version()); - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/resource_creation_tests/vkCreateSwapchainKHR_test/vkCreateSwapchainKHR_test.py b/gapid_tests/resource_creation_tests/vkCreateSwapchainKHR_test/vkCreateSwapchainKHR_test.py deleted file mode 100644 index 7b67ebd2..00000000 --- a/gapid_tests/resource_creation_tests/vkCreateSwapchainKHR_test/vkCreateSwapchainKHR_test.py +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest -from struct_offsets import VulkanStruct, UINT32_T, SIZE_T, POINTER -from struct_offsets import HANDLE, FLOAT, CHAR, ARRAY -from vulkan_constants import * - - -@gapit_test("vkCreateSwapchainKHR_test") -class SwapchainCreateTest(GapitTest): - - def expect(self): - architecture = self.architecture - device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - - createSwapchain = require(self.next_call_of("vkCreateSwapchainKHR")) - destroySwapchain = require(self.next_call_of("vkDestroySwapchainKHR")) - - def get_swapchain_create_info_member(offset, size): - return little_endian_bytes_to_int(require( - createSwapchain.get_read_data(createSwapchain.hex_pCreateInfo + - offset, size))) - - swapchain_create_info = VulkanStruct( - architecture, - [("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T), - ("surface", HANDLE), - ("minImageCount", UINT32_T), - ("imageFormat", UINT32_T), - ("imageColorSpace", UINT32_T), - ("extent.width", UINT32_T), - ("extent.height", UINT32_T), - ("imageArrayLayers", UINT32_T), - ("imageUsage", UINT32_T), - ("imageSharingMode", UINT32_T), - ("queueFamilyIndexCount", UINT32_T), - ("queueFamilyIndices", POINTER), - ("preTransform", UINT32_T), - ("compositeAlpha", UINT32_T), - ("presentMode", UINT32_T), - ("clipped", UINT32_T), - ("oldSwapchain", HANDLE) # oldSwapchain - ], - get_swapchain_create_info_member) - - require_equal(swapchain_create_info.sType, - VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR) - - require_equal(swapchain_create_info.oldSwapchain, 0) - require_equal(swapchain_create_info.clipped, 0) - require_equal(swapchain_create_info.imageArrayLayers, 1) - require_not_equal(0, destroySwapchain.int_swapchain) - require_equal(True, (swapchain_create_info.queueFamilyIndexCount == 0 or - swapchain_create_info.queueFamilyIndexCount == 2)) diff --git a/gapid_tests/synchronization_tests/CMakeLists.txt b/gapid_tests/synchronization_tests/CMakeLists.txt deleted file mode 100644 index 7918d4bb..00000000 --- a/gapid_tests/synchronization_tests/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -add_vulkan_subdirectory(Event_test) -add_vulkan_subdirectory(Fence_test) -add_vulkan_subdirectory(vkCmdPipelineBarrier_test) -add_vulkan_subdirectory(vkDeviceWaitIdle_test) diff --git a/gapid_tests/synchronization_tests/Event_test/CMakeLists.txt b/gapid_tests/synchronization_tests/Event_test/CMakeLists.txt deleted file mode 100644 index e0e23ca6..00000000 --- a/gapid_tests/synchronization_tests/Event_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(Event_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/synchronization_tests/Event_test/Event_test.py b/gapid_tests/synchronization_tests/Event_test/Event_test.py deleted file mode 100644 index 2088129b..00000000 --- a/gapid_tests/synchronization_tests/Event_test/Event_test.py +++ /dev/null @@ -1,394 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal, require_true -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from struct_offsets import VulkanStruct, UINT32_T, ARRAY, UINT64_T, POINTER, HANDLE -from vulkan_constants import * - -EVENT_CREATE_INFO = [ - ("sType", UINT32_T), ("pNext", POINTER), ("flags", UINT32_T) -] - -BUFFER_SIZE = 4 - - -def GetCreatedEvent(architecture, create_event): - require_equal(VK_SUCCESS, int(create_event.return_val)) - require_not_equal(0, create_event.int_device) - require_not_equal(0, create_event.hex_pCreateInfo) - require_not_equal(0, create_event.hex_pEvent) - - create_info = VulkanStruct(architecture, EVENT_CREATE_INFO, - get_read_offset_function( - create_event, create_event.hex_pCreateInfo)) - require_equal(VK_STRUCTURE_TYPE_EVENT_CREATE_INFO, create_info.sType) - require_equal(0, create_info.pNext) - require_equal(0, create_info.flags) - - event = little_endian_bytes_to_int(require(create_event.get_write_data( - create_event.hex_pEvent, NON_DISPATCHABLE_HANDLE_SIZE))) - return event - - -def GetMappedLocation(test): - require(test.nth_call_of("vkDestroyBuffer", 3)) - map_coherent_memory = require(test.next_call_of("vkMapMemory")) - require_equal(VK_SUCCESS, int(map_coherent_memory.return_val)) - require_not_equal(0, map_coherent_memory.int_device) - require_not_equal(0, map_coherent_memory.int_memory) - # All vkMapMemory called in this test has offset 0. - require_equal(0, map_coherent_memory.int_offset) - require_true(map_coherent_memory.int_size >= BUFFER_SIZE) - require_equal(0, map_coherent_memory.int_flags) - require_not_equal(0, map_coherent_memory.hex_ppData) - pData = little_endian_bytes_to_int(require(map_coherent_memory.get_write_data( - map_coherent_memory.hex_ppData, test.architecture.int_pointerSize))) - return pData - - -def GetStart(test, index): - while index > 0: - get_device_proc = require(test.next_call_of("vkGetDeviceProcAddr")) - if get_device_proc.pName == "TAG": - index -= 1 - - -@gapit_test("Event_test") -class BasicHostSideCommandTest(GapitTest): - - def expect(self): - architecture = self.architecture - GetStart(self, 1) - create_event = require(self.next_call_of("vkCreateEvent")) - device = create_event.int_device - first_status = require(self.next_call_of("vkGetEventStatus")) - set_event = require(self.next_call_of("vkSetEvent")) - second_status = require(self.next_call_of("vkGetEventStatus")) - reset_event = require(self.next_call_of("vkResetEvent")) - third_status = require(self.next_call_of("vkGetEventStatus")) - destroy_event = require(self.next_call_of("vkDestroyEvent")) - - # Check vkCreateEvent - event = GetCreatedEvent(architecture, create_event) - require_not_equal(0, event) - - # Check the first status - require_equal(device, first_status.int_device) - require_equal(event, first_status.int_event) - require_equal(VK_EVENT_RESET, int(first_status.return_val)) - - # Check the vkSetEvent - require_equal(device, set_event.int_device) - require_equal(event, set_event.int_event) - require_equal(VK_SUCCESS, int(set_event.return_val)) - - # Check the second status - require_equal(device, second_status.int_device) - require_equal(event, second_status.int_event) - require_equal(VK_EVENT_SET, int(second_status.return_val)) - - # Check the vkResetEvent - require_equal(device, reset_event.int_device) - require_equal(event, reset_event.int_event) - require_equal(VK_SUCCESS, int(reset_event.return_val)) - - # Check the third status - require_equal(device, third_status.int_device) - require_equal(event, third_status.int_event) - require_equal(VK_EVENT_RESET, int(third_status.return_val)) - - # Check the vkDestroyEvent - require_equal(device, destroy_event.int_device) - require_equal(event, destroy_event.int_event) - - -@gapit_test("Event_test") -class SingleThreadTest(GapitTest): - - def expect(self): - pData = GetMappedLocation(self) - GetStart(self, 2) - require(self.next_call_of("vkAllocateCommandBuffers")) - require(self.next_call_of("vkCreateBuffer")) - require(self.next_call_of("vkCreateBuffer")) - require(self.next_call_of("vkCreateEvent")) - require(self.next_call_of("vkCreateEvent")) - - # submit -> update -> set -> wait idle - require(self.next_call_of("vkCmdWaitEvents")) - require(self.next_call_of("vkCmdCopyBuffer")) - require(self.next_call_of("vkQueueSubmit")) - set_event = require(self.next_call_of("vkSetEvent")) - require(self.next_call_of("vkQueueWaitIdle")) - require(self.next_call_of("vkResetEvent")) - require_equal(0x11111111, little_endian_bytes_to_int(require( - set_event.get_read_data(pData, BUFFER_SIZE)))) - - # update -> set -> submit -> wait idle - require(self.next_call_of("vkSetEvent")) - require(self.next_call_of("vkCmdWaitEvents")) - submit = require(self.next_call_of("vkQueueSubmit")) - require(self.next_call_of("vkQueueWaitIdle")) - require(self.next_call_of("vkResetEvent")) - require_equal(0x22222222, little_endian_bytes_to_int(require( - submit.get_read_data(pData, BUFFER_SIZE)))) - - # submit [cmdSetEvent (multiple), ... cmdWaitEvents] - require(self.next_call_of("vkCmdSetEvent")) - require(self.next_call_of("vkCmdSetEvent")) - require(self.next_call_of("vkCmdWaitEvents")) - require(self.next_call_of("vkCmdCopyBuffer")) - submit = require(self.next_call_of("vkQueueSubmit")) - require(self.next_call_of("vkQueueWaitIdle")) - require(self.next_call_of("vkResetEvent")) - require(self.next_call_of("vkResetEvent")) - require_equal(0x33333333, little_endian_bytes_to_int(require( - submit.get_read_data(pData, BUFFER_SIZE)))) - - # submit [cmdSetEvent] -> submit [cmdWaitEvents] - require(self.next_call_of("vkCmdSetEvent")) - require(self.next_call_of("vkQueueSubmit")) - require(self.next_call_of("vkCmdWaitEvents")) - require(self.next_call_of("vkCmdCopyBuffer")) - submit = require(self.next_call_of("vkQueueSubmit")) - require(self.next_call_of("vkQueueWaitIdle")) - require(self.next_call_of("vkResetEvent")) - require_equal(0x44444444, little_endian_bytes_to_int(require( - submit.get_read_data(pData, BUFFER_SIZE)))) - - -@gapit_test("Event_test") -class MultipleThreadTest(GapitTest): - - def expect(self): - pData = GetMappedLocation(self) - GetStart(self, 3) - require(self.next_call_of("vkAllocateCommandBuffers")) - require(self.next_call_of("vkCreateBuffer")) - require(self.next_call_of("vkCreateBuffer")) - require(self.next_call_of("vkCreateEvent")) - require(self.next_call_of("vkCreateEvent")) - - # Thread 1: submit [vkCmdWaitEvents] -> -> queue wait idle - # Thread 2: setEvent - require(self.next_call_of("vkCmdWaitEvents")) - require(self.next_call_of("vkCmdCopyBuffer")) - require(self.next_call_of("vkQueueSubmit")) - set_event = require(self.next_call_of("vkSetEvent")) - require(self.next_call_of("vkQueueWaitIdle")) - require(self.next_call_of("vkResetEvent")) - require_equal(0x11111111, little_endian_bytes_to_int(require( - set_event.get_read_data(pData, BUFFER_SIZE)))) - - # Thread 1: submit [vkCmdWaitEvents (multiple events)] -> -> queue idle - # Thread 2: setEvent(s) - require(self.next_call_of("vkCmdWaitEvents")) - require(self.next_call_of("vkCmdCopyBuffer")) - require(self.next_call_of("vkQueueSubmit")) - require(self.next_call_of("vkSetEvent")) - second_set_event = require(self.next_call_of("vkSetEvent")) - require(self.next_call_of("vkQueueWaitIdle")) - require(self.next_call_of("vkResetEvent")) - require(self.next_call_of("vkResetEvent")) - require_equal(0x33333333, little_endian_bytes_to_int(require( - second_set_event.get_read_data(pData, BUFFER_SIZE)))) - - # Thread 1: submit [wait, reset, semaphore, fence]-> submit [wait]-> idle - # Thread 2: setEvent -> setEvent - require(self.next_call_of("vkCmdWaitEvents")) - require(self.next_call_of("vkCmdCopyBuffer")) - require(self.next_call_of("vkCmdResetEvent")) - require(self.next_call_of("vkQueueSubmit")) - require(self.next_call_of("vkCmdWaitEvents")) - require(self.next_call_of("vkCmdCopyBuffer")) - require(self.next_call_of("vkQueueSubmit")) - - first_set = require(self.next_call_of("vkSetEvent")) - second_set = require(self.next_call_of("vkSetEvent")) - require(self.next_call_of("vkQueueWaitIdle")) - require(self.next_call_of("vkResetEvent")) - require_equal(0x44444444, little_endian_bytes_to_int(require( - first_set.get_read_data(pData, BUFFER_SIZE)))) - require_equal(0x55555555, little_endian_bytes_to_int(require( - second_set.get_read_data(pData, BUFFER_SIZE)))) - - # Thread 1: submit [wait x, wait y] -> idle - # Thread 2: set y -> set x - require(self.next_call_of("vkCmdWaitEvents")) - require(self.next_call_of("vkCmdWaitEvents")) - require(self.next_call_of("vkCmdCopyBuffer")) - require(self.next_call_of("vkQueueSubmit")) - require(self.next_call_of("vkSetEvent")) - second_set = require(self.next_call_of("vkSetEvent")) - require(self.next_call_of("vkQueueWaitIdle")) - require(self.next_call_of("vkResetEvent")) - require(self.next_call_of("vkResetEvent")) - - require_equal(0x77777777, little_endian_bytes_to_int(require( - second_set.get_read_data(pData, BUFFER_SIZE)))) - - -def GetCreatedBuffer(create_buffer): - require_equal(VK_SUCCESS, int(create_buffer.return_val)) - require_not_equal(0, create_buffer.int_device) - require_not_equal(0, create_buffer.hex_pCreateInfo) - require_not_equal(0, create_buffer.hex_pBuffer) - - buf = little_endian_bytes_to_int(require(create_buffer.get_write_data( - create_buffer.hex_pBuffer, NON_DISPATCHABLE_HANDLE_SIZE))) - return buf - - -def GetCreatedImage(create_image): - require_equal(VK_SUCCESS, int(create_image.return_val)) - require_not_equal(0, create_image.int_device) - require_not_equal(0, create_image.hex_pCreateInfo) - require_not_equal(0, create_image.hex_pImage) - - img = little_endian_bytes_to_int(require(create_image.get_write_data( - create_image.hex_pImage, NON_DISPATCHABLE_HANDLE_SIZE))) - return img - - -@gapit_test("Event_test") -class MemoryBarrierTest(GapitTest): - - def expect(self): - architecture = self.architecture - GetStart(self, 4) - require(self.next_call_of("vkAllocateCommandBuffers")) - src_buf = GetCreatedBuffer( - require(self.next_call_of("vkCreateBuffer"))) - dst_buf = GetCreatedBuffer( - require(self.next_call_of("vkCreateBuffer"))) - img = GetCreatedImage(require(self.next_call_of("vkCreateImage"))) - event = GetCreatedEvent(architecture, - require(self.next_call_of("vkCreateEvent"))) - - wait_events = require(self.next_call_of("vkCmdWaitEvents")) - require(self.next_call_of("vkCmdCopyBuffer")) - require(self.next_call_of("vkQueueSubmit")) - require(self.next_call_of("vkSetEvent")) - require(self.next_call_of("vkQueueWaitIdle")) - - # Check vkCmdWaitEvents - require_equal(1, wait_events.int_eventCount) - require_not_equal(0, wait_events.hex_pEvents) - require_equal( - event, - little_endian_bytes_to_int(require(wait_events.get_read_data( - wait_events.hex_pEvents, NON_DISPATCHABLE_HANDLE_SIZE)))) - require_equal(VK_PIPELINE_STAGE_HOST_BIT, wait_events.int_srcStageMask) - require_equal(VK_PIPELINE_STAGE_TRANSFER_BIT, - wait_events.int_dstStageMask) - - require_equal(1, wait_events.int_memoryBarrierCount) - memory_barrier = VulkanStruct(architecture, [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("srcAccessMask", UINT32_T), - ("dstAccessMask", UINT32_T), - ], get_read_offset_function(wait_events, wait_events.hex_pMemoryBarriers)) - require_equal(VK_STRUCTURE_TYPE_MEMORY_BARRIER, memory_barrier.sType) - require_equal(0, memory_barrier.pNext) - require_equal(VK_ACCESS_HOST_WRITE_BIT, memory_barrier.srcAccessMask) - require_equal(VK_ACCESS_TRANSFER_WRITE_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, - memory_barrier.dstAccessMask) - - BUFFER_MEMORY_BARRIER = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("srcAccessMask", UINT32_T), - ("dstAccessMask", UINT32_T), - ("srcQueueFamilyIndex", UINT32_T), - ("dstQueueFamilyIndex", UINT32_T), - ("buffer", HANDLE), - ("offset", UINT64_T), - ("size", UINT64_T), - ] - - require_equal(2, wait_events.int_bufferMemoryBarrierCount) - first_buffer_barrier = VulkanStruct( - architecture, BUFFER_MEMORY_BARRIER, get_read_offset_function( - wait_events, wait_events.hex_pBufferMemoryBarriers)) - require_equal(VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, - first_buffer_barrier.sType) - require_equal(0, first_buffer_barrier.pNext) - require_equal(0, first_buffer_barrier.srcAccessMask) - require_equal(VK_ACCESS_TRANSFER_WRITE_BIT, - first_buffer_barrier.dstAccessMask) - require_equal(VK_QUEUE_FAMILY_IGNORED, - first_buffer_barrier.srcQueueFamilyIndex) - require_equal(VK_QUEUE_FAMILY_IGNORED, - first_buffer_barrier.dstQueueFamilyIndex) - require_equal(dst_buf, first_buffer_barrier.buffer) - require_equal(0, first_buffer_barrier.offset) - require_equal(BUFFER_SIZE, first_buffer_barrier.size) - - second_buffer_barrier = VulkanStruct( - architecture, BUFFER_MEMORY_BARRIER, get_read_offset_function( - wait_events, wait_events.hex_pBufferMemoryBarriers + - first_buffer_barrier.total_size)) - require_equal(VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, - second_buffer_barrier.sType) - require_equal(0, second_buffer_barrier.pNext) - require_equal(VK_ACCESS_HOST_WRITE_BIT, - second_buffer_barrier.srcAccessMask) - require_equal(VK_ACCESS_TRANSFER_READ_BIT, - second_buffer_barrier.dstAccessMask) - require_equal(VK_QUEUE_FAMILY_IGNORED, - second_buffer_barrier.srcQueueFamilyIndex) - require_equal(VK_QUEUE_FAMILY_IGNORED, - second_buffer_barrier.dstQueueFamilyIndex) - require_equal(src_buf, second_buffer_barrier.buffer) - require_equal(0, second_buffer_barrier.offset) - require_equal(BUFFER_SIZE, second_buffer_barrier.size) - - require_equal(1, wait_events.int_imageMemoryBarrierCount) - image_barrier = VulkanStruct(architecture, [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("srcAccessMask", UINT32_T), - ("dstAccessMask", UINT32_T), - ("oldLayout", UINT32_T), - ("newLayout", UINT32_T), - ("srcQueueFamilyIndex", UINT32_T), - ("dstQueueFamilyIndex", UINT32_T), - ("image", HANDLE), - ("subresourceRange_aspectMask", UINT32_T), - ("subresourceRange_baseMipLevel", UINT32_T), - ("subresourceRange_levelCount", UINT32_T), - ("subresourceRange_baseArrayLayer", UINT32_T), - ("subresourceRange_layerCount", UINT32_T), - ], get_read_offset_function(wait_events, - wait_events.hex_pImageMemoryBarriers)) - require_equal(VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, - image_barrier.sType) - require_equal(0, image_barrier.pNext) - require_equal(0, image_barrier.srcAccessMask) - require_equal(VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, - image_barrier.dstAccessMask) - require_equal(VK_IMAGE_LAYOUT_UNDEFINED, image_barrier.oldLayout) - require_equal(VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, - image_barrier.newLayout) - require_equal(VK_QUEUE_FAMILY_IGNORED, - image_barrier.srcQueueFamilyIndex) - require_equal(VK_QUEUE_FAMILY_IGNORED, - image_barrier.dstQueueFamilyIndex) - require_equal(img, image_barrier.image) - require_equal(VK_IMAGE_ASPECT_COLOR_BIT, - image_barrier.subresourceRange_aspectMask) - require_equal(0, image_barrier.subresourceRange_baseMipLevel) - require_equal(1, image_barrier.subresourceRange_levelCount) - require_equal(0, image_barrier.subresourceRange_baseArrayLayer) - require_equal(1, image_barrier.subresourceRange_layerCount) diff --git a/gapid_tests/synchronization_tests/Event_test/README.md b/gapid_tests/synchronization_tests/Event_test/README.md deleted file mode 100644 index cb79f2c3..00000000 --- a/gapid_tests/synchronization_tests/Event_test/README.md +++ /dev/null @@ -1,136 +0,0 @@ -# vkCreateEvent / vkDestroyEvent / vkGetEventStatus / vkSetEvent / vkResetEvent - -## Signatures -```c++ -VkResult vkCreateEvent( - VkDevice device, - const VkEventCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkEvent* pEvent); - -void vkDestroyEvent( - VkDevice device, - VkEvent event, - const VkAllocationCallbacks* pAllocator); - -VkResult vkGetEventStatus( - VkDevice device, - VkEvent event); - -VkResult vkSetEvent( - VkDevice device, - VkEvent event); - -VkResult vkResetEvent( - VkDevice device, - VkEvent event); -``` - -# VkEventCreateInfo -```c++ -typedef struct VkEventCreateInfo { - VkStructureType sType; - const void* pNext; - VkEventCreateFlags flags; -} VkEventCreateInfo; - -``` - -According to the Vulkan spec: -- VkEventCreateInfo - - `flags` **must** be 0 -- vkGetEventStatus - - If a `vkCmdSetEvent` or `vkCmdResetEvent` command is in a command buffer - that is in the *pending state*, then the value returned by this command may - immediately be out of date. -- vkSetEvent - - If `event` is already in the signaled state when `vkSetEvent` is executed, - then `vkSetEvent` has no effect, and no event signal operation occurs. -- vkResetEvent - - If `event` is already i the unsignaled state when `vkResetEvent` is - executed, then `vkResetEvent` has no effect, and no event unsignal operation - occurs. - -These tests should test the following cases: -- [x] `vkCreateEvent` and `vkDestroyEvent` -- [x] `vkGetEventStatus` -- [x] `vkSetEvent` and `vkResetEvent` - -# vkCmdSetEvent / vkCmdResetEvent / vkCmdWaitEvent - -## Signatures -```c++ -void vkCmdSetEvent( - VkCommandBuffer commandBuffer, - VkEvent event, - VkPipelineStageFlags stageMask); - -void vkCmdResetEvent( - VkCommandBuffer commandBuffer, - VkEvent event, - VkPipelineStageFlags stageMask); - -void vkCmdWaitEvents( - VkCommandBuffer commandBuffer, - uint32_t eventCount, - const VkEvent* pEvents, - VkPipelineStageFlags srcStageMask, - VkPipelineStageFlags dstStageMask, - uint32_t memoryBarrierCount, - const VkMemoryBarrier* pMemoryBarriers, - uint32_t bufferMemoryBarrierCount, - const VkBufferMemoryBarrier* pBufferMemoryBarriers, - uint32_t imageMemoryBarrierCount, - const VkImageMemoryBarrier* pImageMemoryBarriers); -``` - -# VkMemoryBarrier / VkBufferMemoryBarrier / VkImageMemoryBarrier -Struct definition in [vkCmdPipelineBarrier_test/README.md](../vkCmdPipelineBarrier_test/README.md) - -According to the Vulkan spec: -- vkCmdSetEvent and vkCmdResetEvent - - If the `tessellation shaders` feature is not enabled, `stageMask` **must** - not contain `VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT` or - `VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT` - - If the `geometry shaders` feature is not enabled, `stageMask` **must** not - contain `VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT` - - When `vkCmdReset` command executes, `event` **must** NOT be waited on by a - `vkCmdWaitEvents` commands that is currently executing - - Those commands **must** be called outside of a renderpass -- vkCmdWaitEvents - - If the `geometry shaders` feature is not enabled, `srcStageMask` and - `dstStageMask` **must** not contain `VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT` - - If the `tessellation shaders` feature is not enabled, `srcStageMask` and - `dstStageMask` **must** not contain - `VK_PIPEINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT` or - `VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT` - - If `pEvents` includes one or more events that will be signaled by - `vkSetEvent` after `commandBuffer` has been submitted to a queue, then - `vkCmdWaitEvents` **must** NOT be called inside a render pass instance - - Any pipeline stage included in `srcStageMask` or `dstStageMask` must be - supported by the capabilities of the queue family specified by the - `queueFamilyIndex` member of the `VkCommandPoolCreateInfo` structure that was - used to create the `VkCommandPool` that commandBuffer was allocated from, as - specified in the table of supported pipeline stages. - - Any given element of `pMemoryBarriers`, `pBufferMemoryBarriers` or - `pImageMemoryBarriers` **must** NOT have any access flag included in its - `srcAccessMask` member if that bit is not supported by any of the pipeline - stages in `srcStageMask`, as specified in the table of supported access types - - Any given element of `pMemoryBarriers`, `pBufferMemoryBarriers` or - `pImageMemoryBarriers` **must** NOT have any access flag included in its - `dstAccessMask` member if that bit is not supported by any of the pipeline - stages in `dstStageMask`, as specified in the table of supported access types - - `srcStageMask` and `dstStageMask` **must** NOT be 0 - - `eventCount` **must** be greater than 0 - -These tests should test the following cases: -- vkCmdSetEvent - - [x] `event` and `stageMask` of valid values -- vkCmdRestEvent - - [x] `event` and `stageMask` of valid values -- vkCmdWaitEvents - - [x] `srcStageMask` and `dstStageMask` of valid values - - [x] Non-zero `memoryBarrierCount` and non-null `pMemoryBarriers` - - [x] Non-zero `bufferMemoryBarrierCount` and non-null `pBufferMemoryBarriers` - - [x] Non-zero `imageMemoryBarrierCount` and non-null `pImageMemoryBarriers` - - [x] Non-zero `eventCount` and non-null `pEvents` diff --git a/gapid_tests/synchronization_tests/Event_test/main.cpp b/gapid_tests/synchronization_tests/Event_test/main.cpp deleted file mode 100644 index 67d82761..00000000 --- a/gapid_tests/synchronization_tests/Event_test/main.cpp +++ /dev/null @@ -1,388 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include -#include -#include -#include - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/sub_objects.h" - -namespace { -// Records a vkCmdWaitEvents command without any memory barrier in the command -// buffer. -void AddCmdWaitEvents(containers::Allocator* allocator, - vulkan::VkCommandBuffer* cmd_buf_ptr, - std::initializer_list<::VkEvent> wait_events, - VkPipelineStageFlags src_stages, - VkPipelineStageFlags dst_stages) { - if (!cmd_buf_ptr) { - return; - } - auto& cmd_buf = *cmd_buf_ptr; - containers::vector<::VkEvent> events(wait_events, allocator); - cmd_buf->vkCmdWaitEvents(cmd_buf, - events.size(), // eventCount - events.data(), // pEvents - src_stages, // srcStageMask - dst_stages, // dstStageMask - 0, // memoryBarrierCount - nullptr, // pMemoryBarriers - 0, // bufferMemoryBarrierCount - nullptr, // pBufferMemoryBarriers - 0, // imageMemoryBarrierCount - nullptr // pImageMemoryBarriers - ); -} - -// Records a vkCmdCopyBuffer to the command buffer, which copies from the src -// buffer to the dst buffer. The copy offsets are 0 for both src and dst -// buffer, the copy size is the min(src_buffer_size, dst_buffer_size) -void AddCmdCopyBuffer(vulkan::VkCommandBuffer* cmd_buf_ptr, - const vulkan::VulkanApplication::Buffer& src_buf, - const vulkan::VulkanApplication::Buffer& dst_buf) { - if (!cmd_buf_ptr) { - return; - } - auto& cmd_buf = *cmd_buf_ptr; - VkDeviceSize size = - src_buf.size() < dst_buf.size() ? src_buf.size() : dst_buf.size(); - VkBufferCopy copy_region{0, 0, size}; - cmd_buf->vkCmdCopyBuffer(cmd_buf, src_buf, dst_buf, 1, ©_region); -} - -void RunInTwoThreads(std::function)> run_first, - std::function run_second) { - std::mutex m; - std::condition_variable cv; - bool second_thread_can_run = false; - auto start_second_thread = [&]() { - { - std::lock_guard lk(m); - second_thread_can_run = true; - } - cv.notify_all(); - }; - std::thread first_thread([&]() { run_first(start_second_thread); }); - std::unique_lock lk(m); - cv.wait(lk, [&] { return second_thread_can_run; }); - run_second(); - first_thread.join(); -} - -struct CommonHandles { - CommonHandles(const entry::EntryData* data, vulkan::VulkanApplication* app) - : device(app->device()), - queue(app->render_queue()), - cmd_buf(app->GetCommandBuffer()), - src_buf(app->CreateAndBindDefaultExclusiveCoherentBuffer( - sizeof(uint32_t), VK_BUFFER_USAGE_TRANSFER_SRC_BIT)), - dst_buf(app->CreateAndBindDefaultExclusiveDeviceBuffer( - sizeof(uint32_t), VK_BUFFER_USAGE_TRANSFER_DST_BIT)) {} - - vulkan::VkDevice& device; - vulkan::VkQueue& queue; - vulkan::VkCommandBuffer cmd_buf; - vulkan::BufferPointer src_buf; - vulkan::BufferPointer dst_buf; -}; -} // anonymous namespace - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - // Basic test of vkSetEvent, vkResetEvent and vkGetEventStatus - { - // Use "TAG" in the trace to figure out where we are supposed to be - app.device().getProcAddrFunction()(app.device(), "TAG"); - CommonHandles t(data, &app); - - auto event = vulkan::CreateEvent(&t.device); - LOG_EXPECT(==, data->logger(), VK_EVENT_RESET, - t.device->vkGetEventStatus(t.device, event)); - LOG_EXPECT(==, data->logger(), VK_SUCCESS, - t.device->vkSetEvent(t.device, event)); - LOG_EXPECT(==, data->logger(), VK_EVENT_SET, - t.device->vkGetEventStatus(t.device, event)); - LOG_EXPECT(==, data->logger(), VK_SUCCESS, - t.device->vkResetEvent(t.device, event)); - LOG_EXPECT(==, data->logger(), VK_EVENT_RESET, - t.device->vkGetEventStatus(t.device, event)); - // vkDestroyEvent will be called when 'event' is out of scope. - } - - // Single thread - { - app.device().getProcAddrFunction()(app.device(), "TAG"); - CommonHandles t(data, &app); - - auto event_x = vulkan::CreateEvent(&t.device); - auto event_y = vulkan::CreateEvent(&t.device); - - // submit -> update -> set -> wait idle - *reinterpret_cast(t.src_buf->base_address()) = 0x00000000; - app.BeginCommandBuffer(&t.cmd_buf); - AddCmdWaitEvents(data->allocator(), &t.cmd_buf, {event_x}, - VK_PIPELINE_STAGE_HOST_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT); - AddCmdCopyBuffer(&t.cmd_buf, *t.src_buf, *t.dst_buf); - app.EndAndSubmitCommandBuffer(&t.cmd_buf, &t.queue, {}, {}, {}, - VkFence(VK_NULL_HANDLE)); - *reinterpret_cast(t.src_buf->base_address()) = 0x11111111; - t.device->vkSetEvent(t.device, event_x); - t.queue->vkQueueWaitIdle(t.queue); - t.device->vkResetEvent(t.device, event_x); - - // update -> set -> submit -> wait idle - *reinterpret_cast(t.src_buf->base_address()) = 0x22222222; - app.BeginCommandBuffer(&t.cmd_buf); - t.device->vkSetEvent(t.device, event_x); - AddCmdWaitEvents(data->allocator(), &t.cmd_buf, {event_x}, - VK_PIPELINE_STAGE_HOST_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT); - AddCmdCopyBuffer(&t.cmd_buf, *t.src_buf, *t.dst_buf); - app.EndAndSubmitCommandBuffer(&t.cmd_buf, &t.queue, {}, {}, {}, - VkFence(VK_NULL_HANDLE)); - t.queue->vkQueueWaitIdle(t.queue); - t.device->vkResetEvent(t.device, event_x); - - // update -> submit:[cmdSetEvent (multiple), ... , cmdWaitEvents] - app.BeginCommandBuffer(&t.cmd_buf); - t.cmd_buf->vkCmdSetEvent(t.cmd_buf, event_x, - VK_PIPELINE_STAGE_TRANSFER_BIT); - t.cmd_buf->vkCmdSetEvent(t.cmd_buf, event_y, - VK_PIPELINE_STAGE_TRANSFER_BIT); - AddCmdWaitEvents(data->allocator(), &t.cmd_buf, {event_x, event_y}, - VK_PIPELINE_STAGE_TRANSFER_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT); - AddCmdCopyBuffer(&t.cmd_buf, *t.src_buf, *t.dst_buf); - *reinterpret_cast(t.src_buf->base_address()) = 0x33333333; - app.EndAndSubmitCommandBufferAndWaitForQueueIdle(&t.cmd_buf, &t.queue); - t.device->vkResetEvent(t.device, event_x); - t.device->vkResetEvent(t.device, event_y); - - // update -> submit:[cmdSetEvent] -> submit:[cmdWaitEvents, ...] - app.BeginCommandBuffer(&t.cmd_buf); - t.cmd_buf->vkCmdSetEvent(t.cmd_buf, event_x, - VK_PIPELINE_STAGE_TRANSFER_BIT); - app.EndAndSubmitCommandBuffer(&t.cmd_buf, &t.queue, {}, {}, {}, - ::VkFence(VK_NULL_HANDLE)); - auto another_cmd_buf = app.GetCommandBuffer(); - app.BeginCommandBuffer(&another_cmd_buf); - AddCmdWaitEvents(data->allocator(), &another_cmd_buf, {event_x}, - VK_PIPELINE_STAGE_TRANSFER_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT); - AddCmdCopyBuffer(&another_cmd_buf, *t.src_buf, *t.dst_buf); - *reinterpret_cast(t.src_buf->base_address()) = 0x44444444; - app.EndAndSubmitCommandBufferAndWaitForQueueIdle(&another_cmd_buf, - &t.queue); - t.device->vkResetEvent(t.device, event_x); - } - - // Multiple thread, host sends signal to the event waiting in a t.queue - { - app.device().getProcAddrFunction()(app.device(), "TAG"); - CommonHandles t(data, &app); - auto event_x = vulkan::CreateEvent(&t.device); - auto event_y = vulkan::CreateEvent(&t.device); - *reinterpret_cast(t.src_buf->base_address()) = 0x00000000; - - // Thread 1: submit [vkCmdWaitEvents] -> -> t.queue wait idle - // Thread 2: setEvent - app.BeginCommandBuffer(&t.cmd_buf); - AddCmdWaitEvents(data->allocator(), &t.cmd_buf, {event_x}, - VK_PIPELINE_STAGE_HOST_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT); - AddCmdCopyBuffer(&t.cmd_buf, *t.src_buf, *t.dst_buf); - std::function)> run_first = - [&](std::function start_second_thread) { - app.EndAndSubmitCommandBuffer(&t.cmd_buf, &t.queue, {}, {}, {}, - VkFence(VK_NULL_HANDLE)); - start_second_thread(); - t.queue->vkQueueWaitIdle(t.queue); - }; - std::function run_second = [&]() { - *reinterpret_cast(t.src_buf->base_address()) = 0x11111111; - t.device->vkSetEvent(t.device, event_x); - }; - RunInTwoThreads(run_first, run_second); - t.device->vkResetEvent(t.device, event_x); - - // Thread 1: submit [vkCmdWaitEvents (multiple events)] -> -> t.queue - // idle - // Thread 2: setEvent(s) - app.BeginCommandBuffer(&t.cmd_buf); - AddCmdWaitEvents(data->allocator(), &t.cmd_buf, {event_x, event_y}, - VK_PIPELINE_STAGE_HOST_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT); - AddCmdCopyBuffer(&t.cmd_buf, *t.src_buf, *t.dst_buf); - run_second = [&]() { - *reinterpret_cast(t.src_buf->base_address()) = 0x22222222; - t.device->vkSetEvent(t.device, event_x); - *reinterpret_cast(t.src_buf->base_address()) = 0x33333333; - t.device->vkSetEvent(t.device, event_y); - }; - RunInTwoThreads(run_first, run_second); - t.device->vkResetEvent(t.device, event_x); - t.device->vkResetEvent(t.device, event_y); - - // Thread 1: submit [wait, reset, semaphore, fence]-> submit [wait]-> idle - // Thread 2: setEvent -> setEvent - vulkan::VkFence fence = vulkan::CreateFence(&t.device, false); - run_first = [&](std::function start_second_thread) { - vulkan::VkSemaphore semaphore = vulkan::CreateSemaphore(&t.device); - VkPipelineStageFlags wait_stage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; - app.BeginCommandBuffer(&t.cmd_buf); - AddCmdWaitEvents(data->allocator(), &t.cmd_buf, {event_x}, - VK_PIPELINE_STAGE_HOST_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT); - AddCmdCopyBuffer(&t.cmd_buf, *t.src_buf, *t.dst_buf); - t.cmd_buf->vkCmdResetEvent(t.cmd_buf, event_x, - VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT); - app.EndAndSubmitCommandBuffer(&t.cmd_buf, &t.queue, {}, {}, - {semaphore.get_raw_object()}, fence); - auto another_cmd_buf = app.GetCommandBuffer(); - app.BeginCommandBuffer(&another_cmd_buf); - AddCmdWaitEvents(data->allocator(), &another_cmd_buf, {event_x}, - VK_PIPELINE_STAGE_HOST_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT); - AddCmdCopyBuffer(&another_cmd_buf, *t.src_buf, *t.dst_buf); - app.EndAndSubmitCommandBuffer(&another_cmd_buf, &t.queue, - {semaphore.get_raw_object()}, {wait_stage}, - {}, ::VkFence(VK_NULL_HANDLE)); - start_second_thread(); - t.queue->vkQueueWaitIdle(t.queue); - }; - run_second = [&]() { - *reinterpret_cast(t.src_buf->base_address()) = 0x44444444; - t.device->vkSetEvent(t.device, event_x); - t.device->vkWaitForFences(t.device, 1, &fence.get_raw_object(), true, - uint64_t(0) - 1); - *reinterpret_cast(t.src_buf->base_address()) = 0x55555555; - t.device->vkSetEvent(t.device, event_x); - }; - RunInTwoThreads(run_first, run_second); - t.device->vkResetEvent(t.device, event_x); - - // Thread 1: submit [wait x, wait y, copy] -> idle - // Thread 2: set y -> set x - app.BeginCommandBuffer(&t.cmd_buf); - AddCmdWaitEvents(data->allocator(), &t.cmd_buf, {event_x}, - VK_PIPELINE_STAGE_HOST_BIT, - VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT); - AddCmdWaitEvents(data->allocator(), &t.cmd_buf, {event_y}, - VK_PIPELINE_STAGE_HOST_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT); - AddCmdCopyBuffer(&t.cmd_buf, *t.src_buf, *t.dst_buf); - run_first = [&](std::function start_second_thread) { - app.EndAndSubmitCommandBuffer(&t.cmd_buf, &t.queue, {}, {}, {}, - ::VkFence(VK_NULL_HANDLE)); - start_second_thread(); - t.queue->vkQueueWaitIdle(t.queue); - }; - run_second = [&]() { - *reinterpret_cast(t.src_buf->base_address()) = 0x66666666; - t.device->vkSetEvent(t.device, event_y); - *reinterpret_cast(t.src_buf->base_address()) = 0x77777777; - t.device->vkSetEvent(t.device, event_x); - }; - RunInTwoThreads(run_first, run_second); - t.device->vkResetEvent(t.device, event_x); - t.device->vkResetEvent(t.device, event_y); - } - - // Test for memory barriers carried with vkCmdWaitEvents - { - app.device().getProcAddrFunction()(app.device(), "TAG"); - CommonHandles t(data, &app); - vulkan::VkImage img = vulkan::CreateDefault2DColorImage( - &t.device, app.swapchain().width(), app.swapchain().height()); - auto event_x = vulkan::CreateEvent(&t.device); - *reinterpret_cast(t.src_buf->base_address()) = 0x00000000; - - // barriers - VkMemoryBarrier memory_barrier{ - VK_STRUCTURE_TYPE_MEMORY_BARRIER, // sType - nullptr, // pNext - VK_ACCESS_HOST_WRITE_BIT, // srcAccessMask - VK_ACCESS_TRANSFER_WRITE_BIT | - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, // dstAccessMask - }; - VkBufferMemoryBarrier buffer_barriers[2] = { - { - VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, // stype - nullptr, // pNext - 0, // srcAccessMask - VK_ACCESS_TRANSFER_WRITE_BIT, // dstAccessMask - VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex - VK_QUEUE_FAMILY_IGNORED, // dstQueueFamilyIndex - *t.dst_buf, // buffer - 0, // offset - sizeof(uint32_t) // size - }, - { - VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, // stype - nullptr, // pNext - VK_ACCESS_HOST_WRITE_BIT, // srcAccessMask - VK_ACCESS_TRANSFER_READ_BIT, // dstAccessMask - VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex - VK_QUEUE_FAMILY_IGNORED, // dstQueueFamilyIndex - *t.src_buf, // buffer - 0, // offset - sizeof(uint32_t) // size - }}; - VkImageSubresourceRange rng{VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; - VkImageMemoryBarrier image_barrier{ - VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // sType - nullptr, // pNext - 0, // srcAccessMask - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, // dstAccessMask - VK_IMAGE_LAYOUT_UNDEFINED, // oldLayout - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, // newLayout - VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex - VK_QUEUE_FAMILY_IGNORED, // dstQueueFamilyIndex - img, // image - rng, // subresourceRange - }; - - app.BeginCommandBuffer(&t.cmd_buf); - t.cmd_buf->vkCmdWaitEvents( - t.cmd_buf, 1, &event_x.get_raw_object(), VK_PIPELINE_STAGE_HOST_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT, 1, &memory_barrier, 2, buffer_barriers, - 1, &image_barrier); - AddCmdCopyBuffer(&t.cmd_buf, *t.src_buf, *t.dst_buf); - auto run_first = [&](std::function start_second_thread) { - app.EndAndSubmitCommandBuffer(&t.cmd_buf, &t.queue, {}, {}, {}, - ::VkFence(0)); - start_second_thread(); - t.queue->vkQueueWaitIdle(t.queue); - }; - auto run_second = [&]() { - *reinterpret_cast(t.src_buf->base_address()) = 0xFFFFFFFF; - t.device->vkSetEvent(t.device, event_x); - }; - RunInTwoThreads(run_first, run_second); - } - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/synchronization_tests/Fence_test/CMakeLists.txt b/gapid_tests/synchronization_tests/Fence_test/CMakeLists.txt deleted file mode 100644 index 6544b8fa..00000000 --- a/gapid_tests/synchronization_tests/Fence_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(Fence_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/synchronization_tests/Fence_test/Fence_test.py b/gapid_tests/synchronization_tests/Fence_test/Fence_test.py deleted file mode 100644 index 6e437bc4..00000000 --- a/gapid_tests/synchronization_tests/Fence_test/Fence_test.py +++ /dev/null @@ -1,98 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from struct_offsets import * -from vulkan_constants import * - -FENCE_CREATE_INFO = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("flags", UINT32_T) -] - - -@gapit_test("Fence_test") -class CreateDestroyWaitTest(GapitTest): - - def expect(self): - - architecture = self.architecture - create_fence = require(self.nth_call_of("vkCreateFence", 1)) - wait_for_fences = require(self.next_call_of("vkWaitForFences")) - reset_fences = require(self.next_call_of("vkResetFences")) - destroy_fence = require(self.next_call_of("vkDestroyFence")) - - require_not_equal(0, create_fence.int_device) - require_not_equal(0, create_fence.hex_pCreateInfo) - require_equal(0, create_fence.hex_pAllocator) - require_not_equal(0, create_fence.hex_pFence) - - create_info = VulkanStruct(architecture, - FENCE_CREATE_INFO, get_read_offset_function( - create_fence, create_fence.hex_pCreateInfo)) - - require_equal(VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, create_info.sType) - require_equal(0, create_info.pNext) - require_equal(0, create_info.flags) - - returned_fence = little_endian_bytes_to_int( - require( - create_fence.get_write_data( - create_fence.hex_pFence, NON_DISPATCHABLE_HANDLE_SIZE))) - require_not_equal(0, returned_fence) - - require_equal(create_fence.int_device, wait_for_fences.int_device) - require_equal(1, wait_for_fences.int_fenceCount) - require_not_equal(1, wait_for_fences.hex_pFences) - require_equal(0, wait_for_fences.int_waitAll) - require_equal(100000000, wait_for_fences.int_timeout) - - waited_for_fence = little_endian_bytes_to_int( - require( - wait_for_fences.get_read_data( - wait_for_fences.hex_pFences, NON_DISPATCHABLE_HANDLE_SIZE - ))) - require_equal(waited_for_fence, returned_fence) - - require_equal(create_fence.int_device, reset_fences.int_device) - require_equal(1, reset_fences.int_fenceCount) - require_equal(create_fence.int_device, reset_fences.int_device) - - reset_fence = little_endian_bytes_to_int( - require( - reset_fences.get_read_data( - wait_for_fences.hex_pFences, NON_DISPATCHABLE_HANDLE_SIZE - ))) - require_equal(returned_fence, reset_fence) - - require_equal(create_fence.int_device, destroy_fence.int_device) - require_equal(returned_fence, destroy_fence.int_fence) - require_equal(0, destroy_fence.hex_pAllocator) - - -@gapit_test("Fence_test") -class GetFenceStatus(GapitTest): - - def expect(self): - require(self.nth_call_of("vkCreateFence", 2)) - first_get_status = require(self.next_call_of("vkGetFenceStatus")) - require_equal(VK_NOT_READY, int(first_get_status.return_val)) - second_get_status = require(self.next_call_of("vkGetFenceStatus")) - require_equal(VK_SUCCESS, int(second_get_status.return_val)) - third_get_status = require(self.next_call_of("vkGetFenceStatus")) - require_equal(VK_NOT_READY, int(third_get_status.return_val)) - - require(self.next_call_of("vkCreateFence")) - fourth_get_status = require(self.next_call_of("vkGetFenceStatus")) - require_equal(VK_SUCCESS, (fourth_get_status.return_val)) diff --git a/gapid_tests/synchronization_tests/Fence_test/README.md b/gapid_tests/synchronization_tests/Fence_test/README.md deleted file mode 100644 index 457a1e16..00000000 --- a/gapid_tests/synchronization_tests/Fence_test/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# vkCmdPipelineBarrier - -## Signatures -```c++ -VkResult vkCreateFence( - VkDevice device, - const VkFenceCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkFence* pFence); -void vkDestroyFence( - VkDevice device, - VkFence fence, - const VkAllocationCallbacks* pAllocator); -VkResult vkWaitForFences( - VkDevice device, - uint32_t fenceCount, - const VkFence* pFences, - VkBool32 waitAll, - uint64_t timeout); -VkResult vkResetFences( - VkDevice device, - uint32_t fenceCount, - const VkFence* pFences); -``` - -# VkFenceCreateInfo -```c++ -typedef struct VkFenceCreateInfo { - VkStructureType sType; - const void* pNext; - VkFenceCreateFlags flags; -} VkFenceCreateInfo; - -``` - -According to the Vulkan spec: -- `device` **must** be valid -- `pCreateInfo` **must** be valid -- `flags` **may** be 0 or `VK_FENCE_CREATE_SIGNALED_BIT` -- `fenceCount` **must** be > 0 -- `pFences` **must** point to `fenceCount` `VkFence` objects - -These tests should test the following cases: -- [x] `flags` == 0 -- [ ] `flags` == `VK_FENCE_CREATE_SIGNALED_BIT` -- [x] `fenceCount` == 1 -- [ ] `fenceCount` > 1 -- [x] `VkDestroyFence.fence` == Valid Fence -- [x] `VkDestroyFence.fence` == `VK_NULL_HANDLE` -- [x] `vkResetFence.fenceCount == 1` -- [ ] `vkResetFence.fenceCount > 1` \ No newline at end of file diff --git a/gapid_tests/synchronization_tests/Fence_test/main.cpp b/gapid_tests/synchronization_tests/Fence_test/main.cpp deleted file mode 100644 index 88454639..00000000 --- a/gapid_tests/synchronization_tests/Fence_test/main.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - // So we don't have to type app.device every time. - vulkan::VkDevice& device = app.device(); - vulkan::VkQueue& render_queue = app.render_queue(); - - { // Create/Destroy/Wait - VkFenceCreateInfo create_info{ - VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, // sType - nullptr, // pNext - 0 // flags - }; - VkFence fence; - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkCreateFence(device, &create_info, nullptr, &fence)); - render_queue->vkQueueSubmit(render_queue, 0, nullptr, fence); - - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkWaitForFences(device, 1, &fence, VK_FALSE, 100000000)); - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkResetFences(device, 1, &fence)); - - device->vkDestroyFence(device, fence, nullptr); - } - - { // Get fence status - vulkan::VkFence fence = vulkan::CreateFence(&device, false); - LOG_ASSERT(==, data->logger(), VK_NOT_READY, - device->vkGetFenceStatus(device, fence)); - render_queue->vkQueueSubmit(render_queue, 0, nullptr, fence); - render_queue->vkQueueWaitIdle(render_queue); - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkGetFenceStatus(device, fence)); - device->vkResetFences(device, 1, &fence.get_raw_object()); - LOG_ASSERT(==, data->logger(), VK_NOT_READY, - device->vkGetFenceStatus(device, fence)); - - vulkan::VkFence fence_signaled = vulkan::CreateFence(&device, true); - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkGetFenceStatus(device, fence_signaled)); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/synchronization_tests/README.md b/gapid_tests/synchronization_tests/README.md deleted file mode 100644 index a0ba1c4f..00000000 --- a/gapid_tests/synchronization_tests/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Synchronization Tests -These tests are specifically for testing synchronization primitives. - -- [Event_test](Event_test/README.md) -- [Fence_test](Fence_test/README.md) -- [vkCmdPipelineBarrier_test](vkCmdPipelineBarrier_test/README.md) -- [vkDeviceWaitIdle_test](vkDeviceWaitIdle_test/README.md) diff --git a/gapid_tests/synchronization_tests/vkCmdPipelineBarrier_test/CMakeLists.txt b/gapid_tests/synchronization_tests/vkCmdPipelineBarrier_test/CMakeLists.txt deleted file mode 100644 index c9b69224..00000000 --- a/gapid_tests/synchronization_tests/vkCmdPipelineBarrier_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkCmdPipelineBarrier_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/synchronization_tests/vkCmdPipelineBarrier_test/README.md b/gapid_tests/synchronization_tests/vkCmdPipelineBarrier_test/README.md deleted file mode 100644 index 7788859f..00000000 --- a/gapid_tests/synchronization_tests/vkCmdPipelineBarrier_test/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# vkCmdPipelineBarrier - -## Signatures -```c++ -void vkCmdPipelineBarrier( - VkCommandBuffer commandBuffer, - VkPipelineStageFlags srcStageMask, - VkPipelineStageFlags dstStageMask, - VkDependencyFlags dependencyFlags, - uint32_t memoryBarrierCount, - const VkMemoryBarrier* pMemoryBarriers, - uint32_t bufferMemoryBarrierCount, - const VkBufferMemoryBarrier* pBufferMemoryBarriers, - uint32_t imageMemoryBarrierCount, - const VkImageMemoryBarrier* pImageMemoryBarriers); -``` - -# VkMemoryBarrier -```c++ -typedef struct VkMemoryBarrier { - VkStructureType sType; - const void* pNext; - VkAccessFlags srcAccessMask; - VkAccessFlags dstAccessMask; -} VkMemoryBarrier; -``` - -# VkBufferMemoryBarrier -```c++ -typedef struct VkBufferMemoryBarrier { - VkStructureType sType; - const void* pNext; - VkAccessFlags srcAccessMask; - VkAccessFlags dstAccessMask; - uint32_t srcQueueFamilyIndex; - uint32_t dstQueueFamilyIndex; - VkBuffer buffer; - VkDeviceSize offset; - VkDeviceSize size; -} VkBufferMemoryBarrier; -``` -# VkImageMemoryBarrier -```c++ -typedef struct VkImageMemoryBarrier { - VkStructureType sType; - const void* pNext; - VkAccessFlags srcAccessMask; - VkAccessFlags dstAccessMask; - VkImageLayout oldLayout; - VkImageLayout newLayout; - uint32_t srcQueueFamilyIndex; - uint32_t dstQueueFamilyIndex; - VkImage image; - VkImageSubresourceRange subresourceRange; -} VkImageMemoryBarrier; -``` - -According to the Vulkan spec: -- `commandBuffer` **must** be valid -- `srcStageMask` **must** be non-zero and a combination of -VkPipelineStageFlagBits -- `dstStageMask` **must** be non-zero and a combination of -VkPipelineStageFlagBits -- `dependencyFlags` **must** be a combination of VkDependencyFlagBits -- `memoryBarrierCount` **can** be 0 OR `pMemoryBarriers` points to an array of -`memoryBarrierCount` `VkMemoryBarrier` structures. -- `bufferMemoryBarrierCount` **can** be 0 OR `pBufferMemoryBarriers` points to -an array of `bufferMemoryBarrierCount` `VkBufferMemoryBarrier` structures. -- `imageMemoryBarrierCount` **can** be 0 OR `pImageMemoryBarriers` points to -an array of `imageMemoryBarrierCount` `VkImageMemoryBarrier` structures - - -These tests should test the following cases: -- [x] `srcStageMask` 1 or > 1 bits set -- [x] `dstStageMask` 1 or > 1 bits set -- [x] `dependencyFlags` == `VK_DEPENDENCY_BY_REGION_BIT` or 0 -- [ ] `memoryBarrierCount` 0 or > 0 -- [ ] `bufferMemoryBarrierCount` 0 or > 0 -- [x] `imageMemoryBarrierCount` 0 or > 0 -- [ ] `srcAccessMask` / `dstAccessMask` 1 or >1 bits set \ No newline at end of file diff --git a/gapid_tests/synchronization_tests/vkCmdPipelineBarrier_test/main.cpp b/gapid_tests/synchronization_tests/vkCmdPipelineBarrier_test/main.cpp deleted file mode 100644 index 2c60588f..00000000 --- a/gapid_tests/synchronization_tests/vkCmdPipelineBarrier_test/main.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" -#include "vulkan_wrapper/sub_objects.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateDefaultInstance(data->allocator(), &wrapper)); - vulkan::VkSurfaceKHR surface(vulkan::CreateDefaultSurface(&instance, data)); - - uint32_t queues[2]; - vulkan::VkDevice device(vulkan::CreateDeviceForSwapchain( - data->allocator(), &instance, &surface, &queues[0], &queues[1], false)); - vulkan::VkSwapchainKHR swapchain(vulkan::CreateDefaultSwapchain( - &instance, &device, &surface, data->allocator(), queues[0], queues[1], - data)); - - containers::vector images(data->allocator()); - vulkan::LoadContainer(data->logger(), device->vkGetSwapchainImagesKHR, - &images, device, swapchain); - - vulkan::VkCommandPool command_pool = - vulkan::CreateDefaultCommandPool(data->allocator(), device, false); - vulkan::VkCommandBuffer command_buffer = - vulkan::CreateDefaultCommandBuffer(&command_pool, &device); - - VkImageMemoryBarrier image_memory_barrier{ - VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // sType - nullptr, // pNext - VK_ACCESS_MEMORY_READ_BIT, // srcAccessMask - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, // dstAccessMask - VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, // oldLayout - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // newLayout - queues[0], // srcQueueFamilyIndex - queues[1], // dstQueueFamilyIndex - images[0], // image - { - VK_IMAGE_ASPECT_COLOR_BIT, // aspectMask - 0, // baseMipLevel - 1, // mipCount - 0, // baseArrayLayer - 1, // layerCount - }}; - - VkCommandBufferBeginInfo begin_info{ - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr, - VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, nullptr}; - - command_buffer->vkBeginCommandBuffer(command_buffer, &begin_info); - - command_buffer->vkCmdPipelineBarrier( - command_buffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, - VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, - VK_DEPENDENCY_BY_REGION_BIT, 0, nullptr, 0, nullptr, 0, nullptr); - - command_buffer->vkCmdPipelineBarrier( - command_buffer, - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT | VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT, - VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT | - VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, - 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier); - - command_buffer->vkEndCommandBuffer(command_buffer); - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/synchronization_tests/vkCmdPipelineBarrier_test/vkCmdPipelineBarrier_test.py b/gapid_tests/synchronization_tests/vkCmdPipelineBarrier_test/vkCmdPipelineBarrier_test.py deleted file mode 100644 index a040de3c..00000000 --- a/gapid_tests/synchronization_tests/vkCmdPipelineBarrier_test/vkCmdPipelineBarrier_test.py +++ /dev/null @@ -1,108 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest -from struct_offsets import * -from vulkan_constants import * - -IMAGE_MEMORY_BARRIER = [ - ("sType", UINT32_T), - ("pNext", POINTER), - ("srcAccessMask", UINT32_T), - ("dstAccessMask", UINT32_T), - ("oldLayout", UINT32_T), - ("newLayout", UINT32_T), - ("srcQueueFamilyIndex", UINT32_T), - ("dstQueueFamilyIndex", UINT32_T), - ("image", HANDLE), - # These nested struct offsets are correct because all of the alignments - # are trivially satisfied. - ("subresourceRange_aspectMask", UINT32_T), - ("subresourceRange_baseMipLevel", UINT32_T), - ("subresourceRange_mipCount", UINT32_T), - ("subresourceRange_baseArrayLayer", UINT32_T), - ("subresourceRange_layerCount", UINT32_T) -] - - -@gapit_test("vkCmdPipelineBarrier_test") -class EmptyPipelineBarrierTest(GapitTest): - - def expect(self): - """Expect that the applicationInfoPointer is null for the first - vkCreateInstance""" - pipeline_barrier = require(self.nth_call_of("vkCmdPipelineBarrier", 1)) - require_not_equal(pipeline_barrier.int_commandBuffer, 0) - require_equal(pipeline_barrier.int_srcStageMask, - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT) - require_equal(pipeline_barrier.int_dstStageMask, - VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT) - require_equal(pipeline_barrier.int_dependencyFlags, - VK_DEPENDENCY_BY_REGION_BIT) - require_equal(pipeline_barrier.int_memoryBarrierCount, 0) - require_equal(pipeline_barrier.hex_pMemoryBarriers, 0) - require_equal(pipeline_barrier.int_bufferMemoryBarrierCount, 0) - require_equal(pipeline_barrier.hex_pBufferMemoryBarriers, 0) - require_equal(pipeline_barrier.int_imageMemoryBarrierCount, 0) - require_equal(pipeline_barrier.hex_pImageMemoryBarriers, 0) - - -@gapit_test("vkCmdPipelineBarrier_test") -class DefaultSwapchainMemoryBarrierTest(GapitTest): - - def expect(self): - """Expect that the applicationInfoPointer is null for the first - vkCreateInstance""" - architecture = self.architecture - pipeline_barrier = require(self.nth_call_of("vkCmdPipelineBarrier", 2)) - require_not_equal(pipeline_barrier.int_commandBuffer, 0) - require_equal(pipeline_barrier.int_srcStageMask, - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT - | VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT) - require_equal(pipeline_barrier.int_dstStageMask, - VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT - | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT) - require_equal(pipeline_barrier.int_dependencyFlags, 0) - require_equal(pipeline_barrier.int_memoryBarrierCount, 0) - require_equal(pipeline_barrier.hex_pMemoryBarriers, 0) - require_equal(pipeline_barrier.int_bufferMemoryBarrierCount, 0) - require_equal(pipeline_barrier.hex_pBufferMemoryBarriers, 0) - require_equal(pipeline_barrier.int_imageMemoryBarrierCount, 1) - require_not_equal(pipeline_barrier.hex_pImageMemoryBarriers, 0) - - def get_image_barrier_data(offset, size): - return little_endian_bytes_to_int( - require( - pipeline_barrier.get_read_data( - pipeline_barrier.hex_pImageMemoryBarriers + offset, - size))) - - image_memory_barrier = VulkanStruct(architecture, IMAGE_MEMORY_BARRIER, - get_image_barrier_data) - require_equal(image_memory_barrier.sType, - VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER) - require_equal(image_memory_barrier.pNext, 0) - require_equal(image_memory_barrier.srcAccessMask, - VK_ACCESS_MEMORY_READ_BIT) - require_equal(image_memory_barrier.dstAccessMask, - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT) - require_equal(image_memory_barrier.oldLayout, - VK_IMAGE_LAYOUT_PRESENT_SRC_KHR) - require_equal(image_memory_barrier.newLayout, - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) - require_equal(image_memory_barrier.subresourceRange_aspectMask, - VK_IMAGE_ASPECT_COLOR_BIT) - require_equal(image_memory_barrier.subresourceRange_baseMipLevel, 0) - require_equal(image_memory_barrier.subresourceRange_mipCount, 1) - require_equal(image_memory_barrier.subresourceRange_baseArrayLayer, 0) - require_equal(image_memory_barrier.subresourceRange_layerCount, 1) diff --git a/gapid_tests/synchronization_tests/vkDeviceWaitIdle_test/CMakeLists.txt b/gapid_tests/synchronization_tests/vkDeviceWaitIdle_test/CMakeLists.txt deleted file mode 100644 index fd308b80..00000000 --- a/gapid_tests/synchronization_tests/vkDeviceWaitIdle_test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkDeviceWaitIdle_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/synchronization_tests/vkDeviceWaitIdle_test/README.md b/gapid_tests/synchronization_tests/vkDeviceWaitIdle_test/README.md deleted file mode 100644 index 4023d8e8..00000000 --- a/gapid_tests/synchronization_tests/vkDeviceWaitIdle_test/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# vkDeviceWaitIdle - -## Signatures -```c++ -VkResult vkDeviceWaitIdle( - VkDevice device); -``` - -According to the Vulkan spec: -- `device` **must** be a valid `VkDevice` handle -- `vkDeviceWaitIdle` is equivalent to calling `vkQueueWaitIdle` for all queues - owned by `device`. - -These tests should test the following cases: -- [x] Wait for queue diff --git a/gapid_tests/synchronization_tests/vkDeviceWaitIdle_test/main.cpp b/gapid_tests/synchronization_tests/vkDeviceWaitIdle_test/main.cpp deleted file mode 100644 index 5cb19d8d..00000000 --- a/gapid_tests/synchronization_tests/vkDeviceWaitIdle_test/main.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/known_device_infos.h" -#include "vulkan_helpers/vulkan_application.h" -#include "vulkan_wrapper/queue_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - - vulkan::VulkanApplication app(data->allocator(), data->logger(), data, - vulkan::VulkanApplicationOptions()); - // So we don't have to type app.device every time. - vulkan::VkDevice& device = app.device(); - vulkan::VkQueue& render_queue = app.render_queue(); - - { - // 1. Wait on a single queue which will signal a fence. - VkFenceCreateInfo create_info{ - VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, // sType - nullptr, // pNext - 0 // flags - }; - VkFence fence; - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkCreateFence(device, &create_info, nullptr, &fence)); - render_queue->vkQueueSubmit(render_queue, 0, nullptr, fence); - - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkDeviceWaitIdle(device)); - - // vkWaitForFences() should return VK_SUCCESS immediately. - LOG_ASSERT(==, data->logger(), VK_SUCCESS, - device->vkWaitForFences(device, 1, &fence, VK_FALSE, 0)); - device->vkDestroyFence(device, fence, nullptr); - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/synchronization_tests/vkDeviceWaitIdle_test/vkDeviceWaitIdle_test.py b/gapid_tests/synchronization_tests/vkDeviceWaitIdle_test/vkDeviceWaitIdle_test.py deleted file mode 100644 index ce4f9252..00000000 --- a/gapid_tests/synchronization_tests/vkDeviceWaitIdle_test/vkDeviceWaitIdle_test.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import GapitTest, require_not_equal -from vulkan_constants import VK_SUCCESS - - -@gapit_test("vkDeviceWaitIdle_test") -class WaitForSingleQueue(GapitTest): - - def expect(self): - - device_wait_idle = require(self.nth_call_of("vkDeviceWaitIdle", 1)) - - require_not_equal(0, device_wait_idle.int_device) - require_equal(VK_SUCCESS, int(device_wait_idle.return_val)) diff --git a/gapid_tests/traits_query_tests/CMakeLists.txt b/gapid_tests/traits_query_tests/CMakeLists.txt deleted file mode 100644 index 86139784..00000000 --- a/gapid_tests/traits_query_tests/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -add_vulkan_subdirectory(EnumerateLayersAndExtensions) -add_vulkan_subdirectory(vkEnumeratePhysicalDevices) -add_vulkan_subdirectory(PhysicalDeviceSurface_tests) -add_vulkan_subdirectory(PhysicalDeviceTraits) -add_vulkan_subdirectory(PresentationSupport) -add_vulkan_subdirectory(vkGetPDQueueFamilyProperties) -add_vulkan_subdirectory(vkGetPhysicalDeviceFormatProperties) -add_vulkan_subdirectory(PhysicalDeviceImageFormatTraits) diff --git a/gapid_tests/traits_query_tests/EnumerateLayersAndExtensions/CMakeLists.txt b/gapid_tests/traits_query_tests/EnumerateLayersAndExtensions/CMakeLists.txt deleted file mode 100644 index b95dba39..00000000 --- a/gapid_tests/traits_query_tests/EnumerateLayersAndExtensions/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(EnumerateLayersAndExtensions - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/traits_query_tests/EnumerateLayersAndExtensions/EnumerateLayersAndExtensions.py b/gapid_tests/traits_query_tests/EnumerateLayersAndExtensions/EnumerateLayersAndExtensions.py deleted file mode 100644 index d8734554..00000000 --- a/gapid_tests/traits_query_tests/EnumerateLayersAndExtensions/EnumerateLayersAndExtensions.py +++ /dev/null @@ -1,95 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest -from gapit_test_framework import get_write_offset_function -import gapit_test_framework -from struct_offsets import VulkanStruct, POINTER, ARRAY, CHAR, UINT32_T -from vulkan_constants import * - - -@gapit_test("EnumerateLayersAndExtensions") -class EnumerateDeviceExtensionProperties(GapitTest): - - def expect(self): - """Check the arguments and values referred by the pointer arugments of - vkEnumerateDeviceExtensionProperties""" - architecture = self.architecture - # First call returns the number of extension properties - get_device_extension_property_count = require(self.next_call_of( - "vkEnumerateDeviceExtensionProperties")) - require_equal(VK_SUCCESS, - int(get_device_extension_property_count.return_val)) - # Skip the check of layer name because device layer is a deprecate - # concept, and all layer names will be empty strings. - require_not_equal( - 0, get_device_extension_property_count.hex_pPropertyCount) - require_equal(0, get_device_extension_property_count.hex_pProperties) - - property_count_after_call = little_endian_bytes_to_int(require( - get_device_extension_property_count.get_write_data( - get_device_extension_property_count.hex_pPropertyCount, - architecture.int_integerSize))) - property_count = property_count_after_call - - # If the number of properties is larger than 1, there should be a call - # with one less number of properties passed to - # vkEnumerateDeviceExtensionProperties() and a VK_INCOMPLETE should be - # returned. - if property_count > 1: - incomplete_reutrn = require(self.next_call_of( - "vkEnumerateDeviceExtensionProperties")) - require_equal(VK_INCOMPLETE, int(incomplete_reutrn.return_val)) - # Skip the check of layer name because device layer is a deprecate - # concept, and all layer names will be empty strings. - require_not_equal(0, incomplete_reutrn.hex_pPropertyCount) - require_not_equal(0, incomplete_reutrn.hex_pProperties) - one_less_count = little_endian_bytes_to_int(require( - incomplete_reutrn.get_write_data( - incomplete_reutrn.hex_pPropertyCount, - architecture.int_integerSize))) - require_equal(one_less_count, property_count - 1) - - # If the number of properties is not zero, there must be a call to get - # the properties, and each property struct should have a non-zero - # specVersion value. - if property_count > 0: - get_device_extension_properties = require(self.next_call_of( - "vkEnumerateDeviceExtensionProperties")) - require_equal(VK_SUCCESS, - int(get_device_extension_properties.return_val)) - # Skip the check of layer name because device layer is a deprecate - # concept, and all layer names will be empty strings. - require_not_equal( - 0, get_device_extension_properties.hex_pPropertyCount) - require_not_equal(0, - get_device_extension_properties.hex_pProperties) - property_count_after_call = little_endian_bytes_to_int(require( - get_device_extension_properties.get_write_data( - get_device_extension_properties.hex_pPropertyCount, - architecture.int_integerSize))) - require_equal(property_count, property_count_after_call) - EXTENSION_PROPERTIES = [ - ("extensionName", ARRAY, VK_MAX_EXTENSION_NAME_SIZE, CHAR), - ("specVersion", UINT32_T), - ] - property_offset = 0 - for i in range(property_count_after_call): - property = VulkanStruct( - architecture, EXTENSION_PROPERTIES, - get_write_offset_function( - get_device_extension_properties, - get_device_extension_properties.hex_pProperties + - property_offset)) - property_offset += property.total_size - require_not_equal(0, property.specVersion) diff --git a/gapid_tests/traits_query_tests/EnumerateLayersAndExtensions/README.md b/gapid_tests/traits_query_tests/EnumerateLayersAndExtensions/README.md deleted file mode 100644 index ec1ebe17..00000000 --- a/gapid_tests/traits_query_tests/EnumerateLayersAndExtensions/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# vkEnumerateDeviceExtensionProperties - -## Signatures -```c++ -VkResult vkEnumerateInstanceLayerProperties( - uint32_t* pPropertyCount, - VkLayerProperties* pProperties); - -VkResult vkEnumerateInstanceExtensionProperties( - const char* pLayerName, - uint32_t* pPropertyCount, - VkExtensionProperties* pProperties); - -VkResult vkEnumerateDeviceLayerProperties( - VkPhysicalDevice physicalDevice, - uint32_t* pPropertyCount, - VkLayerProperties* pProperties); - -VkResult vkEnumerateDeviceExtensionProperties( - VkPhysicalDevice physicalDevice, - const char* pLayerName, - uint32_t* pPropertyCount, - VkExtensionProperties* pProperties); -``` - -## VkExtensionProperties -```c++ -typedef struct VkExtensionProperties { - char extensionName[VK_MAX_EXTENSION_NAME_SIZE]; - uint32_t specVersion; -} VkExtensionProperties; - -typedef struct VkLayerProperties { - char layerName[VK_MAX_EXTENSION_NAME_SIZE]; - uint32_t specVersion; - uint32_t implementationVersion; - char description[VK_MAX_DESCRIPTION_SIZE]; -} VkLayerProperties; -``` - -These tests should test the following cases: -- [x] `pPropertyCount` 0, returned or 0 < x < returned -- [x] `pLayerName` nullptr or not diff --git a/gapid_tests/traits_query_tests/EnumerateLayersAndExtensions/main.cpp b/gapid_tests/traits_query_tests/EnumerateLayersAndExtensions/main.cpp deleted file mode 100644 index 62dfee5f..00000000 --- a/gapid_tests/traits_query_tests/EnumerateLayersAndExtensions/main.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateEmptyInstance(data->allocator(), &wrapper)); - containers::vector devices( - vulkan::GetPhysicalDevices(data->allocator(), instance)); - - uint32_t num_layers = 0; - LOG_EXPECT(==, data->logger(), VK_SUCCESS, - wrapper.vkEnumerateInstanceLayerProperties(&num_layers, nullptr)); - containers::vector layer_properties(data->allocator()); - layer_properties.resize(num_layers); - - if (num_layers > 1) { - uint32_t num_reduced_layers = num_layers - 1; - LOG_EXPECT(==, data->logger(), VK_INCOMPLETE, - wrapper.vkEnumerateInstanceLayerProperties( - &num_reduced_layers, layer_properties.data())); - } - - LOG_EXPECT(==, data->logger(), VK_SUCCESS, - wrapper.vkEnumerateInstanceLayerProperties( - &num_layers, layer_properties.data())); - - uint32_t num_extension_properties = 0; - - LOG_EXPECT(==, data->logger(), VK_SUCCESS, - wrapper.vkEnumerateInstanceExtensionProperties( - nullptr, &num_extension_properties, nullptr)); - - containers::vector extension_properties( - data->allocator()); - extension_properties.resize(num_extension_properties); - - if (num_extension_properties > 1) { - uint32_t num_reduced_extension_properties = num_extension_properties - 1; - LOG_EXPECT(==, data->logger(), VK_INCOMPLETE, - wrapper.vkEnumerateInstanceExtensionProperties( - nullptr, &num_reduced_extension_properties, - extension_properties.data())); - } - - LOG_EXPECT( - ==, data->logger(), VK_SUCCESS, - wrapper.vkEnumerateInstanceExtensionProperties( - nullptr, &num_extension_properties, extension_properties.data())); - - for (const auto& extension : extension_properties) { - data->logger()->LogInfo("Instance Extension Found ", extension.extensionName); - } - - for (const auto& layer : layer_properties) { - data->logger()->LogInfo("Instance Layer Found ", layer.layerName); - - LOG_EXPECT(==, data->logger(), VK_SUCCESS, - wrapper.vkEnumerateInstanceExtensionProperties( - layer.layerName, &num_extension_properties, nullptr)); - - extension_properties.resize(num_extension_properties); - LOG_EXPECT(==, data->logger(), VK_SUCCESS, - wrapper.vkEnumerateInstanceExtensionProperties( - layer.layerName, &num_extension_properties, - extension_properties.data())); - for (const auto& extension : extension_properties) { - data->logger()->LogInfo(" Extension Found ", extension.extensionName); - } - } - - size_t device_count = 0; - for (const auto& physical_device : devices) { - data->logger()->LogInfo("PhysicalDevice ", device_count++); - LOG_EXPECT(==, data->logger(), VK_SUCCESS, - instance->vkEnumerateDeviceLayerProperties( - physical_device, &num_layers, nullptr)); - layer_properties.resize(num_layers); - - if (num_layers > 1) { - uint32_t num_reduced_layers = num_layers - 1; - LOG_EXPECT( - ==, data->logger(), VK_INCOMPLETE, - instance->vkEnumerateDeviceLayerProperties( - physical_device, &num_reduced_layers, layer_properties.data())); - } - - LOG_EXPECT(==, data->logger(), VK_SUCCESS, - instance->vkEnumerateDeviceLayerProperties( - physical_device, &num_layers, layer_properties.data())); - - LOG_EXPECT( - ==, data->logger(), VK_SUCCESS, - instance->vkEnumerateDeviceExtensionProperties( - physical_device, nullptr, &num_extension_properties, nullptr)); - - extension_properties.resize(num_extension_properties); - - if (num_extension_properties > 1) { - uint32_t num_reduced_extension_properties = num_extension_properties - 1; - LOG_EXPECT( - ==, data->logger(), VK_INCOMPLETE, - instance->vkEnumerateDeviceExtensionProperties( - physical_device, nullptr, &num_reduced_extension_properties, - extension_properties.data())); - } - - LOG_EXPECT(==, data->logger(), VK_SUCCESS, - instance->vkEnumerateDeviceExtensionProperties( - physical_device, nullptr, &num_extension_properties, - extension_properties.data())); - - for (const auto& extension : extension_properties) { - data->logger()->LogInfo(" Device Extension Found ", extension.extensionName); - } - - for (const auto& layer : layer_properties) { - data->logger()->LogInfo(" Device Layer Found ", layer.layerName); - - LOG_EXPECT(==, data->logger(), VK_SUCCESS, - instance->vkEnumerateDeviceExtensionProperties( - physical_device, layer.layerName, - &num_extension_properties, nullptr)); - - extension_properties.resize(num_extension_properties); - LOG_EXPECT(==, data->logger(), VK_SUCCESS, - instance->vkEnumerateDeviceExtensionProperties( - physical_device, layer.layerName, - &num_extension_properties, extension_properties.data())); - for (const auto& extension : extension_properties) { - data->logger()->LogInfo(" Extension Found ", extension.extensionName); - } - } - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/traits_query_tests/PhysicalDeviceImageFormatTraits/CMakeLists.txt b/gapid_tests/traits_query_tests/PhysicalDeviceImageFormatTraits/CMakeLists.txt deleted file mode 100644 index d26b8082..00000000 --- a/gapid_tests/traits_query_tests/PhysicalDeviceImageFormatTraits/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(PhysicalDeviceImageFormatTraits_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/traits_query_tests/PhysicalDeviceImageFormatTraits/PhysicalDeviceImageFormatTraits_test.py b/gapid_tests/traits_query_tests/PhysicalDeviceImageFormatTraits/PhysicalDeviceImageFormatTraits_test.py deleted file mode 100644 index 57543bf6..00000000 --- a/gapid_tests/traits_query_tests/PhysicalDeviceImageFormatTraits/PhysicalDeviceImageFormatTraits_test.py +++ /dev/null @@ -1,125 +0,0 @@ -# Copyright 2017 Google 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. - -from numpy import int32 - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_write_offset_function -from vulkan_constants import * -from struct_offsets import VulkanStruct, UINT32_T, UINT64_T, ARRAY, POINTER - -IMAGE_FORMAT_PROPERTIES = [ - ("maxExtent_width", UINT32_T), - ("maxExtent_height", UINT32_T), - ("maxExtent_depth", UINT32_T), - ("maxMipLevels", UINT32_T), - ("maxArrayLayers", UINT32_T), - ("maxResourceSize", UINT64_T), -] - - -def GetPhysicalDevices(test, architecture): - # first call to enumerate physical devices - first_enumerate_physical_devices = require(test.next_call_of( - "vkEnumeratePhysicalDevices")) - require_equal(VK_SUCCESS, int(first_enumerate_physical_devices.return_val)) - require_not_equal(0, first_enumerate_physical_devices.int_instance) - require_not_equal(0, - first_enumerate_physical_devices.hex_pPhysicalDeviceCount) - require_equal(0, first_enumerate_physical_devices.hex_pPhysicalDevices) - - num_phy_devices = little_endian_bytes_to_int(require( - first_enumerate_physical_devices.get_write_data( - first_enumerate_physical_devices.hex_pPhysicalDeviceCount, - architecture.int_integerSize))) - - # second call to enumerate physical devices - second_enumerate_physical_devices = require(test.next_call_of( - "vkEnumeratePhysicalDevices")) - require_equal(VK_SUCCESS, int(second_enumerate_physical_devices.return_val)) - require_not_equal(0, second_enumerate_physical_devices.int_instance) - require_not_equal( - 0, second_enumerate_physical_devices.hex_pPhysicalDeviceCount) - require_not_equal(0, second_enumerate_physical_devices.hex_pPhysicalDevices) - require_not_equal(0, num_phy_devices) - PHYSICAL_DEVICES = [("physicalDevices", ARRAY, num_phy_devices, POINTER)] - returned_physical_devices = VulkanStruct( - architecture, PHYSICAL_DEVICES, get_write_offset_function( - second_enumerate_physical_devices, - second_enumerate_physical_devices.hex_pPhysicalDevices)) - return returned_physical_devices.physicalDevices - - -def IsExpectedReturnCode(rc): - if rc == VK_SUCCESS or rc == VK_ERROR_OUT_OF_HOST_MEMORY or rc == VK_ERROR_OUT_OF_DEVICE_MEMORY or rc == VK_ERROR_FORMAT_NOT_SUPPORTED: - return True - return False - - -def CheckAtom(atom, - architecture, - physical_device, - format=VK_FORMAT_R8G8B8A8_UNORM, - type=VK_IMAGE_TYPE_2D, - tiling=VK_IMAGE_TILING_OPTIMAL, - usage=VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, - flags=0): - require_equal(True, IsExpectedReturnCode(int(int32(atom.return_val)))) - require_equal(physical_device, atom.int_physicalDevice) - require_equal(format, atom.int_format) - require_equal(type, atom.int_type) - require_equal(tiling, atom.int_tiling) - require_equal(usage, atom.int_usage) - require_equal(flags, atom.int_flags) - require_not_equal(0, atom.hex_pImageFormatProperties) - - if int(atom.return_val) == VK_SUCCESS: - VulkanStruct(architecture, IMAGE_FORMAT_PROPERTIES, - get_write_offset_function(atom, - atom.hex_pImageFormatProperties)) - - -@gapit_test("PhysicalDeviceImageFormatTraits_test") -class GetPhysicalDeviceImageFormatProperties(GapitTest): - - def expect(self): - arch = self.architecture - physical_devices = GetPhysicalDevices(self, arch) - - for pd in physical_devices: - for fmt in ALL_VK_FORMATS: - get_properties = require(self.next_call_of( - "vkGetPhysicalDeviceImageFormatProperties")) - CheckAtom(get_properties, arch, pd, format=fmt) - - for t in ALL_VK_IMAGE_TYPES: - get_properties = require(self.next_call_of( - "vkGetPhysicalDeviceImageFormatProperties")) - CheckAtom(get_properties, arch, pd, type=t) - - for t in ALL_VK_IMAGE_TILINGS: - get_properties = require(self.next_call_of( - "vkGetPhysicalDeviceImageFormatProperties")) - CheckAtom(get_properties, arch, pd, tiling=t) - - for u in ALL_VK_IMAGE_USAGE_COMBINATIONS: - get_properties = require(self.next_call_of( - "vkGetPhysicalDeviceImageFormatProperties")) - CheckAtom(get_properties, arch, pd, usage=u) - - for f in ALL_VK_IMAGE_CREATE_FLAG_COMBINATIONS: - get_properties = require(self.next_call_of( - "vkGetPhysicalDeviceImageFormatProperties")) - CheckAtom(get_properties, arch, pd, flags=f) diff --git a/gapid_tests/traits_query_tests/PhysicalDeviceImageFormatTraits/README.md b/gapid_tests/traits_query_tests/PhysicalDeviceImageFormatTraits/README.md deleted file mode 100644 index a331620d..00000000 --- a/gapid_tests/traits_query_tests/PhysicalDeviceImageFormatTraits/README.md +++ /dev/null @@ -1,79 +0,0 @@ -# Physical Device Image Format Traits - -## Signatures -```c++ -VkResult vkGetPhysicalDeviceImageFormatProperties( - VkPhysicalDevice physicalDevice, - VkFormat format, - VkImageType type, - VkImageTiling tiling, - VkImageUsageFlags usage, - VkImageCreateFlags flags, - VkImageFormatProperties* pImageFormatProperties); - -void vkGetPhysicalDeviceSparseImageFormatProperties( - VkPhysicalDevice physicalDevice, - VkFormat format, - VkImageType type, - VkSampleCountFlagBits samples, - VkImageUsageFlags usage, - VkImageTiling tiling, - uint32_t* pPropertyCount, - VkSparseImageFormatProperties* pProperties); -``` - -For `vkGetPhysicalDeviceImageFormatProperties`, according to the Vulkan spec: -- `usage` **must not** be 0 - -For `vkGetPhysicalDeviceSparseImageFormatProperties`, according to -the Vulkan spec: -- `usage` **must not** be 0 -- `samples` must be a bit value that is set in - `VkImageFormatProperties::sampleCounts` returned by - `vkGetPhysicalDeviceImageFormatProperties` with `format`, `type`, `tiling`, - and `usage` equal to those in this command and `flags` equal to the value - that is set in `VkImageCreateInfo::flags` when the image is created - -## VkQueueFamilyProperties -```c++ -typedef struct VkImageFormatProperties { - VkExtent3D maxExtent; - uint32_t maxMipLevels; - uint32_t maxArrayLayers; - VkSampleCountFlags sampleCounts; - VkDeviceSize maxResourceSize; -} VkImageFormatProperties; -``` - -## VkSparseImageFormatProperties -```c++ -typedef struct VkSparseImageFormatProperties { - VkImageAspectFlags aspectMask; - VkExtent3D imageGranularity; - VkSparseImageFormatFlags flags; -} VkSparseImageFormatProperties; -``` - -For `vkGetPhysicalDeviceImageFormatProperties`, these tests should test -the following cases: -- [x] all valid `VkFormat` values -- [x] all valid `VkImageType` values -- [x] all valid `VkImageTiling` values -- [x] all valid `VkImageUsageFlags` values excluding 0 -- [x] all valid `VkImageCreateFlags` values - -For `vkGetPhysicalDeviceSparseImageFormatProperties`, these tests should test -the following cases: -- [ ] All combinations of - - all valid `VkFormat` values - - all valid `VkImageType` values - - all valid `VkSampleCountFlagBits` values - - all valid `VkImageUsageFlags` values excluding 0 - - all valid `VkImageTiling` values -- [ ] And for each of the above combinations: - - [ ] `pProperties` == nullptr - - [ ] `pProperties` != nullptr - - [ ] `pPropertyCount` == 0 - - [ ] `pPropertyCount` < the number returned by first call - - [ ] `pPropertyCount` == the number returned by first call - - [ ] `pPropertyCount` > the number returned by first call diff --git a/gapid_tests/traits_query_tests/PhysicalDeviceImageFormatTraits/main.cpp b/gapid_tests/traits_query_tests/PhysicalDeviceImageFormatTraits/main.cpp deleted file mode 100644 index f75a12ff..00000000 --- a/gapid_tests/traits_query_tests/PhysicalDeviceImageFormatTraits/main.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateEmptyInstance(data->allocator(), &wrapper)); - containers::vector physical_devices( - vulkan::GetPhysicalDevices(data->allocator(), instance)); - - data->logger()->LogInfo("API: vkGetPhysicalDeviceImageFormatProperties"); - auto allocator = data->allocator(); - - auto IsExpectedReturnCode = [](const VkResult result) -> bool { - return result == VK_SUCCESS || result == VK_ERROR_FORMAT_NOT_SUPPORTED || - result == VK_ERROR_OUT_OF_HOST_MEMORY || - result == VK_ERROR_OUT_OF_DEVICE_MEMORY; - }; - - VkFormat kDefaultFormat = VK_FORMAT_R8G8B8A8_UNORM; - VkImageType kDefaultType = VK_IMAGE_TYPE_2D; - VkImageTiling kDefaultTiling = VK_IMAGE_TILING_OPTIMAL; - VkImageUsageFlags kDefaultUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; - VkImageCreateFlags kDefaultFlags = 0; - - for (const auto& device : physical_devices) { - data->logger()->LogInfo(" Phyiscal Device: ", device); - uint64_t counter = 0; - - VkImageFormatProperties properties; - - for (auto format : vulkan::AllVkFormats(allocator)) { - const VkResult result = - instance->vkGetPhysicalDeviceImageFormatProperties( - device, format, kDefaultType, kDefaultTiling, kDefaultUsage, - kDefaultFlags, &properties); - LOG_EXPECT(==, data->logger(), IsExpectedReturnCode(result), true); - } - - for (auto type : vulkan::AllVkImageTypes(allocator)) { - const VkResult result = - instance->vkGetPhysicalDeviceImageFormatProperties( - device, kDefaultFormat, type, kDefaultTiling, kDefaultUsage, - kDefaultFlags, &properties); - LOG_EXPECT(==, data->logger(), IsExpectedReturnCode(result), true); - } - - for (auto tiling : vulkan::AllVkImageTilings(allocator)) { - const VkResult result = - instance->vkGetPhysicalDeviceImageFormatProperties( - device, kDefaultFormat, kDefaultType, tiling, kDefaultUsage, - kDefaultFlags, &properties); - LOG_EXPECT(==, data->logger(), IsExpectedReturnCode(result), true); - } - - for (auto usage : vulkan::AllVkImageUsageFlagCombinations(allocator)) { - if (usage == 0) continue; - const VkResult result = - instance->vkGetPhysicalDeviceImageFormatProperties( - device, kDefaultFormat, kDefaultType, kDefaultTiling, usage, - kDefaultFlags, &properties); - LOG_EXPECT(==, data->logger(), IsExpectedReturnCode(result), true); - } - - for (auto flags : vulkan::AllVkImageCreateFlagCombinations(allocator)) { - const VkResult result = - instance->vkGetPhysicalDeviceImageFormatProperties( - device, kDefaultFormat, kDefaultType, kDefaultTiling, - kDefaultUsage, flags, &properties); - LOG_EXPECT(==, data->logger(), IsExpectedReturnCode(result), true); - } - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/traits_query_tests/PhysicalDeviceSurface_tests/CMakeLists.txt b/gapid_tests/traits_query_tests/PhysicalDeviceSurface_tests/CMakeLists.txt deleted file mode 100644 index 7ed5e288..00000000 --- a/gapid_tests/traits_query_tests/PhysicalDeviceSurface_tests/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(PhysicalDeviceSurface_tests - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/traits_query_tests/PhysicalDeviceSurface_tests/PhysicalDeviceSurface_tests.py b/gapid_tests/traits_query_tests/PhysicalDeviceSurface_tests/PhysicalDeviceSurface_tests.py deleted file mode 100644 index a324c7cb..00000000 --- a/gapid_tests/traits_query_tests/PhysicalDeviceSurface_tests/PhysicalDeviceSurface_tests.py +++ /dev/null @@ -1,185 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest -import gapit_test_framework -from vulkan_constants import * - - -@gapit_test("PhysicalDeviceSurface_tests") -class PhysicalDeviceSurfaceQueries(GapitTest): - - def expect(self): - architecture = self.architecture - - enumerate_physical_devices = require( - self.next_call_of("vkEnumeratePhysicalDevices")) - - num_physical_devices = little_endian_bytes_to_int( - require( - enumerate_physical_devices.get_write_data( - enumerate_physical_devices.hex_pPhysicalDeviceCount, 4))) - for i in range(num_physical_devices): - physical_device_properties = require( - self.next_call_of("vkGetPhysicalDeviceProperties")) - get_queue_family_properties = require( - self.next_call_of("vkGetPhysicalDeviceQueueFamilyProperties")) - num_queue_families = little_endian_bytes_to_int( - require( - get_queue_family_properties.get_write_data( - get_queue_family_properties. - hex_pQueueFamilyPropertyCount, 4))) - supports = False - for j in range(num_queue_families): - get_physical_device_surface_support = require( - self.next_call_of("vkGetPhysicalDeviceSurfaceSupportKHR")) - supports_surface = little_endian_bytes_to_int( - require( - get_physical_device_surface_support.get_write_data( - get_physical_device_surface_support.hex_pSupported, - 4))) - supports = supports | (supports_surface > 0) - - if supports: - get_physical_device_surface_capabilities = require( - self.next_call_of( - "vkGetPhysicalDeviceSurfaceCapabilitiesKHR")) - require_equal( - VK_SUCCESS, - int(get_physical_device_surface_capabilities.return_val)) - get_physical_device_surface_formats = require( - self.next_call_of("vkGetPhysicalDeviceSurfaceFormatsKHR")) - - get_physical_device_surface_formats_2 = require( - self.next_call_of("vkGetPhysicalDeviceSurfaceFormatsKHR")) - - max_surface_format_count = little_endian_bytes_to_int( - require( - get_physical_device_surface_formats.get_write_data( - get_physical_device_surface_formats. - hex_pSurfaceFormatCount, 4))) - - if max_surface_format_count > 1: - get_physical_device_surface_formats_3 = require( - self.next_call_of( - "vkGetPhysicalDeviceSurfaceFormatsKHR")) - - # 2 should request the same number as the return of 1 - require_equal( - max_surface_format_count, little_endian_bytes_to_int( - require( - get_physical_device_surface_formats_2. - get_write_data( - get_physical_device_surface_formats_2. - hex_pSurfaceFormatCount, 4)))) - - # Re-enable this once the loader behaves correctly - # require_equal( - # max_surface_format_count - 1, - # little_endian_bytes_to_int( - # require( - # get_physical_device_surface_formats_3. - # get_write_data( - # get_physical_device_surface_formats_3. - # hex_pSurfaceFormatCount, 4)))) - # 2 should have observed *PSurfaceFormatCount - # * sizeof(VkSurfaceFormatKHR) - # = *PSurfaceFormatCount * 4 * 2 - for i in range(0, max_surface_format_count): - _ = require( - get_physical_device_surface_formats_2.get_write_data( - get_physical_device_surface_formats_2. - hex_pSurfaceFormats + i * 8, 8)) - - -@gapit_test("PhysicalDeviceSurface_tests") -class PhysicalDevicePresentModeQuery(GapitTest): - - def expect(self): - architecture = self.architecture - - enumerate_physical_devices = require( - self.next_call_of("vkEnumeratePhysicalDevices")) - - num_physical_devices = little_endian_bytes_to_int( - require( - enumerate_physical_devices.get_write_data( - enumerate_physical_devices.hex_pPhysicalDeviceCount, 4))) - for i in range(num_physical_devices): - physical_device_properties = require( - self.next_call_of("vkGetPhysicalDeviceProperties")) - get_queue_family_properties = require( - self.next_call_of("vkGetPhysicalDeviceQueueFamilyProperties")) - num_queue_families = little_endian_bytes_to_int( - require( - get_queue_family_properties.get_write_data( - get_queue_family_properties. - hex_pQueueFamilyPropertyCount, 4))) - supports = False - for j in range(num_queue_families): - get_physical_device_surface_support = require( - self.next_call_of("vkGetPhysicalDeviceSurfaceSupportKHR")) - supports_surface = little_endian_bytes_to_int( - require( - get_physical_device_surface_support.get_write_data( - get_physical_device_surface_support.hex_pSupported, - 4))) - supports = supports | (supports_surface > 0) - - if supports: - get_physical_device_surface_present_modes = require( - self.next_call_of( - "vkGetPhysicalDeviceSurfacePresentModesKHR")) - - get_physical_device_surface_present_modes_2 = require( - self.next_call_of( - "vkGetPhysicalDeviceSurfacePresentModesKHR")) - - max_present_mode_count = little_endian_bytes_to_int( - require( - get_physical_device_surface_present_modes. - get_write_data( - get_physical_device_surface_present_modes. - hex_pPresentModeCount, 4))) - - if max_present_mode_count > 1: - get_physical_device_surface_present_modes_3 = require( - self.next_call_of( - "vkGetPhysicalDeviceSurfacePresentModesKHR")) - - # 2 should request the same number as the return of 1 - require_equal( - max_present_mode_count, little_endian_bytes_to_int( - require( - get_physical_device_surface_present_modes_2. - get_write_data( - get_physical_device_surface_present_modes_2. - hex_pPresentModeCount, 4)))) - - # Re-enable this once the loader does this correctly. - # require_equal( - # max_present_mode_count - 1, - # little_endian_bytes_to_int( - # require( - # get_physical_device_surface_present_modes_3. - # get_write_data( - # get_physical_device_surface_present_modes_3. - # hex_pPresentModeCount, 4)))) - # 2 should have observed *PSurfaceFormatCount - # * sizeof(uint32_t) - # = *PSurfaceFormatCount * 4 - for i in range(0, max_present_mode_count): - _ = require( - get_physical_device_surface_present_modes_2.get_write_data( - get_physical_device_surface_present_modes_2. - hex_pPresentModes + i * 4, 4)) diff --git a/gapid_tests/traits_query_tests/PhysicalDeviceSurface_tests/README.md b/gapid_tests/traits_query_tests/PhysicalDeviceSurface_tests/README.md deleted file mode 100644 index 38ff8c4f..00000000 --- a/gapid_tests/traits_query_tests/PhysicalDeviceSurface_tests/README.md +++ /dev/null @@ -1,96 +0,0 @@ -# vkGetPhysicalDeviceSurfaceSupportKHR / vkGetPhysicalDeviceSurfaceCapabilitiesKHR / vkGetPhysicalDeviceSurfaceFormatsKHR - -## Signatures -```c++ -VkResult vkGetPhysicalDeviceSurfaceSupportKHR( - VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - VkSurfaceKHR surface, - VkBool32* pSupported); - -VkResult vkGetPhysicalDeviceSurfaceCapabilitiesKHR( - VkPhysicalDevice physicalDevice, - VkSurfaceKHR surface, - VkSurfaceCapabilitiesKHR* pSurfaceCapabilities); - -VkResult vkGetPhysicalDeviceSurfaceFormatsKHR( - VkPhysicalDevice physicalDevice, - VkSurfaceKHR surface, - uint32_t* pSurfaceFormatCount, - VkSurfaceFormatKHR* pSurfaceFormats); - -VkResult vkGetPhysicalDeviceSurfacePresentModesKHR( - VkPhysicalDevice physicalDevice, - VkSurfaceKHR surface, - uint32_t* pPresentModeCount, - VkPresentModeKHR* pPresentModes); -``` - -According to the Vulkan spec: -- vkGetPhysicalDeviceSurfaceSupportKHR - - `physicalDevice` **must** be valid - - `queueFamilyIndex` **must** be a valid queue family index - - `surface` **must** be a valid surface - - `supported` **must** be a valid bool pointer -- vkGetPhysicalDeviceSurfaceCapabilitiesKHR - - `physicalDevice` **must** be valid - - `surface` **must** be valid - - `pSurfaceCapabilities` **must** be valid -- vkGetPhysicalDeviceSurfaceFormatsKHR - - `physicalDevice` **must** be valid - - `surface` **must** be valid - - `pSurfaceFormatCount` must be a valid pointer - - `pSurfaceFormats` is either nullptr or a pointer to `*pSurfaceFormatCount` - `VkSurfaceFormatKHR` structures. -- vkGetPhysicalDeviceSurfacePresentModesKHR - - `physicalDevice` **must** be valid - - `surface` **must** be valid - - `pPresentModeCount` must be a valid pointer - - `pPresentModes` is either nullptr or a pointer to `*pPresentModeCount` - `VkPresentModeKHR` values. - -## VkSurfaceCapabilitiesKHR -```c++ -typedef struct VkSurfaceCapabilitiesKHR { - uint32_t minImageCount; - uint32_t maxImageCount; - VkExtent2D currentExtent; - VkExtent2D minImageExtent; - VkExtent2D maxImageExtent; - uint32_t maxImageArrayLayers; - VkSurfaceTransformFlagsKHR supportedTransforms; - VkSurfaceTransformFlagBitsKHR currentTransform; - VkCompositeAlphaFlagsKHR supportedCompositeAlpha; - VkImageUsageFlags supportedUsageFlags; -} VkSurfaceCapabilitiesKHR; -``` - -## VkSurfaceFormatKHR -```c++ -typedef struct VkSurfaceFormatKHR { - VkFormat format; - VkColorSpaceKHR colorSpace; -} VkSurfaceFormatKHR; -``` - -## VkPresentModeKHR -``` -typedef enum VkPresentModeKHR { - VK_PRESENT_MODE_IMMEDIATE_KHR = 0, - VK_PRESENT_MODE_MAILBOX_KHR = 1, - VK_PRESENT_MODE_FIFO_KHR = 2, - VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3, -} VkPresentModeKHR; -``` - -These tests should test the following cases: -- [x] Valid `vkGetPhysicalDeviceSurfaceSupportKHR` -- [x] Valid `vkGetPhysicalDeviceSurfaceCapabilitiesKHR` -- [x] `vkGetPhysicalDeviceSurfaceFormatsKHR:pSurfaceFormatCount` 0 -- [x] `vkGetPhysicalDeviceSurfaceFormatsKHR:pSurfaceFormatCount` returned_value -- [x] `vkGetPhysicalDeviceSurfaceFormatsKHR:pSurfaceFormatCount` - 0 < val < returned_value -- [x] `pPresentModeCount` 0 -- [x] `pPresentModeCount` returned_value -- [x] `pPresentModeCount` 0 < val < returned_value - diff --git a/gapid_tests/traits_query_tests/PhysicalDeviceSurface_tests/main.cpp b/gapid_tests/traits_query_tests/PhysicalDeviceSurface_tests/main.cpp deleted file mode 100644 index afb11efa..00000000 --- a/gapid_tests/traits_query_tests/PhysicalDeviceSurface_tests/main.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateDefaultInstance(data->allocator(), &wrapper)); - - vulkan::VkSurfaceKHR surface(vulkan::CreateDefaultSurface(&instance, data)); - containers::vector devices = - vulkan::GetPhysicalDevices(data->allocator(), instance); - - for (auto device : devices) { - VkPhysicalDeviceProperties device_properties; - instance->vkGetPhysicalDeviceProperties(device, &device_properties); - - data->logger()->LogInfo("Physical Device Surfaces for ", - ::VkPhysicalDevice(device)); - auto properties = - GetQueueFamilyProperties(data->allocator(), instance, device); - bool device_supports = false; - - for (size_t i = 0; i < properties.size(); ++i) { - VkBool32 supported = false; - LOG_EXPECT(==, data->logger(), instance->vkGetPhysicalDeviceSurfaceSupportKHR( - device, i, surface, &supported), - VK_SUCCESS); - if (supported) { - data->logger()->LogInfo(" Supports surfaces on queue ", i); - } else { - data->logger()->LogInfo(" Does not support surfaces on queue ", i); - } - device_supports |= (supported != 0); - } - if (device_supports) { - VkSurfaceCapabilitiesKHR surface_caps; - LOG_ASSERT(==, data->logger(), - instance->vkGetPhysicalDeviceSurfaceCapabilitiesKHR( - device, surface, &surface_caps), - VK_SUCCESS); - data->logger()->LogInfo(" Capabilities: "); - data->logger()->LogInfo(" minImageCount: ", surface_caps.minImageCount); - data->logger()->LogInfo(" maxImageCount: ", surface_caps.maxImageCount); - data->logger()->LogInfo(" currentExtent: [", - surface_caps.currentExtent.width, ",", - surface_caps.currentExtent.height, "]"); - - uint32_t num_formats = 0; - LOG_EXPECT(==, data->logger(), instance->vkGetPhysicalDeviceSurfaceFormatsKHR( - device, surface, &num_formats, nullptr), - VK_SUCCESS); - - LOG_EXPECT(>, data->logger(), num_formats, 0u); - - containers::vector surface_formats( - data->allocator()); - surface_formats.resize(num_formats); - - LOG_EXPECT(==, data->logger(), - instance->vkGetPhysicalDeviceSurfaceFormatsKHR( - device, surface, &num_formats, surface_formats.data()), - VK_SUCCESS); - data->logger()->LogInfo(" Formats[", num_formats, "]:"); - for (auto format : surface_formats) { - data->logger()->LogInfo(" ", format.format, ":", format.colorSpace); - } - if (num_formats > 1) { - num_formats -= 1; - const uint32_t expected_num_formats = num_formats; - LOG_EXPECT(==, data->logger(), - instance->vkGetPhysicalDeviceSurfaceFormatsKHR( - device, surface, &num_formats, surface_formats.data()), - VK_INCOMPLETE); - LOG_EXPECT(==, data->logger(), expected_num_formats, num_formats); - LOG_EXPECT(!=, data->logger(), (size_t)surface_formats.data(), - (size_t) nullptr); - } - - uint32_t num_present_modes = 0; - LOG_EXPECT(==, data->logger(), - instance->vkGetPhysicalDeviceSurfacePresentModesKHR( - device, surface, &num_present_modes, nullptr), - VK_SUCCESS); - - containers::vector present_modes(data->allocator()); - present_modes.resize(num_present_modes); - - LOG_EXPECT(==, data->logger(), - instance->vkGetPhysicalDeviceSurfacePresentModesKHR( - device, surface, &num_present_modes, present_modes.data()), - VK_SUCCESS); - - if (num_present_modes > 1) { - num_present_modes -= 1; - uint32_t expected_num_present_modes = num_present_modes; - LOG_EXPECT( - ==, data->logger(), - instance->vkGetPhysicalDeviceSurfacePresentModesKHR( - device, surface, &num_present_modes, present_modes.data()), - VK_INCOMPLETE); - LOG_EXPECT(==, data->logger(), expected_num_present_modes, - num_present_modes); - } - } - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/traits_query_tests/PhysicalDeviceTraits/CMakeLists.txt b/gapid_tests/traits_query_tests/PhysicalDeviceTraits/CMakeLists.txt deleted file mode 100644 index c924aaad..00000000 --- a/gapid_tests/traits_query_tests/PhysicalDeviceTraits/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(PhysicalDeviceTraits_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/traits_query_tests/PhysicalDeviceTraits/PhysicalDeviceTraits_test.py b/gapid_tests/traits_query_tests/PhysicalDeviceTraits/PhysicalDeviceTraits_test.py deleted file mode 100644 index bf0a3a44..00000000 --- a/gapid_tests/traits_query_tests/PhysicalDeviceTraits/PhysicalDeviceTraits_test.py +++ /dev/null @@ -1,175 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_write_offset_function -from vulkan_constants import * -from struct_offsets import VulkanStruct, BOOL32, UINT32_T, POINTER, ARRAY - -PHYSICAL_DEVICE_FEATURES = [ - ("robustBufferAccess", BOOL32), - ("fullDrawIndexUint32", BOOL32), - ("imageCubeArray", BOOL32), - ("independentBlend", BOOL32), - ("geometryShader", BOOL32), - ("tessellationShader", BOOL32), - ("sampleRateShading", BOOL32), - ("dualSrcBlend", BOOL32), - ("logicOp", BOOL32), - ("multiDrawIndirect", BOOL32), - ("drawIndirectFirstInstance", BOOL32), - ("depthClamp", BOOL32), - ("depthBiasClamp", BOOL32), - ("fillModeNonSolid", BOOL32), - ("depthBounds", BOOL32), - ("wideLines", BOOL32), - ("largePoints", BOOL32), - ("alphaToOne", BOOL32), - ("multiViewport", BOOL32), - ("samplerAnisotropy", BOOL32), - ("textureCompressionETC2", BOOL32), - ("textureCompressionASTC_LDR", BOOL32), - ("textureCompressionBC", BOOL32), - ("occlusionQueryPrecise", BOOL32), - ("pipelineStatisticsQuery", BOOL32), - ("vertexPipelineStoresAndAtomics", BOOL32), - ("fragmentStoresAndAtomics", BOOL32), - ("shaderTessellationAndGeometryPointSize", BOOL32), - ("shaderImageGatherExtended", BOOL32), - ("shaderStorageImageExtendedFormats", BOOL32), - ("shaderStorageImageMultisample", BOOL32), - ("shaderStorageImageReadWithoutFormat", BOOL32), - ("shaderStorageImageWriteWithoutFormat", BOOL32), - ("shaderUniformBufferArrayDynamicIndexing", BOOL32), - ("shaderSampledImageArrayDynamicIndexing", BOOL32), - ("shaderStorageBufferArrayDynamicIndexing", BOOL32), - ("shaderStorageImageArrayDynamicIndexing", BOOL32), - ("shaderClipDistance", BOOL32), - ("shaderCullDistance", BOOL32), - ("shaderFloat64", BOOL32), - ("shaderInt64", BOOL32), - ("shaderInt16", BOOL32), - ("shaderResourceResidency", BOOL32), - ("shaderResourceMinLod", BOOL32), - ("sparseBinding", BOOL32), - ("sparseResidencyBuffer", BOOL32), - ("sparseResidencyImage2D", BOOL32), - ("sparseResidencyImage3D", BOOL32), - ("sparseResidency2Samples", BOOL32), - ("sparseResidency4Samples", BOOL32), - ("sparseResidency8Samples", BOOL32), - ("sparseResidency16Samples", BOOL32), - ("sparseResidencyAliased", BOOL32), - ("variableMultisampleRate", BOOL32), - ("inheritedQueries", BOOL32), -] - - -def GetPhysicalDevices(test, architecture): - # first call to enumerate physical devices - first_enumerate_physical_devices = require(test.next_call_of( - "vkEnumeratePhysicalDevices")) - require_equal(VK_SUCCESS, int(first_enumerate_physical_devices.return_val)) - require_not_equal(0, first_enumerate_physical_devices.int_instance) - require_not_equal(0, - first_enumerate_physical_devices.hex_pPhysicalDeviceCount) - require_equal(0, first_enumerate_physical_devices.hex_pPhysicalDevices) - - num_phy_devices = little_endian_bytes_to_int(require( - first_enumerate_physical_devices.get_write_data( - first_enumerate_physical_devices.hex_pPhysicalDeviceCount, - architecture.int_integerSize))) - - # second call to enumerate physical devices - second_enumerate_physical_devices = require(test.next_call_of( - "vkEnumeratePhysicalDevices")) - require_equal(VK_SUCCESS, int( - second_enumerate_physical_devices.return_val)) - require_not_equal(0, second_enumerate_physical_devices.int_instance) - require_not_equal( - 0, second_enumerate_physical_devices.hex_pPhysicalDeviceCount) - require_not_equal( - 0, second_enumerate_physical_devices.hex_pPhysicalDevices) - require_not_equal(0, num_phy_devices) - PHYSICAL_DEVICES = [("physicalDevices", ARRAY, num_phy_devices, POINTER)] - returned_physical_devices = VulkanStruct( - architecture, PHYSICAL_DEVICES, get_write_offset_function( - second_enumerate_physical_devices, - second_enumerate_physical_devices.hex_pPhysicalDevices)) - return returned_physical_devices.physicalDevices - - -@gapit_test("PhysicalDeviceTraits_test") -class GetPhysicalDeviceFeatures(GapitTest): - - def expect(self): - """1. Expect vkEnumeratePhysicalDevices() to be called first, then - vkGetPhysicalDeviceFeatures() to be called num_phy_devices times and - return physical device features.""" - - arch = self.architecture - physical_devices = GetPhysicalDevices(self, arch) - for pd in physical_devices: - get_features = require(self.next_call_of( - "vkGetPhysicalDeviceFeatures")) - # Some layers make extra calls - # into VkEnumeratePhysicalDevices and re-order the calls. - # This means that the order of physical devices might not - # be the same as expected. So just make sure that - # the call at least contains ONE of the physical devices - require_equal( - True, get_features.int_physicalDevice in physical_devices) - require_not_equal(0, get_features.hex_pFeatures) - VulkanStruct(arch, PHYSICAL_DEVICE_FEATURES, - get_write_offset_function(get_features, - get_features.hex_pFeatures)) - - -@gapit_test("PhysicalDeviceTraits_test") -class GetPhysicalDeviceMemoryProperties(GapitTest): - - def expect(self): - """2. Expect vkEnumeratePhysicalDevices() to be called first, then - vkGetPhysicalDeviceMemoryProperties() to be called num_phy_devices times - and return physical device memory properties.""" - - arch = self.architecture - physical_devices = GetPhysicalDevices(self, arch) - for pd in physical_devices: - get_memory_properties = require(self.next_call_of( - "vkGetPhysicalDeviceMemoryProperties")) - require_equal( - True, get_memory_properties.int_physicalDevice in physical_devices) - require_not_equal(0, get_memory_properties.hex_pMemoryProperties) - # TODO: Check the existance of the memory property struct - - -@gapit_test("PhysicalDeviceTraits_test") -class GetPhysicalDeviceProperties(GapitTest): - - def expect(self): - """3. Expect vkEnumeratePhysicalDevices() to be called first, then - vkGetPhysicalDeviceProperties() to be called num_phy_devices times - and return physical device properties.""" - - arch = self.architecture - physical_devices = GetPhysicalDevices(self, arch) - for pd in physical_devices: - get_device_properties = require(self.next_call_of( - "vkGetPhysicalDeviceProperties")) - require_equal( - True, get_device_properties.int_physicalDevice in physical_devices) - require_not_equal(0, get_device_properties.hex_pProperties) - # TODO: Check the existance of the property struct diff --git a/gapid_tests/traits_query_tests/PhysicalDeviceTraits/README.md b/gapid_tests/traits_query_tests/PhysicalDeviceTraits/README.md deleted file mode 100644 index 1062542e..00000000 --- a/gapid_tests/traits_query_tests/PhysicalDeviceTraits/README.md +++ /dev/null @@ -1,248 +0,0 @@ -# Physical Device Traits - -## Signatures -```c++ -void vkGetPhysicalDeviceFeatures( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceFeatures* pFeatures); - -void vkGetPhysicalDeviceMemoryProperties( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceMemoryProperties* pMemoryProperties); - -void vkGetPhysicalDeviceProperties( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceProperties* pProperties); -``` - -For `vkGetPhysicalDeviceFeatures`, according to the Vulkan spec: -- `physicalDevice` **must** be a valid `VkPhysicalDevice` handle -- `pFeatures` **must** be a pointer to a `VkPhysicalDeviceFeatures` structure - -For `vkGetPhysicalDeviceMemoryProperties`, according to the Vulkan spec: -- `physicalDevice` **must** be a valid `VkPhysicalDevice` handle -- `pMemoryProperties` **must** be a pointer to a - `VkPhysicalDeviceMemoryProperties` structure - -For `vkGetPhysicalDeviceProperties`, according to the Vulkan spec: -- `physicalDevice` **must** be a valid `VkPhysicalDevice` handle -- `pProperties` **must** be a pointer to a `VkPhysicalDeviceProperties` - structure - -## VkPhysicalDeviceFeatures -```c++ -typedef struct VkPhysicalDeviceFeatures { - VkBool32 robustBufferAccess; - VkBool32 fullDrawIndexUint32; - VkBool32 imageCubeArray; - VkBool32 independentBlend; - VkBool32 geometryShader; - VkBool32 tessellationShader; - VkBool32 sampleRateShading; - VkBool32 dualSrcBlend; - VkBool32 logicOp; - VkBool32 multiDrawIndirect; - VkBool32 drawIndirectFirstInstance; - VkBool32 depthClamp; - VkBool32 depthBiasClamp; - VkBool32 fillModeNonSolid; - VkBool32 depthBounds; - VkBool32 wideLines; - VkBool32 largePoints; - VkBool32 alphaToOne; - VkBool32 multiViewport; - VkBool32 samplerAnisotropy; - VkBool32 textureCompressionETC2; - VkBool32 textureCompressionASTC_LDR; - VkBool32 textureCompressionBC; - VkBool32 occlusionQueryPrecise; - VkBool32 pipelineStatisticsQuery; - VkBool32 vertexPipelineStoresAndAtomics; - VkBool32 fragmentStoresAndAtomics; - VkBool32 shaderTessellationAndGeometryPointSize; - VkBool32 shaderImageGatherExtended; - VkBool32 shaderStorageImageExtendedFormats; - VkBool32 shaderStorageImageMultisample; - VkBool32 shaderStorageImageReadWithoutFormat; - VkBool32 shaderStorageImageWriteWithoutFormat; - VkBool32 shaderUniformBufferArrayDynamicIndexing; - VkBool32 shaderSampledImageArrayDynamicIndexing; - VkBool32 shaderStorageBufferArrayDynamicIndexing; - VkBool32 shaderStorageImageArrayDynamicIndexing; - VkBool32 shaderClipDistance; - VkBool32 shaderCullDistance; - VkBool32 shaderFloat64; - VkBool32 shaderInt64; - VkBool32 shaderInt16; - VkBool32 shaderResourceResidency; - VkBool32 shaderResourceMinLod; - VkBool32 sparseBinding; - VkBool32 sparseResidencyBuffer; - VkBool32 sparseResidencyImage2D; - VkBool32 sparseResidencyImage3D; - VkBool32 sparseResidency2Samples; - VkBool32 sparseResidency4Samples; - VkBool32 sparseResidency8Samples; - VkBool32 sparseResidency16Samples; - VkBool32 sparseResidencyAliased; - VkBool32 variableMultisampleRate; - VkBool32 inheritedQueries; -} VkPhysicalDeviceFeatures; -``` - -## VkPhysicalDeviceMemoryProperties -```c++ -typedef struct VkPhysicalDeviceMemoryProperties { - uint32_t memoryTypeCount; - VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES]; - uint32_t memoryHeapCount; - VkMemoryHeap memoryHeaps[VK_MAX_MEMORY_HEAPS]; -} VkPhysicalDeviceMemoryProperties; - -typedef struct VkMemoryType { - VkMemoryPropertyFlags propertyFlags; - uint32_t heapIndex; -} VkMemoryType; - -typedef struct VkMemoryHeap { - VkDeviceSize size; - VkMemoryHeapFlags flags; -} VkMemoryHeap; -``` - -## VkPhysicalDeviceProperties -```c++ -typedef struct VkPhysicalDeviceProperties { - uint32_t apiVersion; - uint32_t driverVersion; - uint32_t vendorID; - uint32_t deviceID; - VkPhysicalDeviceType deviceType; - char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]; - uint8_t pipelineCacheUUID[VK_UUID_SIZE]; - VkPhysicalDeviceLimits limits; - VkPhysicalDeviceSparseProperties sparseProperties; -} VkPhysicalDeviceProperties; - -typedef struct VkPhysicalDeviceLimits { - uint32_t maxImageDimension1D; - uint32_t maxImageDimension2D; - uint32_t maxImageDimension3D; - uint32_t maxImageDimensionCube; - uint32_t maxImageArrayLayers; - uint32_t maxTexelBufferElements; - uint32_t maxUniformBufferRange; - uint32_t maxStorageBufferRange; - uint32_t maxPushConstantsSize; - uint32_t maxMemoryAllocationCount; - uint32_t maxSamplerAllocationCount; - VkDeviceSize bufferImageGranularity; - VkDeviceSize sparseAddressSpaceSize; - uint32_t maxBoundDescriptorSets; - uint32_t maxPerStageDescriptorSamplers; - uint32_t maxPerStageDescriptorUniformBuffers; - uint32_t maxPerStageDescriptorStorageBuffers; - uint32_t maxPerStageDescriptorSampledImages; - uint32_t maxPerStageDescriptorStorageImages; - uint32_t maxPerStageDescriptorInputAttachments; - uint32_t maxPerStageResources; - uint32_t maxDescriptorSetSamplers; - uint32_t maxDescriptorSetUniformBuffers; - uint32_t maxDescriptorSetUniformBuffersDynamic; - uint32_t maxDescriptorSetStorageBuffers; - uint32_t maxDescriptorSetStorageBuffersDynamic; - uint32_t maxDescriptorSetSampledImages; - uint32_t maxDescriptorSetStorageImages; - uint32_t maxDescriptorSetInputAttachments; - uint32_t maxVertexInputAttributes; - uint32_t maxVertexInputBindings; - uint32_t maxVertexInputAttributeOffset; - uint32_t maxVertexInputBindingStride; - uint32_t maxVertexOutputComponents; - uint32_t maxTessellationGenerationLevel; - uint32_t maxTessellationPatchSize; - uint32_t maxTessellationControlPerVertexInputComponents; - uint32_t maxTessellationControlPerVertexOutputComponents; - uint32_t maxTessellationControlPerPatchOutputComponents; - uint32_t maxTessellationControlTotalOutputComponents; - uint32_t maxTessellationEvaluationInputComponents; - uint32_t maxTessellationEvaluationOutputComponents; - uint32_t maxGeometryShaderInvocations; - uint32_t maxGeometryInputComponents; - uint32_t maxGeometryOutputComponents; - uint32_t maxGeometryOutputVertices; - uint32_t maxGeometryTotalOutputComponents; - uint32_t maxFragmentInputComponents; - uint32_t maxFragmentOutputAttachments; - uint32_t maxFragmentDualSrcAttachments; - uint32_t maxFragmentCombinedOutputResources; - uint32_t maxComputeSharedMemorySize; - uint32_t maxComputeWorkGroupCount[3]; - uint32_t maxComputeWorkGroupInvocations; - uint32_t maxComputeWorkGroupSize[3]; - uint32_t subPixelPrecisionBits; - uint32_t subTexelPrecisionBits; - uint32_t mipmapPrecisionBits; - uint32_t maxDrawIndexedIndexValue; - uint32_t maxDrawIndirectCount; - float maxSamplerLodBias; - float maxSamplerAnisotropy; - uint32_t maxViewports; - uint32_t maxViewportDimensions[2]; - float viewportBoundsRange[2]; - uint32_t viewportSubPixelBits; - size_t minMemoryMapAlignment; - VkDeviceSize minTexelBufferOffsetAlignment; - VkDeviceSize minUniformBufferOffsetAlignment; - VkDeviceSize minStorageBufferOffsetAlignment; - int32_t minTexelOffset; - uint32_t maxTexelOffset; - int32_t minTexelGatherOffset; - uint32_t maxTexelGatherOffset; - float minInterpolationOffset; - float maxInterpolationOffset; - uint32_t subPixelInterpolationOffsetBits; - uint32_t maxFramebufferWidth; - uint32_t maxFramebufferHeight; - uint32_t maxFramebufferLayers; - VkSampleCountFlags framebufferColorSampleCounts; - VkSampleCountFlags framebufferDepthSampleCounts; - VkSampleCountFlags framebufferStencilSampleCounts; - VkSampleCountFlags framebufferNoAttachmentsSampleCounts; - uint32_t maxColorAttachments; - VkSampleCountFlags sampledImageColorSampleCounts; - VkSampleCountFlags sampledImageIntegerSampleCounts; - VkSampleCountFlags sampledImageDepthSampleCounts; - VkSampleCountFlags sampledImageStencilSampleCounts; - VkSampleCountFlags storageImageSampleCounts; - uint32_t maxSampleMaskWords; - VkBool32 timestampComputeAndGraphics; - float timestampPeriod; - uint32_t maxClipDistances; - uint32_t maxCullDistances; - uint32_t maxCombinedClipAndCullDistances; - uint32_t discreteQueuePriorities; - float pointSizeRange[2]; - float lineWidthRange[2]; - float pointSizeGranularity; - float lineWidthGranularity; - VkBool32 strictLines; - VkBool32 standardSampleLocations; - VkDeviceSize optimalBufferCopyOffsetAlignment; - VkDeviceSize optimalBufferCopyRowPitchAlignment; - VkDeviceSize nonCoherentAtomSize; -} VkPhysicalDeviceLimits; - -typedef struct VkPhysicalDeviceSparseProperties { - VkBool32 residencyStandard2DBlockShape; - VkBool32 residencyStandard2DMultisampleBlockShape; - VkBool32 residencyStandard3DBlockShape; - VkBool32 residencyAlignedMipSize; - VkBool32 residencyNonResidentStrict; -} VkPhysicalDeviceSparseProperties; -``` - -These tests should test the following cases: -- [x] valid inputs for `vkGetPhysicalDeviceFeatures` -- [x] valid inputs for `vkGetPhysicalDeviceMemoryProperties` -- [x] valid inputs for `vkGetPhysicalDeviceProperties` diff --git a/gapid_tests/traits_query_tests/PhysicalDeviceTraits/main.cpp b/gapid_tests/traits_query_tests/PhysicalDeviceTraits/main.cpp deleted file mode 100644 index 5a3d288d..00000000 --- a/gapid_tests/traits_query_tests/PhysicalDeviceTraits/main.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -inline const char* BoolString(bool value) { return value ? "true" : "false"; } -inline const char* BoolString(VkBool32 value) { - return value != 0 ? "true" : "false"; -} - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateEmptyInstance(data->allocator(), &wrapper)); - containers::vector physical_devices( - vulkan::GetPhysicalDevices(data->allocator(), instance)); - - { - data->logger()->LogInfo("API: vkGetPhysicalDeviceFeatures"); - VkPhysicalDeviceFeatures features; - for (const auto& device : physical_devices) { - data->logger()->LogInfo(" Phyiscal Device: ", device); - instance->vkGetPhysicalDeviceFeatures(device, &features); - data->logger()->LogInfo(" shaderInt16: ", BoolString(features.shaderInt16)); - data->logger()->LogInfo(" shaderInt64: ", BoolString(features.shaderInt64)); - data->logger()->LogInfo(" logicOp: ", BoolString(features.logicOp)); - - // Test helper function: vulkan::SupportRequestPhysicalDeviceFeatures(). - // All the supported features returned before should still be considered - // as "supported" by SupportRequestPhysicalDeviceFeatures(). - LOG_EXPECT(==, data->logger(), true, - vulkan::SupportRequestPhysicalDeviceFeatures(&instance, device, - features)); - } - } - - { - data->logger()->LogInfo("API: vkGetPhysicalDeviceMemoryProperties"); - VkPhysicalDeviceMemoryProperties properties; - for (const auto& device : physical_devices) { - data->logger()->LogInfo(" Phyiscal Device: ", device); - instance->vkGetPhysicalDeviceMemoryProperties(device, &properties); - data->logger()->LogInfo(" # memory types: ", properties.memoryTypeCount); - data->logger()->LogInfo(" # memory heaps: ", properties.memoryHeapCount); - } - } - - { - data->logger()->LogInfo("API: vkGetPhysicalDeviceProperties"); - VkPhysicalDeviceProperties properties; - for (const auto& device : physical_devices) { - data->logger()->LogInfo(" Phyiscal Device: ", device); - instance->vkGetPhysicalDeviceProperties(device, &properties); - data->logger()->LogInfo(" apiVersion: ", properties.apiVersion); - data->logger()->LogInfo(" driverVersion: ", properties.driverVersion); - data->logger()->LogInfo(" vendorID: ", properties.vendorID); - data->logger()->LogInfo(" deviceID: ", properties.deviceID); - data->logger()->LogInfo(" deviceName: ", properties.deviceName); - } - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/traits_query_tests/PresentationSupport/CMakeLists.txt b/gapid_tests/traits_query_tests/PresentationSupport/CMakeLists.txt deleted file mode 100644 index 283ccbeb..00000000 --- a/gapid_tests/traits_query_tests/PresentationSupport/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(PresentationSupport_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/traits_query_tests/PresentationSupport/PhysicalDevicePresentationSupport_test.py b/gapid_tests/traits_query_tests/PresentationSupport/PhysicalDevicePresentationSupport_test.py deleted file mode 100644 index 010d12cc..00000000 --- a/gapid_tests/traits_query_tests/PresentationSupport/PhysicalDevicePresentationSupport_test.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_write_offset_function -from vulkan_constants import * -from struct_offsets import VulkanStruct, BOOL32, UINT32_T, POINTER, ARRAY -from gapit_test_framework import WINDOWS, LINUX - - -def GetPhysicalDevices(test, architecture): - # first call to enumerate physical devices - first_enumerate_physical_devices = require(test.next_call_of( - "vkEnumeratePhysicalDevices")) - require_equal(VK_SUCCESS, int(first_enumerate_physical_devices.return_val)) - require_not_equal(0, first_enumerate_physical_devices.int_instance) - require_not_equal(0, - first_enumerate_physical_devices.hex_pPhysicalDeviceCount) - require_equal(0, first_enumerate_physical_devices.hex_pPhysicalDevices) - - num_phy_devices = little_endian_bytes_to_int(require( - first_enumerate_physical_devices.get_write_data( - first_enumerate_physical_devices.hex_pPhysicalDeviceCount, - architecture.int_integerSize))) - - # second call to enumerate physical devices - second_enumerate_physical_devices = require(test.next_call_of( - "vkEnumeratePhysicalDevices")) - require_equal(VK_SUCCESS, int( - second_enumerate_physical_devices.return_val)) - require_not_equal(0, second_enumerate_physical_devices.int_instance) - require_not_equal( - 0, second_enumerate_physical_devices.hex_pPhysicalDeviceCount) - require_not_equal( - 0, second_enumerate_physical_devices.hex_pPhysicalDevices) - require_not_equal(0, num_phy_devices) - PHYSICAL_DEVICES = [("physicalDevices", ARRAY, num_phy_devices, POINTER)] - returned_physical_devices = VulkanStruct( - architecture, PHYSICAL_DEVICES, get_write_offset_function( - second_enumerate_physical_devices, - second_enumerate_physical_devices.hex_pPhysicalDevices)) - return returned_physical_devices.physicalDevices - - -@gapit_test("PresentationSupport_test") -class GetPresentationSupport(GapitTest): - - def expect(self): - - arch = self.architecture - physical_devices = GetPhysicalDevices(self, arch) - for pd in physical_devices: - if self.device.Configuration.OS.Kind == LINUX: - get_support = require(self.next_call_of( - "vkGetPhysicalDeviceXcbPresentationSupportKHR")) - require_equal(pd, get_support.int_physicalDevice) - require_equal(0, get_support.int_queueFamilyIndex) - require_not_equal(0, get_support.hex_connection) - require_equal(VK_TRUE, int(get_support.return_val)) - elif self.device.Configuration.OS.Kind == WINDOWS: - get_support = require(self.next_call_of( - "vkGetPhysicalDeviceWin32PresentationSupportKHR")) - require_equal(pd, get_support.int_physicalDevice) - require_equal(0, get_support.int_queueFamilyIndex) - require_equal(VK_TRUE, int(get_support.return_val)) diff --git a/gapid_tests/traits_query_tests/PresentationSupport/README.md b/gapid_tests/traits_query_tests/PresentationSupport/README.md deleted file mode 100644 index a286907b..00000000 --- a/gapid_tests/traits_query_tests/PresentationSupport/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# Physical Device Presentation Support - -## vkGetPhysicalDeviceXcbPresentationSupportKHR -```c++ -VkBool32 vkGetPhysicalDeviceXcbPresentationSupportKHR( - VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - xcb_connection_t* connection, - xcb_visualid_t visual_id); -``` - -According to Vulkan Spec -- `connection` is a pointer to an `xcb_connection_t` to the X server. -- `visual_id` is an X11 visual (`xcb_visualid_t`) -- `queueFamilyIndex` **must** be less than `pQueueFamilyPropertyCount` returned - by `vkGetPhysicalDeviceQueueFamilyProperties` for the given `physicalDevice`. - -These tests should test the following cases: -- [ ] `physicalDevice` of valid value -- [ ] `queueFamilyIndex` of valid value -- [ ] `connect` of valid value -- [ ] `visual_id` of valid value - -## vkGetPhysicalDeviceWin32PresentationSupportKHR -```c++ -VkBool32 vkGetPhysicalDeviceWin32PresentationSupportKHR( - VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex); -``` - -According to Vulkan Spec -- `queueFamilyIndex` **must** be less than `pQueueFamilyPropertyCount` returned - by `vkGetPhysicalDeviceQueueFamilyProperties` for the given `physicalDevice`. - -These tests should test the following cases: -- [ ] `physicalDevice` of valid value -- [ ] `queueFamilyIndex` of valid value diff --git a/gapid_tests/traits_query_tests/PresentationSupport/main.cpp b/gapid_tests/traits_query_tests/PresentationSupport/main.cpp deleted file mode 100644 index 49e65830..00000000 --- a/gapid_tests/traits_query_tests/PresentationSupport/main.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -inline const char* BoolString(bool value) { return value ? "true" : "false"; } -inline const char* BoolString(VkBool32 value) { - return value != 0 ? "true" : "false"; -} - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateDefaultInstance(data->allocator(), &wrapper)); - containers::vector physical_devices( - vulkan::GetPhysicalDevices(data->allocator(), instance)); - - { - for (const auto& device : physical_devices) { - data->logger()->LogInfo(" Phyiscal Device: ", device); - uint32_t queue_count = 0; - VkBool32 result = VK_FALSE; - instance->vkGetPhysicalDeviceQueueFamilyProperties(device, &queue_count, - nullptr); - if (queue_count == 0) { - continue; - } -#if defined __ANDROID__ - data->logger()->LogInfo( - "According to Vulkan Spec, all physical devices and queue families " - "on Android must be capable of presentation with any native window. " - "So there is no Android-specific query for presentation support"); - break; -#elif defined __ggp__ - break; -#elif defined __linux__ - data->logger()->LogInfo("API: vkGetPhysicalDeviceXcbPresentationSupportKHR"); - result = instance->vkGetPhysicalDeviceXcbPresentationSupportKHR( - device, 0, data->native_connection(), data->native_window_handle()); -#elif defined _WIN32 - data->logger()->LogInfo("API: vkGetPhysicalDeviceWin32PresentationSupportKHR"); - result = - instance->vkGetPhysicalDeviceWin32PresentationSupportKHR(device, 0); -#else - data->logger()->LogInfo( - "Presentation Support test not available on target OS, test " - "skipped."); - break; -#endif - data->logger()->LogInfo(" Physical Device: ", device); - data->logger()->LogInfo(" Return result: ", BoolString(result)); - } - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/traits_query_tests/README.md b/gapid_tests/traits_query_tests/README.md deleted file mode 100644 index ceab713f..00000000 --- a/gapid_tests/traits_query_tests/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Initialization Tests - -These tests are specifically for testing functionality related to querying -features/properties of Vulkan objects. - -# Tests -- [EnumerateLayersAndExtensions](EnumerateLayersAndExtensions/README.md) -- [PhysicalDeviceImageFormatTraits](PhysicalDeviceImageFormatTraits/README.md) -- [PhysicalDeviceSurface_tests](PhysicalDeviceSurface_tests/README.md) -- [PhysicalDeviceTraits](PhysicalDeviceTraits/README.md) -- [PresentationSupport](PresentationSupport/README.md) -- [vkEnumeratePhysicalDevices](vkEnumeratePhysicalDevices/README.md) -- [vkGetPhysicalDeviceFormatProperties](vkGetPhysicalDeviceFormatProperties/README.md) -- [vkGetPhysicalDeviceQueueFamilyProperties](vkGetPhysicalDeviceQueueFamilyProperties/README.md) diff --git a/gapid_tests/traits_query_tests/vkEnumeratePhysicalDevices/CMakeLists.txt b/gapid_tests/traits_query_tests/vkEnumeratePhysicalDevices/CMakeLists.txt deleted file mode 100644 index 84fe4cd9..00000000 --- a/gapid_tests/traits_query_tests/vkEnumeratePhysicalDevices/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkEnumeratePhysicalDevices_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/traits_query_tests/vkEnumeratePhysicalDevices/README.md b/gapid_tests/traits_query_tests/vkEnumeratePhysicalDevices/README.md deleted file mode 100644 index db44c410..00000000 --- a/gapid_tests/traits_query_tests/vkEnumeratePhysicalDevices/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# vkCreateInstance / vkDestroyInstance - -## Signatures -```c++ -VkResult vkEnumeratePhysicalDevices( - VkInstance instance, - uint32_t* pPhysicalDeviceCount, - VkPhysicalDevice* pPhysicalDevices); -``` - -These tests should test the following cases: -- [x] `pPhysicalDeviceCount` == 0 -- [x] `pPhysicalDeviceCount` == the number returned by first call -- [x] `pPhysicalDeviceCount` == 0, pPhysicalDevices != nullptr -- [x] `pPhysicalDeviceCount` < returned number from first call \ No newline at end of file diff --git a/gapid_tests/traits_query_tests/vkEnumeratePhysicalDevices/main.cpp b/gapid_tests/traits_query_tests/vkEnumeratePhysicalDevices/main.cpp deleted file mode 100644 index fad75967..00000000 --- a/gapid_tests/traits_query_tests/vkEnumeratePhysicalDevices/main.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/containers/vector.h" -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateEmptyInstance(data->allocator(), &wrapper)); - - uint32_t device_count = 0; - - LOG_EXPECT( - ==, data->logger(), - instance->vkEnumeratePhysicalDevices(instance, &device_count, nullptr), - VK_SUCCESS); - - LOG_ASSERT(>, data->logger(), device_count, 0u); - data->logger()->LogInfo("Device Count is ", device_count); - - containers::vector physical_devices(data->allocator()); - physical_devices.resize(device_count); - LOG_ASSERT(==, data->logger(), - instance->vkEnumeratePhysicalDevices(instance, &device_count, - physical_devices.data()), - VK_SUCCESS); - - for (size_t i = 0; i < device_count; ++i) { - LOG_ASSERT(!=, data->logger(), physical_devices[i], VkPhysicalDevice(nullptr)); - } - - device_count -= 1; - LOG_EXPECT(==, data->logger(), - instance->vkEnumeratePhysicalDevices(instance, &device_count, - physical_devices.data()), - VK_INCOMPLETE); - - device_count = 0; - LOG_EXPECT(==, data->logger(), - instance->vkEnumeratePhysicalDevices(instance, &device_count, - physical_devices.data()), - VK_INCOMPLETE); - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/traits_query_tests/vkEnumeratePhysicalDevices/vkEnumeratePhysicalDevices_test.py b/gapid_tests/traits_query_tests/vkEnumeratePhysicalDevices/vkEnumeratePhysicalDevices_test.py deleted file mode 100644 index d6ffef3b..00000000 --- a/gapid_tests/traits_query_tests/vkEnumeratePhysicalDevices/vkEnumeratePhysicalDevices_test.py +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_read_offset_function -from gapit_test_framework import get_write_offset_function, WINDOWS -import gapit_test_framework -from struct_offsets import VulkanStruct, POINTER, HANDLE, ARRAY -from vulkan_constants import * - - -@gapit_test("vkEnumeratePhysicalDevices_test") -class EnumeratePhysicalDevices(GapitTest): - - def expect(self): - """Check the arguments and the values referred by the pointer arguments - of vkEnumeratePhysicalDevices""" - architecture = self.architecture - - # The first call to vkEnumeratePhysicalDevices, pPhysicalDevices is - # NULL, pPhysicalDeviceCount refer to 0 prior to the call and should be - # non zero after. - get_count = require(self.next_call_of("vkEnumeratePhysicalDevices")) - require_not_equal(0, get_count.int_instance) - require_not_equal(0, get_count.hex_pPhysicalDeviceCount) - require_equal(0, get_count.hex_pPhysicalDevices) - # Strictly speaking here the return value should be VK_INCOMPLETE, but - # Nvidia drivers return VK_SUCCESS when pPhysicalDevices is NULL - # TODO(qining): Uncomment this once drivers handle it correctly - # require_equal(VK_INCOMPLETE, int(get_count.return_val)) - - physical_device_count_after_call = require(get_count.get_write_data( - get_count.hex_pPhysicalDeviceCount, architecture.int_integerSize)) - physical_device_count = little_endian_bytes_to_int( - physical_device_count_after_call) - require_not_equal(0, physical_device_count) - - # The second call should have physical device handles returned in the memory - # pointed by pPhysicalDevices - get_handles = require(self.next_call_of("vkEnumeratePhysicalDevices")) - require_not_equal(0, get_handles.int_instance) - require_not_equal(0, get_handles.hex_pPhysicalDeviceCount) - require_not_equal(0, get_handles.hex_pPhysicalDevices) - require_equal(VK_SUCCESS, int(get_handles.return_val)) - - # physical device handles are not NON_DISPATCHALBE_HANDLE - PHYSICAL_DEVICES = [("handles", ARRAY, physical_device_count, POINTER)] - physical_devices = VulkanStruct( - architecture, PHYSICAL_DEVICES, get_write_offset_function( - get_handles, get_handles.hex_pPhysicalDevices)) - for handle in physical_devices.handles: - require_not_equal(0, handle) - - # The windows loader + some drivers do very odd things here. - # They change around the calls to EnumeratePhyiscalDevices - # in order to handle multiple devices. - if self.device.Configuration.OS.Kind == WINDOWS: - return - # The third call is made with non-NULL pPhysicalDevices, while the physical - # device count is one less than the actual count. Command should return - # with VK_INCOMPLETE - one_less_count = require( - self.next_call_of("vkEnumeratePhysicalDevices")) - require_not_equal(0, one_less_count.int_instance) - require_not_equal(0, one_less_count.hex_pPhysicalDeviceCount) - require_not_equal(0, one_less_count.hex_pPhysicalDevices) - require_equal(VK_INCOMPLETE, int(one_less_count.return_val)) - - # The fourth call is made with non-NULL pPhysicalDevices, while the physical - # device count is zero. Command should return with VK_INCOMPLETE - zero_count = require(self.next_call_of("vkEnumeratePhysicalDevices")) - require_not_equal(0, zero_count.int_instance) - require_not_equal(0, zero_count.hex_pPhysicalDeviceCount) - require_not_equal(0, zero_count.hex_pPhysicalDevices) - require_equal(VK_INCOMPLETE, int(zero_count.return_val)) - physical_device_count_before_call = require(zero_count.get_read_data( - zero_count.hex_pPhysicalDeviceCount, architecture.int_integerSize)) - require_equal( - 0, little_endian_bytes_to_int(physical_device_count_before_call)) diff --git a/gapid_tests/traits_query_tests/vkGetPDQueueFamilyProperties/CMakeLists.txt b/gapid_tests/traits_query_tests/vkGetPDQueueFamilyProperties/CMakeLists.txt deleted file mode 100644 index 695b448f..00000000 --- a/gapid_tests/traits_query_tests/vkGetPDQueueFamilyProperties/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkGetPDQueueFamilyProperties_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/traits_query_tests/vkGetPDQueueFamilyProperties/README.md b/gapid_tests/traits_query_tests/vkGetPDQueueFamilyProperties/README.md deleted file mode 100644 index 1274a64a..00000000 --- a/gapid_tests/traits_query_tests/vkGetPDQueueFamilyProperties/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# vkGetPhysicalDeviceQueueFamilyProperties - -## Signatures -```c++ -void vkGetPhysicalDeviceQueueFamilyProperties( - VkPhysicalDevice physicalDevice, - uint32_t* pQueueFamilyPropertyCount, - VkQueueFamilyProperties* pQueueFamilyProperties); -``` - -## VkQueueFamilyProperties -```c++ -typedef struct VkQueueFamilyProperties { - VkQueueFlags queueFlags; - uint32_t queueCount; - uint32_t timestampValidBits; - VkExtent3D minImageTransferGranularity; -} VkQueueFamilyProperties; -``` - -These tests should test the following cases: -- [x] `pQueueFamilyProperties` == nullptr -- [x] `pQueueFamilyProperties` != nullptr - - [x] `pQueueFamilyPropertyCount` == 0 - - [x] `pQueueFamilyPropertyCount` < the number returned by first call - - [x] `pQueueFamilyPropertyCount` == the number returned by first call - - [x] `pQueueFamilyPropertyCount` > the number returned by first call diff --git a/gapid_tests/traits_query_tests/vkGetPDQueueFamilyProperties/main.cpp b/gapid_tests/traits_query_tests/vkGetPDQueueFamilyProperties/main.cpp deleted file mode 100644 index 76961471..00000000 --- a/gapid_tests/traits_query_tests/vkGetPDQueueFamilyProperties/main.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/containers/vector.h" -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateEmptyInstance(data->allocator(), &wrapper)); - containers::vector physical_devices( - vulkan::GetPhysicalDevices(data->allocator(), instance)); - const uint32_t physical_device_count = physical_devices.size(); - - data->logger()->LogInfo("API: vkGetPhysicalDeviceQueueFamilyProperties"); - - containers::vector driver_counts(data->allocator()); - driver_counts.resize(physical_device_count); - { - data->logger()->LogInfo(" Case: pQueueFamilyProperties == nullptr"); - for (uint32_t i = 0; i < physical_device_count; ++i) { - const auto device = physical_devices[i]; - data->logger()->LogInfo(" Phyiscal Device: ", device); - instance->vkGetPhysicalDeviceQueueFamilyProperties( - device, &driver_counts[i], nullptr); - data->logger()->LogInfo(" # queue family properties: ", driver_counts[i]); - } - } - - { - data->logger()->LogInfo(" Case: *pQueueFamilyPropertyCount == 0"); - for (uint32_t i = 0; i < physical_device_count; ++i) { - const auto device = physical_devices[i]; - data->logger()->LogInfo(" Phyiscal Device: ", device); - uint32_t count = 0; - VkQueueFamilyProperties properties = {}; - instance->vkGetPhysicalDeviceQueueFamilyProperties(device, &count, - &properties); - LOG_EXPECT(==, data->logger(), count, 0u); - LOG_EXPECT(==, data->logger(), properties.queueCount, 0u); - LOG_EXPECT(==, data->logger(), properties.timestampValidBits, 0u); - } - } - - { - data->logger()->LogInfo(" Case: *pQueueFamilyPropertyCount < capacity"); - for (uint32_t i = 0; i < physical_device_count; ++i) { - if (driver_counts[i] <= 1) continue; - - const auto device = physical_devices[i]; - data->logger()->LogInfo(" Phyiscal Device: ", device); - uint32_t count = driver_counts[i] - 1; - containers::vector properties( - data->allocator()); - properties.resize(count); - instance->vkGetPhysicalDeviceQueueFamilyProperties(device, &count, - properties.data()); - LOG_EXPECT(==, data->logger(), count, driver_counts[i] - 1); - for (uint32_t j = 0; j < count; ++j) { - data->logger()->LogInfo(" queueCount: ", properties[j].queueCount); - } - } - } - - { - data->logger()->LogInfo(" Case: *pQueueFamilyPropertyCount == capacity"); - for (uint32_t i = 0; i < physical_device_count; ++i) { - const auto device = physical_devices[i]; - data->logger()->LogInfo(" Phyiscal Device: ", device); - auto count = driver_counts[i]; - containers::vector properties( - data->allocator()); - properties.resize(count); - instance->vkGetPhysicalDeviceQueueFamilyProperties(device, &count, - properties.data()); - LOG_EXPECT(==, data->logger(), properties.size(), driver_counts[i]); - for (const auto& p : properties) { - data->logger()->LogInfo(" queueCount: ", p.queueCount); - } - } - } - - { - data->logger()->LogInfo(" Case: *pQueueFamilyPropertyCount > capacity"); - for (uint32_t i = 0; i < physical_device_count; ++i) { - const auto device = physical_devices[i]; - data->logger()->LogInfo(" Phyiscal Device: ", device); - uint32_t count = driver_counts[i] + 3; - containers::vector properties( - data->allocator()); - properties.resize(count); - instance->vkGetPhysicalDeviceQueueFamilyProperties(device, &count, - properties.data()); - LOG_EXPECT(==, data->logger(), count, driver_counts[i]); - for (uint32_t j = 0; j < count; ++j) { - data->logger()->LogInfo(" queueCount: ", properties[j].queueCount); - } - } - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/traits_query_tests/vkGetPDQueueFamilyProperties/vkGetPDQueueFamilyProperties_test.py b/gapid_tests/traits_query_tests/vkGetPDQueueFamilyProperties/vkGetPDQueueFamilyProperties_test.py deleted file mode 100644 index e8f48ac1..00000000 --- a/gapid_tests/traits_query_tests/vkGetPDQueueFamilyProperties/vkGetPDQueueFamilyProperties_test.py +++ /dev/null @@ -1,174 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_write_offset_function -from vulkan_constants import * -from struct_offsets import VulkanStruct, BOOL32, UINT32_T, POINTER, ARRAY - -QUEUE_FAMILY_PROPERTIES = [ - ("queueFlags", UINT32_T), - ("queueCount", UINT32_T), - ("timestampValidBits", UINT32_T), - ("minImageTransferGranularity_width", UINT32_T), - ("minImageTransferGranularity_height", UINT32_T), - ("minImageTransferGranularity_depth", UINT32_T), -] - - -def GetPhysicalDevices(test, architecture): - # first call to enumerate physical devices - first_enumerate_physical_devices = require(test.next_call_of( - "vkEnumeratePhysicalDevices")) - require_equal(VK_SUCCESS, int(first_enumerate_physical_devices.return_val)) - require_not_equal(0, first_enumerate_physical_devices.int_instance) - require_not_equal(0, - first_enumerate_physical_devices.hex_pPhysicalDeviceCount) - require_equal(0, first_enumerate_physical_devices.hex_pPhysicalDevices) - - num_phy_devices = little_endian_bytes_to_int(require( - first_enumerate_physical_devices.get_write_data( - first_enumerate_physical_devices.hex_pPhysicalDeviceCount, - architecture.int_integerSize))) - - # second call to enumerate physical devices - second_enumerate_physical_devices = require(test.next_call_of( - "vkEnumeratePhysicalDevices")) - require_equal(VK_SUCCESS, int( - second_enumerate_physical_devices.return_val)) - require_not_equal(0, second_enumerate_physical_devices.int_instance) - require_not_equal( - 0, second_enumerate_physical_devices.hex_pPhysicalDeviceCount) - require_not_equal( - 0, second_enumerate_physical_devices.hex_pPhysicalDevices) - require_not_equal(0, num_phy_devices) - PHYSICAL_DEVICES = [("physicalDevices", ARRAY, num_phy_devices, POINTER)] - returned_physical_devices = VulkanStruct( - architecture, PHYSICAL_DEVICES, get_write_offset_function( - second_enumerate_physical_devices, - second_enumerate_physical_devices.hex_pPhysicalDevices)) - return returned_physical_devices.physicalDevices - - -@gapit_test("vkGetPDQueueFamilyProperties_test") -class GetPhysicalDeviceQueueFamilyProperties(GapitTest): - - def expect(self): - arch = self.architecture - physical_devices = GetPhysicalDevices(self, arch) - property_counts = {} - - # case pQueueFamilyProperties == nullptr - for pd in physical_devices: - get_properties = require(self.next_call_of( - "vkGetPhysicalDeviceQueueFamilyProperties")) - require_equal( - True, get_properties.int_physicalDevice in physical_devices) - require_not_equal(0, get_properties.hex_pQueueFamilyPropertyCount) - require_equal(0, get_properties.hex_pQueueFamilyProperties) - observation_num_properties = little_endian_bytes_to_int( - require(get_properties.get_write_data( - get_properties.hex_pQueueFamilyPropertyCount, - arch.int_integerSize))) - property_counts[pd] = observation_num_properties - - # case *pQueueFamilyPropertyCount == 0 - for pd in physical_devices: - get_properties = require(self.next_call_of( - "vkGetPhysicalDeviceQueueFamilyProperties")) - require_equal( - True, get_properties.int_physicalDevice in physical_devices) - require_not_equal(0, get_properties.hex_pQueueFamilyPropertyCount) - require_not_equal(0, get_properties.hex_pQueueFamilyProperties) - observation_num_properties = little_endian_bytes_to_int( - require(get_properties.get_write_data( - get_properties.hex_pQueueFamilyPropertyCount, - arch.int_integerSize))) - require_equal(0, observation_num_properties) - - # case *pQueueFamilyPropertyCount < capacity - for pd in physical_devices: - if property_counts[pd] <= 1: - continue - get_properties = require(self.next_call_of( - "vkGetPhysicalDeviceQueueFamilyProperties")) - require_equal( - True, get_properties.int_physicalDevice in physical_devices) - require_not_equal(0, get_properties.hex_pQueueFamilyPropertyCount) - require_not_equal(0, get_properties.hex_pQueueFamilyProperties) - # Check the count - observation_num_properties = little_endian_bytes_to_int( - require(get_properties.get_write_data( - get_properties.hex_pQueueFamilyPropertyCount, - arch.int_integerSize))) - require_equal(property_counts[pd] - 1, - observation_num_properties) - - # Check the properties - offset = 0 - for i in range(property_counts[pd] - 1): - p = VulkanStruct( - arch, QUEUE_FAMILY_PROPERTIES, get_write_offset_function( - get_properties, - get_properties.hex_pQueueFamilyProperties + offset)) - offset += p.total_size - - # case *pQueueFamilyPropertyCount < capacity - for pd in physical_devices: - get_properties = require(self.next_call_of( - "vkGetPhysicalDeviceQueueFamilyProperties")) - require_equal( - True, get_properties.int_physicalDevice in physical_devices) - require_not_equal(0, get_properties.hex_pQueueFamilyPropertyCount) - require_not_equal(0, get_properties.hex_pQueueFamilyProperties) - # Check the count - observation_num_properties = little_endian_bytes_to_int( - require(get_properties.get_write_data( - get_properties.hex_pQueueFamilyPropertyCount, - arch.int_integerSize))) - require_equal(property_counts[pd], observation_num_properties) - - # Check the properties - offset = 0 - for i in range(property_counts[pd]): - p = VulkanStruct( - arch, QUEUE_FAMILY_PROPERTIES, get_write_offset_function( - get_properties, - get_properties.hex_pQueueFamilyProperties + offset)) - offset += p.total_size - - # case *pQueueFamilyPropertyCount > capacity - for pd in physical_devices: - get_properties = require(self.next_call_of( - "vkGetPhysicalDeviceQueueFamilyProperties")) - require_equal( - True, get_properties.int_physicalDevice in physical_devices) - require_not_equal(0, get_properties.hex_pQueueFamilyPropertyCount) - require_not_equal(0, get_properties.hex_pQueueFamilyProperties) - # Check the count - observation_num_properties = little_endian_bytes_to_int( - require(get_properties.get_write_data( - get_properties.hex_pQueueFamilyPropertyCount, - arch.int_integerSize))) - require_equal(property_counts[pd], observation_num_properties) - - # Check the properties - offset = 0 - for i in range(property_counts[pd]): - p = VulkanStruct( - arch, QUEUE_FAMILY_PROPERTIES, get_write_offset_function( - get_properties, - get_properties.hex_pQueueFamilyProperties + offset)) - offset += p.total_size diff --git a/gapid_tests/traits_query_tests/vkGetPhysicalDeviceFormatProperties/CMakeLists.txt b/gapid_tests/traits_query_tests/vkGetPhysicalDeviceFormatProperties/CMakeLists.txt deleted file mode 100644 index e3d9b6a6..00000000 --- a/gapid_tests/traits_query_tests/vkGetPhysicalDeviceFormatProperties/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 Google 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. -# - -add_gapid_test(vkGetPhysicalDeviceFormatProperties_test - SOURCES main.cpp - LIBS - vulkan_helpers -) diff --git a/gapid_tests/traits_query_tests/vkGetPhysicalDeviceFormatProperties/README.md b/gapid_tests/traits_query_tests/vkGetPhysicalDeviceFormatProperties/README.md deleted file mode 100644 index 4627bd93..00000000 --- a/gapid_tests/traits_query_tests/vkGetPhysicalDeviceFormatProperties/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# vkGetPhysicalDeviceFormatProperties - -## Signatures -```c++ -void vkGetPhysicalDeviceFormatProperties( - VkPhysicalDevice physicalDevice, - VkFormat format, - VkFormatProperties* pFormatProperties); -``` - -According to the Vulkan spec: -- `format` **must** be a valid `VkFormat` value -- `pFormatProperties` **must** be a pointer to a `VkFormatProperties` structure - -## VkQueueFamilyProperties -```c++ -typedef struct VkFormatProperties { - VkFormatFeatureFlags linearTilingFeatures; - VkFormatFeatureFlags optimalTilingFeatures; - VkFormatFeatureFlags bufferFeatures; -} VkFormatProperties; -``` - -These tests should test the following cases: -- [x] all valid `VkFormat` values -- [x] a variety of different formats diff --git a/gapid_tests/traits_query_tests/vkGetPhysicalDeviceFormatProperties/main.cpp b/gapid_tests/traits_query_tests/vkGetPhysicalDeviceFormatProperties/main.cpp deleted file mode 100644 index b8fe165d..00000000 --- a/gapid_tests/traits_query_tests/vkGetPhysicalDeviceFormatProperties/main.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright 2017 Google 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. - */ - -#include "support/entry/entry.h" -#include "support/log/log.h" -#include "vulkan_helpers/helper_functions.h" -#include "vulkan_helpers/structs.h" -#include "vulkan_wrapper/instance_wrapper.h" -#include "vulkan_wrapper/library_wrapper.h" - -int main_entry(const entry::EntryData* data) { - data->logger()->LogInfo("Application Startup"); - vulkan::LibraryWrapper wrapper(data->allocator(), data->logger()); - vulkan::VkInstance instance( - vulkan::CreateEmptyInstance(data->allocator(), &wrapper)); - containers::vector physical_devices( - vulkan::GetPhysicalDevices(data->allocator(), instance)); - const uint32_t physical_device_count = physical_devices.size(); - - data->logger()->LogInfo("API: vkGetPhysicalDeviceFormatProperties"); - - auto output_properties = [data](const VkFormatProperties& properties) { - data->logger()->LogInfo(" linearTilingFeatures: ", - properties.linearTilingFeatures); - data->logger()->LogInfo(" optimalTilingFeatures: ", - properties.optimalTilingFeatures); - data->logger()->LogInfo(" bufferFeatures: ", properties.bufferFeatures); - }; - - { - for (const auto& device : physical_devices) { - data->logger()->LogInfo(" Phyiscal Device: ", device); - - VkFormatProperties properties; - for (auto format : vulkan::AllVkFormats(data->allocator())) { - data->logger()->LogInfo(" VkFormat: ", format); - instance->vkGetPhysicalDeviceFormatProperties(device, format, - &properties); - output_properties(properties); - } - } - } - - data->logger()->LogInfo("Application Shutdown"); - return 0; -} diff --git a/gapid_tests/traits_query_tests/vkGetPhysicalDeviceFormatProperties/vkGetPhysicalDeviceFormatProperties_test.py b/gapid_tests/traits_query_tests/vkGetPhysicalDeviceFormatProperties/vkGetPhysicalDeviceFormatProperties_test.py deleted file mode 100644 index 5f4a06a1..00000000 --- a/gapid_tests/traits_query_tests/vkGetPhysicalDeviceFormatProperties/vkGetPhysicalDeviceFormatProperties_test.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright 2017 Google 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. - -from gapit_test_framework import gapit_test, require, require_equal -from gapit_test_framework import require_not_equal, little_endian_bytes_to_int -from gapit_test_framework import GapitTest, get_write_offset_function -from vulkan_constants import * -from struct_offsets import VulkanStruct, BOOL32, UINT32_T, POINTER, ARRAY - - -FORMAT_PROPERTIES = [ - ("linearTilingFeatures", UINT32_T), - ("optimalTilingFeatures", UINT32_T), - ("bufferFeatures", UINT32_T), -] - - -def GetPhysicalDevices(test, architecture): - # first call to enumerate physical devices - first_enumerate_physical_devices = require(test.next_call_of( - "vkEnumeratePhysicalDevices")) - require_equal(VK_SUCCESS, int(first_enumerate_physical_devices.return_val)) - require_not_equal(0, first_enumerate_physical_devices.int_instance) - require_not_equal(0, - first_enumerate_physical_devices.hex_pPhysicalDeviceCount) - require_equal(0, first_enumerate_physical_devices.hex_pPhysicalDevices) - - num_phy_devices = little_endian_bytes_to_int(require( - first_enumerate_physical_devices.get_write_data( - first_enumerate_physical_devices.hex_pPhysicalDeviceCount, - architecture.int_integerSize))) - - # second call to enumerate physical devices - second_enumerate_physical_devices = require(test.next_call_of( - "vkEnumeratePhysicalDevices")) - require_equal(VK_SUCCESS, int( - second_enumerate_physical_devices.return_val)) - require_not_equal(0, second_enumerate_physical_devices.int_instance) - require_not_equal( - 0, second_enumerate_physical_devices.hex_pPhysicalDeviceCount) - require_not_equal( - 0, second_enumerate_physical_devices.hex_pPhysicalDevices) - require_not_equal(0, num_phy_devices) - PHYSICAL_DEVICES = [("physicalDevices", ARRAY, num_phy_devices, POINTER)] - returned_physical_devices = VulkanStruct( - architecture, PHYSICAL_DEVICES, get_write_offset_function( - second_enumerate_physical_devices, - second_enumerate_physical_devices.hex_pPhysicalDevices)) - return returned_physical_devices.physicalDevices - - -@gapit_test("vkGetPhysicalDeviceFormatProperties_test") -class GetPhysicalDeviceFormatProperties(GapitTest): - def expect(self): - arch = self.architecture - physical_devices = GetPhysicalDevices(self, arch) - for pd in physical_devices: - for fmt in ALL_VK_FORMATS: - get_properties = require(self.next_call_of( - "vkGetPhysicalDeviceFormatProperties")) - require_equal( - True, get_properties.int_physicalDevice in physical_devices) - require_equal(fmt, get_properties.int_format) - require_not_equal(0, get_properties.hex_pFormatProperties) - VulkanStruct(arch, FORMAT_PROPERTIES, get_write_offset_function( - get_properties, get_properties.hex_pFormatProperties)) diff --git a/tools/gapid_trace_replay_tests.py b/tools/gapid_trace_replay_tests.py deleted file mode 100755 index 86f81578..00000000 --- a/tools/gapid_trace_replay_tests.py +++ /dev/null @@ -1,277 +0,0 @@ -#!/usr/bin/python -# Copyright 2017 Google 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. -'''The main test framework for testing trace/replay -''' - -import argparse -import os -import re -import tempfile -import shutil -import subprocess -import sys - -from gapit_tester import run_on_single_apk -from gapit_tester import RunArgs - -SUCCESS = 0 -FAILURE = 1 -WARNING = 2 -SKIPPED = 3 - - -class Test(object): - - def __init__(self, executable, mid_execution): - self.executable = executable - self.mid_execution = mid_execution - - -class TestManager(object): - - """Manages and runs all requested tests.""" - - def __init__(self, root_directory, verbose, host): - """root_directory is the directory that contains all of the tests""" - self.root_directory = root_directory - self.verbose = verbose - self.host = host - # tests is a dictionary of test-name to Test objects - self.tests = {} - self.number_of_tests_run = 0 - self.failed_tests = [] - self.warned_tests = [] - self.skipped_tests = [] - - def gather_all_tests(self, include_regex, exclude_regex): - '''Finds all tests in the samples.txt file.''' - include_matcher = re.compile(include_regex) - exclude_matcher = re.compile(exclude_regex) - - with open(os.path.join(self.root_directory, "samples.txt"), 'r') as f: - for test_name in f: - if (include_matcher.match(test_name) and - exclude_matcher.match(test_name) is None): - self.add_test(test_name.strip(), test_name.strip(), False) - mec_test_name = test_name.strip() + ".mid_execution" - if (include_matcher.match(mec_test_name) and - exclude_matcher.match(mec_test_name) is None): - self.add_test( - mec_test_name, test_name.strip(), True) - - def print_test_names(self, file_handle): - """Prints out to the given file handle a list of all tests.""" - for test in sorted(self.tests.keys()): - file_handle.write(test + "\n") - - def add_test(self, test_name, test_executable, mid_execution): - """Adds a test case to the manager from the given apk""" - self.tests[test_name] = Test(test_executable, mid_execution) - - def run_apk(self, verbose, test_name, apk_name, capture_name, mid_execution): - args = RunArgs() - additional_args = ["-observe-frames", "1", "-capture-frames", "10"] - if mid_execution: - additional_args.extend(["-start-at-frame", "100"]) - - if verbose: - args.set_verbose() - args.set_output(capture_name) - setattr(args, "verbose", verbose) - setattr(args, "keep", False) - setattr(args, "output", [capture_name]) - setattr(args, "additional_params", additional_args) - print "[ " + "TRACING".center(10) + " ] " + test_name - try: - return_value = run_on_single_apk(apk_name, args) - except: - return (FAILURE, "Could not generate trace file.") - if return_value != 0: - return (FAILURE, "Could not generate trace file.") - if verbose: - print "Successfully traced application" - print "[ " + "DONE".center(10) + " ] " + test_name - return (SUCCESS, "") - - def run_host(self, verbose, test_name, host_name, capture_name, mid_execution): - print "[ " + "TRACING".center(10) + " ] " + test_name - try: - gapit_args = ['gapit'] - - if verbose: - gapit_args.extend(['-log-level', 'Debug']) - gapit_args.extend(['trace', '-out', - capture_name, '-api', 'vulkan', '-uri', host_name]) - # On Ubuntu 14.04 with Nvidia K2200, driver: 375.66, an window of - # size 1000 x 1000 may hang the device with sample: - # 'copy_querypool_results' and 'wireframe'. However the same size - # window does not hang when run on Ubuntu 14.04 with Nvidia driver: - # 375.39. This might be a driver bug. - # TODO: Test with 1000 x 1000 on latest Nvidia driver again. - gapit_args.extend(['-additionalargs', '-w=1024 -h=1024']) - gapit_args.extend([ - "-observe-frames", "1", "-capture-frames", "10"]) - if mid_execution: - gapit_args.extend(["-start-at-frame", "100"]) - if verbose: - print gapit_args - subprocess.check_call(gapit_args) - else: - subprocess.check_call( - gapit_args, stdout=open(os.devnull, 'wb'), - stderr=open(os.devnull, 'wb')) - except subprocess.CalledProcessError: - return (FAILURE, "Could not generate trace file.") - if verbose: - print "Successfully traced application" - print "[ " + "DONE".center(10) + " ] " + test_name - return (SUCCESS, "") - - def run_test(self, test_name, verbose, host, temp_directory): - capture_name = os.path.join( - temp_directory, test_name + ".gfxtrace") - if host: - success, error = self.run_host(verbose, test_name, os.path.join( - self.root_directory, self.tests[ - test_name].executable), capture_name, - self.tests[test_name].mid_execution) - else: - success, error = self.run_apk(verbose, test_name, os.path.join( - self.root_directory, self.tests[ - test_name].executable + ".apk"), capture_name, - self.tests[test_name].mid_execution) - if not success == SUCCESS: - return (success, error) - print "[ " + "RUN".ljust(10) + " ] " + test_name - - video_flags = ["gapit", "video", "-out", - os.path.join(temp_directory, test_name + ".mp4"), - capture_name] - if self.verbose: - print video_flags - if verbose: - proc = subprocess.Popen( - video_flags, stderr=subprocess.PIPE) - else: - proc = subprocess.Popen( - video_flags, stdout=open(os.devnull, 'wb'), - stderr=subprocess.PIPE) - _, stderr = proc.communicate() - err = proc.wait() - if err: - print "[ " + "FAILED".rjust(10) + " ] " + test_name - error_msg = "See {}\n{}".format(os.path.join(temp_directory, - test_name + ".mp4"), - stderr) - - print error_msg - return (FAILURE, error_msg) - print "[ " + "OK".rjust(10) + " ] " + test_name - return SUCCESS, "" - - def run_all_tests(self, temp_directory): - """Runs all of the tests""" - for test in sorted(self.tests): - self.accumulate_result( - test, self.run_test(test, self.verbose, self.host, - temp_directory)) - - def accumulate_result(self, test_name, result): - """Tracks the results for the given test""" - self.number_of_tests_run += 1 - if result[0] == FAILURE: - self.failed_tests.append((test_name, result[1])) - if result[0] == WARNING: - self.warned_tests.append(test_name) - if result[0] == SKIPPED: - self.skipped_tests.append(test_name) - - def print_summary_and_return_code(self): - '''Prints a summary of the test results. Returns 0 if every test - was successful and -1 if any test failed. - Warnings do not count as failure, but are printed out in the summary.''' - print "Total Tests Run: " + str(self.number_of_tests_run - - len(self.skipped_tests)) - print("Total Tests Passed: " + - str(self.number_of_tests_run - len(self.failed_tests) - - len(self.skipped_tests))) - if self.warned_tests: - print "Total Test Warnings: " + str(len(self.warned_tests)) - for warning in self.warned_tests: - print "[ " + "WARNING".rjust(10) + " ] " + warning - if self.skipped_tests: - print "Total Skipped Tests: " + str(len(self.skipped_tests)) - for skipped in self.skipped_tests: - print "[ " + "SKIPPED".rjust(10) + " ] " + skipped - for failure in self.failed_tests: - print "[ " + "FAILED".rjust(10) + " ] " + failure[0] - if self.failed_tests: - return -1 - return 0 - - -def main(): - """Entry-point for the testing framework""" - parser = argparse.ArgumentParser(description=''' -This testing framework will look in a directory for a samples.txt and -associated binaries. It will build its tests from there. - ''') - parser.add_argument( - "--test-dir", nargs=1, help="Directory that contains the executables/apks") - parser.add_argument( - "--verbose", action="store_true", help="Show verbose output") - parser.add_argument( - "--list-tests", - action="store_true", - help="Only print the names of all tests") - parser.add_argument( - "--host", - action="store_true", - help="Run the tests on the host, not an android device") - parser.add_argument( - "--include", - default=".*", - help="Run tests matching this regular expression") - parser.add_argument( - "--exclude", - default="^$", - help="Exclude tests that match this regular expression") - parser.add_argument( - "--keep", - action="store_true", - help="Do not delete output files") - args = parser.parse_args() - - test_directory = os.getcwd() - if args.test_dir: - test_directory = args.test_dir[0] - manager = TestManager( - test_directory, args.verbose, args.host) - manager.gather_all_tests(args.include, args.exclude) - - if args.list_tests: - manager.print_test_names(sys.stdout) - return 0 - else: - temp_directory = tempfile.mkdtemp("", "GAPID_VIDEO-") - print "Running tests in {}".format(temp_directory) - manager.run_all_tests(temp_directory) - if not args.keep: - shutil.rmtree(temp_directory) - return manager.print_summary_and_return_code() - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/tools/gapit_test_framework.py b/tools/gapit_test_framework.py deleted file mode 100755 index 42148cdf..00000000 --- a/tools/gapit_test_framework.py +++ /dev/null @@ -1,586 +0,0 @@ -#!/usr/bin/python -# Copyright 2017 Google 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. -'''The main test framework for all Gapit tests. -''' - -import argparse -import fnmatch -import inspect -import os -import re -import tempfile -import shutil -import subprocess -import sys -import traceback -from distutils.version import StrictVersion - -from gapit_tester import run_on_single_apk -from gapit_tester import RunArgs -from gapit_trace_reader import get_device_and_architecture_info_from_trace_file -from gapit_trace_reader import parse_trace_file, NamedAttributeError - -SUCCESS = 0 -FAILURE = 1 -WARNING = 2 -SKIPPED = 3 - -PIXEL_C = {"vendor_id": 0x10DE, "device_id": 0x92BA03D7} -NVIDIA_K2200 = {"vendor_id": 0x10DE, "device_id": 0x13ba} -NVIDIA_965M = {"vendor_id": 0x10DE, "device_id": 0x1427} - -UNKNOWN_OS, WINDOWS, OSX, LINUX, ANDROID = range(5) - - -class GapitTestException(Exception): - - """Base test exception""" - pass - - -class GapidUnsupportedException(GapitTestException): - - """Unsupported test exception""" - pass - - -def get_read_offset_function(atom, pointer): - """Returns a function that is a integer field decoder for any atom. - It decodes from the atoms read_data, starting at the given pointer""" - - def function(offset, size): - return little_endian_bytes_to_int( - require(atom.get_read_data(pointer + offset, size), 3)) - - return function - - -def get_write_offset_function(atom, pointer): - """Returns a function that is a integer field decoder for any atom. - It decodes from the atoms write_data, starting at the given pointer""" - - def function(offset, size): - return little_endian_bytes_to_int( - require(atom.get_write_data(pointer + offset, size), 3)) - - return function - - -def little_endian_bytes_to_int(val): - '''Takes a sequence of bytes in little-endian format, and turns - them into an integer''' - total = 0 - place = 1 - for byte in val: - total = total + (byte * place) - place *= 256 - return total - - -def require(val, stack_depth=0): - '''Takes a tuple (Object, String). - - If Object is None, throws an exception with the string and fails the test, - otherwise, prints nothing and returns the Object. stack_depth is the - stack_frame to display, where 0 is the callee of this function. - ''' - if val[0] is not None: - return val[0] - else: - call_site = traceback.format_list( - traceback.extract_stack(limit=2 + stack_depth)) - raise GapitTestException(val[1] + "\n" + call_site[0]) - - -def require_true(val, stack_depth=0): - """Takes a value. If that value is not true, throws an exception with an - error message""" - if val: - return - call_site = traceback.format_list( - traceback.extract_stack(limit=2 + stack_depth)) - raise GapitTestException("Expected:" + str(val) + "to be true\n" + - call_site[0]) - - -def require_false(val, stack_depth=0): - """Takes a value. If that value is true, throws an exception with an - error message""" - if not val: - return - call_site = traceback.format_list( - traceback.extract_stack(limit=2 + stack_depth)) - raise GapitTestException("Expected:" + str(val) + "to be false\n" + - call_site[0]) - - -def require_equal(param, val, stack_depth=0): - """Takes 2 values. If they are equal, does nothing, otherwise - throws an exception with an error message""" - # For floating point numbers, we do equivalence check like other types. - # But still, we need to make sure both the expected and actual values - # are floating point numbers, to avoid accidentally converting types - # and altering values. - float_count = int(isinstance(param, float)) + int(isinstance(val, float)) - if float_count >= 1: - assert float_count == 2, "should compare float with float" - - if type(val)(param) == val: - return - call_site = traceback.format_list( - traceback.extract_stack(limit=2 + stack_depth)) - raise GapitTestException("Expected:" + str(param) + "==" + str(val) + "\n" + - call_site[0]) - - -def require_not_equal(param, val, stack_depth=0): - """Takes 2 values. If they are not equal, does nothing, otherwise - throws an exception with an error message""" - if type(val)(param) != val: - return - call_site = traceback.format_list( - traceback.extract_stack(limit=2 + stack_depth)) - raise GapitTestException("Expected:" + str(param) + "!=" + str(val) + "\n" + - call_site[0]) - - -def require_not(val, stack_depth=0): - '''Takes a tuple (Object, String). If Object is not None, throws an - exception stating that we expected this to not exist. Otherwise does - nothing''' - if val[0] is not None: - call_site = traceback.format_list( - traceback.extract_stack(limit=2 + stack_depth)) - raise GapitTestException("Found element we were not expecting\n" + - call_site[0]) - - -class GapitTest(object): - - '''Base class for all Gapit tests. - - This is responsible for tracing our application as well as processing the - log file. Any subclasses 'expect' method will be run. - ''' - - def __init__(self): - self.device = None - self.architecture = None - self.atom_generator = None - self.warnings = [] - - def name(self): - """Returns the name of this class.""" - return self.__class__.__name__ - - def next_call_of(self, call_name): - '''Consumes atoms until a call of the given type is found, returns - a tuple (Atom, ""). Returns (None, "error_message") if the atom could - not be found''' - if self.verbose: - print "Finding next {}".format(call_name) - try: - while True: - atom = self.atom_generator.next() - if atom.name == call_name: - return (atom, "") - if self.verbose: - print "Skipping {}".format(atom.name) - except StopIteration: - return (None, "Could not find atom of type " + call_name) - - def nth_call_of(self, call_name, index): - '''Consumes atoms until the nth call of the given type is found, - returns a tuple (Atom, ""). Returns (None, "error_message") if - the atom could not be found''' - atom = (None, "") - if self.verbose: - print "Finding {}th {}".format(index, call_name) - for _ in range(0, index): - atom = self.next_call_of(call_name) - if atom[0]: - return (atom[0], "") - else: - return ( - None, - "Could not find " + str(index) + " atoms of type " + call_name) - - def next_call(self, call_name): - '''Expects the next call to be of the specified type. Returns - a tuple (Atom, ""), if it could be found, otherwise returns - (None, "Error_message") - ''' - if self.verbose: - print "Expecting next atom is {}".format(call_name) - try: - atom = self.atom_generator.next() - if atom.name == call_name: - return (atom, "") - except StopIteration: - return (None, "The next atom was not of type " + call_name) - - def not_android_version(self, android_version_name): - """If the trace device info matches indicates that the application is - running on Android and the version name matches with the given version - name, emits a warning and returns False. Otherwise returns True.""" - if (self.device.Configuration.OS.Kind == ANDROID and - StrictVersion(self.device.Configuration.OS.Name) <= - StrictVersion(android_version_name)): - call_site = traceback.format_list(traceback.extract_stack(limit=2)) - self.warnings.append( - "Code block disabled due to known Android issue\n" + call_site[ - 0]) - return False - return True - - def not_device(self, device_properties, driver, device): - """If the device_properties matches the given - device, and the device_properties driver_version is less - than driver, Emits a warning, and returns False, otherwise - returns True. - - device_properties is expected to be a valid - vkGetPhysicalDeviceProperties - Atom. - - driver is expected to be a numerical value. - - device is expected to be a map containing - { "vendor_id": int, "device_id": int } - """ - - # VkPhysicalDeviceProperties looks like: - # typedef struct VkPhysicalDeviceProperties { - # uint32_t apiVersion; - # uint32_t driverVersion; - # uint32_t vendorID; - # uint32_t deviceID; - # VkPhysicalDeviceType deviceType; - # char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]; - # uint8_t pipelineCacheUUID[VK_UUID_SIZE]; - # VkPhysicalDeviceLimits limits; - # VkPhysicalDeviceSparseProperties sparseProperties; - # } VkPhysicalDeviceProperties; - - driver_version = little_endian_bytes_to_int( - require( - device_properties.get_write_data( - device_properties.hex_pProperties + 4, 4))) - vendor_id = little_endian_bytes_to_int( - require( - device_properties.get_write_data( - device_properties.hex_pProperties + 2 * 4, 4))) - device_id = little_endian_bytes_to_int( - require( - device_properties.get_write_data( - device_properties.hex_pProperties + 3 * 4, 4))) - if (device["vendor_id"] == vendor_id and - device["device_id"] == device_id and driver_version <= driver): - call_site = traceback.format_list(traceback.extract_stack(limit=2)) - self.warnings.append("Code block disabled due to known driver bug\n" - + call_site[0]) - return False - return True - - def run_apk(self, verbose, apk_name, capture_name): - args = RunArgs() - if verbose: - args.set_verbose() - args.set_output(capture_name) - setattr(args, "verbose", verbose) - setattr(args, "keep", False) - setattr(args, "output", [capture_name]) - print "[ " + "TRACING".center(10) + " ] " + apk_name - try: - return_value = run_on_single_apk(apk_name, args) - except: - return (FAILURE, "Could not generate trace file.") - if return_value != 0: - return (FAILURE, "Could not generate trace file.") - if verbose: - print "Successfully traced application" - print "[ " + "DONE".center(10) + " ] " + apk_name - return (SUCCESS, "") - - def run_host(self, verbose, host_name, capture_name): - print "[ " + "TRACING".center(10) + " ] " + host_name - try: - gapit_args = ['gapit'] - if verbose: - gapit_args.extend(['-log-level', 'Debug']) - gapit_args.extend(['trace', '-api', 'vulkan', '-out', - capture_name, '-uri', host_name]) - if verbose: - subprocess.check_call(gapit_args) - else: - subprocess.check_call( - gapit_args, stdout=open(os.devnull, 'wb'), - stderr=open(os.devnull, 'wb')) - except: - return (FAILURE, "Could not generate trace file.") - if verbose: - print "Successfully traced application" - print "[ " + "DONE".center(10) + " ] " + host_name - return (SUCCESS, "") - - def run_test(self, verbose, host, capture_directory): - '''Runs this test case. Returns a tuple, - (FAILURE|SUCCESS|WARNING, message) on completion.''' - - program_name = getattr(self, "gapit_test_name") - self.verbose = verbose - capture_name = os.path.join( - capture_directory, program_name + ".gfxtrace") - - if not os.path.isfile(capture_name): - # If the file has not been created yet, in this test run, then - # generate the capture file contents. This is a slow process so - # only do it once. - if not host: - success, error = self.run_apk( - verbose, program_name + ".apk", capture_name) - else: - success, error = self.run_host( - verbose, program_name, capture_name) - if not success == SUCCESS: - return (success, error) - test_name = program_name + "." + self.name() - self.device, self.architecture = get_device_and_architecture_info_from_trace_file( - capture_name) - if self.architecture is None: - return (FAILURE, "Failed to obtain device architecture info from trace") - self.atom_generator = parse_trace_file(capture_name) - - def clear_atoms(status, message): - # Empty out all of the atoms in the generator, this way gapit can be - # killed. - for x in self.atom_generator: - pass - return (status, message) - print "[ " + "RUN".ljust(10) + " ] " + test_name - try: - getattr(self, "expect")() - except GapidUnsupportedException as error: - print "[ " + "SKIPPED".rjust(10) + " ] " + test_name - print " " + error.message - return clear_atoms(SKIPPED, error.message) - except GapitTestException as error: - print "[ " + "FAILED".rjust(10) + " ] " + test_name - print " " + error.message - return clear_atoms(FAILURE, error.message) - except NamedAttributeError as error: - exc_type, exc_value, exc_tb = sys.exc_info() - print "[ " + "FAILED".rjust(10) + " ] " + test_name - call_site = traceback.format_exception( - exc_type, exc_value, exc_tb, limit=2) - print " " + error.message + call_site[1] - return clear_atoms(FAILURE, error.message) - return_val = WARNING if len(self.warnings) > 0 else SUCCESS - if return_val == WARNING: - print "[ " + "WARNING".rjust(10) + " ]" - for warning in self.warnings: - print warning - print "[ " + "OK".rjust(10) + " ] " + test_name - return clear_atoms(return_val, None) - - -def gapit_test(gapit_test_name): - ''' This is used as a decoration to classes. - - It checks that the class it is attached to is of the right type, - and sets the program_name on it.''' - - def checked_decorator(clss): - """ This actually performs all of the checks""" - if not inspect.isclass(clss): - raise GapitTestException("The test case should be a class") - if not issubclass(clss, GapitTest): - raise GapitTestException( - "The test case should be a subclass of GapitTest") - clss.gapit_test_name = gapit_test_name - return clss - - return checked_decorator - - -class TestManager(object): - - """Manages and runs all requested tests.""" - - def __init__(self, root_directory, verbose, host): - """root_directory is the directory that contains all of the tests""" - self.root_directory = root_directory - self.verbose = verbose - self.host = host - # The key is the name of the APK, and the value is a list of tuples - # of (name, GapitTest) for the APK - self.tests = {} - self.number_of_tests_run = 0 - self.failed_tests = [] - self.warned_tests = [] - self.skipped_tests = [] - - def gather_all_tests(self, include_regex, exclude_regex): - '''Finds all classes in all python files that contain the attribute - @gapit_test whose names match include_regex and do not match - exclude_regex''' - include_matcher = re.compile(include_regex) - exclude_matcher = re.compile(exclude_regex) - - # __import__ does not re-generated *.pyc files correctly, - # so remove it all-together, it would be best to not clutter - # our directory anyway - sys.dont_write_bytecode = True - - default_path = sys.path - for root, _, filenames in os.walk(self.root_directory): - for filename in fnmatch.filter(filenames, "*.py"): - sys.path = default_path - sys.path.append(root) - if self.verbose: - print("Searching " + os.path.join(root, filename) + - " for tests") - try: - mod = __import__(os.path.splitext(filename)[0]) - for _, obj in inspect.getmembers(mod): - if inspect.isclass(obj) and hasattr( - obj, "gapit_test_name"): - if self.verbose: - print("Found test " + obj.__name__ + " in " + - os.path.join(root, filename)) - test_name = os.path.relpath(root, - self.root_directory) - test_name = test_name.replace("/", ".") - test_name = test_name.replace("\\", ".") - test = obj() - test_name += "." + test.name() - if (include_matcher.search(test_name) and - exclude_matcher.search(test_name) is None): - self.add_test(obj.gapit_test_name, - test_name, test) - except: - print("Warning: Could not parse " + os.path.join( - root, filename) + " for tests.") - pass - - def print_test_names(self, file_handle): - """Prints out to the given file handle a list of all tests.""" - for _, tests in self.tests.iteritems(): - for test in tests: - file_handle.write(test[0] + "\n") - - def add_test(self, program_name, test_name, test): - """Adds a test case to the manager from the given apk""" - if program_name not in self.tests: - self.tests[program_name] = [] - self.tests[program_name].append((test_name, test)) - - def run_all_tests(self, temp_directory): - """Runs all of the tests""" - for apk in sorted(self.tests.keys()): - for test in sorted(self.tests[apk], key=lambda x: x[0]): - self.accumulate_result( - test[0], test[1].run_test(self.verbose, self.host, - temp_directory)) - - def accumulate_result(self, test_name, result): - """Tracks the results for the given test""" - self.number_of_tests_run += 1 - if result[0] == FAILURE: - self.failed_tests.append((test_name, result[1])) - if result[0] == WARNING: - self.warned_tests.append(test_name) - if result[0] == SKIPPED: - self.skipped_tests.append(test_name) - - def print_summary_and_return_code(self): - '''Prints a summary of the test results. Returns 0 if every test - was successful and -1 if any test failed. - Warnings do not count as failure, but are printed out in the summary.''' - print "Total Tests Run: " + str(self.number_of_tests_run - - len(self.skipped_tests)) - print("Total Tests Passed: " + - str(self.number_of_tests_run - len(self.failed_tests) - - len(self.skipped_tests))) - if self.warned_tests: - print "Total Test Warnings: " + str(len(self.warned_tests)) - for warning in self.warned_tests: - print "[ " + "WARNING".rjust(10) + " ] " + warning - if self.skipped_tests: - print "Total Skipped Tests: " + str(len(self.skipped_tests)) - for skipped in self.skipped_tests: - print "[ " + "SKIPPED".rjust(10) + " ] " + skipped - for failure in self.failed_tests: - print "[ " + "FAILED".rjust(10) + " ] " + failure[0] - print " " + failure[1] - if self.failed_tests: - return -1 - return 0 - - -def main(): - """Entry-point for the testing framework""" - parser = argparse.ArgumentParser(description=''' -This testing framework will look in a given directory and accumulate -tests from there. - -Any class that is a subclass of GapitTest and has the annotation @gapit_test -will be considered. - -It is expected the CWD of this script is the output directory for the APK files -from a build. - ''') - parser.add_argument( - "--test-dir", nargs=1, help="Directory to gather the tests from") - parser.add_argument( - "--verbose", action="store_true", help="Show verbose output") - parser.add_argument( - "--list-tests", - action="store_true", - help="Only print the names of all tests") - parser.add_argument( - "--host", - action="store_true", - help="Run the tests on the host, not an android device") - parser.add_argument( - "--include", - default=".*", - help="Run tests matching this regular expression") - parser.add_argument( - "--exclude", - default="^$", - help="Exclude tests that match this regular expression") - args = parser.parse_args() - - test_directory = os.getcwd() - if args.test_dir: - test_directory = args.test_dir[0] - - manager = TestManager(test_directory, args.verbose, args.host) - manager.gather_all_tests(args.include, args.exclude) - - if args.list_tests: - manager.print_test_names(sys.stdout) - return 0 - else: - test_directory = tempfile.mkdtemp("", "GAPID-") - print "Running tests in {}".format(test_directory) - manager.run_all_tests(test_directory) - shutil.rmtree(test_directory) - return manager.print_summary_and_return_code() - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/tools/gapit_tester.py b/tools/gapit_tester.py deleted file mode 100755 index 3b437e6d..00000000 --- a/tools/gapit_tester.py +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/python -# Copyright 2017 Google 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. -'''This runs a single apk through gapit trace and gapit dump. Passes the exit -code of the apk code through to its own exit code.''' - -import argparse -import os -import subprocess -import sys -import android - - -class RunArgs(object): - - """Arguments to run_on_single_apk""" - - def __init__(self): - self.verbose = False - self.output = None - self.keep = False - self.additional_params = [] - - def set_verbose(self): - """Sets the verbose flag to true""" - self.verbose = True - - def set_output(self, output): - """Sets the output to the given output""" - self.output = output - - def set_keep(self): - """Sets the keep flag to true""" - self.keep = True - - def set_additional_params(self, params): - """Sets additional params to gapit""" - self.additional_params = params - - verbose = False - output = None - keep = False - additional_params = [] - - -def run_on_single_apk(apk, args): - '''Installs, traces and optionally uninstalls a single APK from an android - device. args must conform to the RunArgs interface. Returns the exit code - of the running apk.''' - apk_info = android.get_apk_info(apk) - android.install_apk(apk_info, args) - android.adb(['logcat', '-c'], args) - - gapit_args = ['gapit'] - - if args.verbose: - gapit_args.extend(['-log-level', 'Debug']) - - gapit_args.extend(['trace']) - if args.output: - gapit_args.extend(['-out', args.output[0]]) - gapit_args.extend(args.additional_params) - gapit_args.extend([apk_info.package_name]) - - if args.verbose: - print gapit_args - - if args.verbose: - gapit = subprocess.Popen(gapit_args) - else: - null_file = open(os.devnull, 'w') - gapit = subprocess.Popen( - gapit_args, stdout=null_file, stderr=null_file) - - return_value = android.watch_process(True, args, gapit) - android.adb(['shell', 'am', 'force-stop', apk_info.package_name], args) - if not args.keep: - android.adb(['uninstall', apk_info.package_name], args) - if gapit.poll() is None: - gapit.kill() - return return_value - - -def main(): - """Main entry point to the APK runner""" - parser = argparse.ArgumentParser( - description='Run a .apk file on an android device') - parser.add_argument('apk', help='apk to run') - parser.add_argument( - '--keep', action='store_true', help='do not uninstall on completion') - parser.add_argument( - '--verbose', action='store_true', help='enable verbose output') - parser.add_argument( - '--output', - nargs=1, - help='If specified, then the trace will be written here') - args = parser.parse_args() - return run_on_single_apk(args.apk, args) - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/tools/gapit_trace_reader.py b/tools/gapit_trace_reader.py deleted file mode 100755 index 9fec6d63..00000000 --- a/tools/gapit_trace_reader.py +++ /dev/null @@ -1,554 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# Copyright 2017 Google 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. -"""This contains functions for parsing a trace file using gapit dump.""" - -import argparse -import json -import os -import re -import subprocess -import sys -from collections import namedtuple - - -class Observation(object): - - '''A single observation. - - Contains the start, end and id of the observation as well as - the memory that was actually observed.''' - - def __init__(self, observation_type, memory_start, memory_end, memory_id, data): - self.type = observation_type - self.contents = data - self.memory_start = memory_start - self.memory_end = memory_end - self.memory_id = memory_id - - def __str__(self): - val = " {} : [{:016x} - {:016x}]\n{}".format( - self.type, self.memory_start, self.memory_end, - ''.join(["{:02x}".format(i) for i in self.contents])) - return val - - def get_memory_range(self): - """ Returns a pair (start, end) of the memory region""" - return (self.memory_start, self.memory_end) - - def get_memory(self): - """ Returns the bytes inside the range""" - return self.contents - - -def find_memory_in_observations(observations, address, num_bytes): - '''Searches for the given range of bytes in the given array of observations. - - Returns the bytes if they exist, or returns None if they could not be - found - ''' - - for observation in observations: - rng = observation.get_memory_range() - last_address = address + num_bytes - 1 - if (address <= rng[1] and address >= rng[0] and - last_address <= rng[1] and last_address >= rng[0]): - return observation.get_memory()[address - rng[0]:address - rng[0] + - num_bytes] - return None - - -def find_string_in_observations(observations, address): - '''Finds a null-terminated string starting at the given address in - the observations. Returns a python string containing all of the non - null bytes, or None if it could not be found''' - for observation in observations: - rng = observation.get_memory_range() - if address <= rng[1] and address >= rng[0]: - memory = observation.get_memory() - string_data = bytearray() - for idx in range(address - rng[0], rng[1] - rng[0] + 1): - ch = memory[idx] - if ch is 0: - return str(string_data) - string_data.append(ch) - return None - - -class NamedAttributeError(AttributeError): - - """An exception that is thrown when trying to access a parameter from an - object""" - - def __init__(self, message): - super(NamedAttributeError, self).__init__(message) - - -class Extra(object): - - """A single extra attached to an atom""" - - def __init__(self, name, parameters): - self.name = name - self.parameters = {} - for parameter in parameters: - self.parameters[parameter[0]] = parameter[1] - - def __getattr__(self, name): - """Returns parameters that were on this extra. - - Based on the prefix (hex_, int_, float_, ) we convert the - parameter from a string with the given formatting. - """ - - if name.startswith('hex_') or name.startswith('int_'): - if name[4:] in self.parameters: - if name.startswith('hex_'): - return int(self.parameters[name[4:]], 16) - elif name.startswith('int_'): - return int(self.parameters[name[4:]]) - - if name.startswith('float_'): - if name[6:] in self.parameters: - return float(self.parameters[name[6:]]) - - if name in self.parameters: - return self.parameters[name] - raise NamedAttributeError('Could not find parameter ' + name + - ' on extra ' + self.name + '\n') - - -class Atom(object): - - '''A single Atom that was observed. - - Contains all of the memory observations, parameters, index and return code - of the atom.''' - - def __init__(self, index, name, return_val): - self.parameters = {} - self.read_observations = [] - self.write_observations = [] - self.index = index - self.name = name - self.return_val = return_val - - def __getattr__(self, name): - """Returns parameters that were on this atom. - - Based on the prefix (hex_, int_, float_, ) we convert the - parameter from a string with the given formatting. - """ - - # A helper function to iterate through each element of a given array - # to process the array type parameters - def process_array_parameter(parameter_array, f): - l = [] - for p in parameter_array: - l.append(f(p)) - return l - - if name.startswith('hex_') or name.startswith('int_'): - if name[4:] in self.parameters: - if name.startswith('hex_'): - p = self.parameters[name[4:]] - if isinstance(p, list): - return process_array_parameter(p, lambda x: int(x, 16)) - else: - return int(p, 16) - elif name.startswith('int_'): - p = self.parameters[name[4:]] - if isinstance(p, list): - return process_array_parameter(p, lambda x: int(x)) - else: - return int(p) - - if name.startswith('float_'): - if name[6:] in self.parameters: - p = self.parameters[name[6:]] - if isinstance(p, list): - return process_array_parameter(p, lambda x: float(x)) - else: - return float(self.parameters[name[6:]]) - - if name in self.parameters: - return self.parameters[name] - if name.startswith('extra_'): - if name[6:] in self.extras: - return self.extras[name[6:]] - - raise NamedAttributeError('Could not find parameter ' + name + - ' on atom [' + str( - self.index) + ']' + self.name + '\n') - - def num_observations(self): - """Returns the number of observations on this object""" - return len(self.read_observations) + len(self.write_observations) - - def get_read_data(self, address, num_bytes): - """Returns num_bytes from the starting address in the read observations. - - If the range address->address + num_bytes is not contained in any - combination of read Observations (None, "Error_Message") is returned, - otherwise (bytes, "") is returned - """ - mem = find_memory_in_observations(self.read_observations, address, - num_bytes) - if mem is not None: - return (mem, '') - - return (None, 'Could not find a read observation starting at ' + - str(hex(address)) + ' containing ' + str(num_bytes) + ' bytes') - - def get_read_string(self, address): - """Returns a null-terminated string starting at address in the - read observations. - - If there is no null-terminated string at address, then - (None, "Error_Message") is returned otherwise (string, "") - is returned""" - mem = find_string_in_observations(self.read_observations, address) - if mem is not None: - return mem, '' - - return (None, 'Could not find a string starting at ', address) - - def get_write_data(self, address, num_bytes): - """Returns num_bytes from the starting address in the write - observations. - - If the range address->address + num_bytes is not contained in a write - Observation (None, "Error_Message") is returned, otherwise (bytes, "") - is returned - """ - mem = find_memory_in_observations(self.write_observations, address, - num_bytes) - if mem is not None: - return (mem, '') - else: - return (None, 'Could not find a write observation starting at ', - str(address), ' containing ', str(num_bytes), ' bytes') - - def get_write_string(self, address): - """Returns a null-terminated string starting at address in the - read observations. - - If there is no null-terminated string at address, then - (None, "Error_Message") is returned otherwise (string, "") - is returned""" - mem = find_string_in_observations(self.write_observations, address) - if mem is not None: - return mem, '' - - return (None, 'Could not find a string starting at ', address) - - def add_parameter(self, name, value): - """Adds a parameter with the given name and value to the atom.""" - self.parameters[name] = value - - def get_parameter(self, parameter_name): - '''Expects there to be a paramter of the given name on the given atom. - Returns (parmeter, "") if it exists, and (None, "Error_message") if it - does not''' - if parameter_name in self.parameters: - return (self.parameters[parameter_name], '') - else: - return (None, 'Could not find paramter ' + parameter_name + - ' on atom [' + str(self.index) + '] ' + self.name()) - - def add_read_observation(self, memory_start, memory_end, memory_id, data): - '''Adds a read observation to the atom. Does not associate any memory - with the read''' - self.read_observations.append( - Observation("R", memory_start, memory_end, - memory_id, data)) - - def add_write_observation(self, memory_start, memory_end, memory_id, data): - '''Adds a write observation to the atom. Does not associate any memory - with the write''' - self.write_observations.append( - Observation("W", memory_start, memory_end, - memory_id, data)) - - def add_extra(self, name, parameters): - """Takes a name and an array of parameter tuples (name, value) and adds - this extra to the atom""" - self.extras[name] = Extra(name, parameters) - - def __str__(self): - val = "[{}] {}({})".format(self.index, self.name, self.parameters) - if self.return_val: - val += " -> {}".format(self.return_val) - if self.read_observations or self.write_observations: - val += "\n" - val += "\n".join([ - "\n".join([str(observation) - for observation in self.read_observations]), - "\n".join([str(observation) - for observation in self.write_observations])]) - return val - - -def parse_atom_line(line): - '''Parses a single line from a trace dump. - - Example lines: - [0] switchThread(threadID: 1) - [36] vkGetDeviceProcAddr(device: 3853508608, pName: vkGetDeviceProcAddr) → 0xd3a0e6c5 - - This is expected to be first line of a new atom - ''' - match = re.match(r'\[(\d+)\] ([a-zA-Z0-9]*)\((.*)\)(?: → (.*))?', line) - if not match: - print 'failed line:: "{}"'.format(line) - number = int(match.group(1)) - command = match.group(2) - - all_parameters = match.group(3) - # Group 0: Parameter name - # Group 1: Array type parameter, empty if the parameter is not array type - # Group 2: Non-array type parameter - parameters = re.findall( - r'([a-zA-Z]*): (?:\[(.*)\]|([a-zA-Z0-9\.]*))', all_parameters) - - return_val = None - if match.group(4): - return_val = match.group(4) - - atom = Atom(number, command, return_val) - for parameter in parameters: - if parameter[1] != '': - atom.add_parameter(parameter[0], parameter[1].split(' ')) - else: - atom.add_parameter(parameter[0], parameter[2]) - - return atom - - -def parse_memory_observations(observation): - '''Parses all memory observations from a formatted list of observations. - - Example Line: - {Range: [0x00000000eaafff34-0x00000000eaafff37], \ - ID: 8f85530ad0db61eee69aa0ba583751043584d500} - - Returns a list of tuples containing the range start, range end, and ID of - the observation. - ''' - observations = re.findall( - r'\{Range: \[0x([0-9a-f]+)-0x([0-9a-f]+)\], ID: ([0-9a-f]+)\}', - observation) - for observation in observations: - yield observation - - -def parse_extra(name, extra_text, atom): - """Parses extra_text from an extra named `extra_name` - - - Example extra_text: - &{Generate:{} U64Alignment: 8} - """ - interior = extra_text.lstrip('&').strip('{}') - parameters = re.findall(r'([a-zA-Z0-9]+):(\S)+', interior) - atom.add_extra(name, parameters) - - -def parse_observation(observation_type, start, end, line, atom): - '''Parses the second line of a memory observation. - ''' - start_match = re.match( - r'(?:0x)?([0-9a-f]+)(@[0-9]+)?', start) - start_pool = 0 - if start_match.group(2): - start_pool = int(start_match.group(2)) - - end_match = re.match( - r'(?:0x)?([0-9a-f]+)(@[0-9]+)?', end) - - if observation_type == "R": - atom.add_read_observation( - int(start_match.group(1), 16), int(end_match.group(1), 16), - start_pool, parse_memory_line(line)) - else: - atom.add_write_observation( - int(start_match.group(1), 16), int(end_match.group(1), 16), - start_pool, parse_memory_line(line)) - - -def parse_memory_line(line): - """Parses the memory lines of an atom, returns the bytes of the - observation - - 2c00f4a6 - """ - return [int(line[i:i + 2], 16) for i in range(0, len(line.strip()), 2)] - -# FIRST_LINE These are the states that we use when parsing. -# is the first line in the entire file -FIRST_LINE = 1 -# NEW_ATOM is the state we are in just before reading a new atom -NEW_ATOM = 2 -# MEMORY is the state we are in when we have finished reading the ATOM -# and now we have to read all of the memory -MEMORY = 3 - - -def next_line(proc): - ''' Returns the next valid line from the input ''' - - while True: - line = proc.stdout.readline() - if line == '\n': - continue - if line == '\r\n': - continue - if re.match(r'\d\d?:\d\d?:\d\d?\.\d*.* ', line): - continue - return line.strip("\r\n").strip() - - -def get_device_and_architecture_info_from_trace_file(filename): - '''Parses a trace file and returns the device architecture info - - Arguments: - filename is the name of the trace file to read - Return: - device architecture that contains device hardware info if the device - info header is parsed successfully, otherwise returns None - ''' - proc = subprocess.Popen( - ['gapit', '-log-level', 'Fatal', 'dump', - '-showabiinfo', '-showdeviceinfo', filename], - stdout=subprocess.PIPE) - - def get_json_str(): - return_str = "" - line = next_line(proc) - while not line.startswith('}') or not line.strip() == '}': - return_str += line - line = proc.stdout.readline() - if line == '': - return None - # append the ending '}' - return_str += line.strip() + "\n" - return return_str - - device = None - architecture = None - - # This parsing routine is basically a state machine to parse the device info - # which is stored in json string form. - # The first several lines of the process is un-necessary. - # readline keeps the newline on the end so EOF is when readline returns - # an empty string. - line = next_line(proc) - while line != '': - if line.strip() == "Device Information:": - device_info_str = get_json_str() - device = json.loads(device_info_str, - object_hook=lambda d: namedtuple('Device', d.keys())(*d.values())) - - elif line.strip() == "Trace ABI Information:": - abi_info_str = get_json_str() - abi_info = json.loads(abi_info_str) - memory_layout = abi_info["memory_layout"] - layout_dict = {} - for t in memory_layout: - if not isinstance(memory_layout[t], dict): - continue - for p in memory_layout[t]: - key = 'int_' + t[0].lower() + t[1:] + p.title() - layout_dict[key] = memory_layout[t][p] - architecture = type("Architecture", (), layout_dict) - if (device is not None) and (architecture is not None): - break - line = next_line(proc) - proc.kill() - return device, architecture - - -def parse_trace_file(filename): - '''Parses a trace file, for every atom parsed, yields an atom. - - Arguments: - filename is the name of the trace file to read - ''' - proc = subprocess.Popen( - ['gapit', '-log-level', 'Fatal', 'dump', - '-observations-data', '-raw', filename], - stdout=subprocess.PIPE, stderr=open(os.devnull, 'wb')) - - # This parsing routine is basically a state machine - # The very first several lines of the process is un-necessary - # Every atom has 3 parts: - # The first several lines are the number/name/parameters - # The second line is information about the read/write locations - # The subsequent lines are the memory contents of those read/write locations - # IMPORTANT: These memory contents are what is present AFTER the - # call is made, not before. So you cannot get information - # about what the memory was before a call. - num_read_observations = 0 - num_write_observations = 0 - current_memory_observation = 0 - current_state = FIRST_LINE - atom = None - # readline keeps the newline on the end so EOF is when readline returns - # an empty string - line = next_line(proc) - while line != '': - if current_state == FIRST_LINE: - # Only atom lines starts with an index number, and the first atom - # always has index value 0, so the string starts with '0' is the - # first atom line. - if line.startswith('[0]'): - current_state = NEW_ATOM - continue - elif current_state == NEW_ATOM: - if atom: - yield atom - atom = parse_atom_line(line) - current_state = MEMORY - elif current_state == MEMORY: - match = re.match( - r'\s*(R|W): \[((?:0x)?[0-9a-f]+) - ((?:0x)?[0-9a-f]+)\]', line) - match_empty = re.match(r'\s*(R|W): \[0 - 0\]', line) - if not match: - current_state = NEW_ATOM - continue - line = next_line(proc) - parse_observation( - match.group(1), match.group(2), match.group(3), line, atom) - line = next_line(proc) - if atom: - yield atom - proc.kill() -import time - - -def main(): - """Main entry point for the parser.""" - parser = argparse.ArgumentParser( - description='Prints out the name of all atoms found in a trace file') - parser.add_argument('trace', help='trace file to read') - args = parser.parse_args() - - for atom in parse_trace_file(args.trace): - print atom - return 0 - - -if __name__ == '__main__': - sys.exit(main())