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

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

Issue 1617433002: Make swizzling in read/write pixel copy code more generic (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix loop in config conversion test create Created 4 years, 11 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/GrContext.cpp ('k') | src/gpu/GrSwizzle.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 2011 Google Inc. 2 * Copyright 2011 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 GrGpu_DEFINED 8 #ifndef GrGpu_DEFINED
9 #define GrGpu_DEFINED 9 #define GrGpu_DEFINED
10 10
11 #include "GrPipelineBuilder.h" 11 #include "GrPipelineBuilder.h"
12 #include "GrProgramDesc.h" 12 #include "GrProgramDesc.h"
13 #include "GrStencil.h" 13 #include "GrStencil.h"
14 #include "GrSwizzle.h"
14 #include "GrTextureParamsAdjuster.h" 15 #include "GrTextureParamsAdjuster.h"
15 #include "GrXferProcessor.h" 16 #include "GrXferProcessor.h"
16 #include "SkPath.h" 17 #include "SkPath.h"
17 18
18 class GrBatchTracker; 19 class GrBatchTracker;
19 class GrContext; 20 class GrContext;
20 class GrGLContext; 21 class GrGLContext;
21 class GrIndexBuffer; 22 class GrIndexBuffer;
22 class GrNonInstancedVertices; 23 class GrNonInstancedVertices;
23 class GrPath; 24 class GrPath;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 /** Info struct returned by getReadPixelsInfo about performing intermediate draws before 149 /** Info struct returned by getReadPixelsInfo about performing intermediate draws before
149 reading pixels for performance or correctness. */ 150 reading pixels for performance or correctness. */
150 struct ReadPixelTempDrawInfo { 151 struct ReadPixelTempDrawInfo {
151 /** If the GrGpu is requesting that the caller do a draw to an intermedi ate surface then 152 /** If the GrGpu is requesting that the caller do a draw to an intermedi ate surface then
152 this is descriptor for the temp surface. The draw should always be a rect with 153 this is descriptor for the temp surface. The draw should always be a rect with
153 dst 0,0,w,h. */ 154 dst 0,0,w,h. */
154 GrSurfaceDesc fTempSurfaceDesc; 155 GrSurfaceDesc fTempSurfaceDesc;
155 /** Indicates whether there is a performance advantage to using an exact match texture 156 /** Indicates whether there is a performance advantage to using an exact match texture
156 (in terms of width and height) for the intermediate texture instead of approximate. */ 157 (in terms of width and height) for the intermediate texture instead of approximate. */
157 bool fUseExactScratch; 158 bool fUseExactScratch;
158 /** The caller should swap the R and B channel in the temp draw and then instead of reading 159 /** Swizzle to apply during the draw. This is used to compensate for eit her feature or
159 the desired config back it should read GrPixelConfigSwapRAndB(readCo nfig). The swap 160 performance limitations in the underlying 3D API. */
160 during the draw and the swap at readback time cancel and the client gets the correct 161 GrSwizzle fSwizzle;
161 data. The swapped read back is either faster for or required by the underlying backend 162 /** The config that should be used to read from the temp surface after t he draw. This may be
162 3D API. */ 163 different than the original read config in order to compensate for s wizzling. The
163 bool fSwapRAndB; 164 read data will effectively be in the original read config. */
165 GrPixelConfig fReadConfig;
164 }; 166 };
167
165 /** Describes why an intermediate draw must/should be performed before readP ixels. */ 168 /** Describes why an intermediate draw must/should be performed before readP ixels. */
166 enum DrawPreference { 169 enum DrawPreference {
167 /** On input means that the caller would proceed without draw if the GrG pu doesn't request 170 /** On input means that the caller would proceed without draw if the GrG pu doesn't request
168 one. 171 one.
169 On output means that the GrGpu is not requesting a draw. */ 172 On output means that the GrGpu is not requesting a draw. */
170 kNoDraw_DrawPreference, 173 kNoDraw_DrawPreference,
171 /** Means that the client would prefer a draw for performance of the rea dback but 174 /** Means that the client would prefer a draw for performance of the rea dback but
172 can satisfy a straight readPixels call on the inputs without an inte rmediate draw. 175 can satisfy a straight readPixels call on the inputs without an inte rmediate draw.
173 getReadPixelsInfo will never set the draw preference to this value b ut may leave 176 getReadPixelsInfo will never set the draw preference to this value b ut may leave
174 it set. */ 177 it set. */
(...skipping 20 matching lines...) Expand all
195 GrPixelConfig readConfig, DrawPreference*, ReadPixelT empDrawInfo*); 198 GrPixelConfig readConfig, DrawPreference*, ReadPixelT empDrawInfo*);
196 199
197 /** Info struct returned by getWritePixelsInfo about performing an intermedi ate draw in order 200 /** Info struct returned by getWritePixelsInfo about performing an intermedi ate draw in order
198 to write pixels to a GrSurface for either performance or correctness rea sons. */ 201 to write pixels to a GrSurface for either performance or correctness rea sons. */
199 struct WritePixelTempDrawInfo { 202 struct WritePixelTempDrawInfo {
200 /** If the GrGpu is requesting that the caller upload to an intermediate surface and draw 203 /** If the GrGpu is requesting that the caller upload to an intermediate surface and draw
201 that to the dst then this is the descriptor for the intermediate sur face. The caller 204 that to the dst then this is the descriptor for the intermediate sur face. The caller
202 should upload the pixels such that the upper left pixel of the uploa d rect is at 0,0 in 205 should upload the pixels such that the upper left pixel of the uploa d rect is at 0,0 in
203 the intermediate surface.*/ 206 the intermediate surface.*/
204 GrSurfaceDesc fTempSurfaceDesc; 207 GrSurfaceDesc fTempSurfaceDesc;
205 /** If set, fTempSurfaceDesc's config will be a R/B swap of the src pixe l config. The caller 208 /** Swizzle to apply during the draw. This is used to compensate for eit her feature or
206 should upload the pixels as is such that R and B will be swapped in the intermediate 209 performance limitations in the underlying 3D API. */
207 surface. When the intermediate is drawn to the dst the shader should swap R/B again 210 GrSwizzle fSwizzle;
208 such that the correct swizzle results in the dst. This is done to wo rk around either 211 /** The config that should be specified when uploading the *original* da ta to the temp
209 performance or API restrictions in the backend 3D API implementation . */ 212 surface before the draw. This may be different than the original src data config in
210 bool fSwapRAndB; 213 order to compensate for swizzling that will occur when drawing. */
214 GrPixelConfig fWriteConfig;
211 }; 215 };
212 216
213 /** 217 /**
214 * Used to negotiate whether and how an intermediate surface should be used to write pixels to 218 * Used to negotiate whether and how an intermediate surface should be used to write pixels to
215 * a GrSurface. If this returns false then GrGpu could not deduce an interme diate draw 219 * a GrSurface. If this returns false then GrGpu could not deduce an interme diate draw
216 * that would allow a successful transfer of the src pixels to the dst. The passed width, 220 * that would allow a successful transfer of the src pixels to the dst. The passed width,
217 * height, and rowBytes, must be non-zero and already reflect clipping to th e dst bounds. 221 * height, and rowBytes, must be non-zero and already reflect clipping to th e dst bounds.
218 */ 222 */
219 bool getWritePixelsInfo(GrSurface* dstSurface, int width, int height, size_t rowBytes, 223 bool getWritePixelsInfo(GrSurface* dstSurface, int width, int height, size_t rowBytes,
220 GrPixelConfig srcConfig, DrawPreference*, WritePixel TempDrawInfo*); 224 GrPixelConfig srcConfig, DrawPreference*, WritePixel TempDrawInfo*);
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 ResetTimestamp fResetTi mestamp; 571 ResetTimestamp fResetTi mestamp;
568 uint32_t fResetBi ts; 572 uint32_t fResetBi ts;
569 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. 573 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu.
570 GrContext* fContext ; 574 GrContext* fContext ;
571 575
572 friend class GrPathRendering; 576 friend class GrPathRendering;
573 typedef SkRefCnt INHERITED; 577 typedef SkRefCnt INHERITED;
574 }; 578 };
575 579
576 #endif 580 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrSwizzle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698