Commit 20c6f342 by Nicolas Capens

Create a global and thread-safe Blitter.

Bug 21716622 Change-Id: I090154cdfbb6f8781df578b3f493d3ecd297c847 Reviewed-on: https://swiftshader-review.googlesource.com/3437Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent 130c27a3
......@@ -16,6 +16,8 @@
namespace sw
{
Blitter blitter;
Blitter::Blitter()
{
blitCache = new RoutineCache<BlitState>(1024);
......@@ -400,6 +402,7 @@ namespace sw
state.destFormat = dest->getInternalFormat();
state.filter = filter;
criticalSection.lock();
Routine *blitRoutine = blitCache->query(state);
if(!blitRoutine)
......@@ -408,12 +411,15 @@ namespace sw
if(!blitRoutine)
{
criticalSection.unlock();
return false;
}
blitCache->add(state, blitRoutine);
}
criticalSection.unlock();
void (*blitFunction)(const BlitData *data) = (void(*)(const BlitData*))blitRoutine->getEntry();
BlitData data;
......
......@@ -69,7 +69,10 @@ namespace sw
Routine *generate(BlitState &state);
RoutineCache<BlitState> *blitCache;
BackoffLock criticalSection;
};
extern Blitter blitter;
}
#endif // sw_Blitter_hpp
......@@ -442,8 +442,6 @@ namespace sw
VertexProcessor::State vertexState;
SetupProcessor::State setupState;
PixelProcessor::State pixelState;
Blitter blitter;
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment