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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 void onPrepareDraws(Target* target) const override { | 49 void onPrepareDraws(Target* target) const override { |
50 class GP : public GrGeometryProcessor { | 50 class GP : public GrGeometryProcessor { |
51 public: | 51 public: |
52 GP(int numAttribs) { | 52 GP(int numAttribs) { |
53 this->initClassID<GP>(); | 53 this->initClassID<GP>(); |
54 SkASSERT(numAttribs > 1); | 54 SkASSERT(numAttribs > 1); |
55 for (auto i = 0; i < numAttribs; ++i) { | 55 for (auto i = 0; i < numAttribs; ++i) { |
56 fAttribNames.push_back().printf("attr%d", i); | 56 fAttribNames.push_back().printf("attr%d", i); |
57 } | 57 } |
58 for (auto i = 0; i < numAttribs; ++i) { | 58 for (auto i = 0; i < numAttribs; ++i) { |
59 Attribute attribute; | 59 this->addVertexAttrib(fAttribNames[i].c_str(), kVec2f_GrVert
exAttribType); |
60 attribute.fType = kVec2f_GrVertexAttribType; | |
61 attribute.fName = fAttribNames[i].c_str(); | |
62 attribute.fOffset = 2 * sizeof(float) * i; | |
63 attribute.fPrecision = kDefault_GrSLPrecision; | |
64 this->addVertexAttrib(attribute); | |
65 } | 60 } |
66 }; | 61 }; |
67 const char* name() const override { return "Dummy GP"; } | 62 const char* name() const override { return "Dummy GP"; } |
68 | 63 |
69 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) cons
t override { | 64 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) cons
t override { |
70 class GLSLGP : public GrGLSLGeometryProcessor { | 65 class GLSLGP : public GrGLSLGeometryProcessor { |
71 public: | 66 public: |
72 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { | 67 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { |
73 const GP& gp = args.fGP.cast<GP>(); | 68 const GP& gp = args.fGP.cast<GP>(); |
74 args.fVaryingHandler->emitAttributes(gp); | 69 args.fVaryingHandler->emitAttributes(gp); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // This one should fail. | 131 // This one should fail. |
137 batch.reset(new Batch(attribCnt+1)); | 132 batch.reset(new Batch(attribCnt+1)); |
138 drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch); | 133 drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch); |
139 context->flush(); | 134 context->flush(); |
140 #if GR_GPU_STATS | 135 #if GR_GPU_STATS |
141 REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0); | 136 REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0); |
142 REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 1)
; | 137 REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 1)
; |
143 #endif | 138 #endif |
144 } | 139 } |
145 #endif | 140 #endif |
OLD | NEW |