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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h

Issue 2329523002: Save/restore PBO bindings in DrawingBuffer (Closed)
Patch Set: oops Created 4 years, 3 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 (c) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 // commit should copy the full multisample buffer, and not respect the 130 // commit should copy the full multisample buffer, and not respect the
131 // current scissor bounds. Track the state of the scissor test so that it 131 // current scissor bounds. Track the state of the scissor test so that it
132 // can be disabled during calls to commit. 132 // can be disabled during calls to commit.
133 void setScissorEnabled(bool scissorEnabled) { m_scissorEnabled = scissorEnab led; } 133 void setScissorEnabled(bool scissorEnabled) { m_scissorEnabled = scissorEnab led; }
134 134
135 // The DrawingBuffer needs to track the texture bound to texture unit 0. 135 // The DrawingBuffer needs to track the texture bound to texture unit 0.
136 // The bound texture is tracked to avoid costly queries during rendering. 136 // The bound texture is tracked to avoid costly queries during rendering.
137 void setTexture2DBinding(GLuint texture) { m_texture2DBinding = texture; } 137 void setTexture2DBinding(GLuint texture) { m_texture2DBinding = texture; }
138 138
139 void setPixelUnpackBufferBinding(GLuint buffer)
140 {
141 DCHECK(m_webGLVersion > WebGL1);
142 m_pixelUnpackBufferBinding = buffer;
143 }
144
145 void notifyBufferDeleted(GLuint buffer)
146 {
147 if (m_webGLVersion > WebGL1 && buffer == m_pixelUnpackBufferBinding) {
148 setPixelUnpackBufferBinding(0);
149 }
150 }
151
139 // The DrawingBuffer needs to track the currently bound framebuffer so it 152 // The DrawingBuffer needs to track the currently bound framebuffer so it
140 // restore the binding when needed. 153 // restore the binding when needed.
141 void setFramebufferBinding(GLenum target, GLuint fbo) 154 void setFramebufferBinding(GLenum target, GLuint fbo)
142 { 155 {
143 switch (target) { 156 switch (target) {
144 case GL_FRAMEBUFFER: 157 case GL_FRAMEBUFFER:
145 m_drawFramebufferBinding = fbo; 158 m_drawFramebufferBinding = fbo;
146 m_readFramebufferBinding = fbo; 159 m_readFramebufferBinding = fbo;
147 break; 160 break;
148 case GL_DRAW_FRAMEBUFFER: 161 case GL_DRAW_FRAMEBUFFER:
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 bool copyToPlatformTexture(gpu::gles2::GLES2Interface*, GLuint texture, GLen um internalFormat, 233 bool copyToPlatformTexture(gpu::gles2::GLES2Interface*, GLuint texture, GLen um internalFormat,
221 GLenum destType, GLint level, bool premultiplyAlpha, bool flipY, SourceD rawingBuffer); 234 GLenum destType, GLint level, bool premultiplyAlpha, bool flipY, SourceD rawingBuffer);
222 235
223 void setPackAlignment(GLint param); 236 void setPackAlignment(GLint param);
224 237
225 bool paintRenderingResultsToImageData(int&, int&, SourceDrawingBuffer, WTF:: ArrayBufferContents&); 238 bool paintRenderingResultsToImageData(int&, int&, SourceDrawingBuffer, WTF:: ArrayBufferContents&);
226 239
227 int sampleCount() const { return m_sampleCount; } 240 int sampleCount() const { return m_sampleCount; }
228 bool explicitResolveOfMultisampleData() const { return m_antiAliasingMode == MSAAExplicitResolve; } 241 bool explicitResolveOfMultisampleData() const { return m_antiAliasingMode == MSAAExplicitResolve; }
229 242
243 void restorePixelUnpackBufferBindings();
244
230 // Bind to m_drawFramebufferBinding or m_readFramebufferBinding if it's not 0. 245 // Bind to m_drawFramebufferBinding or m_readFramebufferBinding if it's not 0.
231 // Otherwise, bind to the default FBO. 246 // Otherwise, bind to the default FBO.
232 void restoreFramebufferBindings(); 247 void restoreFramebufferBindings();
233 248
234 void restoreTextureBindings(); 249 void restoreTextureBindings();
235 250
236 void addNewMailboxCallback(std::unique_ptr<WTF::Closure> closure) { m_newMai lboxCallback = std::move(closure); } 251 void addNewMailboxCallback(std::unique_ptr<WTF::Closure> closure) { m_newMai lboxCallback = std::move(closure); }
237 252
238 protected: // For unittests 253 protected: // For unittests
239 DrawingBuffer( 254 DrawingBuffer(
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 // Whether the WebGL client wants a depth or stencil buffer. 385 // Whether the WebGL client wants a depth or stencil buffer.
371 bool wantDepthOrStencil(); 386 bool wantDepthOrStencil();
372 387
373 // The format to use when creating a multisampled renderbuffer. 388 // The format to use when creating a multisampled renderbuffer.
374 GLenum getMultisampledRenderbufferFormat(); 389 GLenum getMultisampledRenderbufferFormat();
375 390
376 const PreserveDrawingBuffer m_preserveDrawingBuffer; 391 const PreserveDrawingBuffer m_preserveDrawingBuffer;
377 const WebGLVersion m_webGLVersion; 392 const WebGLVersion m_webGLVersion;
378 bool m_scissorEnabled = false; 393 bool m_scissorEnabled = false;
379 GLuint m_texture2DBinding = 0; 394 GLuint m_texture2DBinding = 0;
395 GLuint m_pixelUnpackBufferBinding = 0;
380 GLuint m_drawFramebufferBinding = 0; 396 GLuint m_drawFramebufferBinding = 0;
381 GLuint m_readFramebufferBinding = 0; 397 GLuint m_readFramebufferBinding = 0;
382 GLuint m_renderbufferBinding = 0; 398 GLuint m_renderbufferBinding = 0;
383 GLenum m_activeTextureUnit = GL_TEXTURE0; 399 GLenum m_activeTextureUnit = GL_TEXTURE0;
384 GLfloat m_clearColor[4]; 400 GLfloat m_clearColor[4];
385 GLboolean m_colorMask[4]; 401 GLboolean m_colorMask[4];
386 402
387 std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; 403 std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider;
388 // Lifetime is tied to the m_contextProvider. 404 // Lifetime is tied to the m_contextProvider.
389 gpu::gles2::GLES2Interface* m_gl; 405 gpu::gles2::GLES2Interface* m_gl;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 // used to resize the Canvas. 499 // used to resize the Canvas.
484 SkBitmap m_resizingBitmap; 500 SkBitmap m_resizingBitmap;
485 501
486 // Used to flip a bitmap vertically. 502 // Used to flip a bitmap vertically.
487 Vector<uint8_t> m_scanline; 503 Vector<uint8_t> m_scanline;
488 }; 504 };
489 505
490 } // namespace blink 506 } // namespace blink
491 507
492 #endif // DrawingBuffer_h 508 #endif // DrawingBuffer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698