зеркало из https://github.com/mozilla/moz-skia.git
Add reset context count to GrGpu
git-svn-id: http://skia.googlecode.com/svn/trunk@2605 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
ce1d9e2e42
Коммит
1bf1c21025
|
@ -32,6 +32,7 @@ extern void gr_run_unittests();
|
|||
|
||||
GrGpu::GrGpu()
|
||||
: fContext(NULL)
|
||||
, fResetCnt(0)
|
||||
, fVertexPool(NULL)
|
||||
, fIndexPool(NULL)
|
||||
, fVertexPoolUseCnt(0)
|
||||
|
@ -61,6 +62,11 @@ GrGpu::~GrGpu() {
|
|||
this->releaseResources();
|
||||
}
|
||||
|
||||
void GrGpu::resetContext() {
|
||||
this->onResetContext();
|
||||
++fResetCnt;
|
||||
}
|
||||
|
||||
void GrGpu::abandonResources() {
|
||||
|
||||
while (NULL != fResourceHead) {
|
||||
|
|
|
@ -288,9 +288,14 @@ protected:
|
|||
void finalizeReservedVertices();
|
||||
void finalizeReservedIndices();
|
||||
|
||||
// overridden by API-specific derived class to handle re-emitting 3D API
|
||||
// preample and dirtying state cache.
|
||||
virtual void resetContext() = 0;
|
||||
// called to handle re-emitting 3D API preample and dirtying state cache.
|
||||
void resetContext();
|
||||
// returns the number of times resetContext has been called. This value
|
||||
// can be used a timestamp to detect when state cache is dirty.
|
||||
int resetCount() const { return fResetCnt; }
|
||||
|
||||
// subclass implementation of resetContext
|
||||
virtual void onResetContext() = 0;
|
||||
|
||||
// overridden by API-specific derived class to create objects.
|
||||
virtual GrTexture* onCreateTexture(const GrTextureDesc& desc,
|
||||
|
@ -364,6 +369,8 @@ protected:
|
|||
private:
|
||||
GrContext* fContext; // not reffed (context refs gpu)
|
||||
|
||||
int fResetCnt;
|
||||
|
||||
GrVertexBufferAllocPool* fVertexPool;
|
||||
|
||||
GrIndexBufferAllocPool* fIndexPool;
|
||||
|
|
|
@ -559,7 +559,7 @@ void GrGpuGL::initStencilFormats() {
|
|||
}
|
||||
}
|
||||
|
||||
void GrGpuGL::resetContext() {
|
||||
void GrGpuGL::onResetContext() {
|
||||
if (gPrintStartupSpew && !fPrintedCaps) {
|
||||
fPrintedCaps = true;
|
||||
this->getCaps().print();
|
||||
|
|
|
@ -70,7 +70,7 @@ protected:
|
|||
} fHWBounds;
|
||||
|
||||
// GrGpu overrides
|
||||
virtual void resetContext();
|
||||
virtual void onResetContext() SK_OVERRIDE;
|
||||
|
||||
virtual GrTexture* onCreateTexture(const GrTextureDesc& desc,
|
||||
const void* srcData,
|
||||
|
|
|
@ -67,8 +67,8 @@ GrGpuGLFixed::GrGpuGLFixed(const GrGLInterface* gl)
|
|||
GrGpuGLFixed::~GrGpuGLFixed() {
|
||||
}
|
||||
|
||||
void GrGpuGLFixed::resetContext() {
|
||||
INHERITED::resetContext();
|
||||
void GrGpuGLFixed::onResetContext() {
|
||||
INHERITED::onResetContext();
|
||||
|
||||
GL_CALL(Disable(GR_GL_TEXTURE_2D));
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ protected:
|
|||
int indexCount);
|
||||
|
||||
private:
|
||||
virtual void resetContext();
|
||||
virtual void onResetContext() SK_OVERRIDE;
|
||||
|
||||
// Helpers to make code more readable
|
||||
const GrMatrix& getHWSamplerMatrix(int stage) const {
|
||||
|
|
|
@ -360,8 +360,8 @@ void GrGpuGLShaders::recordHWSamplerMatrix(int stage, const GrMatrix& matrix) {
|
|||
}
|
||||
}
|
||||
|
||||
void GrGpuGLShaders::resetContext() {
|
||||
INHERITED::resetContext();
|
||||
void GrGpuGLShaders::onResetContext() {
|
||||
INHERITED::onResetContext();
|
||||
|
||||
fHWGeometryState.fVertexOffset = ~0;
|
||||
|
||||
|
|
|
@ -22,14 +22,13 @@ public:
|
|||
GrGpuGLShaders(const GrGLInterface* glInterface);
|
||||
virtual ~GrGpuGLShaders();
|
||||
|
||||
virtual void resetContext();
|
||||
|
||||
virtual void abandonResources();
|
||||
|
||||
bool programUnitTest();
|
||||
|
||||
protected:
|
||||
// overrides from GrGpu
|
||||
virtual void onResetContext() SK_OVERRIDE;
|
||||
virtual bool flushGraphicsState(GrPrimitiveType type);
|
||||
virtual void setupGeometry(int* startVertex,
|
||||
int* startIndex,
|
||||
|
|
Загрузка…
Ссылка в новой задаче