Merge pull request #1734 from Armada651/stereo-fixes

GeometryShaderManager: Set stereo parameters in a SetConstants() call.
This commit is contained in:
Markus Wick 2014-12-20 17:48:31 +01:00
commit 9122c868fe
3 changed files with 27 additions and 13 deletions

View File

@ -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,16 +44,13 @@ void GeometryShaderManager::Dirty()
dirty = true; dirty = true;
} }
void GeometryShaderManager::SetViewportChanged() void GeometryShaderManager::SetConstants()
{ {
constants.lineptparams[0] = 2.0f * xfmem.viewport.wd; if (s_projection_changed && g_ActiveConfig.iStereoMode > 0)
constants.lineptparams[1] = -2.0f * xfmem.viewport.ht; {
dirty = true; s_projection_changed = false;
}
void GeometryShaderManager::SetProjectionChanged() if (xfmem.projection.type == GX_PERSPECTIVE)
{
if (g_ActiveConfig.iStereoMode > 0 && xfmem.projection.type == GX_PERSPECTIVE)
{ {
float offset = (g_ActiveConfig.iStereoSeparation / 1000.0f) * (g_ActiveConfig.iStereoSeparationPercent / 100.0f); float offset = (g_ActiveConfig.iStereoSeparation / 1000.0f) * (g_ActiveConfig.iStereoSeparationPercent / 100.0f);
constants.stereoparams[0] = (g_ActiveConfig.bStereoSwapEyes) ? offset : -offset; constants.stereoparams[0] = (g_ActiveConfig.bStereoSwapEyes) ? offset : -offset;
@ -64,6 +63,19 @@ void GeometryShaderManager::SetProjectionChanged()
} }
dirty = true; dirty = true;
}
}
void GeometryShaderManager::SetViewportChanged()
{
constants.lineptparams[0] = 2.0f * xfmem.viewport.wd;
constants.lineptparams[1] = -2.0f * xfmem.viewport.ht;
dirty = true;
}
void GeometryShaderManager::SetProjectionChanged()
{
s_projection_changed = true;
} }
void GeometryShaderManager::SetLinePtWidthChanged() void GeometryShaderManager::SetLinePtWidthChanged()

View File

@ -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();

View File

@ -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 &&