mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
VideoConfigDiag: Add stereoscopy options group.
This commit is contained in:
@ -41,12 +41,12 @@ static inline void GenerateGeometryShader(T& out, u32 components, API_TYPE ApiTy
|
||||
|
||||
out.Write("//Geometry Shader for 3D stereoscopy\n");
|
||||
|
||||
uid_data->stereo = g_ActiveConfig.bStereo;
|
||||
uid_data->stereo = g_ActiveConfig.iStereoMode > 0;
|
||||
if (ApiType == API_OPENGL)
|
||||
{
|
||||
// Insert layout parameters
|
||||
if (g_ActiveConfig.backend_info.bSupportsGSInstancing)
|
||||
out.Write("layout(triangles, invocations = %d) in;\n", g_ActiveConfig.bStereo ? 2 : 1);
|
||||
out.Write("layout(triangles, invocations = %d) in;\n", g_ActiveConfig.iStereoMode > 0 ? 2 : 1);
|
||||
else
|
||||
out.Write("layout(triangles) in;\n");
|
||||
out.Write("layout(triangle_strip, max_vertices = %d) out;\n", g_ActiveConfig.backend_info.bSupportsGSInstancing ? 3 : 6);
|
||||
@ -74,7 +74,7 @@ static inline void GenerateGeometryShader(T& out, u32 components, API_TYPE ApiTy
|
||||
if (g_ActiveConfig.backend_info.bSupportsGSInstancing)
|
||||
out.Write("\tlayer = gl_InvocationID;\n");
|
||||
else
|
||||
out.Write("\tfor (layer = 0; layer < %d; ++layer) {\n", g_ActiveConfig.bStereo ? 2 : 1);
|
||||
out.Write("\tfor (layer = 0; layer < %d; ++layer) {\n", g_ActiveConfig.iStereoMode > 0 ? 2 : 1);
|
||||
|
||||
out.Write("\tgl_Layer = layer;\n");
|
||||
out.Write("\tvec4 stereoproj = "I_PROJECTION"[0];\n");
|
||||
@ -83,7 +83,7 @@ static inline void GenerateGeometryShader(T& out, u32 components, API_TYPE ApiTy
|
||||
out.Write("\tfor (int i = 0; i < gl_in.length(); ++i) {\n");
|
||||
out.Write("\t\to = v[i];\n");
|
||||
|
||||
if (g_ActiveConfig.bStereo)
|
||||
if (g_ActiveConfig.iStereoMode > 0)
|
||||
out.Write("\t\to.pos = float4(dot(stereoproj, v[i].rawpos), dot(" I_PROJECTION"[1], v[i].rawpos), dot(" I_PROJECTION"[2], v[i].rawpos), dot(" I_PROJECTION"[3], v[i].rawpos)); \n");
|
||||
|
||||
out.Write("\t\tgl_Position = o.pos;\n");
|
||||
|
@ -321,8 +321,8 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
|
||||
// Without MSAA, this flag is defined to have no effect.
|
||||
out.Write("centroid in VS_OUTPUT o;\n");
|
||||
|
||||
uid_data->stereo = g_ActiveConfig.bStereo;
|
||||
if (g_ActiveConfig.bStereo)
|
||||
uid_data->stereo = g_ActiveConfig.iStereoMode > 0;
|
||||
if (g_ActiveConfig.iStereoMode > 0)
|
||||
out.Write("flat in int layer;\n");
|
||||
|
||||
out.Write("void main()\n{\n");
|
||||
@ -926,7 +926,7 @@ static inline void SampleTexture(T& out, const char *texcoords, const char *texs
|
||||
if (ApiType == API_D3D)
|
||||
out.Write("iround(255.0 * Tex%d.Sample(samp%d,%s.xy * " I_TEXDIMS"[%d].xy)).%s;\n", texmap,texmap, texcoords, texmap, texswap);
|
||||
else
|
||||
out.Write("iround(255.0 * texture(samp%d, float3(%s.xy * " I_TEXDIMS"[%d].xy, %s))).%s;\n", texmap, texcoords, texmap, g_ActiveConfig.bStereo ? "layer" : "0.0", texswap);
|
||||
out.Write("iround(255.0 * texture(samp%d, float3(%s.xy * " I_TEXDIMS"[%d].xy, %s))).%s;\n", texmap, texcoords, texmap, g_ActiveConfig.iStereoMode > 0 ? "layer" : "0.0", texswap);
|
||||
}
|
||||
|
||||
static const char *tevAlphaFuncsTable[] =
|
||||
|
@ -52,7 +52,7 @@ static inline void GenerateVSOutputStruct(T& object, API_TYPE api_type)
|
||||
if (g_ActiveConfig.bEnablePixelLighting)
|
||||
DefineVSOutputStructMember(object, api_type, "float4", "Normal", -1, "TEXCOORD", xfmem.numTexGen.numTexGens + 1);
|
||||
|
||||
if (g_ActiveConfig.bStereo)
|
||||
if (g_ActiveConfig.iStereoMode > 0)
|
||||
DefineVSOutputStructMember(object, api_type, "float4", "rawpos", -1, "POSITION");
|
||||
|
||||
object.Write("};\n");
|
||||
@ -125,11 +125,11 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
|
||||
out.Write("in float%d tex%d; // ATTR%d,\n", hastexmtx ? 3 : 2, i, SHADER_TEXTURE0_ATTRIB + i);
|
||||
}
|
||||
|
||||
out.Write("centroid out VS_OUTPUT %s;\n", (g_ActiveConfig.bStereo) ? "v" : "o");
|
||||
out.Write("centroid out VS_OUTPUT %s;\n", (g_ActiveConfig.iStereoMode > 0) ? "v" : "o");
|
||||
|
||||
out.Write("void main()\n{\n");
|
||||
|
||||
if (g_ActiveConfig.bStereo)
|
||||
if (g_ActiveConfig.iStereoMode > 0)
|
||||
out.Write("VS_OUTPUT o;\n");
|
||||
}
|
||||
else // D3D
|
||||
@ -205,8 +205,8 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
|
||||
|
||||
out.Write("o.pos = float4(dot(" I_PROJECTION"[0], pos), dot(" I_PROJECTION"[1], pos), dot(" I_PROJECTION"[2], pos), dot(" I_PROJECTION"[3], pos));\n");
|
||||
|
||||
uid_data->stereo = g_ActiveConfig.bStereo;
|
||||
if (g_ActiveConfig.bStereo)
|
||||
uid_data->stereo = g_ActiveConfig.iStereoMode > 0;
|
||||
if (g_ActiveConfig.iStereoMode > 0)
|
||||
out.Write("o.rawpos = pos;\n");
|
||||
|
||||
out.Write("int4 lacc;\n"
|
||||
@ -420,7 +420,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
|
||||
|
||||
if (api_type == API_OPENGL)
|
||||
{
|
||||
if (g_ActiveConfig.bStereo)
|
||||
if (g_ActiveConfig.iStereoMode > 0)
|
||||
out.Write("v = o;\n");
|
||||
|
||||
out.Write("gl_Position = o.pos;\n");
|
||||
|
@ -513,7 +513,7 @@ void VertexShaderManager::SetConstants()
|
||||
memcpy(constants.projection, correctedMtx.data, 4*16);
|
||||
}
|
||||
|
||||
if (g_ActiveConfig.bStereo && xfmem.projection.type == GX_PERSPECTIVE)
|
||||
if (g_ActiveConfig.iStereoMode > 0 && xfmem.projection.type == GX_PERSPECTIVE)
|
||||
{
|
||||
float offset = g_ActiveConfig.iStereoSeparation / (200.0f * g_ActiveConfig.iStereoFocalLength);
|
||||
constants.stereooffset[0] = offset;
|
||||
|
@ -66,7 +66,7 @@ void VideoConfig::Load(const std::string& ini_file)
|
||||
settings->Get("DumpEFBTarget", &bDumpEFBTarget, 0);
|
||||
settings->Get("FreeLook", &bFreeLook, 0);
|
||||
settings->Get("UseFFV1", &bUseFFV1, 0);
|
||||
settings->Get("Stereo", &bStereo, false);
|
||||
settings->Get("StereoMode", &iStereoMode, 0);
|
||||
settings->Get("StereoSeparation", &iStereoSeparation, 65);
|
||||
settings->Get("StereoFocalLength", &iStereoFocalLength, 100);
|
||||
settings->Get("EnablePixelLighting", &bEnablePixelLighting, 0);
|
||||
@ -140,7 +140,7 @@ void VideoConfig::GameIniLoad()
|
||||
CHECK_SETTING("Video_Settings", "UseRealXFB", bUseRealXFB);
|
||||
CHECK_SETTING("Video_Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples);
|
||||
CHECK_SETTING("Video_Settings", "HiresTextures", bHiresTextures);
|
||||
CHECK_SETTING("Video_Settings", "Stereo", bStereo);
|
||||
CHECK_SETTING("Video_Settings", "StereoMode", iStereoMode);
|
||||
CHECK_SETTING("Video_Settings", "StereoSeparation", iStereoSeparation);
|
||||
CHECK_SETTING("Video_Settings", "StereoFocalLength", iStereoFocalLength);
|
||||
CHECK_SETTING("Video_Settings", "EnablePixelLighting", bEnablePixelLighting);
|
||||
@ -203,7 +203,7 @@ void VideoConfig::VerifyValidity()
|
||||
// TODO: Check iMaxAnisotropy value
|
||||
if (iAdapter < 0 || iAdapter > ((int)backend_info.Adapters.size() - 1)) iAdapter = 0;
|
||||
if (iMultisampleMode < 0 || iMultisampleMode >= (int)backend_info.AAModes.size()) iMultisampleMode = 0;
|
||||
if (!backend_info.bSupportsStereoscopy) bStereo = false;
|
||||
if (!backend_info.bSupportsStereoscopy) iStereoMode = 0;
|
||||
}
|
||||
|
||||
void VideoConfig::Save(const std::string& ini_file)
|
||||
@ -231,7 +231,7 @@ void VideoConfig::Save(const std::string& ini_file)
|
||||
settings->Set("DumpEFBTarget", bDumpEFBTarget);
|
||||
settings->Set("FreeLook", bFreeLook);
|
||||
settings->Set("UseFFV1", bUseFFV1);
|
||||
settings->Set("Stereo", bStereo);
|
||||
settings->Set("StereoMode", iStereoMode);
|
||||
settings->Set("StereoSeparation", iStereoSeparation);
|
||||
settings->Set("StereoFocalLength", iStereoFocalLength);
|
||||
settings->Set("EnablePixelLighting", bEnablePixelLighting);
|
||||
|
@ -71,6 +71,9 @@ struct VideoConfig final
|
||||
bool bForceFiltering;
|
||||
int iMaxAnisotropy;
|
||||
std::string sPostProcessingShader;
|
||||
int iStereoMode;
|
||||
int iStereoSeparation;
|
||||
int iStereoFocalLength;
|
||||
|
||||
// Information
|
||||
bool bShowFPS;
|
||||
@ -92,9 +95,6 @@ struct VideoConfig final
|
||||
bool bDumpEFBTarget;
|
||||
bool bUseFFV1;
|
||||
bool bFreeLook;
|
||||
bool bStereo;
|
||||
int iStereoSeparation;
|
||||
int iStereoFocalLength;
|
||||
bool bBorderlessFullscreen;
|
||||
|
||||
// Hacks
|
||||
|
Reference in New Issue
Block a user