File: PersistantConfig.h

package info (click to toggle)
renderdoc 1.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 79,584 kB
  • sloc: cpp: 491,671; ansic: 285,823; python: 12,617; java: 11,345; cs: 7,181; makefile: 6,703; yacc: 5,682; ruby: 4,648; perl: 3,461; php: 2,119; sh: 2,068; lisp: 1,835; tcl: 1,068; ml: 747; xml: 137
file content (819 lines) | stat: -rw-r--r-- 32,637 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
/******************************************************************************
 * The MIT License (MIT)
 *
 * Copyright (c) 2016-2018 Baldur Karlsson
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 ******************************************************************************/

#pragma once

// do not include any headers here, they must all be in QRDInterface.h
#include "QRDInterface.h"
#include "RemoteHost.h"

DOCUMENT(R"(Identifies a particular known tool used for shader processing.

.. data:: Unknown

  Corresponds to no known tool.

.. data:: SPIRV_Cross

  `SPIRV-Cross <https://github.com/KhronosGroup/SPIRV-Cross>`_.

.. data:: spirv_dis

  `spirv-dis from SPIRV-Tools <https://github.com/KhronosGroup/SPIRV-Tools>`_.

.. data:: glslangValidatorGLSL

  `glslang compiler (GLSL) <https://github.com/KhronosGroup/glslang>`_.

.. data:: glslangValidatorHLSL

  `glslang compiler (HLSL) <https://github.com/KhronosGroup/glslang>`_.

.. data:: spirv_as

  `spirv-as from SPIRV-Tools <https://github.com/KhronosGroup/SPIRV-Tools>`_.

)");
enum class KnownShaderTool : uint32_t
{
  Unknown,
  First = Unknown,
  SPIRV_Cross,
  spirv_dis,
  glslangValidatorGLSL,
  glslangValidatorHLSL,
  spirv_as,
  Count,
};

ITERABLE_OPERATORS(KnownShaderTool);

inline rdcstr ToolExecutable(KnownShaderTool tool)
{
  if(tool == KnownShaderTool::SPIRV_Cross)
    return "spirv-cross";
  else if(tool == KnownShaderTool::spirv_dis)
    return "spirv-dis";
  else if(tool == KnownShaderTool::glslangValidatorGLSL)
    return "glslangValidator";
  else if(tool == KnownShaderTool::glslangValidatorHLSL)
    return "glslangValidator";
  else if(tool == KnownShaderTool::spirv_as)
    return "spirv-as";

  return "";
}

inline ShaderEncoding ToolInput(KnownShaderTool tool)
{
  if(tool == KnownShaderTool::SPIRV_Cross || tool == KnownShaderTool::spirv_dis)
    return ShaderEncoding::SPIRV;
  else if(tool == KnownShaderTool::glslangValidatorGLSL)
    return ShaderEncoding::GLSL;
  else if(tool == KnownShaderTool::glslangValidatorHLSL)
    return ShaderEncoding::HLSL;
  else if(tool == KnownShaderTool::spirv_as)
    return ShaderEncoding::SPIRVAsm;

  return ShaderEncoding::Unknown;
}

inline ShaderEncoding ToolOutput(KnownShaderTool tool)
{
  if(tool == KnownShaderTool::SPIRV_Cross)
    return ShaderEncoding::GLSL;
  else if(tool == KnownShaderTool::spirv_dis)
    return ShaderEncoding::SPIRVAsm;
  else if(tool == KnownShaderTool::glslangValidatorGLSL ||
          tool == KnownShaderTool::glslangValidatorHLSL || tool == KnownShaderTool::spirv_as)
    return ShaderEncoding::SPIRV;

  return ShaderEncoding::Unknown;
}

DOCUMENT(R"(Contains the output from invoking a :class:`ShaderProcessingTool`, including both the
actual output data desired as well as any stdout/stderr messages.
)");
struct ShaderToolOutput
{
  DOCUMENT("The output log - containing the information about the tool run and any errors.");
  rdcstr log;

