| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 void getGLSLProcessorKey(const GrGLSLCaps&, | 82 void getGLSLProcessorKey(const GrGLSLCaps&, |
| 83 GrProcessorKeyBuilder* builder) const overr
ide { | 83 GrProcessorKeyBuilder* builder) const overr
ide { |
| 84 builder->add32(this->numAttribs()); | 84 builder->add32(this->numAttribs()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 private: | 87 private: |
| 88 SkTArray<SkString> fAttribNames; | 88 SkTArray<SkString> fAttribNames; |
| 89 }; | 89 }; |
| 90 SkAutoTUnref<GrGeometryProcessor> gp(new GP(fNumAttribs)); | 90 SkAutoTUnref<GrGeometryProcessor> gp(new GP(fNumAttribs)); |
| 91 target->initDraw(gp); | |
| 92 QuadHelper helper; | 91 QuadHelper helper; |
| 93 size_t vertexStride = gp->getVertexStride(); | 92 size_t vertexStride = gp->getVertexStride(); |
| 94 SkPoint* vertices = reinterpret_cast<SkPoint*>(helper.init(target, verte
xStride, 1)); | 93 SkPoint* vertices = reinterpret_cast<SkPoint*>(helper.init(target, verte
xStride, 1)); |
| 95 vertices->setRectFan(0.f, 0.f, 1.f, 1.f, vertexStride); | 94 vertices->setRectFan(0.f, 0.f, 1.f, 1.f, vertexStride); |
| 96 helper.recordDraw(target); | 95 helper.recordDraw(target, gp); |
| 97 } | 96 } |
| 98 | 97 |
| 99 int fNumAttribs; | 98 int fNumAttribs; |
| 100 | 99 |
| 101 typedef GrVertexBatch INHERITED; | 100 typedef GrVertexBatch INHERITED; |
| 102 }; | 101 }; |
| 103 } | 102 } |
| 104 | 103 |
| 105 DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, context) { | 104 DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, context) { |
| 106 GrTextureDesc desc; | 105 GrTextureDesc desc; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // This one should fail. | 144 // This one should fail. |
| 146 batch.reset(new Batch(attribCnt+1)); | 145 batch.reset(new Batch(attribCnt+1)); |
| 147 dc->drawContextPriv().testingOnly_drawBatch(pb, batch); | 146 dc->drawContextPriv().testingOnly_drawBatch(pb, batch); |
| 148 context->flush(); | 147 context->flush(); |
| 149 #if GR_GPU_STATS | 148 #if GR_GPU_STATS |
| 150 REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0); | 149 REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0); |
| 151 REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 1)
; | 150 REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 1)
; |
| 152 #endif | 151 #endif |
| 153 } | 152 } |
| 154 #endif | 153 #endif |
| OLD | NEW |