Permalink
Browse files

d-r: add new rendering mode

added: DIRTYREGION_SOLVER_FILL_VIEWPORT_ON_CHANGE
This solver (mode 3) always marks the entire screen as dirty. The difference
between this and mode 0 is that it stops rendering when there are no dirty
regions left.

This should be a safe default as it does not require preserved backbuffers,
though to be safe we will need to stop flipping when we haven't rendered.
  • Loading branch information...
theuni
theuni committed Oct 6, 2011
1 parent 2fd1cd9 commit ecb5b57432915eece7602de65e85cb7f4863ab10
@@ -39,6 +39,15 @@ void CFillViewportAlwaysRegionSolver::Solve(const CDirtyRegionList &input, CDirt
output.push_back(unifiedRegion);
}
+void CFillViewportOnChangeRegionSolver::Solve(const CDirtyRegionList &input, CDirtyRegionList &output)
+{
+ if (input.size() > 0)
+ {
+ CDirtyRegion unifiedRegion(g_graphicsContext.GetViewWindow());
+ output.push_back(unifiedRegion);
+ }
+}
+
CGreedyDirtyRegionSolver::CGreedyDirtyRegionSolver()
{
m_costNewRegion = 10.0f;
@@ -34,6 +34,12 @@ class CFillViewportAlwaysRegionSolver : public IDirtyRegionSolver
virtual void Solve(const CDirtyRegionList &input, CDirtyRegionList &output);
};
+class CFillViewportOnChangeRegionSolver : public IDirtyRegionSolver
+{
+public:
+ virtual void Solve(const CDirtyRegionList &input, CDirtyRegionList &output);
+};
+
class CGreedyDirtyRegionSolver : public IDirtyRegionSolver
{
public:
@@ -49,10 +49,14 @@ void CDirtyRegionTracker::SelectAlgorithm()
m_solver = new CGreedyDirtyRegionSolver();
break;
case DIRTYREGION_SOLVER_FILL_VIEWPORT_ALWAYS:
- default:
CLog::Log(LOGDEBUG, "guilib: Fill viewport always for solving rendering passes");
m_solver = new CFillViewportAlwaysRegionSolver();
break;
+ case DIRTYREGION_SOLVER_FILL_VIEWPORT_ON_CHANGE:
+ default:
+ CLog::Log(LOGDEBUG, "guilib: Fill viewport on change for solving rendering passes");
+ m_solver = new CFillViewportOnChangeRegionSolver();
+ break;
}
}
@@ -554,6 +554,14 @@ bool CGUIWindowManager::Render()
RenderPass();
hasRendered = true;
}
+ else if (g_advancedSettings.m_guiAlgorithmDirtyRegions == DIRTYREGION_SOLVER_FILL_VIEWPORT_ON_CHANGE)
+ {
+ if (dirtyRegions.size() > 0)
+ {
+ RenderPass();
+ hasRendered = true;
+ }
+ }
else
{
for (CDirtyRegionList::const_iterator i = dirtyRegions.begin(); i != dirtyRegions.end(); i++)
@@ -25,6 +25,7 @@
#define DIRTYREGION_SOLVER_FILL_VIEWPORT_ALWAYS 0
#define DIRTYREGION_SOLVER_UNION 1
#define DIRTYREGION_SOLVER_COST_REDUCTION 2
+#define DIRTYREGION_SOLVER_FILL_VIEWPORT_ON_CHANGE 3
class IDirtyRegionSolver
{

0 comments on commit ecb5b57

Please sign in to comment.