  DOCUMENT("The actual output data from the tool");
  bytebuf result;
};

DOCUMENT(R"(Describes an external program that can be used to process shaders, typically either
compiling from a high-level language to a binary format, or decompiling from the binary format to
a high-level language or textual representation.

Commonly used with SPIR-V.
)");
struct ShaderProcessingTool
{
  DOCUMENT("");
  ShaderProcessingTool() = default;
  VARIANT_CAST(ShaderProcessingTool);
  bool operator==(const ShaderProcessingTool &o) const
  {
    return tool == o.tool && name == o.name && executable == o.executable && args == o.args &&
           input == o.input && output == o.output;
  }
  bool operator<(const ShaderProcessingTool &o) const
  {
    if(tool != o.tool)
      return tool < o.tool;
    if(name != o.name)
      return name < o.name;
    if(executable != o.executable)
      return executable < o.executable;
    if(args != o.args)
      return args < o.args;
    if(input != o.input)
      return input < o.input;
    if(output != o.output)
      return output < o.output;
    return false;
  }
  DOCUMENT("The :class:`KnownShaderTool` identifying which known tool this program is.");
  KnownShaderTool tool = KnownShaderTool::Unknown;
  DOCUMENT("The human-readable name of the program.");
  rdcstr name;
  DOCUMENT("The path to the executable to run for this program.");
  rdcstr executable;
  DOCUMENT("The command line argmuents to pass to the program.");
  rdcstr args;
  DOCUMENT("The input that this program expects.");
  ShaderEncoding input = ShaderEncoding::Unknown;
  DOCUMENT("The output that this program provides.");
  ShaderEncoding output = ShaderEncoding::Unknown;

  DOCUMENT(R"(Return the default arguments used when invoking this tool

:return: The arguments specified for this tool.
:rtype: ``str``
)");
  rdcstr DefaultArguments() const;

  DOCUMENT(R"(Runs this program to disassemble a given shader reflection.

:param QWidget window: A handle to the window to use when showing a progress bar or error messages.
:param ~renderdoc.ShaderReflection shader: The shader to disassemble.
:param str args: arguments to pass to the tool. The default arguments can be obtained using
  :meth:`DefaultArguments` which can then be customised as desired. Passing an empty string uses the
  default arguments.
:return: The result of running the tool.
:rtype: ShaderToolOutput
)");
  ShaderToolOutput DisassembleShader(QWidget *window, const ShaderReflection *reflection,
                                     rdcstr args) const;

  DOCUMENT(R"(Runs this program to disassemble a given shader source.

:param QWidget window: A handle to the window to use when showing a progress bar or error messages.
:param str source: The source code, preprocessed into a single file.
:param str entryPoint: The name of the entry point in the shader to compile.
:param ~renderdoc.ShaderStage stage: The pipeline stage that this shader represents.
:param str args: arguments to pass to the tool. The default arguments can be obtained using
  :meth:`DefaultArguments` which can then be customised as desired. Passing an empty string uses the
  default arguments.
:return: The result of running the tool.
:rtype: ShaderToolOutput
)");
  ShaderToolOutput CompileShader(QWidget *window, rdcstr source, rdcstr entryPoint,
                                 ShaderStage stage, rdcstr args) const;
};

DECLARE_REFLECTION_STRUCT(ShaderProcessingTool);

#define BUGREPORT_URL "https://renderdoc.org/bugreporter"

