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

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

Issue 1812223002: added support for glMinSampleShading (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: updated for Jim's change Created 4 years, 8 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
« no previous file with comments | « src/gpu/GrCaps.cpp ('k') | src/gpu/GrPrimitiveProcessor.h » ('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 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 #ifndef GrGeometryProcessor_DEFINED 8 #ifndef GrGeometryProcessor_DEFINED
9 #define GrGeometryProcessor_DEFINED 9 #define GrGeometryProcessor_DEFINED
10 10
11 #include "GrPrimitiveProcessor.h" 11 #include "GrPrimitiveProcessor.h"
12 12
13 /** 13 /**
14 * A GrGeometryProcessor is a flexible method for rendering a primitive. The Gr GeometryProcessor 14 * A GrGeometryProcessor is a flexible method for rendering a primitive. The Gr GeometryProcessor
15 * has complete control over vertex attributes and uniforms(aside from the rende r target) but it 15 * has complete control over vertex attributes and uniforms(aside from the rende r target) but it
16 * must obey the same contract as any GrPrimitiveProcessor, specifically it must emit a color and 16 * must obey the same contract as any GrPrimitiveProcessor, specifically it must emit a color and
17 * coverage into the fragment shader. Where this color and coverage come from i s completely the 17 * coverage into the fragment shader. Where this color and coverage come from i s completely the
18 * responsibility of the GrGeometryProcessor. 18 * responsibility of the GrGeometryProcessor.
19 */ 19 */
20 class GrGeometryProcessor : public GrPrimitiveProcessor { 20 class GrGeometryProcessor : public GrPrimitiveProcessor {
21 public: 21 public:
22 GrGeometryProcessor() 22 GrGeometryProcessor()
23 : fWillUseGeoShader(false) 23 : fWillUseGeoShader(false)
24 , fLocalCoordsType(kUnused_LocalCoordsType) {} 24 , fLocalCoordsType(kUnused_LocalCoordsType)
25 , fSampleShading(0.0) {}
25 26
26 bool willUseGeoShader() const override { return fWillUseGeoShader; } 27 bool willUseGeoShader() const override { return fWillUseGeoShader; }
27 28
28 bool hasTransformedLocalCoords() const override { 29 bool hasTransformedLocalCoords() const override {
29 return kHasTransformed_LocalCoordsType == fLocalCoordsType; 30 return kHasTransformed_LocalCoordsType == fLocalCoordsType;
30 } 31 }
31 32
32 bool hasExplicitLocalCoords() const override { 33 bool hasExplicitLocalCoords() const override {
33 return kHasExplicit_LocalCoordsType == fLocalCoordsType; 34 return kHasExplicit_LocalCoordsType == fLocalCoordsType;
34 } 35 }
35 36
37 /**
38 * Returns the minimum fraction of samples for which the fragment shader wil l be run. For
39 * instance, if sampleShading is 0.5 in MSAA16 mode, the fragment shader wil l run a minimum of
40 * 8 times per pixel. The default value is zero.
41 */
42 float getSampleShading() const override {
43 return fSampleShading;
44 }
45
36 protected: 46 protected:
37 /** 47 /**
38 * Subclasses call this from their constructor to register vertex attributes . Attributes 48 * Subclasses call this from their constructor to register vertex attributes . Attributes
39 * will be padded to the nearest 4 bytes for performance reasons. 49 * will be padded to the nearest 4 bytes for performance reasons.
40 * TODO After deferred geometry, we should do all of this inline in Generate Geometry alongside 50 * TODO After deferred geometry, we should do all of this inline in Generate Geometry alongside
41 * the struct used to actually populate the attributes. This is all extreme ly fragile, vertex 51 * the struct used to actually populate the attributes. This is all extreme ly fragile, vertex
42 * attributes have to be added in the order they will appear in the struct w hich maps memory. 52 * attributes have to be added in the order they will appear in the struct w hich maps memory.
43 * The processor key should reflect the vertex attributes, or there lack the reof in the 53 * The processor key should reflect the vertex attributes, or there lack the reof in the
44 * GrGeometryProcessor. 54 * GrGeometryProcessor.
45 */ 55 */
(...skipping 21 matching lines...) Expand all
67 77
68 void setHasExplicitLocalCoords() { 78 void setHasExplicitLocalCoords() {
69 SkASSERT(kUnused_LocalCoordsType == fLocalCoordsType); 79 SkASSERT(kUnused_LocalCoordsType == fLocalCoordsType);
70 fLocalCoordsType = kHasExplicit_LocalCoordsType; 80 fLocalCoordsType = kHasExplicit_LocalCoordsType;
71 } 81 }
72 void setHasTransformedLocalCoords() { 82 void setHasTransformedLocalCoords() {
73 SkASSERT(kUnused_LocalCoordsType == fLocalCoordsType); 83 SkASSERT(kUnused_LocalCoordsType == fLocalCoordsType);
74 fLocalCoordsType = kHasTransformed_LocalCoordsType; 84 fLocalCoordsType = kHasTransformed_LocalCoordsType;
75 } 85 }
76 86
87 void setSampleShading(float sampleShading) {
88 fSampleShading = sampleShading;
89 }
90
77 private: 91 private:
78 bool fWillUseGeoShader; 92 bool fWillUseGeoShader;
79 LocalCoordsType fLocalCoordsType; 93 LocalCoordsType fLocalCoordsType;
94 float fSampleShading;
80 95
81 typedef GrPrimitiveProcessor INHERITED; 96 typedef GrPrimitiveProcessor INHERITED;
82 }; 97 };
83 98
84 #endif 99 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrCaps.cpp ('k') | src/gpu/GrPrimitiveProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698