|
18 | 18 | #include <vulkan/utility/vk_format_utils.h> |
19 | 19 | #include "sync/sync_command_buffer.h" |
20 | 20 | #include "error_message/error_location.h" |
21 | | -#include "sync/sync_image.h" |
22 | 21 | #include "sync/sync_replay.h" |
23 | 22 | #include "sync/sync_reporting.h" |
24 | 23 | #include "sync/sync_validation.h" |
@@ -227,13 +226,6 @@ static SyncAccessIndex GetSyncStageAccessIndexsByDescriptorSet(VkDescriptorType |
227 | 226 | } |
228 | 227 | } |
229 | 228 |
|
230 | | -static void UpdateImageAccessState(AccessContext& access_context, const vvl::Image& image, SyncAccessIndex current_usage, |
231 | | - const VkImageSubresourceRange& subresource_range, const ResourceUsageTag& tag) { |
232 | | - const auto& sub_state = SubState(image); |
233 | | - ImageRangeGen range_gen = sub_state.MakeImageRangeGen(subresource_range, false); |
234 | | - access_context.UpdateAccessState(range_gen, current_usage, ResourceUsageTagEx{tag}); |
235 | | -} |
236 | | - |
237 | 229 | SyncEnvironment::SyncEnvironment(const SyncValidator& validator, VkQueueFlags queue_flags, QueueId queue_id, |
238 | 230 | VulkanTypedHandle handle, SyncEventsContext& events_context, |
239 | 231 | const ResourceUsageInfoProvider& usage_info_provider) |
@@ -857,6 +849,10 @@ void CommandBufferContext::RecordExecutedCommandBuffer(const CommandBufferContex |
857 | 849 | import_common(command_data.image_resolve_commands[index], command_data, tag, entry.tag_count); |
858 | 850 | continue; |
859 | 851 | } |
| 852 | + case CommandType::kImageClear: { |
| 853 | + import_common(command_data.image_clear_commands[index], command_data, tag, entry.tag_count); |
| 854 | + continue; |
| 855 | + } |
860 | 856 | case CommandType::kPipelineBarrier: { |
861 | 857 | import_common(command_data.barrier_commands[index], command_data, tag, entry.tag_count); |
862 | 858 | continue; |
@@ -1425,32 +1421,31 @@ void CommandBufferSubState::RecordResolveImage2(vvl::Image& src_image_state, vvl |
1425 | 1421 | } |
1426 | 1422 | } |
1427 | 1423 |
|
1428 | | -void CommandBufferSubState::RecordClearColorImage(vvl::Image& image_state, VkImageLayout, const VkClearColorValue*, |
1429 | | - uint32_t range_count, const VkImageSubresourceRange* ranges, |
1430 | | - const Location& loc) { |
| 1424 | +static void RecordImageClear(CommandBufferContext& cb_context, vvl::Image& image, vvl::span<const VkImageSubresourceRange> ranges, |
| 1425 | + const Location& loc) { |
1431 | 1426 | const auto tag = cb_context.NextCommandTag(loc.function); |
1432 | | - AccessContext& context = cb_context.GetCbAccessContext(); |
1433 | | - |
1434 | | - cb_context.AddCommandHandle(tag, image_state.Handle()); |
| 1427 | + const auto tag_ex = cb_context.AddCommandHandle(tag, image.Handle()); |
| 1428 | + const ImageClearCommand command{image, ranges, tag_ex.handle_index}; |
1435 | 1429 |
|
1436 | | - for (uint32_t index = 0; index < range_count; index++) { |
1437 | | - const auto& range = ranges[index]; |
1438 | | - UpdateImageAccessState(context, image_state, SYNC_CLEAR_TRANSFER_WRITE, range, tag); |
| 1430 | + const auto& settings = cb_context.GetSyncState().syncval_settings; |
| 1431 | + if (settings.IsRecordTimeValidationEnabled()) { |
| 1432 | + command.Apply(cb_context.GetSyncEnvironment(), tag, cb_context.GetCbAccessContext()); |
1439 | 1433 | } |
| 1434 | + if (settings.full_validation) { |
| 1435 | + cb_context.StoreCommand(tag, command); |
| 1436 | + } |
| 1437 | +} |
| 1438 | + |
| 1439 | +void CommandBufferSubState::RecordClearColorImage(vvl::Image& image_state, VkImageLayout, const VkClearColorValue*, |
| 1440 | + uint32_t range_count, const VkImageSubresourceRange* ranges, |
| 1441 | + const Location& loc) { |
| 1442 | + RecordImageClear(cb_context, image_state, {ranges, range_count}, loc); |
1440 | 1443 | } |
1441 | 1444 |
|
1442 | 1445 | void CommandBufferSubState::RecordClearDepthStencilImage(vvl::Image& image_state, VkImageLayout, const VkClearDepthStencilValue*, |
1443 | 1446 | uint32_t range_count, const VkImageSubresourceRange* ranges, |
1444 | 1447 | const Location& loc) { |
1445 | | - const auto tag = cb_context.NextCommandTag(loc.function); |
1446 | | - AccessContext& context = cb_context.GetCbAccessContext(); |
1447 | | - |
1448 | | - cb_context.AddCommandHandle(tag, image_state.Handle()); |
1449 | | - |
1450 | | - for (uint32_t index = 0; index < range_count; index++) { |
1451 | | - const auto& range = ranges[index]; |
1452 | | - UpdateImageAccessState(context, image_state, SYNC_CLEAR_TRANSFER_WRITE, range, tag); |
1453 | | - } |
| 1448 | + RecordImageClear(cb_context, image_state, {ranges, range_count}, loc); |
1454 | 1449 | } |
1455 | 1450 |
|
1456 | 1451 | void CommandBufferSubState::RecordClearAttachments(uint32_t attachment_count, const VkClearAttachment* pAttachments, |
|
0 commit comments