DOCUMENT("Describes a submitted bug report.");
struct BugReport
{
  DOCUMENT("");
  BugReport() { unreadUpdates = false; }
  VARIANT_CAST(BugReport);
  bool operator==(const BugReport &o) const
  {
    return reportId == o.reportId && submitDate == o.submitDate && checkDate == o.checkDate &&
           unreadUpdates == o.unreadUpdates;
  }
  bool operator<(const BugReport &o) const
  {
    if(reportId != o.reportId)
      return reportId < o.reportId;
    if(submitDate != o.submitDate)
      return submitDate < o.submitDate;
    if(checkDate != o.checkDate)
      return checkDate < o.checkDate;
    if(unreadUpdates != o.unreadUpdates)
      return unreadUpdates < o.unreadUpdates;
    return false;
  }
  DOCUMENT("The private ID of the bug report.");
  rdcstr reportId;
  DOCUMENT("The original date when this bug was submitted.");
  rdcdatetime submitDate;
  DOCUMENT("The last date that we checked for updates.");
  rdcdatetime checkDate;
  DOCUMENT("Unread updates to the bug exist");
  bool unreadUpdates = false;

  DOCUMENT(R"(Gets the URL for this report.

:return: The URL to the report.
:rtype: ``str``
)");
  rdcstr URL() const;
};

DECLARE_REFLECTION_STRUCT(BugReport);

#define CONFIG_SETTING_VAL(access, variantType, type, name, defaultValue) \
  access:                                                                 \
  type name = defaultValue;
#define CONFIG_SETTING(access, variantType, type, name) \
  access:                                               \
  type name;

// Since this macro is already complex enough, the documentation for each of these members is
// in the docstring for PersistantConfig as :data: members.
// Please keep that docstring up to date when you add/remove/change these config settings.
// Note that only public properties should be documented.
#define CONFIG_SETTINGS()                                                                  \
                                                                                           \
  CONFIG_SETTING_VAL(public, QString, rdcstr, UIStyle, "")                                 \
                                                                                           \
  CONFIG_SETTING_VAL(public, QString, rdcstr, LastCaptureFilePath, "")                     \
                                                                                           \
  CONFIG_SETTING_VAL(public, QString, rdcstr, LastFileBrowsePath, "")                      \
                                                                                           \
  CONFIG_SETTING(public, QVariantList, rdcarray<rdcstr>, RecentCaptureFiles)               \
                                                                                           \
  CONFIG_SETTING_VAL(public, QString, rdcstr, LastCapturePath, "")                         \
                                                                                           \
  CONFIG_SETTING(public, QVariantList, rdcarray<rdcstr>, RecentCaptureSettings)            \
                                                                                           \
  CONFIG_SETTING_VAL(public, QString, rdcstr, TemporaryCaptureDirectory, "")               \
                                                                                           \
  CONFIG_SETTING_VAL(public, QString, rdcstr, DefaultCaptureSaveDirectory, "")             \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, TextureViewer_ResetRange, false)                  \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, TextureViewer_PerTexSettings, true)               \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, ShaderViewer_FriendlyNaming, true)                \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, AlwaysReplayLocally, false)                       \
                                                                                           \
  CONFIG_SETTING_VAL(public, int, int, LocalProxyAPI, -1)                                  \
                                                                                           \
  CONFIG_SETTING_VAL(public, int, TimeUnit, EventBrowser_TimeUnit, TimeUnit::Microseconds) \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, EventBrowser_AddFake, true)                       \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, EventBrowser_HideEmpty, false)                    \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, EventBrowser_HideAPICalls, false)                 \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, EventBrowser_ApplyColors, true)                   \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, EventBrowser_ColorEventRow, true)                 \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, Comments_ShowOnLoad, true)                        \
                                                                                           \
  CONFIG_SETTING_VAL(public, int, int, Formatter_MinFigures, 2)                            \
                                                                                           \
  CONFIG_SETTING_VAL(public, int, int, Formatter_MaxFigures, 5)                            \
                                                                                           \
  CONFIG_SETTING_VAL(public, int, int, Formatter_NegExp, 5)                                \
                                                                                           \
  CONFIG_SETTING_VAL(public, int, int, Formatter_PosExp, 7)                                \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, Font_PreferMonospaced, false)                     \
                                                                                           \
  CONFIG_SETTING_VAL(public, QString, rdcstr, Android_SDKPath, "")                         \
                                                                                           \
  CONFIG_SETTING_VAL(public, QString, rdcstr, Android_JDKPath, "")                         \
                                                                                           \
  CONFIG_SETTING_VAL(public, int, int, Android_MaxConnectTimeout, 30)                      \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, CheckUpdate_AllowChecks, true)                    \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, CheckUpdate_UpdateAvailable, false)               \
                                                                                           \
  CONFIG_SETTING_VAL(public, QString, rdcstr, CheckUpdate_UpdateResponse, "")              \
                                                                                           \
  CONFIG_SETTING_VAL(public, QDateTime, rdcdatetime, CheckUpdate_LastUpdate,               \
                     rdcdatetime(2012, 06, 27))                                            \
                                                                                           \
  CONFIG_SETTING_VAL(public, QDateTime, rdcdatetime, DegradedCapture_LastUpdate,           \
                     rdcdatetime(2015, 01, 01))                                            \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, ExternalTool_RGPIntegration, false)               \
                                                                                           \
  CONFIG_SETTING_VAL(public, QString, rdcstr, ExternalTool_RadeonGPUProfiler, "")          \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, Tips_HasSeenFirst, false)                         \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, AllowGlobalHook, false)                           \
                                                                                           \
  CONFIG_SETTING(public, QVariantList, rdcarray<ShaderProcessingTool>, ShaderProcessors)   \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, Analytics_TotalOptOut, false)                     \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, Analytics_ManualCheck, false)                     \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, CrashReport_EmailNagged, false)                   \
                                                                                           \
  CONFIG_SETTING_VAL(public, bool, bool, CrashReport_ShouldRememberEmail, true)            \
                                                                                           \
  CONFIG_SETTING_VAL(public, QString, rdcstr, CrashReport_EmailAddress, "")                \
                                                                                           \
  CONFIG_SETTING_VAL(public, QString, rdcstr, CrashReport_LastOpenedCapture, "")           \
                                                                                           \
  CONFIG_SETTING(public, QVariantList, rdcarray<BugReport>, CrashReport_ReportedBugs)      \
                                                                                           \
  CONFIG_SETTING(public, QVariantList, rdcarray<rdcstr>, AlwaysLoad_Extensions)            \
                                                                                           \
  CONFIG_SETTING(private, QVariantMap, rdcstrpairs, ConfigSettings)                        \
                                                                                           \
  CONFIG_SETTING(private, QVariantList, rdcarray<RemoteHost>, RemoteHostList)

