OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2016 Google Inc. | 3 * Copyright 2016 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 // This is a GPU-backend specific test. It relies on static intializers to work | 9 // This is a GPU-backend specific test. It relies on static intializers to work |
10 | 10 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 82 } |
83 void getGLSLProcessorKey(const GrGLSLCaps&, | 83 void getGLSLProcessorKey(const GrGLSLCaps&, |
84 GrProcessorKeyBuilder* builder) const overr
ide { | 84 GrProcessorKeyBuilder* builder) const overr
ide { |
85 builder->add32(this->numAttribs()); | 85 builder->add32(this->numAttribs()); |
86 } | 86 } |
87 | 87 |
88 private: | 88 private: |
89 SkTArray<SkString> fAttribNames; | 89 SkTArray<SkString> fAttribNames; |
90 }; | 90 }; |
91 SkAutoTUnref<GrGeometryProcessor> gp(new GP(fNumAttribs)); | 91 SkAutoTUnref<GrGeometryProcessor> gp(new GP(fNumAttribs)); |
92 target->initDraw(gp); | |
93 QuadHelper helper; | 92 QuadHelper helper; |
94 size_t vertexStride = gp->getVertexStride(); | 93 size_t vertexStride = gp->getVertexStride(); |
95 SkPoint* vertices = reinterpret_cast<SkPoint*>(helper.init(target, verte
xStride, 1)); | 94 SkPoint* vertices = reinterpret_cast<SkPoint*>(helper.init(target, verte
xStride, 1)); |
96 vertices->setRectFan(0.f, 0.f, 1.f, 1.f, vertexStride); | 95 vertices->setRectFan(0.f, 0.f, 1.f, 1.f, vertexStride); |
97 helper.recordDraw(target); | 96 helper.recordDraw(target, gp); |
98 } | 97 } |
99 | 98 |
100 int fNumAttribs; | 99 int fNumAttribs; |
101 | 100 |
102 typedef GrVertexBatch INHERITED; | 101 typedef GrVertexBatch INHERITED; |
103 }; | 102 }; |
104 } | 103 } |
105 | 104 |
106 DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, context) { | 105 DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, context) { |
107 GrTextureDesc desc; | 106 GrTextureDesc desc; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // This one should fail. | 145 // This one should fail. |
147 batch.reset(new Batch(attribCnt+1)); | 146 batch.reset(new Batch(attribCnt+1)); |
148 dc->drawContextPriv().testingOnly_drawBatch(pb, batch); | 147 dc->drawContextPriv().testingOnly_drawBatch(pb, batch); |
149 context->flush(); | 148 context->flush(); |
150 #if GR_GPU_STATS | 149 #if GR_GPU_STATS |
151 REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0); | 150 REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0); |
152 REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 1)
; | 151 REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 1)
; |
153 #endif | 152 #endif |
154 } | 153 } |
155 #endif | 154 #endif |
OLD | NEW |