Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Unified Diff: tests/SurfaceTest.cpp

Issue 1810323002: Cache render targets that render to wrapped textures Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/gpu/gl/GrGLGpu.cpp ('K') | « tests/ResourceCacheTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SurfaceTest.cpp
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 89c7765c5601326a1bc6b1ce84cf024d6ece1329..8cf880339dac2883f899c4c86c6f7f0ca69c8247 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -900,4 +900,43 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceClear_Gpu, reporter, context) {
context->getGpu()->deleteTestingOnlyBackendTexture(textureObject);
}
}
+
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ExternalTextureSurfaceUsesRenderTargetCache_Gpu, reporter,
+ context) {
+
+ static const int kWidth = 10;
+ static const int kHeight = 10;
+ SkAutoTDeleteArray<uint32_t> pixels(new uint32_t[kWidth * kHeight]);
+ memset(pixels.get(), 0xAB, sizeof(uint32_t) * kWidth * kHeight);
+
+ GrBackendObject textureObject =
+ context->getGpu()->createTestingOnlyBackendTexture(pixels.get(), kWidth, kHeight,
+ kRGBA_8888_GrPixelConfig);
+ GrBackendTextureDesc desc;
+ desc.fConfig = kRGBA_8888_GrPixelConfig;
+ desc.fWidth = kWidth;
+ desc.fHeight = kHeight;
+ desc.fFlags = kRenderTarget_GrBackendTextureFlag;
+ desc.fTextureHandle = textureObject;
+
+ for (auto sampleCnt : { 0, 4 }) {
+ desc.fSampleCnt = sampleCnt;
+
+ SkAutoTUnref<SkSurface> surface1(
+ SkSurface::NewFromBackendTextureAsRenderTarget(context, desc, nullptr));
+ GrBackendObject surface1_id;
+ REPORTER_ASSERT(reporter, surface1->getRenderTargetHandle(
+ &surface1_id, SkSurface::kFlushRead_BackendHandleAccess));
+ // TODO: check for clear.
+ SkAutoTUnref<SkSurface> surface2(
+ SkSurface::NewFromBackendTextureAsRenderTarget(context, desc, nullptr));
+ GrBackendObject surface2_id;
+ REPORTER_ASSERT(reporter, surface2->getRenderTargetHandle(
+ &surface2_id, SkSurface::kFlushRead_BackendHandleAccess));
+ // TODO: check for clear.
+
+ REPORTER_ASSERT(reporter, surface1_id == surface2_id);
+ }
+ context->getGpu()->deleteTestingOnlyBackendTexture(textureObject);
+}
#endif
« src/gpu/gl/GrGLGpu.cpp ('K') | « tests/ResourceCacheTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698