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

Side by Side Diff: include/gpu/GrXferProcessor.h

Issue 1040303002: Use texture barriers to read directly from the RT (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_zz1_reverseiter
Patch Set: fix windows build Created 5 years, 7 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 | « no previous file | src/gpu/GrDrawTarget.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 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 GrXferProcessor_DEFINED 8 #ifndef GrXferProcessor_DEFINED
9 #define GrXferProcessor_DEFINED 9 #define GrXferProcessor_DEFINED
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 kIConstA_GrBlendCoeff, //<! one minus constant color alpha 42 kIConstA_GrBlendCoeff, //<! one minus constant color alpha
43 kS2C_GrBlendCoeff, 43 kS2C_GrBlendCoeff,
44 kIS2C_GrBlendCoeff, 44 kIS2C_GrBlendCoeff,
45 kS2A_GrBlendCoeff, 45 kS2A_GrBlendCoeff,
46 kIS2A_GrBlendCoeff, 46 kIS2A_GrBlendCoeff,
47 47
48 kTotalGrBlendCoeffCount 48 kTotalGrBlendCoeffCount
49 }; 49 };
50 50
51 /** 51 /**
52 * Barriers for blending. When a shader reads the dst directly, an Xfer barrier is sometimes
53 * required after a pixel has been written, before it can be safely read again.
54 */
55 enum GrXferBarrierType {
56 kTexture_GrXferBarrierType, //<! Required when a shader reads and renders to the same texture.
57 };
58
59 /**
52 * GrXferProcessor is responsible for implementing the xfer mode that blends the src color and dst 60 * GrXferProcessor is responsible for implementing the xfer mode that blends the src color and dst
53 * color. It does this by emitting fragment shader code and controlling the fixe d-function blend 61 * color. It does this by emitting fragment shader code and controlling the fixe d-function blend
54 * state. The inputs to its shader code are the final computed src color and fra ctional pixel 62 * state. The inputs to its shader code are the final computed src color and fra ctional pixel
55 * coverage. The GrXferProcessor's shader code writes the fragment shader output color that goes 63 * coverage. The GrXferProcessor's shader code writes the fragment shader output color that goes
56 * into the fixed-function blend. When dual-source blending is available, it may also write a 64 * into the fixed-function blend. When dual-source blending is available, it may also write a
57 * seconday fragment shader output color. When allowed by the backend API, the G rXferProcessor may 65 * seconday fragment shader output color. When allowed by the backend API, the G rXferProcessor may
58 * read the destination color. The GrXferProcessor is responsible for setting th e blend coefficients 66 * read the destination color. The GrXferProcessor is responsible for setting th e blend coefficients
59 * and blend constant color. 67 * and blend constant color.
60 * 68 *
61 * A GrXferProcessor is never installed directly into our draw state, but instea d is created from a 69 * A GrXferProcessor is never installed directly into our draw state, but instea d is created from a
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 * overrideColor will be the required value that should be passed into the X P. 126 * overrideColor will be the required value that should be passed into the X P.
119 * A caller who calls this function on a XP is required to honor the returne d OptFlags 127 * A caller who calls this function on a XP is required to honor the returne d OptFlags
120 * and color values for its draw. 128 * and color values for its draw.
121 */ 129 */
122 virtual OptFlags getOptimizations(const GrProcOptInfo& colorPOI, 130 virtual OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
123 const GrProcOptInfo& coveragePOI, 131 const GrProcOptInfo& coveragePOI,
124 bool doesStencilWrite, 132 bool doesStencilWrite,
125 GrColor* overrideColor, 133 GrColor* overrideColor,
126 const GrDrawTargetCaps& caps) = 0; 134 const GrDrawTargetCaps& caps) = 0;
127 135
136 /**
137 * Returns whether this XP will require an Xfer barrier on the given rt. If true, outBarrierType
138 * is updated to contain the type of barrier needed.
139 */
140 bool willNeedXferBarrier(const GrRenderTarget* rt,
141 const GrDrawTargetCaps& caps,
142 GrXferBarrierType* outBarrierType) const;
143
128 struct BlendInfo { 144 struct BlendInfo {
129 void reset() { 145 void reset() {
130 fSrcBlend = kOne_GrBlendCoeff; 146 fSrcBlend = kOne_GrBlendCoeff;
131 fDstBlend = kZero_GrBlendCoeff; 147 fDstBlend = kZero_GrBlendCoeff;
132 fBlendConstant = 0; 148 fBlendConstant = 0;
133 fWriteColor = true; 149 fWriteColor = true;
134 } 150 }
135 151
136 GrBlendCoeff fSrcBlend; 152 GrBlendCoeff fSrcBlend;
137 GrBlendCoeff fDstBlend; 153 GrBlendCoeff fDstBlend;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 enum { 342 enum {
327 kIllegalXPFClassID = 0, 343 kIllegalXPFClassID = 0,
328 }; 344 };
329 static int32_t gCurrXPFClassID; 345 static int32_t gCurrXPFClassID;
330 346
331 typedef GrProgramElement INHERITED; 347 typedef GrProgramElement INHERITED;
332 }; 348 };
333 349
334 #endif 350 #endif
335 351
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698