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

Side by Side Diff: tests/ResourceCacheTest.cpp

Issue 1966013002: Turn ContextInfos returned by GrContextFactory into structs. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Address comment Created 4 years, 7 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
« no previous file with comments | « tests/RectangleTextureTest.cpp ('k') | tests/SRGBReadWritePixelsTest.cpp » ('j') | 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 here to ensure SK_SUPPORT_GPU is set correctly before it is examined. 8 // Include here to ensure SK_SUPPORT_GPU is set correctly before it is examined.
9 #include "SkTypes.h" 9 #include "SkTypes.h"
10 10
(...skipping 13 matching lines...) Expand all
24 #include "SkGr.h" 24 #include "SkGr.h"
25 #include "SkMessageBus.h" 25 #include "SkMessageBus.h"
26 #include "SkSurface.h" 26 #include "SkSurface.h"
27 #include "Test.h" 27 #include "Test.h"
28 28
29 static const int gWidth = 640; 29 static const int gWidth = 640;
30 static const int gHeight = 480; 30 static const int gHeight = 480;
31 31
32 //////////////////////////////////////////////////////////////////////////////// 32 ////////////////////////////////////////////////////////////////////////////////
33 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheCache, reporter, ctxInfo) { 33 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheCache, reporter, ctxInfo) {
34 GrContext* context = ctxInfo.fGrContext; 34 GrContext* context = ctxInfo.grContext();
35 GrSurfaceDesc desc; 35 GrSurfaceDesc desc;
36 desc.fConfig = kSkia8888_GrPixelConfig; 36 desc.fConfig = kSkia8888_GrPixelConfig;
37 desc.fFlags = kRenderTarget_GrSurfaceFlag; 37 desc.fFlags = kRenderTarget_GrSurfaceFlag;
38 desc.fWidth = gWidth; 38 desc.fWidth = gWidth;
39 desc.fHeight = gHeight; 39 desc.fHeight = gHeight;
40 SkImageInfo info = SkImageInfo::MakeN32Premul(gWidth, gHeight); 40 SkImageInfo info = SkImageInfo::MakeN32Premul(gWidth, gHeight);
41 auto surface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info)); 41 auto surface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info));
42 SkCanvas* canvas = surface->getCanvas(); 42 SkCanvas* canvas = surface->getCanvas();
43 43
44 const SkIRect size = SkIRect::MakeWH(gWidth, gHeight); 44 const SkIRect size = SkIRect::MakeWH(gWidth, gHeight);
(...skipping 29 matching lines...) Expand all
74 context->getResourceCacheUsage(nullptr, &curCacheSize); 74 context->getResourceCacheUsage(nullptr, &curCacheSize);
75 75
76 // we should never go over the size limit 76 // we should never go over the size limit
77 REPORTER_ASSERT(reporter, curCacheSize <= maxCacheSize); 77 REPORTER_ASSERT(reporter, curCacheSize <= maxCacheSize);
78 } 78 }
79 79
80 context->setResourceCacheLimits(oldMaxNum, oldMaxBytes); 80 context->setResourceCacheLimits(oldMaxNum, oldMaxBytes);
81 } 81 }
82 82
83 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, ctxInf o) { 83 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, ctxInf o) {
84 GrContext* context = ctxInfo.fGrContext; 84 GrContext* context = ctxInfo.grContext();
85 GrSurfaceDesc smallDesc; 85 GrSurfaceDesc smallDesc;
86 smallDesc.fFlags = kRenderTarget_GrSurfaceFlag; 86 smallDesc.fFlags = kRenderTarget_GrSurfaceFlag;
87 smallDesc.fConfig = kSkia8888_GrPixelConfig; 87 smallDesc.fConfig = kSkia8888_GrPixelConfig;
88 smallDesc.fWidth = 4; 88 smallDesc.fWidth = 4;
89 smallDesc.fHeight = 4; 89 smallDesc.fHeight = 4;
90 smallDesc.fSampleCnt = 0; 90 smallDesc.fSampleCnt = 0;
91 91
92 GrTextureProvider* cache = context->textureProvider(); 92 GrTextureProvider* cache = context->textureProvider();
93 GrResourceProvider* resourceProvider = context->resourceProvider(); 93 GrResourceProvider* resourceProvider = context->resourceProvider();
94 // Test that two budgeted RTs with the same desc share a stencil buffer. 94 // Test that two budgeted RTs with the same desc share a stencil buffer.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 smallMSAART0 && smallMSAART1 && 182 smallMSAART0 && smallMSAART1 &&
183 smallMSAART0->asRenderTarget() && 183 smallMSAART0->asRenderTarget() &&
184 smallMSAART1->asRenderTarget() && 184 smallMSAART1->asRenderTarget() &&
185 resourceProvider->attachStencilAttachment(smallMSAART0-> asRenderTarget()) != 185 resourceProvider->attachStencilAttachment(smallMSAART0-> asRenderTarget()) !=
186 resourceProvider->attachStencilAttachment(smallMSAART1-> asRenderTarget())); 186 resourceProvider->attachStencilAttachment(smallMSAART1-> asRenderTarget()));
187 } 187 }
188 } 188 }
189 } 189 }
190 190
191 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI nfo) { 191 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI nfo) {
192 GrContext* context = ctxInfo.fGrContext; 192 GrContext* context = ctxInfo.grContext();
193 GrGpu* gpu = context->getGpu(); 193 GrGpu* gpu = context->getGpu();
194 // this test is only valid for GL 194 // this test is only valid for GL
195 if (!gpu || !gpu->glContextForTesting()) { 195 if (!gpu || !gpu->glContextForTesting()) {
196 return; 196 return;
197 } 197 }
198 198
199 GrBackendObject texHandles[2]; 199 GrBackendObject texHandles[2];
200 static const int kW = 100; 200 static const int kW = 100;
201 static const int kH = 100; 201 static const int kH = 100;
202 202
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 test_cache_chained_purge(reporter); 1318 test_cache_chained_purge(reporter);
1319 test_resource_size_changed(reporter); 1319 test_resource_size_changed(reporter);
1320 test_timestamp_wrap(reporter); 1320 test_timestamp_wrap(reporter);
1321 test_flush(reporter); 1321 test_flush(reporter);
1322 test_large_resource_count(reporter); 1322 test_large_resource_count(reporter);
1323 test_custom_data(reporter); 1323 test_custom_data(reporter);
1324 test_abandoned(reporter); 1324 test_abandoned(reporter);
1325 } 1325 }
1326 1326
1327 #endif 1327 #endif
OLDNEW
« no previous file with comments | « tests/RectangleTextureTest.cpp ('k') | tests/SRGBReadWritePixelsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698