Files
dolphin/Source/Core/VideoCommon/VideoConfig.h
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

260 lines
6.8 KiB
C++
Raw Normal View History

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