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

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

Issue 446953002: Add an opaqueness hint to GrDrawState. (Closed) Base URL: https://skia.googlesource.com/skia.git@greg
Patch Set: remove whitespace at end of line Created 6 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright 2010 Google Inc. 2 * Copyright 2010 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 GrDrawTarget_DEFINED 8 #ifndef GrDrawTarget_DEFINED
9 #define GrDrawTarget_DEFINED 9 #define GrDrawTarget_DEFINED
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 * Read-only access to the GrDrawTarget's current draw state. 77 * Read-only access to the GrDrawTarget's current draw state.
78 */ 78 */
79 const GrDrawState& getDrawState() const { return *fDrawState; } 79 const GrDrawState& getDrawState() const { return *fDrawState; }
80 80
81 /** 81 /**
82 * Read-write access to the GrDrawTarget's current draw state. Note that 82 * Read-write access to the GrDrawTarget's current draw state. Note that
83 * this doesn't ref. 83 * this doesn't ref.
84 */ 84 */
85 GrDrawState* drawState() { return fDrawState; } 85 GrDrawState* drawState() { return fDrawState; }
86 86
87 /**
88 * Color alpha and coverage are two inputs to the drawing pipeline. For some
89 * blend modes it is safe to fold the coverage into constant or per-vertex
90 * color alpha value. For other blend modes they must be handled separately.
91 * Depending on features available in the underlying 3D API this may or may
92 * not be possible.
93 *
94 * This function considers the current draw state and the draw target's
95 * capabilities to determine whether coverage can be handled correctly. The
96 * following assumptions are made:
97 * 1. The caller intends to somehow specify coverage. This can be
98 * specified either by enabling a coverage stage on the GrDrawState or
99 * via the vertex layout.
100 * 2. Other than enabling coverage stages or enabling coverage in the
101 * layout, the current configuration of the target's GrDrawState is as
102 * it will be at draw time.
103 */
104 bool canApplyCoverage() const;
105
106 /** When we're using coverage AA but the blend is incompatible (given gpu 87 /** When we're using coverage AA but the blend is incompatible (given gpu
107 * limitations) we should disable AA. */ 88 * limitations) we should disable AA. */
108 bool shouldDisableCoverageAAForBlend() { 89 bool shouldDisableCoverageAAForBlend() const {
109 // Enable below if we should draw with AA even when it produces 90 // Enable below if we should draw with AA even when it produces
110 // incorrect blending. 91 // incorrect blending.
111 // return false; 92 // return false;
112 return !this->canApplyCoverage(); 93 return !this->getDrawState().couldApplyCoverage(*this->caps());
113 } 94 }
114 95
115 /** 96 /**
116 * There are three types of "sources" of geometry (vertices and indices) for 97 * There are three types of "sources" of geometry (vertices and indices) for
117 * draw calls made on the target. When performing an indexed draw, the 98 * draw calls made on the target. When performing an indexed draw, the
118 * indices and vertices can use different source types. Once a source is 99 * indices and vertices can use different source types. Once a source is
119 * specified it can be used for multiple draws. However, the time at which 100 * specified it can be used for multiple draws. However, the time at which
120 * the geometry data is no longer editable depends on the source type. 101 * the geometry data is no longer editable depends on the source type.
121 * 102 *
122 * Sometimes it is necessary to perform a draw while upstack code has 103 * Sometimes it is necessary to perform a draw while upstack code has
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 GrContext* fContext; 953 GrContext* fContext;
973 // To keep track that we always have at least as many debug marker adds as r emoves 954 // To keep track that we always have at least as many debug marker adds as r emoves
974 int fGpuTraceMar kerCount; 955 int fGpuTraceMar kerCount;
975 GrTraceMarkerSet fActiveTrace Markers; 956 GrTraceMarkerSet fActiveTrace Markers;
976 GrTraceMarkerSet fStoredTrace Markers; 957 GrTraceMarkerSet fStoredTrace Markers;
977 958
978 typedef SkRefCnt INHERITED; 959 typedef SkRefCnt INHERITED;
979 }; 960 };
980 961
981 #endif 962 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698