DOCUMENT(R"(The unit that GPU durations are displayed in.

.. data:: Seconds

  The durations are displayed as seconds (s).

.. data:: Milliseconds

  The durations are displayed as milliseconds (ms).

.. data:: Microseconds

  The durations are displayed as microseconds (µs).

.. data:: Nanoseconds

  The durations are displayed as nanoseconds (ns).
)");
enum class TimeUnit : int
{
  Seconds = 0,
  Milliseconds,
  Microseconds,
  Nanoseconds,
  Count,
};

DOCUMENT(R"(Gets the suffix for a time unit.

:return: The one or two character suffix.
:rtype: ``str``
)");
inline rdcstr UnitSuffix(TimeUnit unit)
{
  if(unit == TimeUnit::Seconds)
    return "s";
  else if(unit == TimeUnit::Milliseconds)
    return "ms";
  else if(unit == TimeUnit::Microseconds)
    // without a BOM in the file, this will break using lit() in MSVC
    return "µs";
  else if(unit == TimeUnit::Nanoseconds)
    return "ns";

  return "s";
}

DOCUMENT(R"(Checks if a given file is in a list. If it is, then it's shuffled to the end. If it's
not then it's added to the end and an item is dropped from the front of the list if necessary to
stay within a given maximum

As the name suggests, this is used for tracking a 'recent file' list.

:param list recentList: A ``list`` of ``str`` that is mutated by the function.
:param str file: The file to add to the list.
:param int maxItems: The maximum allowed length of the list.
)");
void AddRecentFile(rdcarray<rdcstr> &recentList, const rdcstr &file, int maxItems);

