OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 #include "gpu/command_buffer/client/gles2_interface.h" | 33 #include "gpu/command_buffer/client/gles2_interface.h" |
34 #include "platform/RuntimeEnabledFeatures.h" | 34 #include "platform/RuntimeEnabledFeatures.h" |
35 #include "platform/TraceEvent.h" | 35 #include "platform/TraceEvent.h" |
36 #include "platform/graphics/GraphicsLayer.h" | 36 #include "platform/graphics/GraphicsLayer.h" |
37 #include "platform/graphics/ImageBuffer.h" | 37 #include "platform/graphics/ImageBuffer.h" |
38 #include "platform/graphics/gpu/Extensions3DUtil.h" | 38 #include "platform/graphics/gpu/Extensions3DUtil.h" |
39 #include "public/platform/Platform.h" | 39 #include "public/platform/Platform.h" |
40 #include "public/platform/WebCompositorSupport.h" | 40 #include "public/platform/WebCompositorSupport.h" |
41 #include "public/platform/WebExternalBitmap.h" | 41 #include "public/platform/WebExternalBitmap.h" |
42 #include "public/platform/WebExternalTextureLayer.h" | 42 #include "public/platform/WebExternalTextureLayer.h" |
43 #include "public/platform/WebGraphicsContext3D.h" | |
44 #include "public/platform/WebGraphicsContext3DProvider.h" | 43 #include "public/platform/WebGraphicsContext3DProvider.h" |
45 #include "wtf/CheckedNumeric.h" | 44 #include "wtf/CheckedNumeric.h" |
46 #include "wtf/typed_arrays/ArrayBufferContents.h" | 45 #include "wtf/typed_arrays/ArrayBufferContents.h" |
47 #include <algorithm> | 46 #include <algorithm> |
48 | 47 |
49 namespace blink { | 48 namespace blink { |
50 | 49 |
51 namespace { | 50 namespace { |
52 | 51 |
53 const float s_resourceAdjustedRatio = 0.5; | 52 const float s_resourceAdjustedRatio = 0.5; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 bool wantAlphaChannel, | 129 bool wantAlphaChannel, |
131 bool premultipliedAlpha, | 130 bool premultipliedAlpha, |
132 PreserveDrawingBuffer preserve) | 131 PreserveDrawingBuffer preserve) |
133 : m_preserveDrawingBuffer(preserve) | 132 : m_preserveDrawingBuffer(preserve) |
134 , m_scissorEnabled(false) | 133 , m_scissorEnabled(false) |
135 , m_texture2DBinding(0) | 134 , m_texture2DBinding(0) |
136 , m_drawFramebufferBinding(0) | 135 , m_drawFramebufferBinding(0) |
137 , m_readFramebufferBinding(0) | 136 , m_readFramebufferBinding(0) |
138 , m_activeTextureUnit(GL_TEXTURE0) | 137 , m_activeTextureUnit(GL_TEXTURE0) |
139 , m_contextProvider(std::move(contextProvider)) | 138 , m_contextProvider(std::move(contextProvider)) |
140 , m_context(m_contextProvider->context3d()) | |
141 , m_gl(m_contextProvider->contextGL()) | 139 , m_gl(m_contextProvider->contextGL()) |
142 , m_extensionsUtil(std::move(extensionsUtil)) | 140 , m_extensionsUtil(std::move(extensionsUtil)) |
143 , m_size(-1, -1) | 141 , m_size(-1, -1) |
144 , m_discardFramebufferSupported(discardFramebufferSupported) | 142 , m_discardFramebufferSupported(discardFramebufferSupported) |
145 , m_wantAlphaChannel(wantAlphaChannel) | 143 , m_wantAlphaChannel(wantAlphaChannel) |
146 , m_premultipliedAlpha(premultipliedAlpha) | 144 , m_premultipliedAlpha(premultipliedAlpha) |
147 , m_hasImplicitStencilBuffer(false) | 145 , m_hasImplicitStencilBuffer(false) |
148 , m_fbo(0) | 146 , m_fbo(0) |
149 , m_depthStencilBuffer(0) | 147 , m_depthStencilBuffer(0) |
150 , m_multisampleFBO(0) | 148 , m_multisampleFBO(0) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 183 |
186 void DrawingBuffer::setBufferClearNeeded(bool flag) | 184 void DrawingBuffer::setBufferClearNeeded(bool flag) |
187 { | 185 { |
188 if (m_preserveDrawingBuffer == Discard) { | 186 if (m_preserveDrawingBuffer == Discard) { |
189 m_bufferClearNeeded = flag; | 187 m_bufferClearNeeded = flag; |
190 } else { | 188 } else { |
191 ASSERT(!m_bufferClearNeeded); | 189 ASSERT(!m_bufferClearNeeded); |
192 } | 190 } |
193 } | 191 } |
194 | 192 |
195 WebGraphicsContext3D* DrawingBuffer::context() | |
196 { | |
197 return m_context; | |
198 } | |
199 | |
200 gpu::gles2::GLES2Interface* DrawingBuffer::contextGL() | 193 gpu::gles2::GLES2Interface* DrawingBuffer::contextGL() |
201 { | 194 { |
202 return m_gl; | 195 return m_gl; |
203 } | 196 } |
204 | 197 |
205 WebGraphicsContext3DProvider* DrawingBuffer::contextProvider() | 198 WebGraphicsContext3DProvider* DrawingBuffer::contextProvider() |
206 { | 199 { |
207 return m_contextProvider.get(); | 200 return m_contextProvider.get(); |
208 } | 201 } |
209 | 202 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 } | 466 } |
474 | 467 |
475 if (m_gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { | 468 if (m_gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { |
476 // It's possible that the drawing buffer allocation provokes a context l
oss, so check again just in case. http://crbug.com/512302 | 469 // It's possible that the drawing buffer allocation provokes a context l
oss, so check again just in case. http://crbug.com/512302 |
477 return false; | 470 return false; |
478 } | 471 } |
479 | 472 |
480 return true; | 473 return true; |
481 } | 474 } |
482 | 475 |
483 bool DrawingBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, gpu::gl
es2::GLES2Interface* gl, GLuint texture, GLenum internalFormat, | 476 bool DrawingBuffer::copyToPlatformTexture(gpu::gles2::GLES2Interface* gl, GLuint
texture, GLenum internalFormat, |
484 GLenum destType, GLint level, bool premultiplyAlpha, bool flipY, SourceDrawi
ngBuffer sourceBuffer) | 477 GLenum destType, GLint level, bool premultiplyAlpha, bool flipY, SourceDrawi
ngBuffer sourceBuffer) |
485 { | 478 { |
486 if (m_contentsChanged) { | 479 if (m_contentsChanged) { |
487 if (m_antiAliasingMode != None) { | 480 if (m_antiAliasingMode != None) { |
488 commit(); | 481 commit(); |
489 restoreFramebufferBindings(); | 482 restoreFramebufferBindings(); |
490 } | 483 } |
491 m_gl->Flush(); | 484 m_gl->Flush(); |
492 } | 485 } |
493 | 486 |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 | 996 |
1004 if (m_antiAliasingMode == MSAAImplicitResolve) | 997 if (m_antiAliasingMode == MSAAImplicitResolve) |
1005 m_gl->FramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACH
MENT0, target, m_colorBuffer.textureId, 0, m_sampleCount); | 998 m_gl->FramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACH
MENT0, target, m_colorBuffer.textureId, 0, m_sampleCount); |
1006 else | 999 else |
1007 m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target,
m_colorBuffer.textureId, 0); | 1000 m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target,
m_colorBuffer.textureId, 0); |
1008 | 1001 |
1009 m_gl->BindTexture(GL_TEXTURE_2D, m_texture2DBinding); | 1002 m_gl->BindTexture(GL_TEXTURE_2D, m_texture2DBinding); |
1010 } | 1003 } |
1011 | 1004 |
1012 } // namespace blink | 1005 } // namespace blink |
OLD | NEW |