| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 SkAutoTUnref<GrTexture> bigRT(cache->createTexture(bigDesc, false)); | 115 SkAutoTUnref<GrTexture> bigRT(cache->createTexture(bigDesc, false)); |
| 116 if (bigRT && bigRT->asRenderTarget()) { | 116 if (bigRT && bigRT->asRenderTarget()) { |
| 117 bigRT->asRenderTarget()->renderTargetPriv().attachStencilAttachment(); | 117 bigRT->asRenderTarget()->renderTargetPriv().attachStencilAttachment(); |
| 118 } | 118 } |
| 119 REPORTER_ASSERT(reporter, | 119 REPORTER_ASSERT(reporter, |
| 120 smallRT0 && bigRT && | 120 smallRT0 && bigRT && |
| 121 smallRT0->asRenderTarget() && bigRT->asRenderTarget() && | 121 smallRT0->asRenderTarget() && bigRT->asRenderTarget() && |
| 122 smallRT0->asRenderTarget()->renderTargetPriv().getStencilAtt
achment() != | 122 smallRT0->asRenderTarget()->renderTargetPriv().getStencilAtt
achment() != |
| 123 bigRT->asRenderTarget()->renderTargetPriv().getStencilAttach
ment()); | 123 bigRT->asRenderTarget()->renderTargetPriv().getStencilAttach
ment()); |
| 124 | 124 |
| 125 if (context->getMaxSampleCount() >= 4) { | 125 if (context->caps()->maxSampleCount() >= 4) { |
| 126 // An RT with a different sample count should not share. | 126 // An RT with a different sample count should not share. |
| 127 GrSurfaceDesc smallMSAADesc = smallDesc; | 127 GrSurfaceDesc smallMSAADesc = smallDesc; |
| 128 smallMSAADesc.fSampleCnt = 4; | 128 smallMSAADesc.fSampleCnt = 4; |
| 129 SkAutoTUnref<GrTexture> smallMSAART0(cache->createTexture(smallMSAADesc,
false)); | 129 SkAutoTUnref<GrTexture> smallMSAART0(cache->createTexture(smallMSAADesc,
false)); |
| 130 if (smallMSAART0 && smallMSAART0->asRenderTarget()) { | 130 if (smallMSAART0 && smallMSAART0->asRenderTarget()) { |
| 131 smallMSAART0->asRenderTarget()->renderTargetPriv().attachStencilAtta
chment(); | 131 smallMSAART0->asRenderTarget()->renderTargetPriv().attachStencilAtta
chment(); |
| 132 } | 132 } |
| 133 #ifdef SK_BUILD_FOR_ANDROID | 133 #ifdef SK_BUILD_FOR_ANDROID |
| 134 if (!smallMSAART0) { | 134 if (!smallMSAART0) { |
| 135 // The nexus player seems to fail to create MSAA textures. | 135 // The nexus player seems to fail to create MSAA textures. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 147 smallMSAART1->asRenderTarget()->renderTargetPriv().attachStencilAtta
chment(); | 147 smallMSAART1->asRenderTarget()->renderTargetPriv().attachStencilAtta
chment(); |
| 148 } | 148 } |
| 149 REPORTER_ASSERT(reporter, | 149 REPORTER_ASSERT(reporter, |
| 150 smallMSAART0 && smallMSAART1 && | 150 smallMSAART0 && smallMSAART1 && |
| 151 smallMSAART0->asRenderTarget() && | 151 smallMSAART0->asRenderTarget() && |
| 152 smallMSAART1->asRenderTarget() && | 152 smallMSAART1->asRenderTarget() && |
| 153 smallMSAART0->asRenderTarget()->renderTargetPriv().getSt
encilAttachment() == | 153 smallMSAART0->asRenderTarget()->renderTargetPriv().getSt
encilAttachment() == |
| 154 smallMSAART1->asRenderTarget()->renderTargetPriv().getSt
encilAttachment()); | 154 smallMSAART1->asRenderTarget()->renderTargetPriv().getSt
encilAttachment()); |
| 155 // But not one with a larger sample count should not. (Also check that t
he request for 4 | 155 // But not one with a larger sample count should not. (Also check that t
he request for 4 |
| 156 // samples didn't get rounded up to >= 8 or else they could share.). | 156 // samples didn't get rounded up to >= 8 or else they could share.). |
| 157 if (context->getMaxSampleCount() >= 8 && smallMSAART0 && smallMSAART0->a
sRenderTarget() && | 157 if (context->caps()->maxSampleCount() >= 8 && |
| 158 smallMSAART0 && smallMSAART0->asRenderTarget() && |
| 158 smallMSAART0->asRenderTarget()->numSamples() < 8) { | 159 smallMSAART0->asRenderTarget()->numSamples() < 8) { |
| 159 smallMSAADesc.fSampleCnt = 8; | 160 smallMSAADesc.fSampleCnt = 8; |
| 160 smallMSAART1.reset(cache->createTexture(smallMSAADesc, false)); | 161 smallMSAART1.reset(cache->createTexture(smallMSAADesc, false)); |
| 161 SkAutoTUnref<GrTexture> smallMSAART1(cache->createTexture(smallMSAAD
esc, false)); | 162 SkAutoTUnref<GrTexture> smallMSAART1(cache->createTexture(smallMSAAD
esc, false)); |
| 162 if (smallMSAART1 && smallMSAART1->asRenderTarget()) { | 163 if (smallMSAART1 && smallMSAART1->asRenderTarget()) { |
| 163 smallMSAART1->asRenderTarget()->renderTargetPriv().attachStencil
Attachment(); | 164 smallMSAART1->asRenderTarget()->renderTargetPriv().attachStencil
Attachment(); |
| 164 } | 165 } |
| 165 REPORTER_ASSERT(reporter, | 166 REPORTER_ASSERT(reporter, |
| 166 smallMSAART0 && smallMSAART1 && | 167 smallMSAART0 && smallMSAART1 && |
| 167 smallMSAART0->asRenderTarget() && | 168 smallMSAART0->asRenderTarget() && |
| (...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1205 test_scratch_key_consistency(reporter); | 1206 test_scratch_key_consistency(reporter); |
| 1206 test_purge_invalidated(reporter); | 1207 test_purge_invalidated(reporter); |
| 1207 test_cache_chained_purge(reporter); | 1208 test_cache_chained_purge(reporter); |
| 1208 test_resource_size_changed(reporter); | 1209 test_resource_size_changed(reporter); |
| 1209 test_timestamp_wrap(reporter); | 1210 test_timestamp_wrap(reporter); |
| 1210 test_flush(reporter); | 1211 test_flush(reporter); |
| 1211 test_large_resource_count(reporter); | 1212 test_large_resource_count(reporter); |
| 1212 } | 1213 } |
| 1213 | 1214 |
| 1214 #endif | 1215 #endif |
| OLD | NEW |