DOCUMENT2(R"(A persistant config file that is automatically loaded and saved, which contains any
settings and information that needs to be preserved from one run to the next.

For more information about some of these settings that are user-facing see
:ref:`the documentation for the settings window <settings-window>`.

.. data:: UIStyle

  The style to load for the UI. Possible values include 'Native', 'RDLight', 'RDDark'. If empty,
  the closest of RDLight and RDDark will be chosen, based on the overall light-on-dark or
  dark-on-light theme of the application native style.

.. data:: LastCaptureFilePath

  The path to the last capture to be opened, which is useful as a default location for browsing.

.. data:: LastFileBrowsePath

  The path to the last file browsed to in any dialog. Used as a default location for all file
  browsers without another explicit default directory (such as opening capture files - see
  :data:`LastCaptureFilePath`).

.. data:: RecentCaptureFiles

  A ``list`` of ``str`` with the recently opened capture files.

.. data:: LastCapturePath

  The path containing the last executable that was captured, which is useful as a default location
  for browsing.

.. data:: RecentCaptureSettings

  A ``list`` of ``str`` with the recently opened capture settings files.

.. data:: TemporaryCaptureDirectory

  The path to where temporary capture files should be stored until they're saved permanently.

.. data:: DefaultCaptureSaveDirectory

  The default path to save captures in, when browsing to save a temporary capture somewhere.

.. data:: TextureViewer_ResetRange

  ``True`` if the :class:`TextureViewer` should reset the visible range when a new texture is
  selected.

  Defaults to ``False``.

.. data:: TextureViewer_PerTexSettings

  ``True`` if the :class:`TextureViewer` should store most visualisation settings on a per-texture
  basis instead of keeping it persistent across different textures.

  Defaults to ``True``.

.. data:: ShaderViewer_FriendlyNaming

  ``True`` if the :class:`ShaderViewer` should replace register names with the high-level language
  variable names where possible.

  Defaults to ``True``.

.. data:: AlwaysReplayLocally

  ``True`` if when loading a capture that was originally captured on a remote device but uses an
  API that can be supported locally, should be loaded locally without prompting to switch to a
  remote context.

  Defaults to ``False``.

.. data:: LocalProxyAPI

  The index of the local proxy API to use when using remote context replay. ``-1`` if the default
  proxy should be used.

  Defaults to ``-1``.

.. data:: EventBrowser_TimeUnit

  The :class:`TimeUnit` to use to display the duration column in the :class:`EventBrowser`.

  Defaults to microseconds.

.. data:: EventBrowser_AddFake

  ``True`` if fake drawcall marker regions should be added to captures that don't have any markers,
  for easier browsing. The regions are identified by grouping drawcalls that write to the same
  targets together.

  Defaults to ``True``.

.. data:: EventBrowser_HideEmpty

  ``True`` if the :class:`EventBrowser` should hide marker regions that don't contain any actual
  non-marker events.

  Defaults to ``False``.

.. data:: EventBrowser_HideAPICalls

  ``True`` if the :class:`EventBrowser` should hide marker regions that don't contain any events
  that aren't just drawcalls (this will hide events under "API Events" faux-markers).

  Defaults to ``False``.

.. data:: EventBrowser_ApplyColors

  ``True`` if the :class:`EventBrowser` should apply any colors specified with API marker regions.

  Defaults to ``True``.

.. data:: EventBrowser_ColorEventRow

  ``True`` if when coloring marker regions in the :class:`EventBrowser`, the whole row should be
  colored instead of just a side-bar.

  Defaults to ``True``.
)",
          R"(
.. data:: Comments_ShowOnLoad

  ``True`` if when loading a new capture that contains a comments section, the comment viewer will
  be opened and focussed.

  Defaults to ``False``.

.. data:: Formatter_MinFigures

  The minimum number of significant figures to show in formatted floating point values.

  Defaults to ``2``.

.. data:: Formatter_MaxFigures

  The maximum number of significant figures to show in formatted floating point values.

  Defaults to ``5``.

