зеркало из 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()
|
GrGpu::GrGpu()
|
||||||
: fContext(NULL)
|
: fContext(NULL)
|
||||||
|
, fResetCnt(0)
|
||||||
, fVertexPool(NULL)
|
, fVertexPool(NULL)
|
||||||
, fIndexPool(NULL)
|
, fIndexPool(NULL)
|
||||||
, fVertexPoolUseCnt(0)
|
, fVertexPoolUseCnt(0)
|
||||||
|
@ -61,6 +62,11 @@ GrGpu::~GrGpu() {
|
||||||
this->releaseResources();
|
this->releaseResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GrGpu::resetContext() {
|
||||||
|
this->onResetContext();
|
||||||
|
++fResetCnt;
|
||||||
|
}
|
||||||
|
|
||||||
void GrGpu::abandonResources() {
|
void GrGpu::abandonResources() {
|
||||||
|
|
||||||
while (NULL != fResourceHead) {
|
while (NULL != fResourceHead) {
|
||||||
|
|
|
@ -288,9 +288,14 @@ protected:
|
||||||
void finalizeReservedVertices();
|
void finalizeReservedVertices();
|
||||||
void finalizeReservedIndices();
|
void finalizeReservedIndices();
|
||||||
|
|
||||||
// overridden by API-specific derived class to handle re-emitting 3D API
|
// called to handle re-emitting 3D API preample and dirtying state cache.
|
||||||
// preample and dirtying state cache.
|
void resetContext();
|
||||||
virtual void resetContext() = 0;
|
// 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.
|
// overridden by API-specific derived class to create objects.
|
||||||
virtual GrTexture* onCreateTexture(const GrTextureDesc& desc,
|
virtual GrTexture* onCreateTexture(const GrTextureDesc& desc,
|
||||||
|
@ -363,6 +368,8 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GrContext* fContext; // not reffed (context refs gpu)
|
GrContext* fContext; // not reffed (context refs gpu)
|
||||||
|
|
||||||
|
int fResetCnt;
|
||||||
|
|
||||||
GrVertexBufferAllocPool* fVertexPool;
|
GrVertexBufferAllocPool* fVertexPool;
|
||||||
|
|
||||||
|
|
|
@ -559,7 +559,7 @@ void GrGpuGL::initStencilFormats() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGpuGL::resetContext() {
|
void GrGpuGL::onResetContext() {
|
||||||
if (gPrintStartupSpew && !fPrintedCaps) {
|
if (gPrintStartupSpew && !fPrintedCaps) {
|
||||||
fPrintedCaps = true;
|
fPrintedCaps = true;
|
||||||
this->getCaps().print();
|
this->getCaps().print();
|
||||||
|
|
|
@ -70,7 +70,7 @@ protected:
|
||||||
} fHWBounds;
|
} fHWBounds;
|
||||||
|
|
||||||
// GrGpu overrides
|
// GrGpu overrides
|
||||||
virtual void resetContext();
|
virtual void onResetContext() SK_OVERRIDE;
|
||||||
|
|
||||||
virtual GrTexture* onCreateTexture(const GrTextureDesc& desc,
|
virtual GrTexture* onCreateTexture(const GrTextureDesc& desc,
|
||||||
const void* srcData,
|
const void* srcData,
|
||||||
|
|
|
@ -67,8 +67,8 @@ GrGpuGLFixed::GrGpuGLFixed(const GrGLInterface* gl)
|
||||||
GrGpuGLFixed::~GrGpuGLFixed() {
|
GrGpuGLFixed::~GrGpuGLFixed() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGpuGLFixed::resetContext() {
|
void GrGpuGLFixed::onResetContext() {
|
||||||
INHERITED::resetContext();
|
INHERITED::onResetContext();
|
||||||
|
|
||||||
GL_CALL(Disable(GR_GL_TEXTURE_2D));
|
GL_CALL(Disable(GR_GL_TEXTURE_2D));
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ protected:
|
||||||
int indexCount);
|
int indexCount);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void resetContext();
|
virtual void onResetContext() SK_OVERRIDE;
|
||||||
|
|
||||||
// Helpers to make code more readable
|
// Helpers to make code more readable
|
||||||
const GrMatrix& getHWSamplerMatrix(int stage) const {
|
const GrMatrix& getHWSamplerMatrix(int stage) const {
|
||||||
|
|
|
@ -360,8 +360,8 @@ void GrGpuGLShaders::recordHWSamplerMatrix(int stage, const GrMatrix& matrix) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGpuGLShaders::resetContext() {
|
void GrGpuGLShaders::onResetContext() {
|
||||||
INHERITED::resetContext();
|
INHERITED::onResetContext();
|
||||||
|
|
||||||
fHWGeometryState.fVertexOffset = ~0;
|
fHWGeometryState.fVertexOffset = ~0;
|
||||||
|
|
||||||
|
|
|
@ -22,14 +22,13 @@ public:
|
||||||
GrGpuGLShaders(const GrGLInterface* glInterface);
|
GrGpuGLShaders(const GrGLInterface* glInterface);
|
||||||
virtual ~GrGpuGLShaders();
|
virtual ~GrGpuGLShaders();
|
||||||
|
|
||||||
virtual void resetContext();
|
|
||||||
|
|
||||||
virtual void abandonResources();
|
virtual void abandonResources();
|
||||||
|
|
||||||
bool programUnitTest();
|
bool programUnitTest();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// overrides from GrGpu
|
// overrides from GrGpu
|
||||||
|
virtual void onResetContext() SK_OVERRIDE;
|
||||||
virtual bool flushGraphicsState(GrPrimitiveType type);
|
virtual bool flushGraphicsState(GrPrimitiveType type);
|
||||||
virtual void setupGeometry(int* startVertex,
|
virtual void setupGeometry(int* startVertex,
|
||||||
int* startIndex,
|
int* startIndex,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче