Skip to content

Commit

Permalink
d-r: add new rendering mode
Browse files Browse the repository at this point in the history
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 committed Oct 24, 2011
1 parent a3304cf commit 0e8168e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
6 changes: 6 additions & 0 deletions xbmc/guilib/DirtyRegionSolvers.cpp
Expand Up @@ -39,6 +39,12 @@ void CFillViewportAlwaysRegionSolver::Solve(const CDirtyRegionList &input, CDirt
output.push_back(unifiedRegion);
}

void CFillViewportOnChangeRegionSolver::Solve(const CDirtyRegionList &input, CDirtyRegionList &output)
{
if (input.size() > 0)
output.assign(1,g_graphicsContext.GetViewWindow());
}

CGreedyDirtyRegionSolver::CGreedyDirtyRegionSolver()
{
m_costNewRegion = 10.0f;
Expand Down
6 changes: 6 additions & 0 deletions xbmc/guilib/DirtyRegionSolvers.h
Expand Up @@ -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:
Expand Down
10 changes: 7 additions & 3 deletions xbmc/guilib/DirtyRegionTracker.cpp
Expand Up @@ -41,14 +41,18 @@ void CDirtyRegionTracker::SelectAlgorithm()

switch (g_advancedSettings.m_guiAlgorithmDirtyRegions)
{
case DIRTYREGION_SOLVER_UNION:
m_solver = new CUnionDirtyRegionSolver();
CLog::Log(LOGDEBUG, "guilib: Union as algorithm for solving rendering passes");
case DIRTYREGION_SOLVER_FILL_VIEWPORT_ON_CHANGE:
CLog::Log(LOGDEBUG, "guilib: Fill viewport on change for solving rendering passes");
m_solver = new CFillViewportOnChangeRegionSolver();
break;
case DIRTYREGION_SOLVER_COST_REDUCTION:
CLog::Log(LOGDEBUG, "guilib: Cost reduction as algorithm for solving rendering passes");
m_solver = new CGreedyDirtyRegionSolver();
break;
case DIRTYREGION_SOLVER_UNION:
m_solver = new CUnionDirtyRegionSolver();
CLog::Log(LOGDEBUG, "guilib: Union as algorithm for solving rendering passes");
break;
case DIRTYREGION_SOLVER_FILL_VIEWPORT_ALWAYS:
default:
CLog::Log(LOGDEBUG, "guilib: Fill viewport always for solving rendering passes");
Expand Down
8 changes: 8 additions & 0 deletions xbmc/guilib/GUIWindowManager.cpp
Expand Up @@ -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++)
Expand Down
1 change: 1 addition & 0 deletions xbmc/guilib/IDirtyRegionSolver.h
Expand Up @@ -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
{
Expand Down

0 comments on commit 0e8168e

Please sign in to comment.