.. data:: Formatter_NegExp

  The cut-off on negative exponents of a normalised values to display using scientific notation.

  E.g. for a value of 5, anything below 1.0e-5 will be displayed using scientific notation.

  Defaults to ``5``.

.. data:: Formatter_PosExp

  The cut-off on the exponent of a normalised values to display using scientific notation.

  E.g. for a value of 7, anything above 1.0e+7 will be displayed using scientific notation.

  Defaults to ``7``.

.. data:: Font_PreferMonospaced

  ``True`` if a monospaced font should be used in all places where data is displayed, even if the
  data is not tabular such as names.

  Defaults to ``False``.

.. data:: Android_SDKPath

  The path to the root of the android SDK, to locate android tools to use for android remote hosts.

  Defaults to using the tools distributed with RenderDoc.

.. data:: Android_JDKPath

  The path to the root of the Java JDK, to locate java for running android java tools.

  Defaults to using the JAVA_HOME environment variable, if set.

.. data:: Android_MaxConnectTimeout

  The maximum timeout in seconds to wait when launching an Android package.

  Defaults to ``30``.

.. data:: CheckUpdate_AllowChecks

  ``True`` if when coloring marker regions in the :class:`EventBrowser`, the whole row should be
  colored instead of just a side-bar.

  Defaults to ``True``.

.. data:: CheckUpdate_UpdateAvailable

  ``True`` if an update to a newer version is currently available.

  Defaults to ``False``.

.. data:: CheckUpdate_UpdateResponse

  Contains the response from the update server from the last update check, with any release notes
  for the new version.

.. data:: CheckUpdate_LastUpdate

  A date containing the last time that update checks happened.

.. data:: DegradedCapture_LastUpdate

  A date containing the last time that the user was warned about captures being loaded in degraded
  support. This prevents the user being spammed if their hardware is low spec.

.. data:: ExternalTool_RGPIntegration

  Whether to enable integration with the external Radeon GPU Profiler tool.

.. data:: ExternalTool_RadeonGPUProfiler

  The path to the executable of the external Radeon GPU Profiler tool.

.. data:: Tips_HasSeenFirst

  ``True`` if the user has seen the first tip, which should always be shown first before
  randomising.

  Defaults to ``False``.

.. data:: AllowGlobalHook

  ``True`` if global hooking is enabled. Since it has potentially problematic side-effects and is
  dangerous, it requires explicit opt-in.

  Defaults to ``False``.

.. data:: ShaderProcessors

  A list of :class:`ShaderProcessingTool` detailing shader processing programs. The list comes in
  priority order, with earlier processors preferred over later ones.

.. data:: Analytics_TotalOptOut

  ``True`` if the user has selected to completely opt-out from and disable all analytics collection
  and reporting.

  Defaults to ``False``.

.. data:: Analytics_ManualCheck

  ``True`` if the user has remained with analytics turned on, but has chosen to manually check each
  report that is sent out.

  Defaults to ``False``.

.. data:: CrashReport_EmailNagged

  ``True`` if the user has been prompted to enter their email address on a crash report. This really
  helps find fixes for bugs, so we prompt the user once only if they didn't enter an email. Once the
  prompt has happened, regardless of the answer this is set to true and remains there forever.

  Defaults to ``False``.

.. data:: CrashReport_ShouldRememberEmail

  ``True`` if the email address entered in the crash reporter should be remembered for next time. If
  no email is entered then nothing happens (any previous saved email is kept).

  Defaults to ``True``.

.. data:: CrashReport_EmailAddress

  The saved email address for pre-filling out in crash reports.

.. data:: CrashReport_LastOpenedCapture

  The last opened capture, to send if any crash is encountered. This is different to the most recent
  opened file, because it's set before any processing happens (recent files are only added to the
  list when they successfully open), and it's cleared again when the capture is closed.

.. data:: CrashReport_ReportedBugs

  A list of :class:`BugReport` detailing previously submitted bugs that we're watching for updates.

