Rename backing texture testing routines

Review URL: https://codereview.chromium.org/1230193006
This commit is contained in:
jvanverth 2015-07-14 11:02:52 -07:00 committed by Commit bot
parent 3df1e2163f
commit 8895792877
7 changed files with 30 additions and 26 deletions

View File

@ -102,9 +102,10 @@ protected:
for (int i = 0; i < 3; ++i) {
SkASSERT(fYUVBmps[i].width() == SkToInt(fYUVBmps[i].rowBytes()));
yuvIDs[i] = gpu->createBackendTexture(fYUVBmps[i].getPixels(),
fYUVBmps[i].width(), fYUVBmps[i].height(),
kAlpha_8_GrPixelConfig);
yuvIDs[i] = gpu->createTestingOnlyBackendTexture(fYUVBmps[i].getPixels(),
fYUVBmps[i].width(),
fYUVBmps[i].height(),
kAlpha_8_GrPixelConfig);
}
context->resetContext();
}
@ -117,7 +118,7 @@ protected:
}
for (int i = 0; i < 3; ++i) {
gpu->deleteBackendTexture(yuvIDs[i]);
gpu->deleteTestingOnlyBackendTexture(yuvIDs[i]);
}
context->resetContext();

View File

@ -363,10 +363,11 @@ public:
void restoreActiveTraceMarkers();
// creation and deletion of raw texture for testing
virtual GrBackendObject createBackendTexture(void* pixels, int w, int h,
GrPixelConfig config) const = 0;
virtual bool isBackendTexture(GrBackendObject id) const = 0;
virtual void deleteBackendTexture(GrBackendObject id) const = 0;
// only to be used in GPU-specific tests
virtual GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h,
GrPixelConfig config) const = 0;
virtual bool isTestingOnlyBackendTexture(GrBackendObject id) const = 0;
virtual void deleteTestingOnlyBackendTexture(GrBackendObject id) const = 0;
// Given a rt, find or create a stencil buffer and attach it
bool attachStencilAttachmentToRenderTarget(GrRenderTarget* target);

View File

@ -235,10 +235,12 @@ private:
void didRemoveGpuTraceMarker() override {}
GrBackendObject createBackendTexture(void* pixels, int w, int h,
GrPixelConfig config) const override { return 0; }
bool isBackendTexture(GrBackendObject id) const override { return false; }
void deleteBackendTexture(GrBackendObject id) const override {}
GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h,
GrPixelConfig config) const override {
return 0;
}
bool isTestingOnlyBackendTexture(GrBackendObject id) const override { return false; }
void deleteTestingOnlyBackendTexture(GrBackendObject id) const override {}
typedef GrGpu INHERITED;
};

View File

@ -3067,7 +3067,7 @@ void GrGLGpu::didRemoveGpuTraceMarker() {
}
}
GrBackendObject GrGLGpu::createBackendTexture(void* pixels, int w, int h,
GrBackendObject GrGLGpu::createTestingOnlyBackendTexture(void* pixels, int w, int h,
GrPixelConfig config) const {
GrGLuint texID;
GL_CALL(GenTextures(1, &texID));
@ -3091,7 +3091,7 @@ GrBackendObject GrGLGpu::createBackendTexture(void* pixels, int w, int h,
return texID;
}
bool GrGLGpu::isBackendTexture(GrBackendObject id) const {
bool GrGLGpu::isTestingOnlyBackendTexture(GrBackendObject id) const {
GrGLuint texID = (GrGLuint)id;
GrGLboolean result;
@ -3100,7 +3100,7 @@ bool GrGLGpu::isBackendTexture(GrBackendObject id) const {
return (GR_GL_TRUE == result);
}
void GrGLGpu::deleteBackendTexture(GrBackendObject id) const {
void GrGLGpu::deleteTestingOnlyBackendTexture(GrBackendObject id) const {
GrGLuint texID = (GrGLuint)id;
GL_CALL(DeleteTextures(1, &texID));
}

View File

@ -112,10 +112,10 @@ public:
return &this->glContext();
}
GrBackendObject createBackendTexture(void* pixels, int w, int h,
GrPixelConfig config) const override;
bool isBackendTexture(GrBackendObject id) const override;
void deleteBackendTexture(GrBackendObject id) const override;
GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h,
GrPixelConfig config) const override;
bool isTestingOnlyBackendTexture(GrBackendObject id) const override;
void deleteTestingOnlyBackendTexture(GrBackendObject id) const override;
private:
GrGLGpu(GrGLContext* ctx, GrContext* context);

View File

@ -184,8 +184,8 @@ static void test_wrapped_resources(skiatest::Reporter* reporter, GrContext* cont
static const int kW = 100;
static const int kH = 100;
texIDs[0] = gpu->createBackendTexture(NULL, kW, kH, kRGBA_8888_GrPixelConfig);
texIDs[1] = gpu->createBackendTexture(NULL, kW, kH, kRGBA_8888_GrPixelConfig);
texIDs[0] = gpu->createTestingOnlyBackendTexture(NULL, kW, kH, kRGBA_8888_GrPixelConfig);
texIDs[1] = gpu->createTestingOnlyBackendTexture(NULL, kW, kH, kRGBA_8888_GrPixelConfig);
context->resetContext();
@ -212,13 +212,13 @@ static void test_wrapped_resources(skiatest::Reporter* reporter, GrContext* cont
context->flush();
bool borrowedIsAlive = gpu->isBackendTexture(texIDs[0]);
bool adoptedIsAlive = gpu->isBackendTexture(texIDs[1]);
bool borrowedIsAlive = gpu->isTestingOnlyBackendTexture(texIDs[0]);
bool adoptedIsAlive = gpu->isTestingOnlyBackendTexture(texIDs[1]);
REPORTER_ASSERT(reporter, borrowedIsAlive);
REPORTER_ASSERT(reporter, !adoptedIsAlive);
gpu->deleteBackendTexture(texIDs[0]);
gpu->deleteTestingOnlyBackendTexture(texIDs[0]);
context->resetContext();
}

View File

@ -117,8 +117,8 @@ static void test_wrapped_texture_surface(skiatest::Reporter* reporter, GrContext
static const uint32_t kOrigColor = 0xFFAABBCC;
SkAutoTArray<uint32_t> pixels(kW * kH);
sk_memset32(pixels.get(), kOrigColor, kW * kH);
GrBackendObject texID = gpu->createBackendTexture(pixels.get(), kW, kH,
kRGBA_8888_GrPixelConfig);
GrBackendObject texID = gpu->createTestingOnlyBackendTexture(pixels.get(), kW, kH,
kRGBA_8888_GrPixelConfig);
GrBackendTextureDesc wrappedDesc;
wrappedDesc.fConfig = kRGBA_8888_GrPixelConfig;