Skip to content

Commit

Permalink
Fix block index counter when capturing trimmed
Browse files Browse the repository at this point in the history
  • Loading branch information
panos-lunarg committed May 3, 2024
1 parent 0d2f829 commit 1a174b8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 1 addition & 2 deletions framework/encode/capture_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ uint32_t CaptureManager::instanc
std::mutex CaptureManager::instance_lock_;
thread_local std::unique_ptr<CaptureManager::ThreadData> CaptureManager::thread_data_;
CaptureManager::ApiCallMutexT CaptureManager::api_call_mutex_;
std::atomic<uint64_t> CaptureManager::block_index_ = 0;
std::function<void()> CaptureManager::delete_instance_func_ = nullptr;

std::atomic<format::HandleId> CaptureManager::unique_id_counter_{ format::kNullHandleId };
Expand Down Expand Up @@ -99,7 +98,7 @@ CaptureManager::CaptureManager(format::ApiFamilyId api_family) :
previous_runtime_trigger_state_(CaptureSettings::RuntimeTriggerState::kNotUsed), debug_layer_(false),
debug_device_lost_(false), screenshot_prefix_(""), screenshots_enabled_(false), disable_dxr_(false),
accel_struct_padding_(0), iunknown_wrapping_(false), force_command_serialization_(false), queue_zero_only_(false),
allow_pipeline_compile_required_(false), quit_after_frame_ranges_(false)
allow_pipeline_compile_required_(false), quit_after_frame_ranges_(false), block_index_(0)
{}

CaptureManager::~CaptureManager()
Expand Down
2 changes: 1 addition & 1 deletion framework/encode/capture_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class CaptureManager
util::Keyboard keyboard_;
std::string screenshot_prefix_;
util::ScreenshotFormat screenshot_format_;
static std::atomic<uint64_t> block_index_;
std::atomic<uint64_t> block_index_;

void WriteToFile(const void* data, size_t size);

Expand Down
7 changes: 6 additions & 1 deletion framework/encode/vulkan_state_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ uint64_t VulkanStateWriter::WriteState(const VulkanStateTable& state_table, uint
marker.frame_number = frame_number;
output_stream_->Write(&marker, sizeof(marker));

// For the Begin Marker meta command
++blocks_written_;

// Instance, device, and queue creation.
StandardCreateWrite<vulkan_wrappers::InstanceWrapper>(state_table);
WritePhysicalDeviceState(state_table);
Expand Down Expand Up @@ -180,6 +183,9 @@ uint64_t VulkanStateWriter::WriteState(const VulkanStateTable& state_table, uint
marker.marker_type = format::kEndMarker;
output_stream_->Write(&marker, sizeof(marker));

// For the EndMarker meta command
++blocks_written_;

return blocks_written_;
// clang-format on
}
Expand Down Expand Up @@ -1887,7 +1893,6 @@ void VulkanStateWriter::WriteMappedMemoryState(const VulkanStateTable& state_tab

WriteFunctionCall(format::ApiCallId::ApiCall_vkMapMemory, &parameter_stream_);
parameter_stream_.Clear();
++blocks_written_;
}
});
}
Expand Down

0 comments on commit 1a174b8

Please sign in to comment.