Skip to content

Commit a8e5aa2

Browse files
authored
Custom Local Capture Save Location Option (#620)
Adds custom local save directory for pm4 captures in addition to gfxr captures. Manual Testing: Linux: Open capture window, perform gfxr capture, perform pm4 capture. Ensure if local save dir is not entered, capture file is saved to "dive_capture_file" <img width="457" height="364" alt="Screenshot 2025-12-01 at 6 19 33 PM" src="https://github.com/user-attachments/assets/701a8bc0-cbc4-41de-8fd8-a960f83dd555" />
1 parent ecb20c4 commit a8e5aa2

File tree

4 files changed

+28
-21
lines changed

4 files changed

+28
-21
lines changed

capture_service/constants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ inline constexpr char kUnixAbstractPath[] = "dive_abstract";
4141
inline constexpr char kEnableReplayPm4DumpPropertyName[] = "debug.dive.replay.capture_pm4";
4242
inline constexpr char
4343
kReplayPm4DumpFileNamePropertyName[] = "debug.dive.replay.capture_pm4_file_name";
44-
inline constexpr char kDefaultCaptureFolderName[] = "gfxr_capture";
44+
inline constexpr char kDefaultCaptureFolderName[] = "dive_capture_folder";
4545
inline constexpr char kDefaultReplayFolderName[] = "gfxr_replay_downloads";
4646
inline constexpr char kProfilingPluginFolderName[] = "dive_profiling_plugin";
4747
inline constexpr char kProfilingPluginName[] = "dive_drawcall_metrics";

ui/capture_worker.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,8 @@ void CaptureWorker::run()
108108
emit ErrorMessage(QString::fromStdString(err_msg));
109109
return;
110110
}
111-
std::string download_path = ".";
112111
std::filesystem::path p(*capture_file_path);
113-
std::filesystem::path target_download_path(download_path);
112+
std::filesystem::path target_download_path(m_target_capture_dir);
114113
target_download_path /= p.filename();
115114
qDebug() << "Begin to download the capture file to "
116115
<< target_download_path.generic_string().c_str();

ui/trace_window.cpp

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ TraceDialog::TraceDialog(ApplicationController &controller, QWidget *parent) :
8282
m_app_type_label = new QLabel(tr("Application Type:"));
8383
m_gfxr_capture_file_on_device_directory_label = new QLabel(
8484
tr("On Device GFXR Capture File Directory Name:"));
85-
m_gfxr_capture_file_local_directory_label = new QLabel(tr("Local GFXR Capture Save Location:"));
85+
QLabel *capture_file_local_directory_label = new QLabel(tr("Local Capture Save Location:"));
8686

8787
m_dev_model = new QStandardItemModel();
8888
m_pkg_model = new QStandardItemModel();
@@ -209,16 +209,12 @@ TraceDialog::TraceDialog(ApplicationController &controller, QWidget *parent) :
209209
m_gfxr_capture_file_on_device_directory_label->hide();
210210
m_gfxr_capture_file_directory_input_box->hide();
211211