.. data:: AlwaysLoad_Extensions

  A list of strings with extension packages to always load on startup, without needing manual
  enabling.


)");
class PersistantConfig
{
public:
// don't allow SWIG direct access to the RemoteHosts since they're an array of references and our
// bindings can't handle that properly
#if !defined(SWIG)
  // Runtime list of dynamically allocated hosts.
  // Saved to/from private RemoteHostList in CONFIG_SETTINGS()
  // This is documented above in the docstring, similar to the values in CONFIG_SETTINGS()
  // This must only be accessed on the UI thread to prevent races. For access on other threads (e.g.
  // a background/asynchronous update), take a copy on the UI thread, update it in the background,
  // then apply the updates.
  DOCUMENT("");
  rdcarray<RemoteHost *> RemoteHosts;
#endif

  DOCUMENT(R"(Returns the number of remote hosts currently registered.

:return: The number of remote hosts.
:rtype: ``int``
)");
  int RemoteHostCount();
  DOCUMENT(R"(Returns a given remote host at an index.

:param int index: The index of the remote host to retrieve
:return: The remote host specified, or ``None`` if an invalid index was passed
:rtype: ``RemoteHost``
)");
  RemoteHost *GetRemoteHost(int index);

  DOCUMENT(R"(Adds a new remote host.

:param RemoteHost host: The remote host to add.
R)");
  void AddRemoteHost(RemoteHost host);
  DOCUMENT("If configured, queries ``adb`` to add android hosts to :data:`RemoteHosts`.");
  void AddAndroidHosts();

  DOCUMENT("");
  CONFIG_SETTINGS()
public:
  PersistantConfig() {}
  ~PersistantConfig();

  DOCUMENT(R"(Loads the config from a given filename. This happens automatically on startup, so it's
not recommended that you call this function manually.

:param str filename: The filename to load from
:return: A boolean status if the load was successful.
:rtype: ``bool``
)");
  bool Load(const rdcstr &filename);

  DOCUMENT(R"(Saves the config to disk. This can happen if you want to be sure a setting has been
propagated and will not be forgotten in the case of crash or otherwise unexpected exit.

:return: A boolean status if the save was successful.
:rtype: ``bool``
)");
  bool Save();

  DOCUMENT(R"(Closes the config file so that subsequent calls to Save() will not write to disk at
the file the config was loaded from.

This function is rarely directly used, except in the case where RenderDoc is relaunching itself and
wants to avoid file locking conflicts between the closing instance saving, and the loading instance
loading. It can explicitly save and close before relaunching.
)");
  void Close();

  DOCUMENT("Configures the :class:`Formatter` class with the settings from this config.");
  void SetupFormatting();

  DOCUMENT(R"(Sets an arbitrary dynamic setting similar to a key-value store. This can be used for
storing custom settings to be persisted without needing to modify code.

:param str name: The name of the setting. Any existing setting will be overwritten.
:param str value: The contents of the setting.
)");
  void SetConfigSetting(const rdcstr &name, const rdcstr &value);
  DOCUMENT(R"(Retrieves an arbitrary dynamic setting. See :meth:`SetConfigSetting`.

:param str name: The name of the setting.
:return: The value of the setting, or the empty string if the setting did not exist.
:rtype: ``str``
)");
  rdcstr GetConfigSetting(const rdcstr &name);

  DOCUMENT(R"(Sets the UI style to the value in :data:`UIStyle`.

Changing the style after the application has started may not properly update everything, so to be
sure the new style is applied, the application should be restarted.

:param str name: The name of the setting.
:return: ``True`` if the style was set successfully, ``False`` if there was a problem e.g. the value
  of :data:`UIStyle` was unrecognised or empty.
:rtype: ``bool``
)");
  bool SetStyle();

private:
  bool Deserialize(const rdcstr &filename);
  bool Serialize(const rdcstr &filename);

#if !defined(SWIG_GENERATED)
  QVariantMap storeValues() const;
  void applyValues(const QVariantMap &values);
#endif

  rdcstr m_Filename;
};