diff options
| author | Jules Blok <jules.blok@gmail.com> | 2014-12-17 03:11:23 +0100 |
|---|---|---|
| committer | Jules Blok <jules.blok@gmail.com> | 2014-12-18 00:37:09 +0100 |
| commit | 1af3d8447a47ea7a8be86060ca879cafe1c57824 (patch) | |
| tree | e3e05621ab93eaca2695592677ab9c8a7c0da4c5 /Source/Core/VideoCommon/GeometryShaderManager.cpp | |
| parent | 3d9dfad6a229f03948620b97f7e3b48e80784b3c (diff) | |
GeometryShaderManager: Set the constants within the callbacks.
Diffstat (limited to 'Source/Core/VideoCommon/GeometryShaderManager.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/GeometryShaderManager.cpp | 78 |
1 files changed, 25 insertions, 53 deletions
diff --git a/Source/Core/VideoCommon/GeometryShaderManager.cpp b/Source/Core/VideoCommon/GeometryShaderManager.cpp index 3d05a7161c..2ca0965343 100644 --- a/Source/Core/VideoCommon/GeometryShaderManager.cpp +++ b/Source/Core/VideoCommon/GeometryShaderManager.cpp @@ -12,9 +12,6 @@ #include "VideoCommon/VideoConfig.h" #include "VideoCommon/XFMemory.h" -// track changes -static bool s_projection_changed, s_viewport_changed, s_lineptwidth_changed; - static const int LINE_PT_TEX_OFFSETS[8] = { 0, 16, 8, 4, 2, 1, 1, 1 }; @@ -35,72 +32,47 @@ void GeometryShaderManager::Shutdown() void GeometryShaderManager::Dirty() { - s_projection_changed = true; - s_viewport_changed = true; - s_lineptwidth_changed = true; - - SetTexCoordChanged(0); - SetTexCoordChanged(1); - SetTexCoordChanged(2); - SetTexCoordChanged(3); - SetTexCoordChanged(4); - SetTexCoordChanged(5); - SetTexCoordChanged(6); - SetTexCoordChanged(7); + SetViewportChanged(); + SetProjectionChanged(); + SetLinePtWidthChanged(); + + for (int i = 0; i < 8; i++) + SetTexCoordChanged(i); dirty = true; } -// Syncs the shader constant buffers with xfmem -void GeometryShaderManager::SetConstants() +void GeometryShaderManager::SetViewportChanged() { - if (s_lineptwidth_changed) - { - constants.lineptparams[2] = bpmem.lineptwidth.linesize / 6.f; - constants.lineptparams[3] = bpmem.lineptwidth.pointsize / 6.f; - constants.texoffset[2] = LINE_PT_TEX_OFFSETS[bpmem.lineptwidth.lineoff]; - constants.texoffset[3] = LINE_PT_TEX_OFFSETS[bpmem.lineptwidth.pointoff]; - } + constants.lineptparams[0] = 2.0f * xfmem.viewport.wd; + constants.lineptparams[1] = -2.0f * xfmem.viewport.ht; + dirty = true; +} - if (s_viewport_changed) +void GeometryShaderManager::SetProjectionChanged() +{ + if (g_ActiveConfig.iStereoMode > 0 && xfmem.projection.type == GX_PERSPECTIVE) { - constants.lineptparams[0] = 2.0f * xfmem.viewport.wd; - constants.lineptparams[1] = -2.0f * xfmem.viewport.ht; + 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); } - - if (s_projection_changed) + else { - s_projection_changed = false; - - if (g_ActiveConfig.iStereoMode > 0 && 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; - } + constants.stereoparams[0] = constants.stereoparams[1] = 0; } dirty = true; } -void GeometryShaderManager::SetViewportChanged() -{ - s_viewport_changed = true; -} - -void GeometryShaderManager::SetProjectionChanged() -{ - s_projection_changed = true; -} - void GeometryShaderManager::SetLinePtWidthChanged() { - s_lineptwidth_changed = true; + constants.lineptparams[2] = bpmem.lineptwidth.linesize / 6.f; + constants.lineptparams[3] = bpmem.lineptwidth.pointsize / 6.f; + constants.texoffset[2] = LINE_PT_TEX_OFFSETS[bpmem.lineptwidth.lineoff]; + constants.texoffset[3] = LINE_PT_TEX_OFFSETS[bpmem.lineptwidth.pointoff]; + dirty = true; } void GeometryShaderManager::SetTexCoordChanged(u8 texmapid) |
