@@ -93,8 +93,8 @@ CaptureManager::CaptureManager(format::ApiFamilyId api_family) :
9393 page_guard_memory_mode_(kMemoryModeShadowInternal ), trim_enabled_(false ), trim_current_range_(0 ),
9494 current_frame_(kFirstFrame ), capture_mode_(kModeWrite ), previous_hotkey_state_(false ),
9595 previous_runtime_trigger_state_(CaptureSettings::RuntimeTriggerState::kNotUsed ), debug_layer_(false ),
96- debug_device_lost_(false ), screenshot_prefix_(" " ), screenshots_enabled_(false ), global_frame_count_( 0 ),
97- disable_dxr_( false ), accel_struct_padding_(0 ), iunknown_wrapping_(false ), force_command_serialization_(false )
96+ debug_device_lost_(false ), screenshot_prefix_(" " ), screenshots_enabled_(false ), disable_dxr_( false ),
97+ accel_struct_padding_(0 ), iunknown_wrapping_(false ), force_command_serialization_(false )
9898{}
9999
100100CaptureManager::~CaptureManager ()
@@ -662,7 +662,7 @@ bool CaptureManager::ShouldTriggerScreenshot()
662662 uint32_t target_frame = screenshot_indices_.back ();
663663
664664 // If this is a frame of interest, take a screenshot
665- if (target_frame == (global_frame_count_ + 1 ) )
665+ if (target_frame == current_frame_ )
666666 {
667667 triger_screenshot = true ;
668668
@@ -680,12 +680,27 @@ bool CaptureManager::ShouldTriggerScreenshot()
680680 return triger_screenshot;
681681}
682682
683+ void CaptureManager::WriteFrameMarker (format::MarkerType marker_type)
684+ {
685+ if ((capture_mode_ & kModeWrite ) == kModeWrite )
686+ {
687+ format::Marker marker_cmd;
688+ uint64_t header_size = sizeof (format::Marker);
689+ marker_cmd.header .type = format::BlockType::kFrameMarkerBlock ;
690+ marker_cmd.header .size = header_size;
691+ marker_cmd.marker_type = marker_type;
692+ marker_cmd.frame_number = current_frame_;
693+ current_frame_;
694+ WriteToFile (&marker_cmd, header_size);
695+ }
696+ }
697+
683698void CaptureManager::EndFrame ()
684699{
700+ ++current_frame_;
701+
685702 if (trim_enabled_)
686703 {
687- ++current_frame_;
688-
689704 if ((capture_mode_ & kModeWrite ) == kModeWrite )
690705 {
691706 // Currently capturing a frame range.
@@ -700,8 +715,6 @@ void CaptureManager::EndFrame()
700715 }
701716 }
702717
703- global_frame_count_++;
704-
705718 // Flush after presents to help avoid capture files with incomplete final blocks.
706719 if (file_stream_.get () != nullptr )
707720 {
0 commit comments