212-
m_gfxr_capture_file_local_directory_layout = new QHBoxLayout();
213-
m_gfxr_capture_file_local_directory_input_box = new QLineEdit();
214-
m_gfxr_capture_file_local_directory_input_box->setPlaceholderText(
212+
QHBoxLayout *capture_file_local_directory_layout = new QHBoxLayout();
213+
m_capture_file_local_directory_input_box = new QLineEdit();
214+
m_capture_file_local_directory_input_box->setPlaceholderText(
215215
"Input the location to save the directory to");
216-
m_gfxr_capture_file_local_directory_layout->addWidget(
217-
m_gfxr_capture_file_local_directory_label);
218-
m_gfxr_capture_file_local_directory_layout->addWidget(
219-
m_gfxr_capture_file_local_directory_input_box);
220-
m_gfxr_capture_file_local_directory_label->hide();
221-
m_gfxr_capture_file_local_directory_input_box->hide();
216+
capture_file_local_directory_layout->addWidget(capture_file_local_directory_label);
217+
capture_file_local_directory_layout->addWidget(m_capture_file_local_directory_input_box);
222218

223219
m_button_layout->addWidget(m_run_button);
224220
m_button_layout->addWidget(m_capture_button);
@@ -231,7 +227,7 @@ TraceDialog::TraceDialog(ApplicationController &controller, QWidget *parent) :
231227
m_main_layout->addLayout(m_capture_warning_layout);
232228
m_main_layout->addLayout(m_pkg_layout);
233229
m_main_layout->addLayout(m_gfxr_capture_file_directory_layout);
234-
m_main_layout->addLayout(m_gfxr_capture_file_local_directory_layout);
230+
m_main_layout->addLayout(capture_file_local_directory_layout);
235231
m_main_layout->addLayout(m_args_layout);
236232

237233
m_main_layout->addLayout(m_type_layout);
@@ -714,6 +710,20 @@ void TraceDialog::OnTraceClicked()
714710
progress_bar->setAutoClose(true);
715711
progress_bar->setMinimumDuration(0);
716712
CaptureWorker *workerThread = new CaptureWorker(progress_bar);
713+
714+
if (m_capture_file_local_directory_input_box->text() == "")
715+
{
716+
#if defined(__APPLE__)
717+
m_capture_file_local_directory_input_box->setText(
718+
QDir::homePath() + "/" + QString::fromUtf8(Dive::kDefaultCaptureFolderName));
719+
#else
720+
m_capture_file_local_directory_input_box->setText(
721+
"./" + QString::fromUtf8(Dive::kDefaultCaptureFolderName));
722+
#endif
723+
}
724+
725+
workerThread->SetTargetCaptureDir(
726+
m_capture_file_local_directory_input_box->text().toStdString());
717727
connect(workerThread, &CaptureWorker::CaptureAvailable, this, &TraceDialog::OnTraceAvailable);
718728
connect(workerThread, &CaptureWorker::finished, workerThread, &QObject::deleteLater);
719729
connect(workerThread, &CaptureWorker::ErrorMessage, this, &TraceDialog::ShowErrorMessage);
@@ -903,13 +913,13 @@ void TraceDialog::RetrieveGfxrCapture()
903913
return;
904914
}
905915

906-
if (m_gfxr_capture_file_local_directory_input_box->text() == "")
916+
if (m_capture_file_local_directory_input_box->text() == "")
907917
{
908918
#if defined(__APPLE__)
909-
m_gfxr_capture_file_local_directory_input_box->setText(
919+
m_capture_file_local_directory_input_box->setText(
910920
QDir::homePath() + "/" + QString::fromUtf8(Dive::kDefaultCaptureFolderName));
911921
#else
912-
m_gfxr_capture_file_local_directory_input_box->setText(
922+
m_capture_file_local_directory_input_box->setText(
913923
"./" + QString::fromUtf8(Dive::kDefaultCaptureFolderName));
914924
#endif
915925
}
@@ -935,7 +945,7 @@ void TraceDialog::RetrieveGfxrCapture()
935945
workerThread->SetGfxrSourceCaptureDir(on_device_capture_file_directory);
936946

937947
workerThread->SetTargetCaptureDir(
938-
m_gfxr_capture_file_local_directory_input_box->text().toStdString());
948+
m_capture_file_local_directory_input_box->text().toStdString());
939949

940950
connect(workerThread,
941951
&GfxrCaptureWorker::CaptureAvailable,

ui/trace_window.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,7 @@ private slots:
162162
QLabel *m_gfxr_capture_file_on_device_directory_label;
163163
QLineEdit *m_gfxr_capture_file_directory_input_box;
164164

165-
QHBoxLayout *m_gfxr_capture_file_local_directory_layout;
166-
QLabel *m_gfxr_capture_file_local_directory_label;
167-
QLineEdit *m_gfxr_capture_file_local_directory_input_box;
165+
QLineEdit *m_capture_file_local_directory_input_box;
168166

169167
QVBoxLayout *m_main_layout;
170168
std::vector<Dive::DeviceInfo> m_devices;

0 commit comments

Comments
 (0)