Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: src/gpu/GrGeometryProcessor.cpp

Issue 1404473003: Add passthrough GP for cases where no color or coverage should be emitted by GP (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/gpu/GrGeometryProcessor.h ('K') | « src/gpu/GrGeometryProcessor.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "GrGeometryProcessor.h"
9 #include "gl/GrGLGeometryProcessor.h"
10 #include "gl/builders/GrGLProgramBuilder.h"
11 #include "gl/builders/GrGLVertexShaderBuilder.h"
12
13 const GrGeometryProcessor* GrGeometryProcessor::CreatePassthroughGP(size_t verte xStride) {
14 class NullGP : public GrGeometryProcessor {
15 public:
16 NullGP(size_t vertexStride) {
17 this->initClassID<NullGP>();
18 fPosAttr = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrV ertexAttribType));
19 // Must call this after setting fPosAttr as that function adds 2 flo ats to the vertex
20 // stride.
21 SkASSERT(vertexStride >= sizeof(float) * 2);
22 fVertexStride = vertexStride;
23 }
24
25 const char* name() const override { return "Null"; }
26
27 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override {}
28
29 GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps& caps) const o verride {
30 class GLGP : public GrGLGeometryProcessor {
31 private:
32 void onEmitCode(EmitArgs& emitArgs, GrGPArgs* gpArgs) override {
33 SkASSERT(!emitArgs.fTransformsIn.count());
34 const NullGP& gp = emitArgs.fGP.cast<NullGP>();
35 GrGLGPBuilder* pb = emitArgs.fPB;
36 GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
37 vsBuilder->emitAttributes(gp);
38 this->setupPosition(pb, gpArgs, gp.fPosAttr->fName);
39 }
40 void setData(const GrGLProgramDataManager&, const GrPrimitivePro cessor&) override {}
41 };
42 return new GLGP();
43 }
44 private:
45 const Attribute* fPosAttr;
46 };
47 return new NullGP(vertexStride);
48 }
OLDNEW
« src/gpu/GrGeometryProcessor.h ('K') | « src/gpu/GrGeometryProcessor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698