| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 // This is a GPU-backend specific test. It relies on static intializers to work | 8 // This is a GPU-backend specific test. It relies on static intializers to work |
| 9 | 9 |
| 10 #include "SkTypes.h" | 10 #include "SkTypes.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 desc.fHeight = 1; | 107 desc.fHeight = 1; |
| 108 desc.fWidth = 1; | 108 desc.fWidth = 1; |
| 109 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 109 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 110 desc.fConfig = kRGBA_8888_GrPixelConfig; | 110 desc.fConfig = kRGBA_8888_GrPixelConfig; |
| 111 SkAutoTUnref<GrTexture> target(context->textureProvider()->createTexture(des
c, | 111 SkAutoTUnref<GrTexture> target(context->textureProvider()->createTexture(des
c, |
| 112 SkB
udgeted::kYes)); | 112 SkB
udgeted::kYes)); |
| 113 if (!target) { | 113 if (!target) { |
| 114 ERRORF(reporter, "Could not create render target."); | 114 ERRORF(reporter, "Could not create render target."); |
| 115 return; | 115 return; |
| 116 } | 116 } |
| 117 SkAutoTUnref<GrDrawContext> dc(context->drawContext(target->asRenderTarget()
)); | 117 sk_sp<GrDrawContext> dc(context->drawContext(sk_ref_sp(target->asRenderTarge
t()))); |
| 118 if (!dc) { | 118 if (!dc) { |
| 119 ERRORF(reporter, "Could not create draw context."); | 119 ERRORF(reporter, "Could not create draw context."); |
| 120 return; | 120 return; |
| 121 } | 121 } |
| 122 int attribCnt = context->caps()->maxVertexAttributes(); | 122 int attribCnt = context->caps()->maxVertexAttributes(); |
| 123 if (!attribCnt) { | 123 if (!attribCnt) { |
| 124 ERRORF(reporter, "No attributes allowed?!"); | 124 ERRORF(reporter, "No attributes allowed?!"); |
| 125 return; | 125 return; |
| 126 } | 126 } |
| 127 context->flush(); | 127 context->flush(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 145 // This one should fail. | 145 // This one should fail. |
| 146 batch.reset(new Batch(attribCnt+1)); | 146 batch.reset(new Batch(attribCnt+1)); |
| 147 dc->drawContextPriv().testingOnly_drawBatch(pb, batch); | 147 dc->drawContextPriv().testingOnly_drawBatch(pb, batch); |
| 148 context->flush(); | 148 context->flush(); |
| 149 #if GR_GPU_STATS | 149 #if GR_GPU_STATS |
| 150 REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0); | 150 REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0); |
| 151 REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 1)
; | 151 REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 1)
; |
| 152 #endif | 152 #endif |
| 153 } | 153 } |
| 154 #endif | 154 #endif |
| OLD | NEW |