2015-05-24 06:55:12 +02:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-18 01:08:10 +02:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 05:09:55 +02:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 05:46:09 +01:00
|
|
|
|
2009-09-13 10:21:35 +02:00
|
|
|
// IMPORTANT: UI etc should modify g_Config. Graphics code should read g_ActiveConfig.
|
|
|
|
// The reason for this is to get rid of race conditions etc when the configuration
|
|
|
|
// changes in the middle of a frame. This is done by copying g_Config to g_ActiveConfig
|
2013-10-29 06:23:17 +01:00
|
|
|
// at the start of every frame. Noone should ever change members of g_ActiveConfig
|
2009-09-13 10:21:35 +02:00
|
|
|
// directly.
|
|
|
|
|
2014-02-10 19:54:46 +01:00
|
|
|
#pragma once
|
2008-12-08 05:46:09 +01:00
|
|
|
|
2009-07-12 23:58:32 +02:00
|
|
|
#include <string>
|
2014-02-17 11:18:15 +01:00
|
|
|
#include <vector>
|
|
|
|
|
2014-09-08 03:06:58 +02:00
|
|
|
#include "Common/CommonTypes.h"
|
2019-07-17 02:18:48 +02:00
|
|
|
|
|
|
|
enum class APIType;
|
2009-07-12 23:58:32 +02:00
|
|
|
|
2009-02-04 18:33:59 +01:00
|
|
|
// Log in two categories, and save three other options in the same byte
|
2014-02-16 21:30:18 +01:00
|
|
|
#define CONF_LOG 1
|
|
|
|
#define CONF_PRIMLOG 2
|
|
|
|
#define CONF_SAVETARGETS 8
|
|
|
|
#define CONF_SAVESHADERS 16
|
2008-12-08 05:46:09 +01:00
|
|
|
|
2017-07-03 16:32:02 +02:00
|
|
|
constexpr int EFB_SCALE_AUTO_INTEGRAL = 0;
|
|
|
|
|
2018-01-08 12:04:12 +01:00
|
|
|
enum class AspectMode : int
|
2014-02-09 22:03:16 +01:00
|
|
|
{
|
2017-11-11 04:45:32 +01:00
|
|
|
Auto,
|
|
|
|
AnalogWide,
|
|
|
|
Analog,
|
|
|
|
Stretch,
|
2010-01-13 22:11:02 +01:00
|
|
|
};
|
|
|
|
|
2018-01-08 12:04:12 +01:00
|
|
|
enum class StereoMode : int
|
2014-10-31 15:25:42 +01:00
|
|
|
{
|
2017-11-11 04:55:00 +01:00
|
|
|
Off,
|
|
|
|
SBS,
|
|
|
|
TAB,
|
|
|
|
Anaglyph,
|
|
|
|
QuadBuffer,
|
2019-10-02 03:07:17 +02:00
|
|
|
Passive
|
2014-10-31 15:25:42 +01:00
|
|
|
};
|
|
|
|
|
2018-03-16 14:10:22 +01:00
|
|
|
enum class ShaderCompilationMode : int
|
2018-03-01 09:03:24 +01:00
|
|
|
{
|
2018-03-16 14:10:22 +01:00
|
|
|
Synchronous,
|
|
|
|
SynchronousUberShaders,
|
|
|
|
AsynchronousUberShaders,
|
|
|
|
AsynchronousSkipRendering
|
2018-03-01 09:03:24 +01:00
|
|
|
};
|
|
|
|
|
2020-04-26 23:37:49 +02:00
|
|
|
enum class FreelookControlType : int
|
|
|
|
{
|
|
|
|
SixAxis,
|
|
|
|
FPS,
|
|
|
|
Orbital
|
|
|
|
};
|
|
|
|
|
2009-02-28 17:33:59 +01:00
|
|
|
// NEVER inherit from this class.
|
2014-03-16 22:00:29 +01:00
|
|
|
struct VideoConfig final
|
2008-12-08 05:46:09 +01:00
|
|
|
{
|
2011-03-21 20:57:31 +01:00
|
|
|
VideoConfig();
|
2017-05-18 14:59:38 +02:00
|
|
|
void Refresh();
|
2011-02-13 14:42:59 +01:00
|
|
|
void VerifyValidity();
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2010-06-05 03:38:22 +02:00
|
|
|
// General
|
2009-03-06 00:11:13 +01:00
|
|
|
bool bVSync;
|
2019-01-27 03:24:53 +01:00
|
|
|
bool bVSyncActive;
|
2009-09-02 23:30:19 +02:00
|
|
|
bool bWidescreenHack;
|
2017-11-11 04:45:32 +01:00
|
|
|
AspectMode aspect_mode;
|
2018-11-07 19:00:24 +01:00
|
|
|
AspectMode suggested_aspect_mode;
|
2010-06-05 03:38:22 +02:00
|
|
|
bool bCrop; // Aspect ratio controls.
|
2017-02-19 12:02:47 +01:00
|
|
|
bool bShaderCache;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2008-12-08 05:46:09 +01:00
|
|
|
// Enhancements
|
2017-06-07 13:30:39 +02:00
|
|
|
u32 iMultisamples;
|
2015-09-01 07:17:24 +02:00
|
|
|
bool bSSAA;
|
2010-06-09 17:33:01 +02:00
|
|
|
int iEFBScale;
|
2010-06-05 03:38:22 +02:00
|
|
|
bool bForceFiltering;
|
|
|
|
int iMaxAnisotropy;
|
2009-06-08 21:42:25 +02:00
|
|
|
std::string sPostProcessingShader;
|
2016-09-08 02:43:34 +02:00
|
|
|
bool bForceTrueColor;
|
2018-04-29 10:52:30 +02:00
|
|
|
bool bDisableCopyFilter;
|
2018-05-17 02:12:56 +02:00
|
|
|
bool bArbitraryMipmapDetection;
|
2018-05-17 02:45:10 +02:00
|
|
|
float fArbitraryMipmapDetectionThreshold;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2008-12-08 05:46:09 +01:00
|
|
|
// Information
|
2010-06-05 03:38:22 +02:00
|
|
|
bool bShowFPS;
|
2016-02-02 16:35:27 +01:00
|
|
|
bool bShowNetPlayPing;
|
|
|
|
bool bShowNetPlayMessages;
|
2010-06-05 03:38:22 +02:00
|
|
|
bool bOverlayStats;
|
2009-02-15 21:49:59 +01:00
|
|
|
bool bOverlayProjStats;
|
2010-06-05 03:38:22 +02:00
|
|
|
bool bTexFmtOverlayEnable;
|
|
|
|
bool bTexFmtOverlayCenter;
|
2014-07-09 17:03:17 +02:00
|
|
|
bool bLogRenderTimeToFile;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2010-06-05 03:38:22 +02:00
|
|
|
// Render
|
|
|
|
bool bWireFrame;
|
2009-04-01 14:31:18 +02:00
|
|
|
bool bDisableFog;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2010-06-05 03:38:22 +02:00
|
|
|
// Utility
|
|
|
|
bool bDumpTextures;
|
2020-05-05 06:07:06 +02:00
|
|
|
bool bDumpMipmapTextures;
|
|
|
|
bool bDumpBaseTextures;
|
2011-04-25 22:06:45 +02:00
|
|
|
bool bHiresTextures;
|
2015-03-01 23:53:15 +01:00
|
|
|
bool bCacheHiresTextures;
|
2009-03-07 10:29:25 +01:00
|
|
|
bool bDumpEFBTarget;
|
2017-06-03 03:33:26 +02:00
|
|
|
bool bDumpXFBTarget;
|
2016-11-18 13:57:08 +01:00
|
|
|
bool bDumpFramesAsImages;
|
2011-02-11 23:09:20 +01:00
|
|
|
bool bUseFFV1;
|
2017-02-21 20:04:22 +01:00
|
|
|
std::string sDumpCodec;
|
2017-12-29 15:00:55 +01:00
|
|
|
std::string sDumpEncoder;
|
2017-02-21 11:43:49 +01:00
|
|
|
std::string sDumpFormat;
|
2017-02-21 20:37:36 +01:00
|
|
|
std::string sDumpPath;
|
2016-11-10 14:26:57 +01:00
|
|
|
bool bInternalResolutionFrameDumps;
|
2010-06-05 03:38:22 +02:00
|
|
|
bool bFreeLook;
|
2020-04-26 23:37:49 +02:00
|
|
|
FreelookControlType iFreelookControlType;
|
2014-07-26 12:43:49 +02:00
|
|
|
bool bBorderlessFullscreen;
|
2016-11-27 09:14:57 +01:00
|
|
|
bool bEnableGPUTextureDecoding;
|
2017-02-25 03:54:22 +01:00
|
|
|
int iBitrateKbps;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2010-06-05 03:38:22 +02:00
|
|
|
// Hacks
|
|
|
|
bool bEFBAccessEnable;
|
2019-03-02 08:05:38 +01:00
|
|
|
bool bEFBAccessDeferInvalidation;
|
2013-08-11 17:08:12 +02:00
|
|
|
bool bPerfQueriesEnable;
|
2015-04-06 02:17:57 +02:00
|
|
|
bool bBBoxEnable;
|
2015-07-27 14:04:03 +02:00
|
|
|
bool bForceProgressive;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2010-12-27 22:56:20 +01:00
|
|
|
bool bEFBEmulateFormatChanges;
|
2015-02-21 12:08:47 +01:00
|
|
|
bool bSkipEFBCopyToRam;
|
2017-06-26 05:23:47 +02:00
|
|
|
bool bSkipXFBCopyToRam;
|
2018-02-11 06:36:49 +01:00
|
|
|
bool bDisableCopyToVRAM;
|
2018-11-02 15:17:00 +01:00
|
|
|
bool bDeferEFBCopies;
|
2017-08-13 06:10:21 +02:00
|
|
|
bool bImmediateXFB;
|
2020-01-14 01:57:35 +01:00
|
|
|
bool bSkipPresentingDuplicateXFBs;
|
2009-12-15 02:40:54 +01:00
|
|
|
bool bCopyEFBScaled;
|
2010-11-15 10:54:07 +01:00
|
|
|
int iSafeTextureCache_ColorSamples;
|
2010-04-05 00:52:27 +02:00
|
|
|
float fAspectRatioHackW, fAspectRatioHackH;
|
2011-03-19 01:50:34 +01:00
|
|
|
bool bEnablePixelLighting;
|
2016-02-29 00:55:51 +01:00
|
|
|
bool bFastDepthCalc;
|
2017-02-19 01:22:41 +01:00
|
|
|
bool bVertexRounding;
|
2019-03-02 06:11:47 +01:00
|
|
|
int iEFBAccessTileSize;
|
2010-06-05 03:38:22 +02:00
|
|
|
int iLog; // CONF_ bits
|
2012-05-28 11:31:37 +02:00
|
|
|
int iSaveTargetId; // TODO: Should be dropped
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2014-11-24 12:01:21 +01:00
|
|
|
// Stereoscopy
|
2017-11-11 04:55:00 +01:00
|
|
|
StereoMode stereo_mode;
|
2015-09-10 22:14:21 +02:00
|
|
|
int iStereoDepth;
|
|
|
|
int iStereoConvergence;
|
|
|
|
int iStereoConvergencePercentage;
|
|
|
|
bool bStereoSwapEyes;
|
2014-12-24 23:06:44 +01:00
|
|
|
bool bStereoEFBMonoDepth;
|
2014-12-21 14:06:16 +01:00
|
|
|
int iStereoDepthPercentage;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2009-09-13 10:21:35 +02:00
|
|
|
// D3D only config, mostly to be merged into the above
|
|
|
|
int iAdapter;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2015-10-09 20:50:36 +02:00
|
|
|
// VideoSW Debugging
|
|
|
|
int drawStart;
|
|
|
|
int drawEnd;
|
|
|
|
bool bZComploc;
|
|
|
|
bool bZFreeze;
|
|
|
|
bool bDumpObjects;
|
|
|
|
bool bDumpTevStages;
|
|
|
|
bool bDumpTevTextureFetches;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2016-08-13 14:08:46 +02:00
|
|
|
// Enable API validation layers, currently only supported with Vulkan.
|
|
|
|
bool bEnableValidationLayer;
|
|
|
|
|
|
|
|
// Multithreaded submission, currently only supported with Vulkan.
|
|
|
|
bool bBackendMultithreading;
|
|
|
|
|
2016-08-13 14:57:50 +02:00
|
|
|
// Early command buffer execution interval in number of draws.
|
|
|
|
// Currently only supported with Vulkan.
|
|
|
|
int iCommandBufferExecuteInterval;
|
|
|
|
|
2018-03-01 09:03:24 +01:00
|
|
|
// Shader compilation settings.
|
2018-03-01 10:21:06 +01:00
|
|
|
bool bWaitForShadersBeforeStarting;
|
2018-03-16 14:10:22 +01:00
|
|
|
ShaderCompilationMode iShaderCompilationMode;
|
2017-06-13 12:07:09 +02:00
|
|
|
|
|
|
|
// Number of shader compiler threads.
|
|
|
|
// 0 disables background compilation.
|
|
|
|
// -1 uses an automatic number based on the CPU threads.
|
|
|
|
int iShaderCompilerThreads;
|
2017-07-27 05:15:38 +02:00
|
|
|
int iShaderPrecompilerThreads;
|
2017-06-13 12:07:09 +02:00
|
|
|
|
2009-09-13 23:18:04 +02:00
|
|
|
// Static config per API
|
2011-05-31 22:16:59 +02:00
|
|
|
// TODO: Move this out of VideoConfig
|
2011-03-21 20:57:31 +01:00
|
|
|
struct
|
2010-11-21 15:47:28 +01:00
|
|
|
{
|
2016-07-22 01:04:57 +02:00
|
|
|
APIType api_type;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2013-09-22 17:49:26 +02:00
|
|
|
std::vector<std::string> Adapters; // for D3D
|
2017-06-07 13:30:39 +02:00
|
|
|
std::vector<u32> AAModes;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2016-06-20 13:54:44 +02:00
|
|
|
// TODO: merge AdapterName and Adapters array
|
|
|
|
std::string AdapterName; // for OpenGL
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2017-03-09 15:01:23 +01:00
|
|
|
u32 MaxTextureSize;
|
2019-02-15 02:59:50 +01:00
|
|
|
bool bUsesLowerLeftOrigin;
|
2017-03-09 15:01:23 +01:00
|
|
|
|
2014-07-19 20:18:03 +02:00
|
|
|
bool bSupportsExclusiveFullscreen;
|
2013-09-22 17:49:26 +02:00
|
|
|
bool bSupportsDualSourceBlend;
|
2013-03-29 14:27:33 +01:00
|
|
|
bool bSupportsPrimitiveRestart;
|
2013-10-14 15:16:42 +02:00
|
|
|
bool bSupportsOversizedViewports;
|
2014-12-17 00:26:03 +01:00
|
|
|
bool bSupportsGeometryShaders;
|
2016-11-27 09:14:55 +01:00
|
|
|
bool bSupportsComputeShaders;
|
2014-11-14 00:24:53 +01:00
|
|
|
bool bSupports3DVision;
|
2013-07-22 12:02:16 +02:00
|
|
|
bool bSupportsEarlyZ; // needed by PixelShaderGen, so must stay in VideoCommon
|
2014-03-30 20:58:05 +02:00
|
|
|
bool bSupportsBindingLayout; // Needed by ShaderGen, so must stay in VideoCommon
|
2014-11-13 23:26:49 +01:00
|
|
|
bool bSupportsBBox;
|
2014-10-29 14:51:12 +01:00
|
|
|
bool bSupportsGSInstancing; // Needed by GeometryShaderGen, so must stay in VideoCommon
|
2015-01-03 01:33:30 +01:00
|
|
|
bool bSupportsPostProcessing;
|
2015-01-27 00:33:23 +01:00
|
|
|
bool bSupportsPaletteConversion;
|
2015-05-19 01:18:04 +02:00
|
|
|
bool bSupportsClipControl; // Needed by VertexShaderGen, so must stay in VideoCommon
|
2015-09-01 07:17:24 +02:00
|
|
|
bool bSupportsSSAA;
|
2017-03-06 00:17:54 +01:00
|
|
|
bool bSupportsFragmentStoresAndAtomics; // a.k.a. OpenGL SSBOs a.k.a. Direct3D UAVs
|
2016-08-12 13:55:35 +02:00
|
|
|
bool bSupportsDepthClamp; // Needed by VertexShaderGen, so must stay in VideoCommon
|
2016-08-21 17:47:24 +02:00
|
|
|
bool bSupportsReversedDepthRange;
|
2018-05-25 16:04:18 +02:00
|
|
|
bool bSupportsLogicOp;
|
2016-08-13 14:08:46 +02:00
|
|
|
bool bSupportsMultithreading;
|
2016-11-27 09:14:57 +01:00
|
|
|
bool bSupportsGPUTextureDecoding;
|
2017-04-16 11:30:11 +02:00
|
|
|
bool bSupportsST3CTextures;
|
2017-05-30 00:02:09 +02:00
|
|
|
bool bSupportsCopyToVram;
|
2017-07-20 07:25:24 +02:00
|
|
|
bool bSupportsBitfield; // Needed by UberShaders, so must stay in VideoCommon
|
|
|
|
bool bSupportsDynamicSamplerIndexing; // Needed by UberShaders, so must stay in VideoCommon
|
2017-07-27 14:00:04 +02:00
|
|
|
bool bSupportsBPTCTextures;
|
2017-10-26 07:44:39 +02:00
|
|
|
bool bSupportsFramebufferFetch; // Used as an alternative to dual-source blend on GLES
|
2018-02-25 08:56:09 +01:00
|
|
|
bool bSupportsBackgroundCompiling;
|
2019-02-15 02:59:50 +01:00
|
|
|
bool bSupportsLargePoints;
|
2019-03-02 06:03:49 +01:00
|
|
|
bool bSupportsPartialDepthCopies;
|
2020-05-24 08:11:10 +02:00
|
|
|
bool bSupportsDepthReadback;
|
2019-04-15 13:55:26 +02:00
|
|
|
bool bSupportsShaderBinaries;
|
|
|
|
bool bSupportsPipelineCacheData;
|
2010-11-21 15:47:28 +01:00
|
|
|
} backend_info;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2013-03-20 02:51:12 +01:00
|
|
|
// Utility
|
2017-04-30 10:07:57 +02:00
|
|
|
bool MultisamplingEnabled() const { return iMultisamples > 1; }
|
2014-10-07 16:43:32 +02:00
|
|
|
bool ExclusiveFullscreenEnabled() const
|
|
|
|
{
|
|
|
|
return backend_info.bSupportsExclusiveFullscreen && !bBorderlessFullscreen;
|
|
|
|
}
|
2016-11-27 09:14:57 +01:00
|
|
|
bool UseGPUTextureDecoding() const
|
|
|
|
{
|
|
|
|
return backend_info.bSupportsGPUTextureDecoding && bEnableGPUTextureDecoding;
|
|
|
|
}
|
2017-07-03 16:32:02 +02:00
|
|
|
bool UseVertexRounding() const { return bVertexRounding && iEFBScale != 1; }
|
2018-03-16 14:10:22 +01:00
|
|
|
bool UsingUberShaders() const;
|
2017-06-13 12:07:09 +02:00
|
|
|
u32 GetShaderCompilerThreads() const;
|
2017-07-27 05:15:38 +02:00
|
|
|
u32 GetShaderPrecompilerThreads() const;
|
2008-12-08 05:46:09 +01:00
|
|
|
};
|
|
|
|
|
2009-09-13 12:18:01 +02:00
|
|
|
extern VideoConfig g_Config;
|
|
|
|
extern VideoConfig g_ActiveConfig;
|
2009-09-13 10:21:35 +02:00
|
|
|
|
|
|
|
// Called every frame.
|
|
|
|
void UpdateActiveConfig();
|