OLD | NEW |
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 12 matching lines...) Expand all Loading... |
23 #include "SkCanvas.h" | 23 #include "SkCanvas.h" |
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_GL_RENDERING_CONTEXTS(ResourceCacheCache, reporter, ctxInfo) { | 33 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheCache, reporter, ctxInfo) { |
34 GrContext* context = ctxInfo.fGrContext; | 34 GrContext* context = ctxInfo.fGrContext; |
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 |
(...skipping 29 matching lines...) Expand all Loading... |
73 size_t curCacheSize; | 73 size_t curCacheSize; |
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_GL_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, ctx
Info) { | 83 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, ctxInf
o) { |
84 GrContext* context = ctxInfo.fGrContext; | 84 GrContext* context = ctxInfo.fGrContext; |
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(); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 REPORTER_ASSERT(reporter, | 181 REPORTER_ASSERT(reporter, |
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_GL_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, c
txInfo) { | 191 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI
nfo) { |
192 GrContext* context = ctxInfo.fGrContext; | 192 GrContext* context = ctxInfo.fGrContext; |
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; |
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 test_cache_chained_purge(reporter); | 1311 test_cache_chained_purge(reporter); |
1312 test_resource_size_changed(reporter); | 1312 test_resource_size_changed(reporter); |
1313 test_timestamp_wrap(reporter); | 1313 test_timestamp_wrap(reporter); |
1314 test_flush(reporter); | 1314 test_flush(reporter); |
1315 test_large_resource_count(reporter); | 1315 test_large_resource_count(reporter); |
1316 test_custom_data(reporter); | 1316 test_custom_data(reporter); |
1317 test_abandoned(reporter); | 1317 test_abandoned(reporter); |
1318 } | 1318 } |
1319 | 1319 |
1320 #endif | 1320 #endif |
OLD | NEW |