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

Side by Side Diff: src/gpu/batches/GrAAConvexPathRenderer.cpp

Issue 1441683008: Move GrGLPrimitive/GeometryProc to GLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@xferProcs
Patch Set: nits Created 5 years, 1 month 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
« no previous file with comments | « src/gpu/GrPrimitiveProcessor.h ('k') | src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 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 #include "GrAAConvexPathRenderer.h" 9 #include "GrAAConvexPathRenderer.h"
10 10
11 #include "GrAAConvexTessellator.h" 11 #include "GrAAConvexTessellator.h"
12 #include "GrBatchFlushState.h" 12 #include "GrBatchFlushState.h"
13 #include "GrBatchTest.h" 13 #include "GrBatchTest.h"
14 #include "GrCaps.h" 14 #include "GrCaps.h"
15 #include "GrContext.h" 15 #include "GrContext.h"
16 #include "GrDefaultGeoProcFactory.h" 16 #include "GrDefaultGeoProcFactory.h"
17 #include "GrGeometryProcessor.h" 17 #include "GrGeometryProcessor.h"
18 #include "GrInvariantOutput.h" 18 #include "GrInvariantOutput.h"
19 #include "GrPathUtils.h" 19 #include "GrPathUtils.h"
20 #include "GrProcessor.h" 20 #include "GrProcessor.h"
21 #include "GrPipelineBuilder.h" 21 #include "GrPipelineBuilder.h"
22 #include "GrStrokeInfo.h" 22 #include "GrStrokeInfo.h"
23 #include "SkGeometry.h" 23 #include "SkGeometry.h"
24 #include "SkPathPriv.h" 24 #include "SkPathPriv.h"
25 #include "SkString.h" 25 #include "SkString.h"
26 #include "SkTraceEvent.h" 26 #include "SkTraceEvent.h"
27 #include "batches/GrVertexBatch.h" 27 #include "batches/GrVertexBatch.h"
28 #include "gl/GrGLGeometryProcessor.h" 28 #include "glsl/GrGLSLGeometryProcessor.h"
29 #include "glsl/GrGLSLProgramBuilder.h" 29 #include "glsl/GrGLSLProgramBuilder.h"
30 #include "glsl/GrGLSLProgramDataManager.h" 30 #include "glsl/GrGLSLProgramDataManager.h"
31 31
32 GrAAConvexPathRenderer::GrAAConvexPathRenderer() { 32 GrAAConvexPathRenderer::GrAAConvexPathRenderer() {
33 } 33 }
34 34
35 struct Segment { 35 struct Segment {
36 enum { 36 enum {
37 // These enum values are assumed in member functions below. 37 // These enum values are assumed in member functions below.
38 kLine = 0, 38 kLine = 0,
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 534
535 const char* name() const override { return "QuadEdge"; } 535 const char* name() const override { return "QuadEdge"; }
536 536
537 const Attribute* inPosition() const { return fInPosition; } 537 const Attribute* inPosition() const { return fInPosition; }
538 const Attribute* inQuadEdge() const { return fInQuadEdge; } 538 const Attribute* inQuadEdge() const { return fInQuadEdge; }
539 GrColor color() const { return fColor; } 539 GrColor color() const { return fColor; }
540 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } 540 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; }
541 const SkMatrix& localMatrix() const { return fLocalMatrix; } 541 const SkMatrix& localMatrix() const { return fLocalMatrix; }
542 bool usesLocalCoords() const { return fUsesLocalCoords; } 542 bool usesLocalCoords() const { return fUsesLocalCoords; }
543 543
544 class GLProcessor : public GrGLGeometryProcessor { 544 class GLProcessor : public GrGLSLGeometryProcessor {
545 public: 545 public:
546 GLProcessor() 546 GLProcessor()
547 : fColor(GrColor_ILLEGAL) {} 547 : fColor(GrColor_ILLEGAL) {}
548 548
549 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { 549 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
550 const QuadEdgeEffect& qe = args.fGP.cast<QuadEdgeEffect>(); 550 const QuadEdgeEffect& qe = args.fGP.cast<QuadEdgeEffect>();
551 GrGLSLGPBuilder* pb = args.fPB; 551 GrGLSLGPBuilder* pb = args.fPB;
552 GrGLSLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder(); 552 GrGLSLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
553 553
554 // emit attributes 554 // emit attributes
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 const GrGLSLProgramDataManager& pdman, 620 const GrGLSLProgramDataManager& pdman,
621 int index, 621 int index,
622 const SkTArray<const GrCoordTransform*, true>& tra nsforms) override { 622 const SkTArray<const GrCoordTransform*, true>& tra nsforms) override {
623 this->setTransformDataHelper<QuadEdgeEffect>(primProc, pdman, index, transforms); 623 this->setTransformDataHelper<QuadEdgeEffect>(primProc, pdman, index, transforms);
624 } 624 }
625 625
626 private: 626 private:
627 GrColor fColor; 627 GrColor fColor;
628 UniformHandle fColorUniform; 628 UniformHandle fColorUniform;
629 629
630 typedef GrGLGeometryProcessor INHERITED; 630 typedef GrGLSLGeometryProcessor INHERITED;
631 }; 631 };
632 632
633 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con st override { 633 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con st override {
634 GLProcessor::GenKey(*this, caps, b); 634 GLProcessor::GenKey(*this, caps, b);
635 } 635 }
636 636
637 GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override { 637 GrGLSLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override {
638 return new GLProcessor(); 638 return new GLProcessor();
639 } 639 }
640 640
641 private: 641 private:
642 QuadEdgeEffect(GrColor color, const SkMatrix& localMatrix, bool usesLocalCoo rds) 642 QuadEdgeEffect(GrColor color, const SkMatrix& localMatrix, bool usesLocalCoo rds)
643 : fColor(color) 643 : fColor(color)
644 , fLocalMatrix(localMatrix) 644 , fLocalMatrix(localMatrix)
645 , fUsesLocalCoords(usesLocalCoords) { 645 , fUsesLocalCoords(usesLocalCoords) {
646 this->initClassID<QuadEdgeEffect>(); 646 this->initClassID<QuadEdgeEffect>();
647 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType)); 647 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType));
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) { 1007 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) {
1008 AAConvexPathBatch::Geometry geometry; 1008 AAConvexPathBatch::Geometry geometry;
1009 geometry.fColor = GrRandomColor(random); 1009 geometry.fColor = GrRandomColor(random);
1010 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); 1010 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random);
1011 geometry.fPath = GrTest::TestPathConvex(random); 1011 geometry.fPath = GrTest::TestPathConvex(random);
1012 1012
1013 return AAConvexPathBatch::Create(geometry); 1013 return AAConvexPathBatch::Create(geometry);
1014 } 1014 }
1015 1015
1016 #endif 1016 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrPrimitiveProcessor.h ('k') | src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698