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

Side by Side 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 unified diff | Download patch
« src/gpu/gl/GrGLGpu.cpp ('K') | « tests/ResourceCacheTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include <functional> 8 #include <functional>
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 desc.fWidth = kWidth; 893 desc.fWidth = kWidth;
894 desc.fHeight = kHeight; 894 desc.fHeight = kHeight;
895 desc.fFlags = kRenderTarget_GrBackendTextureFlag; 895 desc.fFlags = kRenderTarget_GrBackendTextureFlag;
896 desc.fTextureHandle = textureObject; 896 desc.fTextureHandle = textureObject;
897 897
898 SkSurface* surface = SkSurface::NewFromBackendTexture(context, desc, nul lptr); 898 SkSurface* surface = SkSurface::NewFromBackendTexture(context, desc, nul lptr);
899 test_surface_clear(reporter, surface, grSurfaceGetter, 0xABABABAB); 899 test_surface_clear(reporter, surface, grSurfaceGetter, 0xABABABAB);
900 context->getGpu()->deleteTestingOnlyBackendTexture(textureObject); 900 context->getGpu()->deleteTestingOnlyBackendTexture(textureObject);
901 } 901 }
902 } 902 }
903
904 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ExternalTextureSurfaceUsesRenderTargetCache_G pu, reporter,
905 context) {
906
907 static const int kWidth = 10;
908 static const int kHeight = 10;
909 SkAutoTDeleteArray<uint32_t> pixels(new uint32_t[kWidth * kHeight]);
910 memset(pixels.get(), 0xAB, sizeof(uint32_t) * kWidth * kHeight);
911
912 GrBackendObject textureObject =
913 context->getGpu()->createTestingOnlyBackendTexture(pixels.get(), kWi dth, kHeight,
914 kRGBA_8888_GrPixe lConfig);
915 GrBackendTextureDesc desc;
916 desc.fConfig = kRGBA_8888_GrPixelConfig;
917 desc.fWidth = kWidth;
918 desc.fHeight = kHeight;
919 desc.fFlags = kRenderTarget_GrBackendTextureFlag;
920 desc.fTextureHandle = textureObject;
921
922 for (auto sampleCnt : { 0, 4 }) {
923 desc.fSampleCnt = sampleCnt;
924
925 SkAutoTUnref<SkSurface> surface1(
926 SkSurface::NewFromBackendTextureAsRenderTarget(context, desc, nullpt r));
927 GrBackendObject surface1_id;
928 REPORTER_ASSERT(reporter, surface1->getRenderTargetHandle(
929 &surface1_id, SkSurface::kFlushRead_BackendHandleAccess));
930 // TODO: check for clear.
931 SkAutoTUnref<SkSurface> surface2(
932 SkSurface::NewFromBackendTextureAsRenderTarget(context, desc, nullpt r));
933 GrBackendObject surface2_id;
934 REPORTER_ASSERT(reporter, surface2->getRenderTargetHandle(
935 &surface2_id, SkSurface::kFlushRead_BackendHandleAccess));
936 // TODO: check for clear.
937
938 REPORTER_ASSERT(reporter, surface1_id == surface2_id);
939 }
940 context->getGpu()->deleteTestingOnlyBackendTexture(textureObject);
941 }
903 #endif 942 #endif
OLDNEW
« 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