Skip to content

Commit

Permalink
tests: Remove QueueCommandBuffer method
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-lunarg committed Apr 26, 2024
1 parent aa835d1 commit 62c65a6
Show file tree
Hide file tree
Showing 35 changed files with 188 additions and 169 deletions.
20 changes: 16 additions & 4 deletions tests/framework/barrier_queue_family.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,12 @@ void BarrierQueueFamilyTestHelper::operator()(const std::string &img_err, const
// the Fence resolves to VK_NULL_HANLE... i.e. no fence
qf->queue->submit({{qf->command_buffer, qf->command_buffer2}}, vkt::Fence(), positive);
} else {
qf->command_buffer->QueueCommandBuffer(qf->queue, positive); // Check for success on positive tests only
if (positive) { // Check for success on positive tests only
qf->queue->submit(*qf->command_buffer);
} else {
qf->queue->submit(*qf->command_buffer, false);
}
qf->queue->wait();
}
}

Expand Down Expand Up @@ -198,7 +203,12 @@ void Barrier2QueueFamilyTestHelper::operator()(const std::string &img_err, const
// the Fence resolves to VK_NULL_HANLE... i.e. no fence
qf->queue->submit({{qf->command_buffer, qf->command_buffer2}}, vkt::Fence(), positive);
} else {
qf->command_buffer->QueueCommandBuffer(qf->queue, positive); // Check for success on positive tests only
if (positive) { // Check for success on positive tests only
qf->queue->submit(*qf->command_buffer);
} else {
qf->queue->submit(*qf->command_buffer, false);
}
qf->queue->wait();
}
}

Expand All @@ -217,7 +227,8 @@ void ValidOwnershipTransferOp(ErrorMonitor *monitor, vkt::Queue *queue, vkt::Com
vk::CmdPipelineBarrier(cb->handle(), src_stages, dst_stages, 0, 0, nullptr, num_buf_barrier, buf_barrier, num_img_barrier,
img_barrier);
cb->end();
cb->QueueCommandBuffer(queue); // Implicitly waits
queue->submit(*cb);
queue->wait();
}

