Merge pull request #1734 from Armada651/stereo-fixes
GeometryShaderManager: Set stereo parameters in a SetConstants() call.
This commit is contained in:
commit
9122c868fe
|
@ -19,6 +19,8 @@ static const int LINE_PT_TEX_OFFSETS[8] = {
|
||||||
GeometryShaderConstants GeometryShaderManager::constants;
|
GeometryShaderConstants GeometryShaderManager::constants;
|
||||||
bool GeometryShaderManager::dirty;
|
bool GeometryShaderManager::dirty;
|
||||||
|
|
||||||
|
static bool s_projection_changed;
|
||||||
|
|
||||||
void GeometryShaderManager::Init()
|
void GeometryShaderManager::Init()
|
||||||
{
|
{
|
||||||
memset(&constants, 0, sizeof(constants));
|
memset(&constants, 0, sizeof(constants));
|
||||||
|
@ -42,6 +44,28 @@ void GeometryShaderManager::Dirty()
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GeometryShaderManager::SetConstants()
|
||||||
|
{
|
||||||
|
if (s_projection_changed && g_ActiveConfig.iStereoMode > 0)
|
||||||
|
{
|
||||||
|
s_projection_changed = false;
|
||||||
|
|
||||||
|
if (xfmem.projection.type == GX_PERSPECTIVE)
|
||||||
|
{
|
||||||
|
float offset = (g_ActiveConfig.iStereoSeparation / 1000.0f) * (g_ActiveConfig.iStereoSeparationPercent / 100.0f);
|
||||||
|
constants.stereoparams[0] = (g_ActiveConfig.bStereoSwapEyes) ? offset : -offset;
|
||||||
|
constants.stereoparams[1] = (g_ActiveConfig.bStereoSwapEyes) ? -offset : offset;
|
||||||
|
constants.stereoparams[2] = (g_ActiveConfig.iStereoConvergence / 10.0f) * (g_ActiveConfig.iStereoConvergencePercent / 100.0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
constants.stereoparams[0] = constants.stereoparams[1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GeometryShaderManager::SetViewportChanged()
|
void GeometryShaderManager::SetViewportChanged()
|
||||||
{
|
{
|
||||||
constants.lineptparams[0] = 2.0f * xfmem.viewport.wd;
|
constants.lineptparams[0] = 2.0f * xfmem.viewport.wd;
|
||||||
|
@ -51,19 +75,7 @@ void GeometryShaderManager::SetViewportChanged()
|
||||||
|
|
||||||
void GeometryShaderManager::SetProjectionChanged()
|
void GeometryShaderManager::SetProjectionChanged()
|
||||||
{
|
{
|
||||||
if (g_ActiveConfig.iStereoMode > 0 && xfmem.projection.type == GX_PERSPECTIVE)
|
s_projection_changed = true;
|
||||||
{
|
|
||||||
float offset = (g_ActiveConfig.iStereoSeparation / 1000.0f) * (g_ActiveConfig.iStereoSeparationPercent / 100.0f);
|
|
||||||
constants.stereoparams[0] = (g_ActiveConfig.bStereoSwapEyes) ? offset : -offset;
|
|
||||||
constants.stereoparams[1] = (g_ActiveConfig.bStereoSwapEyes) ? -offset : offset;
|
|
||||||
constants.stereoparams[2] = (g_ActiveConfig.iStereoConvergence / 10.0f) * (g_ActiveConfig.iStereoConvergencePercent / 100.0f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
constants.stereoparams[0] = constants.stereoparams[1] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
dirty = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeometryShaderManager::SetLinePtWidthChanged()
|
void GeometryShaderManager::SetLinePtWidthChanged()
|
||||||
|
|
|
@ -18,6 +18,7 @@ public:
|
||||||
static void Shutdown();
|
static void Shutdown();
|
||||||
static void DoState(PointerWrap &p);
|
static void DoState(PointerWrap &p);
|
||||||
|
|
||||||
|
static void SetConstants();
|
||||||
static void SetViewportChanged();
|
static void SetViewportChanged();
|
||||||
static void SetProjectionChanged();
|
static void SetProjectionChanged();
|
||||||
static void SetLinePtWidthChanged();
|
static void SetLinePtWidthChanged();
|
||||||
|
|
|
@ -223,6 +223,7 @@ void VertexManager::Flush()
|
||||||
|
|
||||||
// set global constants
|
// set global constants
|
||||||
VertexShaderManager::SetConstants();
|
VertexShaderManager::SetConstants();
|
||||||
|
GeometryShaderManager::SetConstants();
|
||||||
PixelShaderManager::SetConstants();
|
PixelShaderManager::SetConstants();
|
||||||
|
|
||||||
bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass &&
|
bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass &&
|
||||||
|
|
Loading…
Reference in New Issue