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

Side by Side Diff: src/gpu/gl/GrGLGpu.h

Issue 970613003: Revert of Improve tracking of bound FBOs in GrGLGpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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/gl/GrGLGpu.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 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 GrGLGpu_DEFINED 8 #ifndef GrGLGpu_DEFINED
9 #define GrGLGpu_DEFINED 9 #define GrGLGpu_DEFINED
10 10
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 239
240 void initFSAASupport(); 240 void initFSAASupport();
241 241
242 // determines valid stencil formats 242 // determines valid stencil formats
243 void initStencilFormats(); 243 void initStencilFormats();
244 244
245 // sets a texture unit to use for texture operations other than binding a te xture to a program. 245 // sets a texture unit to use for texture operations other than binding a te xture to a program.
246 // ensures that such operations don't negatively interact with tracking boun d textures. 246 // ensures that such operations don't negatively interact with tracking boun d textures.
247 void setScratchTextureUnit(); 247 void setScratchTextureUnit();
248 248
249 // Binds the render target, sets the viewport, tracks dirty are for resolve, and tracks whether 249 // bounds is region that may be modified and therefore has to be resolved.
250 // mip maps need rebuilding. bounds is region that may be modified by the dr aw. NULL means whole 250 // NULL means whole target. Can be an empty rect.
251 // target. Can be an empty rect. 251 void flushRenderTarget(GrGLRenderTarget*, const SkIRect* bounds);
252 void prepareToDrawToRenderTarget(GrGLRenderTarget*, const SkIRect* bounds);
253
254 // On older GLs there may not be separate FBO bindings for draw and read. In that case these
255 // alias each other.
256 enum FBOBinding {
257 kDraw_FBOBinding, // drawing or dst of blit
258 kRead_FBOBinding, // src of blit, read pixels.
259
260 kLast_FBOBinding = kRead_FBOBinding
261 };
262 static const int kFBOBindingCnt = kLast_FBOBinding + 1;
263
264 // binds the FBO and returns the GL enum of the framebuffer target it was bo und to.
265 GrGLenum bindFBO(FBOBinding, const GrGLFBO*);
266
267 void setViewport(const GrGLIRect& viewport);
268 252
269 void flushStencil(const GrStencilSettings&); 253 void flushStencil(const GrStencilSettings&);
270 void flushHWAAState(GrRenderTarget* rt, bool useHWAA, bool isLineDraw); 254 void flushHWAAState(GrRenderTarget* rt, bool useHWAA, bool isLineDraw);
271 255
272 bool configToGLFormats(GrPixelConfig config, 256 bool configToGLFormats(GrPixelConfig config,
273 bool getSizedInternal, 257 bool getSizedInternal,
274 GrGLenum* internalFormat, 258 GrGLenum* internalFormat,
275 GrGLenum* externalFormat, 259 GrGLenum* externalFormat,
276 GrGLenum* externalType); 260 GrGLenum* externalType);
277 // helper for onCreateTexture and writeTexturePixels 261 // helper for onCreateTexture and writeTexturePixels
(...skipping 12 matching lines...) Expand all
290 // with new data. 274 // with new data.
291 bool uploadCompressedTexData(const GrSurfaceDesc& desc, 275 bool uploadCompressedTexData(const GrSurfaceDesc& desc,
292 const void* data, 276 const void* data,
293 bool isNewTexture = true, 277 bool isNewTexture = true,
294 int left = 0, int top = 0, 278 int left = 0, int top = 0,
295 int width = -1, int height = -1); 279 int width = -1, int height = -1);
296 280
297 bool createRenderTargetObjects(const GrSurfaceDesc&, bool budgeted, GrGLuint texID, 281 bool createRenderTargetObjects(const GrSurfaceDesc&, bool budgeted, GrGLuint texID,
298 GrGLRenderTarget::IDDesc*); 282 GrGLRenderTarget::IDDesc*);
299 283
300 static const FBOBinding kInvalidFBOBinding = static_cast<FBOBinding>(-1); 284 enum TempFBOTarget {
285 kSrc_TempFBOTarget,
286 kDst_TempFBOTarget
287 };
301 288
302 // Binds a surface as an FBO. A temporary FBO ID may be used if the surface is not already 289 GrGLuint bindSurfaceAsFBO(GrSurface* surface, GrGLenum fboTarget, GrGLIRect* viewport,
303 // a render target. Afterwards unbindSurfaceAsFBOForCopy must be called with the value returned. 290 TempFBOTarget tempFBOTarget);
304 FBOBinding bindSurfaceAsFBOForCopy(GrSurface*, FBOBinding, GrGLIRect* viewpo rt);
305 291
306 // Must be matched with bindSurfaceAsFBOForCopy. 292 void unbindTextureFromFBO(GrGLenum fboTarget);
307 void unbindSurfaceAsFBOForCopy(FBOBinding);
308 293
309 GrGLContext fGLContext; 294 GrGLContext fGLContext;
310 295
311 // GL program-related state 296 // GL program-related state
312 ProgramCache* fProgramCache; 297 ProgramCache* fProgramCache;
313 SkAutoTUnref<GrGLProgram> fCurrentProgram; 298 SkAutoTUnref<GrGLProgram> fCurrentProgram;
314 299
315 /////////////////////////////////////////////////////////////////////////// 300 ///////////////////////////////////////////////////////////////////////////
316 ///@name Caching of GL State 301 ///@name Caching of GL State
317 ///@{ 302 ///@{
318 int fHWActiveTextureUnitIdx; 303 int fHWActiveTextureUnitIdx;
319 GrGLuint fHWProgramID; 304 GrGLuint fHWProgramID;
320 305
321 enum TriState { 306 enum TriState {
322 kNo_TriState, 307 kNo_TriState,
323 kYes_TriState, 308 kYes_TriState,
324 kUnknown_TriState 309 kUnknown_TriState
325 }; 310 };
326 311
327 SkAutoTUnref<GrGLFBO> fTempSrcFBO; 312 GrGLuint fTempSrcFBOID;
328 SkAutoTUnref<GrGLFBO> fTempDstFBO; 313 GrGLuint fTempDstFBOID;
329 SkAutoTUnref<GrGLFBO> fStencilClearFBO; 314
315 GrGLuint fStencilClearFBOID;
330 316
331 // last scissor / viewport scissor state seen by the GL. 317 // last scissor / viewport scissor state seen by the GL.
332 struct { 318 struct {
333 TriState fEnabled; 319 TriState fEnabled;
334 GrGLIRect fRect; 320 GrGLIRect fRect;
335 void invalidate() { 321 void invalidate() {
336 fEnabled = kUnknown_TriState; 322 fEnabled = kUnknown_TriState;
337 fRect.invalidate(); 323 fRect.invalidate();
338 } 324 }
339 } fHWScissorSettings; 325 } fHWScissorSettings;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 451
466 TriState fMSAAEnabled; 452 TriState fMSAAEnabled;
467 453
468 GrStencilSettings fHWStencilSettings; 454 GrStencilSettings fHWStencilSettings;
469 TriState fHWStencilTestEnabled; 455 TriState fHWStencilTestEnabled;
470 456
471 457
472 GrPipelineBuilder::DrawFace fHWDrawFace; 458 GrPipelineBuilder::DrawFace fHWDrawFace;
473 TriState fHWWriteToColor; 459 TriState fHWWriteToColor;
474 TriState fHWDitherEnabled; 460 TriState fHWDitherEnabled;
461 uint32_t fHWBoundRenderTargetUniqueID;
475 SkTArray<uint32_t, true> fHWBoundTextureUniqueIDs; 462 SkTArray<uint32_t, true> fHWBoundTextureUniqueIDs;
476 463
477 // Track fbo binding state.
478 struct HWFBOBinding {
479 SkAutoTUnref<const GrGLFBO> fFBO;
480 void invalidate() { fFBO.reset(NULL); }
481 } fHWFBOBinding[kFBOBindingCnt];
482
483 ///@} 464 ///@}
484 465
485 // we record what stencil format worked last time to hopefully exit early 466 // we record what stencil format worked last time to hopefully exit early
486 // from our loop that tries stencil formats and calls check fb status. 467 // from our loop that tries stencil formats and calls check fb status.
487 int fLastSuccessfulStencilFmtIdx; 468 int fLastSuccessfulStencilFmtIdx;
488 469
489 typedef GrGpu INHERITED; 470 typedef GrGpu INHERITED;
490 friend class GrGLPathRendering; // For accessing setTextureUnit. 471 friend class GrGLPathRendering; // For accessing setTextureUnit.
491 }; 472 };
492 473
493 #endif 474 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698