Skip to content

Commit

Permalink
sync: Wip
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-lunarg committed Jan 29, 2025
1 parent 0d99e5a commit 15c513f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
5 changes: 2 additions & 3 deletions layers/sync/sync_commandbuffer.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2019-2024 Valve Corporation
* Copyright (c) 2019-2024 LunarG, Inc.
* Copyright (c) 2019-2025 Valve Corporation
* Copyright (c) 2019-2025 LunarG, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -214,7 +214,6 @@ class CommandExecutionContext {
virtual void AddUsageRecordExtraProperties(ResourceUsageTag tag, ReportKeyValues &extra_properties) const = 0;

std::string FormatHazard(const HazardResult &hazard, ReportKeyValues &key_values) const;
std::string FormatHazard(const HazardResult &hazard) const;
bool ValidForSyncOps() const;
const SyncValidator &GetSyncState() const { return sync_state_; }

Expand Down
5 changes: 0 additions & 5 deletions layers/sync/sync_reporting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,6 @@ std::string CommandExecutionContext::FormatHazard(const HazardResult &hazard, Re
return out.str();
}

std::string CommandExecutionContext::FormatHazard(const HazardResult &hazard) const {
ReportKeyValues key_values;
return FormatHazard(hazard, key_values);
}

std::string CommandBufferAccessContext::FormatUsage(ResourceUsageTagEx tag_ex) const {
if (tag_ex.tag >= access_log_->size()) return std::string();

Expand Down
30 changes: 30 additions & 0 deletions tests/unit/sync_val.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,36 @@ TEST_F(NegativeSyncVal, BufferCopy) {
m_command_buffer.End();
}

TEST_F(NegativeSyncVal, BufferCopyWrongBarrier) {
TEST_DESCRIPTION("Buffer barrier does not specify proper dst stage/access");
SetTargetApiVersion(VK_API_VERSION_1_3);
AddRequiredFeature(vkt::Feature::synchronization2);
RETURN_IF_SKIP(InitSyncVal());

vkt::Buffer buffer_a(*m_device, 256, VK_BUFFER_USAGE_TRANSFER_SRC_BIT);
vkt::Buffer buffer_b(*m_device, 256, VK_BUFFER_USAGE_TRANSFER_DST_BIT);

VkBufferMemoryBarrier2 barrier = vku::InitStructHelper();
barrier.srcStageMask = VK_PIPELINE_STAGE_2_TRANSFER_BIT;
barrier.srcAccessMask = VK_ACCESS_2_TRANSFER_WRITE_BIT;
barrier.dstStageMask = VK_PIPELINE_STAGE_2_CLEAR_BIT;
barrier.dstAccessMask = VK_ACCESS_2_TRANSFER_WRITE_BIT;
barrier.buffer = buffer_b;
barrier.size = 256;

VkDependencyInfo dep_info = vku::InitStructHelper();
dep_info.bufferMemoryBarrierCount = 1;
dep_info.pBufferMemoryBarriers = &barrier;

m_command_buffer.Begin();
m_command_buffer.Copy(buffer_a, buffer_b);
vk::CmdPipelineBarrier2(m_command_buffer, &dep_info);
m_errorMonitor->SetDesiredError("SYNC-HAZARD-WRITE-AFTER-WRITE");
m_command_buffer.Copy(buffer_a, buffer_b);
m_errorMonitor->VerifyFound();
m_command_buffer.End();
}

TEST_F(NegativeSyncVal, BufferCopySecondary) {
TEST_DESCRIPTION("Record buffer copy commands in secondary command buffers");
RETURN_IF_SKIP(InitSyncVal());
Expand Down

0 comments on commit 15c513f

Please sign in to comment.