VideoConfig.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. // Copyright 2008 Dolphin Emulator Project
  2. // Licensed under GPLv2+
  3. // Refer to the license.txt file included.
  4. // IMPORTANT: UI etc should modify g_Config. Graphics code should read g_ActiveConfig.
  5. // The reason for this is to get rid of race conditions etc when the configuration
  6. // changes in the middle of a frame. This is done by copying g_Config to g_ActiveConfig
  7. // at the start of every frame. Noone should ever change members of g_ActiveConfig
  8. // directly.
  9. #pragma once
  10. #include <string>
  11. #include <vector>
  12. #include "Common/CommonTypes.h"
  13. #include "VideoCommon/VideoCommon.h"
  14. // Log in two categories, and save three other options in the same byte
  15. #define CONF_LOG 1
  16. #define CONF_PRIMLOG 2
  17. #define CONF_SAVETARGETS 8
  18. #define CONF_SAVESHADERS 16
  19. enum AspectMode
  20. {
  21. ASPECT_AUTO = 0,
  22. ASPECT_FORCE_16_9 = 1,
  23. ASPECT_FORCE_4_3 = 2,
  24. ASPECT_STRETCH = 3,
  25. };
  26. enum EFBScale
  27. {
  28. SCALE_FORCE_INTEGRAL = -1,
  29. SCALE_AUTO,
  30. SCALE_AUTO_INTEGRAL,
  31. SCALE_1X,
  32. SCALE_1_5X,
  33. SCALE_2X,
  34. SCALE_2_5X,
  35. };
  36. enum StereoMode
  37. {
  38. STEREO_OFF = 0,
  39. STEREO_SBS,
  40. STEREO_TAB,
  41. STEREO_ANAGLYPH,
  42. STEREO_3DVISION
  43. };
  44. // NEVER inherit from this class.
  45. struct VideoConfig final
  46. {
  47. VideoConfig();
  48. void Load(const std::string& ini_file);
  49. void GameIniLoad();
  50. void VerifyValidity();
  51. void Save(const std::string& ini_file);
  52. void UpdateProjectionHack();
  53. bool IsVSync();
  54. // General
  55. bool bVSync;
  56. bool bFullscreen;
  57. bool bExclusiveMode;
  58. bool bRunning;
  59. bool bWidescreenHack;
  60. int iAspectRatio;
  61. bool bCrop; // Aspect ratio controls.
  62. bool bUseXFB;
  63. bool bUseRealXFB;
  64. // Enhancements
  65. int iMultisampleMode;
  66. int iEFBScale;
  67. bool bForceFiltering;
  68. int iMaxAnisotropy;
  69. std::string sPostProcessingShader;
  70. int iStereoMode;
  71. int iStereoDepth;
  72. int iStereoConvergence;
  73. bool bStereoSwapEyes;
  74. // Information
  75. bool bShowFPS;
  76. bool bOverlayStats;
  77. bool bOverlayProjStats;
  78. bool bTexFmtOverlayEnable;
  79. bool bTexFmtOverlayCenter;
  80. bool bShowEFBCopyRegions;
  81. bool bLogRenderTimeToFile;
  82. // Render
  83. bool bWireFrame;
  84. bool bDstAlphaPass;
  85. bool bDisableFog;
  86. // Utility
  87. bool bDumpTextures;
  88. bool bHiresTextures;
  89. bool bConvertHiresTextures;
  90. bool bCacheHiresTextures;
  91. bool bDumpEFBTarget;
  92. bool bUseFFV1;
  93. bool bFreeLook;
  94. bool bBorderlessFullscreen;
  95. // Hacks
  96. bool bEFBAccessEnable;
  97. bool bPerfQueriesEnable;
  98. bool bBBoxEnable;
  99. bool bEFBEmulateFormatChanges;
  100. bool bSkipEFBCopyToRam;
  101. bool bCopyEFBScaled;
  102. int iSafeTextureCache_ColorSamples;
  103. int iPhackvalue[3];
  104. std::string sPhackvalue[2];
  105. float fAspectRatioHackW, fAspectRatioHackH;
  106. bool bEnablePixelLighting;
  107. bool bFastDepthCalc;
  108. int iLog; // CONF_ bits
  109. int iSaveTargetId; // TODO: Should be dropped
  110. // Stereoscopy
  111. bool bStereoEFBMonoDepth;
  112. int iStereoDepthPercentage;
  113. int iStereoConvergenceMinimum;
  114. // D3D only config, mostly to be merged into the above
  115. int iAdapter;
  116. // Debugging
  117. bool bEnableShaderDebugging;
  118. // Static config per API
  119. // TODO: Move this out of VideoConfig
  120. struct
  121. {
  122. API_TYPE APIType;
  123. std::vector<std::string> Adapters; // for D3D
  124. std::vector<std::string> AAModes;
  125. std::vector<std::string> PPShaders; // post-processing shaders
  126. std::vector<std::string> AnaglyphShaders; // anaglyph shaders
  127. bool bSupportsExclusiveFullscreen;
  128. bool bSupportsDualSourceBlend;
  129. bool bSupportsPrimitiveRestart;
  130. bool bSupportsOversizedViewports;
  131. bool bSupportsGeometryShaders;
  132. bool bSupports3DVision;
  133. bool bSupportsEarlyZ; // needed by PixelShaderGen, so must stay in VideoCommon
  134. bool bSupportsBindingLayout; // Needed by ShaderGen, so must stay in VideoCommon
  135. bool bSupportsBBox;
  136. bool bSupportsGSInstancing; // Needed by GeometryShaderGen, so must stay in VideoCommon
  137. bool bSupportsPostProcessing;
  138. bool bSupportsPaletteConversion;
  139. bool bSupportsClipControl; // Needed by VertexShaderGen, so must stay in VideoCommon
  140. } backend_info;
  141. // Utility
  142. bool RealXFBEnabled() const { return bUseXFB && bUseRealXFB; }
  143. bool VirtualXFBEnabled() const { return bUseXFB && !bUseRealXFB; }
  144. bool ExclusiveFullscreenEnabled() const { return backend_info.bSupportsExclusiveFullscreen && !bBorderlessFullscreen; }
  145. };
  146. extern VideoConfig g_Config;
  147. extern VideoConfig g_ActiveConfig;
  148. // Called every frame.
  149. void UpdateActiveConfig();