void ValidOwnershipTransfer(ErrorMonitor *monitor, vkt::Queue *queue_from, vkt::CommandBuffer *cb_from, vkt::Queue *queue_to,
Expand All @@ -238,7 +249,8 @@ void ValidOwnershipTransferOp(ErrorMonitor *monitor, vkt::Queue *queue, vkt::Com
dep_info.pImageMemoryBarriers = img_barrier;
vk::CmdPipelineBarrier2KHR(cb->handle(), &dep_info);
cb->end();
cb->QueueCommandBuffer(queue); // Implicitly waits
queue->submit(*cb);
queue->wait();
}

void ValidOwnershipTransfer(ErrorMonitor *monitor, vkt::Queue *queue_from, vkt::CommandBuffer *cb_from, vkt::Queue *queue_to,
Expand Down
32 changes: 3 additions & 29 deletions tests/framework/binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,9 @@ void Image::SetLayout(VkImageAspectFlags aspect, VkImageLayout image_layout) {
SetLayout(&cmd_buf, aspect, image_layout);
cmd_buf.end();

cmd_buf.QueueCommandBuffer(device_->QueuesWithGraphicsCapability()[0]);
auto graphics_queue = device_->QueuesWithGraphicsCapability()[0];
graphics_queue->submit(cmd_buf);
graphics_queue->wait();
}

VkImageViewCreateInfo Image::BasicViewCreatInfo(VkImageAspectFlags aspect_mask) const {
Expand Down Expand Up @@ -1487,34 +1489,6 @@ void CommandBuffer::EndVideoCoding(const VkVideoEndCodingInfoKHR &endInfo) {
vkCmdEndVideoCodingKHR(handle(), &endInfo);
}

void CommandBuffer::QueueCommandBuffer(Queue *queue, bool check_success) {
Fence null_fence;
QueueCommandBuffer(queue, null_fence, check_success);
}

void CommandBuffer::QueueCommandBuffer(Queue *queue, const Fence &fence, bool check_success, bool submit_2) {
VkResult err = VK_SUCCESS;
(void)err;

if (submit_2) {
err = queue->submit2(*this, fence, check_success);
} else {
err = queue->submit(*this, fence, check_success);
}
if (check_success) {
assert(err == VK_SUCCESS);
}

err = queue->wait();
if (check_success) {
assert(err == VK_SUCCESS);
}

// TODO: Determine if we really want this serialization here
// Wait for work to finish before cleaning up.
vk::DeviceWaitIdle(dev_handle_);
}

void RenderPass::init(const Device &dev, const VkRenderPassCreateInfo &info) {
NON_DISPATCHABLE_HANDLE_INIT(vk::CreateRenderPass, dev, &info);
}
Expand Down
3 changes: 0 additions & 3 deletions tests/framework/binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -1032,9 +1032,6 @@ class CommandBuffer : public internal::Handle<VkCommandBuffer> {
void EncodeVideo(const VkVideoEncodeInfoKHR &encodeInfo);
void EndVideoCoding(const VkVideoEndCodingInfoKHR &endInfo);

void QueueCommandBuffer(Queue *queue, bool check_success = true);
void QueueCommandBuffer(Queue *queue, const Fence &fence, bool check_success = true, bool submit_2 = false);

void SetEvent(Event &event, VkPipelineStageFlags stageMask) { event.cmd_set(*this, stageMask); }
void ResetEvent(Event &event, VkPipelineStageFlags stageMask) { event.cmd_reset(*this, stageMask); }
void WaitEvents(uint32_t eventCount, const VkEvent *pEvents, VkPipelineStageFlags srcStageMask,
Expand Down
4 changes: 2 additions & 2 deletions tests/framework/ray_tracing_objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ BuildGeometryInfoKHR BuildOnDeviceTopLevel(const vkt::Device &device, vkt::Queue
bot_level_accel_struct->BuildCmdBuffer(cmd_buffer);
cmd_buffer.end();

cmd_buffer.QueueCommandBuffer(&queue);
queue.submit(cmd_buffer);
device.wait();

cmd_buffer.begin();
Expand All @@ -1176,7 +1176,7 @@ BuildGeometryInfoKHR BuildOnDeviceTopLevel(const vkt::Device &device, vkt::Queue
top_level_accel_struct.BuildCmdBuffer(cmd_buffer);
cmd_buffer.end();

cmd_buffer.QueueCommandBuffer(&queue);
queue.submit(cmd_buffer);
device.wait();

return top_level_accel_struct;
Expand Down
13 changes: 8 additions & 5 deletions tests/unit/best_practices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1889,7 +1889,8 @@ TEST_F(VkBestPracticesLayerTest, ExclusiveImageMultiQueueUsage) {

graphics_buffer.end();

graphics_buffer.QueueCommandBuffer(graphics_queue);
graphics_queue->submit(graphics_buffer);
graphics_queue->wait();

// Record compute command buffer
compute_buffer.begin();
Expand All @@ -1905,7 +1906,8 @@ TEST_F(VkBestPracticesLayerTest, ExclusiveImageMultiQueueUsage) {

// Warning should trigger as we are potentially accessing undefined resources
m_errorMonitor->SetDesiredFailureMsg(kWarningBit, "BestPractices-ConcurrentUsageOfExclusiveImage");
compute_buffer.QueueCommandBuffer(compute_queue);
compute_queue->submit(compute_buffer);
compute_queue->wait();
m_errorMonitor->VerifyFound();

vk::ResetCommandPool(device(), graphics_pool.handle(), 0);
Expand Down Expand Up @@ -1937,8 +1939,8 @@ TEST_F(VkBestPracticesLayerTest, ExclusiveImageMultiQueueUsage) {
VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VK_DEPENDENCY_BY_REGION_BIT, 0, nullptr, 0, nullptr, 1, &barrier);

graphics_buffer.end();

graphics_buffer.QueueCommandBuffer(graphics_queue);
graphics_queue->submit(graphics_buffer);
graphics_queue->wait();

// Record compute command buffer
compute_buffer.begin();
Expand All @@ -1957,7 +1959,8 @@ TEST_F(VkBestPracticesLayerTest, ExclusiveImageMultiQueueUsage) {

// Warning shouldn't trigger
m_errorMonitor->SetDesiredFailureMsg(kWarningBit, "BestPractices-ConcurrentUsageOfExclusiveImage");
compute_buffer.QueueCommandBuffer(compute_queue);
compute_queue->submit(compute_buffer);
compute_queue->wait();
m_errorMonitor->Finish();
}

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/debug_printf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ TEST_F(NegativeDebugPrintf, MeshTaskShaders) {

m_errorMonitor->SetDesiredFailureMsg(kInformationBit, "hello from task shader");
m_errorMonitor->SetDesiredFailureMsg(kInformationBit, "hello from mesh shader");
m_commandBuffer->QueueCommandBuffer(m_default_queue);
m_default_queue->submit(*m_commandBuffer);
m_default_queue->wait();
m_errorMonitor->VerifyFound();
}
Expand Down Expand Up @@ -806,7 +806,7 @@ TEST_F(NegativeDebugPrintf, GPLFragment) {

m_errorMonitor->SetDesiredFailureMsg(kInformationBit, "Vertex shader 0, 0x1030507");
m_errorMonitor->SetDesiredFailureMsg(kInformationBit, "Fragment shader 0x2040608");
m_commandBuffer->QueueCommandBuffer(m_default_queue);
m_default_queue->submit(*m_commandBuffer);
m_default_queue->wait();
m_errorMonitor->VerifyFound();
}
Expand Down Expand Up @@ -942,7 +942,7 @@ TEST_F(NegativeDebugPrintf, GPLFragmentIndependentSets) {

m_errorMonitor->SetDesiredFailureMsg(kInformationBit, "Vertex shader 0, 0x1030507");
m_errorMonitor->SetDesiredFailureMsg(kInformationBit, "Fragment shader 0x2040608");
m_commandBuffer->QueueCommandBuffer(m_default_queue);
m_default_queue->submit(*m_commandBuffer);
m_default_queue->wait();
m_errorMonitor->VerifyFound();
}
Expand Down Expand Up @@ -1285,7 +1285,7 @@ TEST_F(NegativeDebugPrintf, MeshTaskShaderObjects) {

m_errorMonitor->SetDesiredFailureMsg(kInformationBit, "hello from task shader");
m_errorMonitor->SetDesiredFailureMsg(kInformationBit, "hello from mesh shader");
m_commandBuffer->QueueCommandBuffer(m_default_queue);
m_default_queue->submit(*m_commandBuffer);
m_default_queue->wait();
m_errorMonitor->VerifyFound();
}
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/descriptor_indexing_positive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ TEST_F(PositiveDescriptorIndexing, BindingPartiallyBound) {
vk::CmdDrawIndexed(m_commandBuffer->handle(), 1, 1, 0, 0, 0);
m_commandBuffer->EndRenderPass();
m_commandBuffer->end();
m_commandBuffer->QueueCommandBuffer(m_default_queue);
m_default_queue->submit(*m_commandBuffer);
m_default_queue->wait();
}

TEST_F(PositiveDescriptorIndexing, UpdateAfterBind) {
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/device_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ TEST_F(NegativeDeviceQueue, FamilyIndexUsage) {
m_commandBuffer->begin();
vk::CmdFillBuffer(m_commandBuffer->handle(), ib.handle(), 0, 16, 5);
m_commandBuffer->end();
m_commandBuffer->QueueCommandBuffer(m_default_queue, false);
m_default_queue->submit(*m_commandBuffer, false);
m_default_queue->wait();
m_errorMonitor->VerifyFound();
}

Expand Down
3 changes: 2 additions & 1 deletion tests/unit/external_memory_sync_positive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ TEST_F(PositiveExternalMemorySync, ExternalMemory) {
&mem_barrier, 0, nullptr, 0, nullptr);
vk::CmdCopyBuffer(m_commandBuffer->handle(), buffer_import.handle(), buffer_output.handle(), 1, &copy_info);
m_commandBuffer->end();
m_commandBuffer->QueueCommandBuffer(m_default_queue);
m_default_queue->submit(*m_commandBuffer);
m_default_queue->wait();
}

TEST_F(PositiveExternalMemorySync, BufferDedicatedAllocation) {
Expand Down
20 changes: 10 additions & 10 deletions tests/unit/gpu_av.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ TEST_F(NegativeGpuAV, SelectInstrumentedShaders) {
m_commandBuffer->EndRenderPass();
m_commandBuffer->end();
// Should not get a warning since shader wasn't instrumented
m_commandBuffer->QueueCommandBuffer(m_default_queue);
m_default_queue->submit(*m_commandBuffer);
m_default_queue->wait();
VkValidationFeatureEnableEXT enabled[] = {VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT};
VkValidationFeaturesEXT features = vku::InitStructHelper();
Expand All @@ -163,7 +163,7 @@ TEST_F(NegativeGpuAV, SelectInstrumentedShaders) {
// Should get a warning since shader was instrumented
m_errorMonitor->ExpectSuccess(kWarningBit | kErrorBit);
m_errorMonitor->SetDesiredFailureMsg(kWarningBit, "VUID-vkCmdDraw-storageBuffers-06936");
m_commandBuffer->QueueCommandBuffer(m_default_queue);
m_default_queue->submit(*m_commandBuffer);
m_default_queue->wait();
m_errorMonitor->VerifyFound();
}
Expand Down Expand Up @@ -833,9 +833,9 @@ TEST_F(NegativeGpuAV, CopyBufferToImageD32) {
m_commandBuffer->end();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "has a float value at offset 16376 that is not in the range [0, 1]");
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "has a float value at offset 16376 that is not in the range [0, 1]");
m_commandBuffer->QueueCommandBuffer(m_default_queue);
m_default_queue->submit(*m_commandBuffer);
m_default_queue->wait();
m_errorMonitor->VerifyFound();
vk::DeviceWaitIdle(*m_device);
}

TEST_F(NegativeGpuAV, CopyBufferToImageD32Vk13) {
Expand Down Expand Up @@ -903,9 +903,9 @@ TEST_F(NegativeGpuAV, CopyBufferToImageD32Vk13) {
m_commandBuffer->end();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "has a float value at offset 16376 that is not in the range [0, 1]");
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "has a float value at offset 16376 that is not in the range [0, 1]");
m_commandBuffer->QueueCommandBuffer(m_default_queue);
m_default_queue->submit(*m_commandBuffer);
m_default_queue->wait();
m_errorMonitor->VerifyFound();
vk::DeviceWaitIdle(*m_device);
}

TEST_F(NegativeGpuAV, CopyBufferToImageD32U8) {
Expand Down Expand Up @@ -961,9 +961,9 @@ TEST_F(NegativeGpuAV, CopyBufferToImageD32U8) {

m_commandBuffer->end();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "has a float value at offset 20475 that is not in the range [0, 1]");
m_commandBuffer->QueueCommandBuffer(m_default_queue);
m_default_queue->submit(*m_commandBuffer);
m_default_queue->wait();
m_errorMonitor->VerifyFound();
vk::DeviceWaitIdle(*m_device);
}

TEST_F(NegativeGpuAV, CopyBufferToImageD32U8Vk13) {
Expand Down Expand Up @@ -1030,7 +1030,7 @@ TEST_F(NegativeGpuAV, CopyBufferToImageD32U8Vk13) {

m_commandBuffer->end();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "has a float value at offset 20475 that is not in the range [0, 1]");
m_commandBuffer->QueueCommandBuffer(m_default_queue);
m_default_queue->submit(*m_commandBuffer);
m_default_queue->wait();
m_errorMonitor->VerifyFound();
vk::DeviceWaitIdle(*m_device);
}
Loading

0 comments on commit 62c65a6

Please sign in to comment.