OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 #include "config.h" | 6 #include "config.h" |
7 | 7 |
8 #include "CCRendererGL.h" | 8 #include "CCRendererGL.h" |
9 | 9 |
| 10 #include "third_party/khronos/GLES2/gl2.h" |
| 11 #include "third_party/khronos/GLES2/gl2ext.h" |
10 #include "CCDamageTracker.h" | 12 #include "CCDamageTracker.h" |
11 #include "CCLayerQuad.h" | 13 #include "CCLayerQuad.h" |
12 #include "CCMathUtil.h" | 14 #include "CCMathUtil.h" |
13 #include "CCProxy.h" | 15 #include "CCProxy.h" |
14 #include "CCRenderPass.h" | 16 #include "CCRenderPass.h" |
15 #include "CCRenderSurfaceFilters.h" | 17 #include "CCRenderSurfaceFilters.h" |
16 #include "CCScopedTexture.h" | 18 #include "CCScopedTexture.h" |
17 #include "CCSettings.h" | 19 #include "CCSettings.h" |
18 #include "CCSingleThreadProxy.h" | 20 #include "CCSingleThreadProxy.h" |
19 #include "CCVideoLayerImpl.h" | 21 #include "CCVideoLayerImpl.h" |
20 #include "Extensions3D.h" | |
21 #include "FloatQuad.h" | 22 #include "FloatQuad.h" |
22 #include "GeometryBinding.h" | 23 #include "GeometryBinding.h" |
23 #include "GrTexture.h" | 24 #include "GrTexture.h" |
24 #include "NotImplemented.h" | 25 #include "NotImplemented.h" |
25 #include "PlatformColor.h" | 26 #include "PlatformColor.h" |
26 #include "SkBitmap.h" | 27 #include "SkBitmap.h" |
27 #include "SkColor.h" | 28 #include "SkColor.h" |
28 #include "TraceEvent.h" | 29 #include "TraceEvent.h" |
29 #ifdef LOG | 30 #ifdef LOG |
30 #undef LOG | 31 #undef LOG |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 86 } |
86 | 87 |
87 bool CCRendererGL::initialize() | 88 bool CCRendererGL::initialize() |
88 { | 89 { |
89 if (!m_context->makeContextCurrent()) | 90 if (!m_context->makeContextCurrent()) |
90 return false; | 91 return false; |
91 | 92 |
92 m_context->setContextLostCallback(this); | 93 m_context->setContextLostCallback(this); |
93 m_context->pushGroupMarkerEXT("CompositorContext"); | 94 m_context->pushGroupMarkerEXT("CompositorContext"); |
94 | 95 |
95 std::string extensionsString = UTF16ToASCII(m_context->getString(GraphicsCon
text3D::EXTENSIONS)); | 96 std::string extensionsString = UTF16ToASCII(m_context->getString(GL_EXTENSIO
NS)); |
96 std::vector<std::string> extensionsList; | 97 std::vector<std::string> extensionsList; |
97 base::SplitString(extensionsString, ' ', &extensionsList); | 98 base::SplitString(extensionsString, ' ', &extensionsList); |
98 std::set<string> extensions(extensionsList.begin(), extensionsList.end()); | 99 std::set<string> extensions(extensionsList.begin(), extensionsList.end()); |
99 | 100 |
100 if (settings().acceleratePainting && extensions.count("GL_EXT_texture_format
_BGRA8888") | 101 if (settings().acceleratePainting && extensions.count("GL_EXT_texture_format
_BGRA8888") |
101 && extensions.count("GL_EXT_read_format_bg
ra")) | 102 && extensions.count("GL_EXT_read_format_bg
ra")) |
102 m_capabilities.usingAcceleratedPainting = true; | 103 m_capabilities.usingAcceleratedPainting = true; |
103 else | 104 else |
104 m_capabilities.usingAcceleratedPainting = false; | 105 m_capabilities.usingAcceleratedPainting = false; |
105 | 106 |
(...skipping 14 matching lines...) Expand all Loading... |
120 ASSERT(extensions.count("GL_ARB_texture_rectangle")); | 121 ASSERT(extensions.count("GL_ARB_texture_rectangle")); |
121 | 122 |
122 m_capabilities.usingGpuMemoryManager = extensions.count("GL_CHROMIUM_gpu_mem
ory_manager"); | 123 m_capabilities.usingGpuMemoryManager = extensions.count("GL_CHROMIUM_gpu_mem
ory_manager"); |
123 if (m_capabilities.usingGpuMemoryManager) | 124 if (m_capabilities.usingGpuMemoryManager) |
124 m_context->setMemoryAllocationChangedCallbackCHROMIUM(this); | 125 m_context->setMemoryAllocationChangedCallbackCHROMIUM(this); |
125 | 126 |
126 m_capabilities.usingDiscardFramebuffer = extensions.count("GL_CHROMIUM_disca
rd_framebuffer"); | 127 m_capabilities.usingDiscardFramebuffer = extensions.count("GL_CHROMIUM_disca
rd_framebuffer"); |
127 | 128 |
128 m_capabilities.usingEglImage = extensions.count("GL_OES_EGL_image_external")
; | 129 m_capabilities.usingEglImage = extensions.count("GL_OES_EGL_image_external")
; |
129 | 130 |
130 GLC(m_context, m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &
m_capabilities.maxTextureSize)); | 131 GLC(m_context, m_context->getIntegerv(GL_MAX_TEXTURE_SIZE, &m_capabilities.m
axTextureSize)); |
131 m_capabilities.bestTextureFormat = PlatformColor::bestTextureFormat(m_contex
t, extensions.count("GL_EXT_texture_format_BGRA8888")); | 132 m_capabilities.bestTextureFormat = PlatformColor::bestTextureFormat(m_contex
t, extensions.count("GL_EXT_texture_format_BGRA8888")); |
132 | 133 |
133 m_isUsingBindUniform = extensions.count("GL_CHROMIUM_bind_uniform_location")
; | 134 m_isUsingBindUniform = extensions.count("GL_CHROMIUM_bind_uniform_location")
; |
134 | 135 |
135 if (!initializeSharedObjects()) | 136 if (!initializeSharedObjects()) |
136 return false; | 137 return false; |
137 | 138 |
138 // Make sure the viewport and context gets initialized, even if it is to zer
o. | 139 // Make sure the viewport and context gets initialized, even if it is to zer
o. |
139 viewportChanged(); | 140 viewportChanged(); |
140 return true; | 141 return true; |
(...skipping 14 matching lines...) Expand all Loading... |
155 } | 156 } |
156 | 157 |
157 WebGraphicsContext3D* CCRendererGL::context() | 158 WebGraphicsContext3D* CCRendererGL::context() |
158 { | 159 { |
159 return m_context; | 160 return m_context; |
160 } | 161 } |
161 | 162 |
162 void CCRendererGL::debugGLCall(WebGraphicsContext3D* context, const char* comman
d, const char* file, int line) | 163 void CCRendererGL::debugGLCall(WebGraphicsContext3D* context, const char* comman
d, const char* file, int line) |
163 { | 164 { |
164 unsigned long error = context->getError(); | 165 unsigned long error = context->getError(); |
165 if (error != GraphicsContext3D::NO_ERROR) | 166 if (error != GL_NO_ERROR) |
166 LOG_ERROR("GL command failed: File: %s\n\tLine %d\n\tcommand: %s, error
%x\n", file, line, command, static_cast<int>(error)); | 167 LOG_ERROR("GL command failed: File: %s\n\tLine %d\n\tcommand: %s, error
%x\n", file, line, command, static_cast<int>(error)); |
167 } | 168 } |
168 | 169 |
169 void CCRendererGL::setVisible(bool visible) | 170 void CCRendererGL::setVisible(bool visible) |
170 { | 171 { |
171 if (m_visible == visible) | 172 if (m_visible == visible) |
172 return; | 173 return; |
173 m_visible = visible; | 174 m_visible = visible; |
174 | 175 |
175 // TODO: Replace setVisibilityCHROMIUM with an extension to explicitly manag
e front/backbuffers | 176 // TODO: Replace setVisibilityCHROMIUM with an extension to explicitly manag
e front/backbuffers |
(...skipping 16 matching lines...) Expand all Loading... |
192 { | 193 { |
193 // On DEBUG builds, opaque render passes are cleared to blue to easily see r
egions that were not drawn on the screen. | 194 // On DEBUG builds, opaque render passes are cleared to blue to easily see r
egions that were not drawn on the screen. |
194 if (frame.currentRenderPass->hasTransparentBackground()) | 195 if (frame.currentRenderPass->hasTransparentBackground()) |
195 GLC(m_context, m_context->clearColor(0, 0, 0, 0)); | 196 GLC(m_context, m_context->clearColor(0, 0, 0, 0)); |
196 else | 197 else |
197 GLC(m_context, m_context->clearColor(0, 0, 1, 1)); | 198 GLC(m_context, m_context->clearColor(0, 0, 1, 1)); |
198 | 199 |
199 #if defined(NDEBUG) | 200 #if defined(NDEBUG) |
200 if (frame.currentRenderPass->hasTransparentBackground()) | 201 if (frame.currentRenderPass->hasTransparentBackground()) |
201 #endif | 202 #endif |
202 m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT); | 203 m_context->clear(GL_COLOR_BUFFER_BIT); |
203 } | 204 } |
204 | 205 |
205 void CCRendererGL::beginDrawingFrame(DrawingFrame& frame) | 206 void CCRendererGL::beginDrawingFrame(DrawingFrame& frame) |
206 { | 207 { |
207 // FIXME: Remove this once framebuffer is automatically recreated on first u
se | 208 // FIXME: Remove this once framebuffer is automatically recreated on first u
se |
208 ensureFramebuffer(); | 209 ensureFramebuffer(); |
209 | 210 |
210 if (viewportSize().isEmpty()) | 211 if (viewportSize().isEmpty()) |
211 return; | 212 return; |
212 | 213 |
213 TRACE_EVENT0("cc", "CCRendererGL::drawLayers"); | 214 TRACE_EVENT0("cc", "CCRendererGL::drawLayers"); |
214 if (m_isViewportChanged) { | 215 if (m_isViewportChanged) { |
215 // Only reshape when we know we are going to draw. Otherwise, the reshap
e | 216 // Only reshape when we know we are going to draw. Otherwise, the reshap
e |
216 // can leave the window at the wrong size if we never draw and the prope
r | 217 // can leave the window at the wrong size if we never draw and the prope
r |
217 // viewport size is never set. | 218 // viewport size is never set. |
218 m_isViewportChanged = false; | 219 m_isViewportChanged = false; |
219 m_context->reshape(viewportWidth(), viewportHeight()); | 220 m_context->reshape(viewportWidth(), viewportHeight()); |
220 } | 221 } |
221 | 222 |
222 makeContextCurrent(); | 223 makeContextCurrent(); |
223 // Bind the common vertex attributes used for drawing all the layers. | 224 // Bind the common vertex attributes used for drawing all the layers. |
224 m_sharedGeometry->prepareForDraw(); | 225 m_sharedGeometry->prepareForDraw(); |
225 | 226 |
226 GLC(m_context, m_context->disable(GraphicsContext3D::DEPTH_TEST)); | 227 GLC(m_context, m_context->disable(GL_DEPTH_TEST)); |
227 GLC(m_context, m_context->disable(GraphicsContext3D::CULL_FACE)); | 228 GLC(m_context, m_context->disable(GL_CULL_FACE)); |
228 GLC(m_context, m_context->colorMask(true, true, true, true)); | 229 GLC(m_context, m_context->colorMask(true, true, true, true)); |
229 GLC(m_context, m_context->enable(GraphicsContext3D::BLEND)); | 230 GLC(m_context, m_context->enable(GL_BLEND)); |
230 GLC(m_context, m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3
D::ONE_MINUS_SRC_ALPHA)); | 231 GLC(m_context, m_context->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); |
231 } | 232 } |
232 | 233 |
233 void CCRendererGL::doNoOp() | 234 void CCRendererGL::doNoOp() |
234 { | 235 { |
235 GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)
); | 236 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, 0)); |
236 GLC(m_context, m_context->flush()); | 237 GLC(m_context, m_context->flush()); |
237 } | 238 } |
238 | 239 |
239 void CCRendererGL::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad) | 240 void CCRendererGL::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad) |
240 { | 241 { |
241 if (quad->needsBlending()) | 242 if (quad->needsBlending()) |
242 GLC(m_context, m_context->enable(GraphicsContext3D::BLEND)); | 243 GLC(m_context, m_context->enable(GL_BLEND)); |
243 else | 244 else |
244 GLC(m_context, m_context->disable(GraphicsContext3D::BLEND)); | 245 GLC(m_context, m_context->disable(GL_BLEND)); |
245 | 246 |
246 switch (quad->material()) { | 247 switch (quad->material()) { |
247 case CCDrawQuad::Invalid: | 248 case CCDrawQuad::Invalid: |
248 ASSERT_NOT_REACHED(); | 249 ASSERT_NOT_REACHED(); |
249 break; | 250 break; |
250 case CCDrawQuad::Checkerboard: | 251 case CCDrawQuad::Checkerboard: |
251 drawCheckerboardQuad(frame, CCCheckerboardDrawQuad::materialCast(quad)); | 252 drawCheckerboardQuad(frame, CCCheckerboardDrawQuad::materialCast(quad)); |
252 break; | 253 break; |
253 case CCDrawQuad::DebugBorder: | 254 case CCDrawQuad::DebugBorder: |
254 drawDebugBorderQuad(frame, CCDebugBorderDrawQuad::materialCast(quad)); | 255 drawDebugBorderQuad(frame, CCDebugBorderDrawQuad::materialCast(quad)); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 GLC(context(), context()->uniformMatrix4fv(program->vertexShader().matrixLoc
ation(), 1, false, &glMatrix[0])); | 319 GLC(context(), context()->uniformMatrix4fv(program->vertexShader().matrixLoc
ation(), 1, false, &glMatrix[0])); |
319 | 320 |
320 SkColor color = quad->color(); | 321 SkColor color = quad->color(); |
321 float alpha = SkColorGetA(color) / 255.0; | 322 float alpha = SkColorGetA(color) / 255.0; |
322 | 323 |
323 GLC(context(), context()->uniform4f(program->fragmentShader().colorLocation(
), (SkColorGetR(color) / 255.0) * alpha, (SkColorGetG(color) / 255.0) * alpha, (
SkColorGetB(color) / 255.0) * alpha, alpha)); | 324 GLC(context(), context()->uniform4f(program->fragmentShader().colorLocation(
), (SkColorGetR(color) / 255.0) * alpha, (SkColorGetG(color) / 255.0) * alpha, (
SkColorGetB(color) / 255.0) * alpha, alpha)); |
324 | 325 |
325 GLC(context(), context()->lineWidth(quad->width())); | 326 GLC(context(), context()->lineWidth(quad->width())); |
326 | 327 |
327 // The indices for the line are stored in the same array as the triangle ind
ices. | 328 // The indices for the line are stored in the same array as the triangle ind
ices. |
328 GLC(context(), context()->drawElements(GraphicsContext3D::LINE_LOOP, 4, Grap
hicsContext3D::UNSIGNED_SHORT, 6 * sizeof(unsigned short))); | 329 GLC(context(), context()->drawElements(GL_LINE_LOOP, 4, GL_UNSIGNED_SHORT, 6
* sizeof(unsigned short))); |
329 } | 330 } |
330 | 331 |
331 static inline SkBitmap applyFilters(CCRendererGL* renderer, const WebKit::WebFil
terOperations& filters, CCScopedTexture* sourceTexture) | 332 static inline SkBitmap applyFilters(CCRendererGL* renderer, const WebKit::WebFil
terOperations& filters, CCScopedTexture* sourceTexture) |
332 { | 333 { |
333 if (filters.isEmpty()) | 334 if (filters.isEmpty()) |
334 return SkBitmap(); | 335 return SkBitmap(); |
335 | 336 |
336 WebGraphicsContext3D* filterContext = CCProxy::hasImplThread() ? WebSharedGr
aphicsContext3D::compositorThreadContext() : WebSharedGraphicsContext3D::mainThr
eadContext(); | 337 WebGraphicsContext3D* filterContext = CCProxy::hasImplThread() ? WebSharedGr
aphicsContext3D::compositorThreadContext() : WebSharedGraphicsContext3D::mainThr
eadContext(); |
337 GrContext* filterGrContext = CCProxy::hasImplThread() ? WebSharedGraphicsCon
text3D::compositorThreadGrContext() : WebSharedGraphicsContext3D::mainThreadGrCo
ntext(); | 338 GrContext* filterGrContext = CCProxy::hasImplThread() ? WebSharedGraphicsCon
text3D::compositorThreadGrContext() : WebSharedGraphicsContext3D::mainThreadGrCo
ntext(); |
338 | 339 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 return nullptr; | 389 return nullptr; |
389 | 390 |
390 SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgr
oundTexture.get()); | 391 SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgr
oundTexture.get()); |
391 if (!filteredDeviceBackground.getTexture()) | 392 if (!filteredDeviceBackground.getTexture()) |
392 return nullptr; | 393 return nullptr; |
393 | 394 |
394 GrTexture* texture = reinterpret_cast<GrTexture*>(filteredDeviceBackground.g
etTexture()); | 395 GrTexture* texture = reinterpret_cast<GrTexture*>(filteredDeviceBackground.g
etTexture()); |
395 int filteredDeviceBackgroundTextureId = texture->getTextureHandle(); | 396 int filteredDeviceBackgroundTextureId = texture->getTextureHandle(); |
396 | 397 |
397 OwnPtr<CCScopedTexture> backgroundTexture = CCScopedTexture::create(m_resour
ceProvider); | 398 OwnPtr<CCScopedTexture> backgroundTexture = CCScopedTexture::create(m_resour
ceProvider); |
398 if (!backgroundTexture->allocate(CCRenderer::ImplPool, quad->quadRect().size
(), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageFramebuffer)) | 399 if (!backgroundTexture->allocate(CCRenderer::ImplPool, quad->quadRect().size
(), GL_RGBA, CCResourceProvider::TextureUsageFramebuffer)) |
399 return nullptr; | 400 return nullptr; |
400 | 401 |
401 const CCRenderPass* targetRenderPass = frame.currentRenderPass; | 402 const CCRenderPass* targetRenderPass = frame.currentRenderPass; |
402 bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get(
), quad->quadRect()); | 403 bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get(
), quad->quadRect()); |
403 | 404 |
404 if (usingBackgroundTexture) { | 405 if (usingBackgroundTexture) { |
405 // Copy the readback pixels from device to the background texture for th
e surface. | 406 // Copy the readback pixels from device to the background texture for th
e surface. |
406 WebTransformationMatrix deviceToFramebufferTransform; | 407 WebTransformationMatrix deviceToFramebufferTransform; |
407 deviceToFramebufferTransform.translate(quad->quadRect().width() / 2.0, q
uad->quadRect().height() / 2.0); | 408 deviceToFramebufferTransform.translate(quad->quadRect().width() / 2.0, q
uad->quadRect().height() / 2.0); |
408 deviceToFramebufferTransform.scale3d(quad->quadRect().width(), quad->qua
dRect().height(), 1); | 409 deviceToFramebufferTransform.scale3d(quad->quadRect().width(), quad->qua
dRect().height(), 1); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 | 476 |
476 OwnPtr<CCResourceProvider::ScopedReadLockGL> maskResourceLock; | 477 OwnPtr<CCResourceProvider::ScopedReadLockGL> maskResourceLock; |
477 unsigned maskTextureId = 0; | 478 unsigned maskTextureId = 0; |
478 if (quad->maskResourceId()) { | 479 if (quad->maskResourceId()) { |
479 maskResourceLock = adoptPtr(new CCResourceProvider::ScopedReadLockGL(m_r
esourceProvider, quad->maskResourceId())); | 480 maskResourceLock = adoptPtr(new CCResourceProvider::ScopedReadLockGL(m_r
esourceProvider, quad->maskResourceId())); |
480 maskTextureId = maskResourceLock->textureId(); | 481 maskTextureId = maskResourceLock->textureId(); |
481 } | 482 } |
482 | 483 |
483 // FIXME: use the backgroundTexture and blend the background in with this dr
aw instead of having a separate copy of the background texture. | 484 // FIXME: use the backgroundTexture and blend the background in with this dr
aw instead of having a separate copy of the background texture. |
484 | 485 |
485 GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); | 486 GLC(context(), context()->activeTexture(GL_TEXTURE0)); |
486 context()->bindTexture(GraphicsContext3D::TEXTURE_2D, contentsTextureId); | 487 context()->bindTexture(GL_TEXTURE_2D, contentsTextureId); |
487 | 488 |
488 int shaderQuadLocation = -1; | 489 int shaderQuadLocation = -1; |
489 int shaderEdgeLocation = -1; | 490 int shaderEdgeLocation = -1; |
490 int shaderMaskSamplerLocation = -1; | 491 int shaderMaskSamplerLocation = -1; |
491 int shaderMaskTexCoordScaleLocation = -1; | 492 int shaderMaskTexCoordScaleLocation = -1; |
492 int shaderMaskTexCoordOffsetLocation = -1; | 493 int shaderMaskTexCoordOffsetLocation = -1; |
493 int shaderMatrixLocation = -1; | 494 int shaderMatrixLocation = -1; |
494 int shaderAlphaLocation = -1; | 495 int shaderAlphaLocation = -1; |
495 if (useAA && maskTextureId) { | 496 if (useAA && maskTextureId) { |
496 const RenderPassMaskProgramAA* program = renderPassMaskProgramAA(); | 497 const RenderPassMaskProgramAA* program = renderPassMaskProgramAA(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 GLC(context(), context()->useProgram(program->program())); | 529 GLC(context(), context()->useProgram(program->program())); |
529 GLC(context(), context()->uniform1i(program->fragmentShader().samplerLoc
ation(), 0)); | 530 GLC(context(), context()->uniform1i(program->fragmentShader().samplerLoc
ation(), 0)); |
530 | 531 |
531 shaderMatrixLocation = program->vertexShader().matrixLocation(); | 532 shaderMatrixLocation = program->vertexShader().matrixLocation(); |
532 shaderAlphaLocation = program->fragmentShader().alphaLocation(); | 533 shaderAlphaLocation = program->fragmentShader().alphaLocation(); |
533 } | 534 } |
534 | 535 |
535 if (shaderMaskSamplerLocation != -1) { | 536 if (shaderMaskSamplerLocation != -1) { |
536 ASSERT(shaderMaskTexCoordScaleLocation != 1); | 537 ASSERT(shaderMaskTexCoordScaleLocation != 1); |
537 ASSERT(shaderMaskTexCoordOffsetLocation != 1); | 538 ASSERT(shaderMaskTexCoordOffsetLocation != 1); |
538 GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE1)); | 539 GLC(context(), context()->activeTexture(GL_TEXTURE1)); |
539 GLC(context(), context()->uniform1i(shaderMaskSamplerLocation, 1)); | 540 GLC(context(), context()->uniform1i(shaderMaskSamplerLocation, 1)); |
540 GLC(context(), context()->uniform2f(shaderMaskTexCoordScaleLocation, qua
d->maskTexCoordScaleX(), quad->maskTexCoordScaleY())); | 541 GLC(context(), context()->uniform2f(shaderMaskTexCoordScaleLocation, qua
d->maskTexCoordScaleX(), quad->maskTexCoordScaleY())); |
541 GLC(context(), context()->uniform2f(shaderMaskTexCoordOffsetLocation, qu
ad->maskTexCoordOffsetX(), quad->maskTexCoordOffsetY())); | 542 GLC(context(), context()->uniform2f(shaderMaskTexCoordOffsetLocation, qu
ad->maskTexCoordOffsetX(), quad->maskTexCoordOffsetY())); |
542 context()->bindTexture(GraphicsContext3D::TEXTURE_2D, maskTextureId); | 543 context()->bindTexture(GL_TEXTURE_2D, maskTextureId); |
543 GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); | 544 GLC(context(), context()->activeTexture(GL_TEXTURE0)); |
544 } | 545 } |
545 | 546 |
546 if (shaderEdgeLocation != -1) { | 547 if (shaderEdgeLocation != -1) { |
547 float edge[24]; | 548 float edge[24]; |
548 deviceLayerEdges.toFloatArray(edge); | 549 deviceLayerEdges.toFloatArray(edge); |
549 deviceLayerBounds.toFloatArray(&edge[12]); | 550 deviceLayerBounds.toFloatArray(&edge[12]); |
550 GLC(context(), context()->uniform3fv(shaderEdgeLocation, 8, edge)); | 551 GLC(context(), context()->uniform3fv(shaderEdgeLocation, 8, edge)); |
551 } | 552 } |
552 | 553 |
553 // Map device space quad to surface space. contentsDeviceTransform has no 3d
component since it was generated with to2dTransform() so we don't need to proje
ct. | 554 // Map device space quad to surface space. contentsDeviceTransform has no 3d
component since it was generated with to2dTransform() so we don't need to proje
ct. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 } else { | 660 } else { |
660 if (quad->swizzleContents()) | 661 if (quad->swizzleContents()) |
661 tileUniformLocation(tileProgramSwizzleOpaque(), uniforms); | 662 tileUniformLocation(tileProgramSwizzleOpaque(), uniforms); |
662 else | 663 else |
663 tileUniformLocation(tileProgramOpaque(), uniforms); | 664 tileUniformLocation(tileProgramOpaque(), uniforms); |
664 } | 665 } |
665 } | 666 } |
666 | 667 |
667 GLC(context(), context()->useProgram(uniforms.program)); | 668 GLC(context(), context()->useProgram(uniforms.program)); |
668 GLC(context(), context()->uniform1i(uniforms.samplerLocation, 0)); | 669 GLC(context(), context()->uniform1i(uniforms.samplerLocation, 0)); |
669 GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); | 670 GLC(context(), context()->activeTexture(GL_TEXTURE0)); |
670 CCResourceProvider::ScopedReadLockGL quadResourceLock(m_resourceProvider, qu
ad->resourceId()); | 671 CCResourceProvider::ScopedReadLockGL quadResourceLock(m_resourceProvider, qu
ad->resourceId()); |
671 GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quadRes
ourceLock.textureId())); | 672 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, quadResourceLock.textur
eId())); |
672 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph
icsContext3D::TEXTURE_MIN_FILTER, quad->textureFilter())); | 673 GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER
, quad->textureFilter())); |
673 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph
icsContext3D::TEXTURE_MAG_FILTER, quad->textureFilter())); | 674 GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER
, quad->textureFilter())); |
674 | 675 |
675 bool useAA = !clipped && quad->isAntialiased(); | 676 bool useAA = !clipped && quad->isAntialiased(); |
676 if (useAA) { | 677 if (useAA) { |
677 CCLayerQuad deviceLayerBounds = CCLayerQuad(FloatQuad(deviceLayerQuad.bo
undingBox())); | 678 CCLayerQuad deviceLayerBounds = CCLayerQuad(FloatQuad(deviceLayerQuad.bo
undingBox())); |
678 deviceLayerBounds.inflateAntiAliasingDistance(); | 679 deviceLayerBounds.inflateAntiAliasingDistance(); |
679 | 680 |
680 CCLayerQuad deviceLayerEdges = CCLayerQuad(deviceLayerQuad); | 681 CCLayerQuad deviceLayerEdges = CCLayerQuad(deviceLayerQuad); |
681 deviceLayerEdges.inflateAntiAliasingDistance(); | 682 deviceLayerEdges.inflateAntiAliasingDistance(); |
682 | 683 |
683 float edge[24]; | 684 float edge[24]; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 const VideoYUVProgram* program = videoYUVProgram(); | 771 const VideoYUVProgram* program = videoYUVProgram(); |
771 ASSERT(program && program->initialized()); | 772 ASSERT(program && program->initialized()); |
772 | 773 |
773 const CCVideoLayerImpl::FramePlane& yPlane = quad->yPlane(); | 774 const CCVideoLayerImpl::FramePlane& yPlane = quad->yPlane(); |
774 const CCVideoLayerImpl::FramePlane& uPlane = quad->uPlane(); | 775 const CCVideoLayerImpl::FramePlane& uPlane = quad->uPlane(); |
775 const CCVideoLayerImpl::FramePlane& vPlane = quad->vPlane(); | 776 const CCVideoLayerImpl::FramePlane& vPlane = quad->vPlane(); |
776 | 777 |
777 CCResourceProvider::ScopedReadLockGL yPlaneLock(m_resourceProvider, yPlane.r
esourceId); | 778 CCResourceProvider::ScopedReadLockGL yPlaneLock(m_resourceProvider, yPlane.r
esourceId); |
778 CCResourceProvider::ScopedReadLockGL uPlaneLock(m_resourceProvider, uPlane.r
esourceId); | 779 CCResourceProvider::ScopedReadLockGL uPlaneLock(m_resourceProvider, uPlane.r
esourceId); |
779 CCResourceProvider::ScopedReadLockGL vPlaneLock(m_resourceProvider, vPlane.r
esourceId); | 780 CCResourceProvider::ScopedReadLockGL vPlaneLock(m_resourceProvider, vPlane.r
esourceId); |
780 GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE1)); | 781 GLC(context(), context()->activeTexture(GL_TEXTURE1)); |
781 GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, yPlaneL
ock.textureId())); | 782 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, yPlaneLock.textureId())
); |
782 GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE2)); | 783 GLC(context(), context()->activeTexture(GL_TEXTURE2)); |
783 GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, uPlaneL
ock.textureId())); | 784 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, uPlaneLock.textureId())
); |
784 GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE3)); | 785 GLC(context(), context()->activeTexture(GL_TEXTURE3)); |
785 GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, vPlaneL
ock.textureId())); | 786 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, vPlaneLock.textureId())
); |
786 | 787 |
787 GLC(context(), context()->useProgram(program->program())); | 788 GLC(context(), context()->useProgram(program->program())); |
788 | 789 |
789 float yWidthScaleFactor = static_cast<float>(yPlane.visibleSize.width()) / y
Plane.size.width(); | 790 float yWidthScaleFactor = static_cast<float>(yPlane.visibleSize.width()) / y
Plane.size.width(); |
790 // Arbitrarily take the u sizes because u and v dimensions are identical. | 791 // Arbitrarily take the u sizes because u and v dimensions are identical. |
791 float uvWidthScaleFactor = static_cast<float>(uPlane.visibleSize.width()) /
uPlane.size.width(); | 792 float uvWidthScaleFactor = static_cast<float>(uPlane.visibleSize.width()) /
uPlane.size.width(); |
792 GLC(context(), context()->uniform1f(program->vertexShader().yWidthScaleFacto
rLocation(), yWidthScaleFactor)); | 793 GLC(context(), context()->uniform1f(program->vertexShader().yWidthScaleFacto
rLocation(), yWidthScaleFactor)); |
793 GLC(context(), context()->uniform1f(program->vertexShader().uvWidthScaleFact
orLocation(), uvWidthScaleFactor)); | 794 GLC(context(), context()->uniform1f(program->vertexShader().uvWidthScaleFact
orLocation(), uvWidthScaleFactor)); |
794 | 795 |
795 GLC(context(), context()->uniform1i(program->fragmentShader().yTextureLocati
on(), 1)); | 796 GLC(context(), context()->uniform1i(program->fragmentShader().yTextureLocati
on(), 1)); |
(...skipping 19 matching lines...) Expand all Loading... |
815 -0.0625f, | 816 -0.0625f, |
816 -0.5f, | 817 -0.5f, |
817 -0.5f, | 818 -0.5f, |
818 }; | 819 }; |
819 GLC(context(), context()->uniform3fv(program->fragmentShader().yuvAdjLocatio
n(), 1, yuvAdjust)); | 820 GLC(context(), context()->uniform3fv(program->fragmentShader().yuvAdjLocatio
n(), 1, yuvAdjust)); |
820 | 821 |
821 setShaderOpacity(quad->opacity(), program->fragmentShader().alphaLocation())
; | 822 setShaderOpacity(quad->opacity(), program->fragmentShader().alphaLocation())
; |
822 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->ve
rtexShader().matrixLocation()); | 823 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->ve
rtexShader().matrixLocation()); |
823 | 824 |
824 // Reset active texture back to texture 0. | 825 // Reset active texture back to texture 0. |
825 GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); | 826 GLC(context(), context()->activeTexture(GL_TEXTURE0)); |
826 } | 827 } |
827 | 828 |
828 void CCRendererGL::drawStreamVideoQuad(const DrawingFrame& frame, const CCStream
VideoDrawQuad* quad) | 829 void CCRendererGL::drawStreamVideoQuad(const DrawingFrame& frame, const CCStream
VideoDrawQuad* quad) |
829 { | 830 { |
830 static float glMatrix[16]; | 831 static float glMatrix[16]; |
831 | 832 |
832 ASSERT(m_capabilities.usingEglImage); | 833 ASSERT(m_capabilities.usingEglImage); |
833 | 834 |
834 const VideoStreamTextureProgram* program = videoStreamTextureProgram(); | 835 const VideoStreamTextureProgram* program = videoStreamTextureProgram(); |
835 GLC(context(), context()->useProgram(program->program())); | 836 GLC(context(), context()->useProgram(program->program())); |
836 | 837 |
837 toGLMatrix(&glMatrix[0], quad->matrix()); | 838 toGLMatrix(&glMatrix[0], quad->matrix()); |
838 GLC(context(), context()->uniformMatrix4fv(program->vertexShader().texMatrix
Location(), 1, false, glMatrix)); | 839 GLC(context(), context()->uniformMatrix4fv(program->vertexShader().texMatrix
Location(), 1, false, glMatrix)); |
839 | 840 |
840 GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); | 841 GLC(context(), context()->activeTexture(GL_TEXTURE0)); |
841 GLC(context(), context()->bindTexture(Extensions3DChromium::GL_TEXTURE_EXTER
NAL_OES, quad->textureId())); | 842 GLC(context(), context()->bindTexture(GL_TEXTURE_EXTERNAL_OES, quad->texture
Id())); |
842 | 843 |
843 GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocatio
n(), 0)); | 844 GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocatio
n(), 0)); |
844 | 845 |
845 setShaderOpacity(quad->opacity(), program->fragmentShader().alphaLocation())
; | 846 setShaderOpacity(quad->opacity(), program->fragmentShader().alphaLocation())
; |
846 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->ve
rtexShader().matrixLocation()); | 847 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->ve
rtexShader().matrixLocation()); |
847 } | 848 } |
848 | 849 |
849 struct TextureProgramBinding { | 850 struct TextureProgramBinding { |
850 template<class Program> void set(Program* program) | 851 template<class Program> void set(Program* program) |
851 { | 852 { |
(...skipping 25 matching lines...) Expand all Loading... |
877 TexTransformTextureProgramBinding binding; | 878 TexTransformTextureProgramBinding binding; |
878 if (quad->flipped()) | 879 if (quad->flipped()) |
879 binding.set(textureProgramFlip()); | 880 binding.set(textureProgramFlip()); |
880 else | 881 else |
881 binding.set(textureProgram()); | 882 binding.set(textureProgram()); |
882 GLC(context(), context()->useProgram(binding.programId)); | 883 GLC(context(), context()->useProgram(binding.programId)); |
883 GLC(context(), context()->uniform1i(binding.samplerLocation, 0)); | 884 GLC(context(), context()->uniform1i(binding.samplerLocation, 0)); |
884 const FloatRect& uvRect = quad->uvRect(); | 885 const FloatRect& uvRect = quad->uvRect(); |
885 GLC(context(), context()->uniform4f(binding.texTransformLocation, uvRect.x()
, uvRect.y(), uvRect.width(), uvRect.height())); | 886 GLC(context(), context()->uniform4f(binding.texTransformLocation, uvRect.x()
, uvRect.y(), uvRect.width(), uvRect.height())); |
886 | 887 |
887 GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); | 888 GLC(context(), context()->activeTexture(GL_TEXTURE0)); |
888 CCResourceProvider::ScopedReadLockGL quadResourceLock(m_resourceProvider, qu
ad->resourceId()); | 889 CCResourceProvider::ScopedReadLockGL quadResourceLock(m_resourceProvider, qu
ad->resourceId()); |
889 GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quadRes
ourceLock.textureId())); | 890 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, quadResourceLock.textur
eId())); |
890 | 891 |
891 // FIXME: setting the texture parameters every time is redundant. Move this
code somewhere | 892 // FIXME: setting the texture parameters every time is redundant. Move this
code somewhere |
892 // where it will only happen once per texture. | 893 // where it will only happen once per texture. |
893 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph
icsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); | 894 GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER
, GL_LINEAR)); |
894 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph
icsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); | 895 GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER
, GL_LINEAR)); |
895 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph
icsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); | 896 GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL
_CLAMP_TO_EDGE)); |
896 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph
icsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); | 897 GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL
_CLAMP_TO_EDGE)); |
897 | 898 |
898 if (!quad->premultipliedAlpha()) { | 899 if (!quad->premultipliedAlpha()) { |
899 // As it turns out, the premultiplied alpha blending function (ONE, ONE_
MINUS_SRC_ALPHA) | 900 // As it turns out, the premultiplied alpha blending function (ONE, ONE_
MINUS_SRC_ALPHA) |
900 // will never cause the alpha channel to be set to anything less than 1.
0 if it is | 901 // will never cause the alpha channel to be set to anything less than 1.
0 if it is |
901 // initialized to that value! Therefore, premultipliedAlpha being false
is the first | 902 // initialized to that value! Therefore, premultipliedAlpha being false
is the first |
902 // situation we can generally see an alpha channel less than 1.0 coming
out of the | 903 // situation we can generally see an alpha channel less than 1.0 coming
out of the |
903 // compositor. This is causing platform differences in some layout tests
(see | 904 // compositor. This is causing platform differences in some layout tests
(see |
904 // https://bugs.webkit.org/show_bug.cgi?id=82412), so in this situation,
use a separate | 905 // https://bugs.webkit.org/show_bug.cgi?id=82412), so in this situation,
use a separate |
905 // blend function for the alpha channel to avoid modifying it. Don't use
colorMask for this | 906 // blend function for the alpha channel to avoid modifying it. Don't use
colorMask for this |
906 // as it has performance implications on some platforms. | 907 // as it has performance implications on some platforms. |
907 GLC(context(), context()->blendFuncSeparate(GraphicsContext3D::SRC_ALPHA
, GraphicsContext3D::ONE_MINUS_SRC_ALPHA, GraphicsContext3D::ZERO, GraphicsConte
xt3D::ONE)); | 908 GLC(context(), context()->blendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_S
RC_ALPHA, GL_ZERO, GL_ONE)); |
908 } | 909 } |
909 | 910 |
910 setShaderOpacity(quad->opacity(), binding.alphaLocation); | 911 setShaderOpacity(quad->opacity(), binding.alphaLocation); |
911 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), binding.mat
rixLocation); | 912 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), binding.mat
rixLocation); |
912 | 913 |
913 if (!quad->premultipliedAlpha()) | 914 if (!quad->premultipliedAlpha()) |
914 GLC(m_context, m_context->blendFunc(GraphicsContext3D::ONE, GraphicsCont
ext3D::ONE_MINUS_SRC_ALPHA)); | 915 GLC(m_context, m_context->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); |
915 } | 916 } |
916 | 917 |
917 void CCRendererGL::drawIOSurfaceQuad(const DrawingFrame& frame, const CCIOSurfac
eDrawQuad* quad) | 918 void CCRendererGL::drawIOSurfaceQuad(const DrawingFrame& frame, const CCIOSurfac
eDrawQuad* quad) |
918 { | 919 { |
919 ASSERT(CCProxy::isImplThread()); | 920 ASSERT(CCProxy::isImplThread()); |
920 TexTransformTextureProgramBinding binding; | 921 TexTransformTextureProgramBinding binding; |
921 binding.set(textureIOSurfaceProgram()); | 922 binding.set(textureIOSurfaceProgram()); |
922 | 923 |
923 GLC(context(), context()->useProgram(binding.programId)); | 924 GLC(context(), context()->useProgram(binding.programId)); |
924 GLC(context(), context()->uniform1i(binding.samplerLocation, 0)); | 925 GLC(context(), context()->uniform1i(binding.samplerLocation, 0)); |
925 if (quad->orientation() == CCIOSurfaceDrawQuad::Flipped) | 926 if (quad->orientation() == CCIOSurfaceDrawQuad::Flipped) |
926 GLC(context(), context()->uniform4f(binding.texTransformLocation, 0, qua
d->ioSurfaceSize().height(), quad->ioSurfaceSize().width(), quad->ioSurfaceSize(
).height() * -1.0)); | 927 GLC(context(), context()->uniform4f(binding.texTransformLocation, 0, qua
d->ioSurfaceSize().height(), quad->ioSurfaceSize().width(), quad->ioSurfaceSize(
).height() * -1.0)); |
927 else | 928 else |
928 GLC(context(), context()->uniform4f(binding.texTransformLocation, 0, 0,
quad->ioSurfaceSize().width(), quad->ioSurfaceSize().height())); | 929 GLC(context(), context()->uniform4f(binding.texTransformLocation, 0, 0,
quad->ioSurfaceSize().width(), quad->ioSurfaceSize().height())); |
929 | 930 |
930 GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); | 931 GLC(context(), context()->activeTexture(GL_TEXTURE0)); |
931 GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, q
uad->ioSurfaceTextureId())); | 932 GLC(context(), context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, quad->ioSurf
aceTextureId())); |
932 | 933 |
933 setShaderOpacity(quad->opacity(), binding.alphaLocation); | 934 setShaderOpacity(quad->opacity(), binding.alphaLocation); |
934 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), binding.mat
rixLocation); | 935 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), binding.mat
rixLocation); |
935 | 936 |
936 GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, 0
)); | 937 GLC(context(), context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, 0)); |
937 } | 938 } |
938 | 939 |
939 void CCRendererGL::finishDrawingFrame(DrawingFrame& frame) | 940 void CCRendererGL::finishDrawingFrame(DrawingFrame& frame) |
940 { | 941 { |
941 m_currentFramebufferLock.clear(); | 942 m_currentFramebufferLock.clear(); |
942 m_swapBufferRect.unite(enclosingIntRect(frame.rootDamageRect)); | 943 m_swapBufferRect.unite(enclosingIntRect(frame.rootDamageRect)); |
943 | 944 |
944 GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST)); | 945 GLC(m_context, m_context->disable(GL_SCISSOR_TEST)); |
945 GLC(m_context, m_context->disable(GraphicsContext3D::BLEND)); | 946 GLC(m_context, m_context->disable(GL_BLEND)); |
946 } | 947 } |
947 | 948 |
948 bool CCRendererGL::flippedFramebuffer() const | 949 bool CCRendererGL::flippedFramebuffer() const |
949 { | 950 { |
950 return true; | 951 return true; |
951 } | 952 } |
952 | 953 |
953 void CCRendererGL::toGLMatrix(float* flattened, const WebTransformationMatrix& m
) | 954 void CCRendererGL::toGLMatrix(float* flattened, const WebTransformationMatrix& m
) |
954 { | 955 { |
955 flattened[0] = m.m11(); | 956 flattened[0] = m.m11(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 } | 995 } |
995 | 996 |
996 void CCRendererGL::drawQuadGeometry(const DrawingFrame& frame, const WebKit::Web
TransformationMatrix& drawTransform, const FloatRect& quadRect, int matrixLocati
on) | 997 void CCRendererGL::drawQuadGeometry(const DrawingFrame& frame, const WebKit::Web
TransformationMatrix& drawTransform, const FloatRect& quadRect, int matrixLocati
on) |
997 { | 998 { |
998 WebTransformationMatrix quadRectMatrix; | 999 WebTransformationMatrix quadRectMatrix; |
999 quadRectTransform(&quadRectMatrix, drawTransform, quadRect); | 1000 quadRectTransform(&quadRectMatrix, drawTransform, quadRect); |
1000 static float glMatrix[16]; | 1001 static float glMatrix[16]; |
1001 toGLMatrix(&glMatrix[0], frame.projectionMatrix * quadRectMatrix); | 1002 toGLMatrix(&glMatrix[0], frame.projectionMatrix * quadRectMatrix); |
1002 GLC(m_context, m_context->uniformMatrix4fv(matrixLocation, 1, false, &glMatr
ix[0])); | 1003 GLC(m_context, m_context->uniformMatrix4fv(matrixLocation, 1, false, &glMatr
ix[0])); |
1003 | 1004 |
1004 GLC(m_context, m_context->drawElements(GraphicsContext3D::TRIANGLES, 6, Grap
hicsContext3D::UNSIGNED_SHORT, 0)); | 1005 GLC(m_context, m_context->drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0
)); |
1005 } | 1006 } |
1006 | 1007 |
1007 void CCRendererGL::copyTextureToFramebuffer(const DrawingFrame& frame, int textu
reId, const IntRect& rect, const WebTransformationMatrix& drawMatrix) | 1008 void CCRendererGL::copyTextureToFramebuffer(const DrawingFrame& frame, int textu
reId, const IntRect& rect, const WebTransformationMatrix& drawMatrix) |
1008 { | 1009 { |
1009 const RenderPassProgram* program = renderPassProgram(); | 1010 const RenderPassProgram* program = renderPassProgram(); |
1010 | 1011 |
1011 GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); | 1012 GLC(context(), context()->activeTexture(GL_TEXTURE0)); |
1012 GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, texture
Id)); | 1013 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, textureId)); |
1013 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph
icsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); | 1014 GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER
, GL_LINEAR)); |
1014 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph
icsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); | 1015 GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER
, GL_LINEAR)); |
1015 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph
icsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); | 1016 GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL
_CLAMP_TO_EDGE)); |
1016 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph
icsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); | 1017 GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL
_CLAMP_TO_EDGE)); |
1017 | 1018 |
1018 GLC(context(), context()->useProgram(program->program())); | 1019 GLC(context(), context()->useProgram(program->program())); |
1019 GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocatio
n(), 0)); | 1020 GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocatio
n(), 0)); |
1020 setShaderOpacity(1, program->fragmentShader().alphaLocation()); | 1021 setShaderOpacity(1, program->fragmentShader().alphaLocation()); |
1021 drawQuadGeometry(frame, drawMatrix, rect, program->vertexShader().matrixLoca
tion()); | 1022 drawQuadGeometry(frame, drawMatrix, rect, program->vertexShader().matrixLoca
tion()); |
1022 } | 1023 } |
1023 | 1024 |
1024 void CCRendererGL::finish() | 1025 void CCRendererGL::finish() |
1025 { | 1026 { |
1026 TRACE_EVENT0("cc", "CCRendererGL::finish"); | 1027 TRACE_EVENT0("cc", "CCRendererGL::finish"); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 | 1088 |
1088 void CCRendererGL::discardFramebuffer() | 1089 void CCRendererGL::discardFramebuffer() |
1089 { | 1090 { |
1090 if (m_isFramebufferDiscarded) | 1091 if (m_isFramebufferDiscarded) |
1091 return; | 1092 return; |
1092 | 1093 |
1093 if (!m_capabilities.usingDiscardFramebuffer) | 1094 if (!m_capabilities.usingDiscardFramebuffer) |
1094 return; | 1095 return; |
1095 | 1096 |
1096 // FIXME: Update attachments argument to appropriate values once they are no
longer ignored. | 1097 // FIXME: Update attachments argument to appropriate values once they are no
longer ignored. |
1097 m_context->discardFramebufferEXT(GraphicsContext3D::TEXTURE_2D, 0, 0); | 1098 m_context->discardFramebufferEXT(GL_TEXTURE_2D, 0, 0); |
1098 m_isFramebufferDiscarded = true; | 1099 m_isFramebufferDiscarded = true; |
1099 | 1100 |
1100 // Damage tracker needs a full reset every time framebuffer is discarded. | 1101 // Damage tracker needs a full reset every time framebuffer is discarded. |
1101 m_client->setFullRootLayerDamage(); | 1102 m_client->setFullRootLayerDamage(); |
1102 } | 1103 } |
1103 | 1104 |
1104 void CCRendererGL::ensureFramebuffer() | 1105 void CCRendererGL::ensureFramebuffer() |
1105 { | 1106 { |
1106 if (!m_isFramebufferDiscarded) | 1107 if (!m_isFramebufferDiscarded) |
1107 return; | 1108 return; |
(...skipping 15 matching lines...) Expand all Loading... |
1123 { | 1124 { |
1124 ASSERT(rect.maxX() <= viewportWidth() && rect.maxY() <= viewportHeight()); | 1125 ASSERT(rect.maxX() <= viewportWidth() && rect.maxY() <= viewportHeight()); |
1125 | 1126 |
1126 if (!pixels) | 1127 if (!pixels) |
1127 return; | 1128 return; |
1128 | 1129 |
1129 makeContextCurrent(); | 1130 makeContextCurrent(); |
1130 | 1131 |
1131 bool doWorkaround = needsIOSurfaceReadbackWorkaround(); | 1132 bool doWorkaround = needsIOSurfaceReadbackWorkaround(); |
1132 | 1133 |
1133 Platform3DObject temporaryTexture = 0; | 1134 GLuint temporaryTexture = 0; |
1134 Platform3DObject temporaryFBO = 0; | 1135 GLuint temporaryFBO = 0; |
1135 | 1136 |
1136 if (doWorkaround) { | 1137 if (doWorkaround) { |
1137 // On Mac OS X, calling glReadPixels against an FBO whose color attachme
nt is an | 1138 // On Mac OS X, calling glReadPixels against an FBO whose color attachme
nt is an |
1138 // IOSurface-backed texture causes corruption of future glReadPixels cal
ls, even those on | 1139 // IOSurface-backed texture causes corruption of future glReadPixels cal
ls, even those on |
1139 // different OpenGL contexts. It is believed that this is the root cause
of top crasher | 1140 // different OpenGL contexts. It is believed that this is the root cause
of top crasher |
1140 // http://crbug.com/99393. <rdar://problem/10949687> | 1141 // http://crbug.com/99393. <rdar://problem/10949687> |
1141 | 1142 |
1142 temporaryTexture = m_context->createTexture(); | 1143 temporaryTexture = m_context->createTexture(); |
1143 GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, tem
poraryTexture)); | 1144 GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, temporaryTexture)); |
1144 GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, G
raphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); | 1145 GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FI
LTER, GL_LINEAR)); |
1145 GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, G
raphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); | 1146 GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FI
LTER, GL_LINEAR)); |
1146 GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, G
raphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); | 1147 GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S
, GL_CLAMP_TO_EDGE)); |
1147 GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, G
raphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); | 1148 GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T
, GL_CLAMP_TO_EDGE)); |
1148 // Copy the contents of the current (IOSurface-backed) framebuffer into
a temporary texture. | 1149 // Copy the contents of the current (IOSurface-backed) framebuffer into
a temporary texture. |
1149 GLC(m_context, m_context->copyTexImage2D(GraphicsContext3D::TEXTURE_2D,
0, GraphicsContext3D::RGBA, 0, 0, viewportSize().width(), viewportSize().height(
), 0)); | 1150 GLC(m_context, m_context->copyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0
, viewportSize().width(), viewportSize().height(), 0)); |
1150 temporaryFBO = m_context->createFramebuffer(); | 1151 temporaryFBO = m_context->createFramebuffer(); |
1151 // Attach this texture to an FBO, and perform the readback from that FBO
. | 1152 // Attach this texture to an FBO, and perform the readback from that FBO
. |
1152 GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER
, temporaryFBO)); | 1153 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, temporaryFBO))
; |
1153 GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEB
UFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, temp
oraryTexture, 0)); | 1154 GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_
ATTACHMENT0, GL_TEXTURE_2D, temporaryTexture, 0)); |
1154 | 1155 |
1155 ASSERT(m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER)
== GraphicsContext3D::FRAMEBUFFER_COMPLETE); | 1156 ASSERT(m_context->checkFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFF
ER_COMPLETE); |
1156 } | 1157 } |
1157 | 1158 |
1158 OwnArrayPtr<uint8_t> srcPixels = adoptArrayPtr(new uint8_t[rect.width() * re
ct.height() * 4]); | 1159 OwnArrayPtr<uint8_t> srcPixels = adoptArrayPtr(new uint8_t[rect.width() * re
ct.height() * 4]); |
1159 GLC(m_context, m_context->readPixels(rect.x(), viewportSize().height() - rec
t.maxY(), rect.width(), rect.height(), | 1160 GLC(m_context, m_context->readPixels(rect.x(), viewportSize().height() - rec
t.maxY(), rect.width(), rect.height(), |
1160 GraphicsContext3D::RGBA, GraphicsContext3D:
:UNSIGNED_BYTE, srcPixels.get())); | 1161 GL_RGBA, GL_UNSIGNED_BYTE, srcPixels.get())
); |
1161 | 1162 |
1162 uint8_t* destPixels = static_cast<uint8_t*>(pixels); | 1163 uint8_t* destPixels = static_cast<uint8_t*>(pixels); |
1163 size_t rowBytes = rect.width() * 4; | 1164 size_t rowBytes = rect.width() * 4; |
1164 int numRows = rect.height(); | 1165 int numRows = rect.height(); |
1165 size_t totalBytes = numRows * rowBytes; | 1166 size_t totalBytes = numRows * rowBytes; |
1166 for (size_t destY = 0; destY < totalBytes; destY += rowBytes) { | 1167 for (size_t destY = 0; destY < totalBytes; destY += rowBytes) { |
1167 // Flip Y axis. | 1168 // Flip Y axis. |
1168 size_t srcY = totalBytes - destY - rowBytes; | 1169 size_t srcY = totalBytes - destY - rowBytes; |
1169 // Swizzle BGRA -> RGBA. | 1170 // Swizzle BGRA -> RGBA. |
1170 for (size_t x = 0; x < rowBytes; x += 4) { | 1171 for (size_t x = 0; x < rowBytes; x += 4) { |
1171 destPixels[destY + (x+0)] = srcPixels.get()[srcY + (x+2)]; | 1172 destPixels[destY + (x+0)] = srcPixels.get()[srcY + (x+2)]; |
1172 destPixels[destY + (x+1)] = srcPixels.get()[srcY + (x+1)]; | 1173 destPixels[destY + (x+1)] = srcPixels.get()[srcY + (x+1)]; |
1173 destPixels[destY + (x+2)] = srcPixels.get()[srcY + (x+0)]; | 1174 destPixels[destY + (x+2)] = srcPixels.get()[srcY + (x+0)]; |
1174 destPixels[destY + (x+3)] = srcPixels.get()[srcY + (x+3)]; | 1175 destPixels[destY + (x+3)] = srcPixels.get()[srcY + (x+3)]; |
1175 } | 1176 } |
1176 } | 1177 } |
1177 | 1178 |
1178 if (doWorkaround) { | 1179 if (doWorkaround) { |
1179 // Clean up. | 1180 // Clean up. |
1180 GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER
, 0)); | 1181 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, 0)); |
1181 GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0))
; | 1182 GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, 0)); |
1182 GLC(m_context, m_context->deleteFramebuffer(temporaryFBO)); | 1183 GLC(m_context, m_context->deleteFramebuffer(temporaryFBO)); |
1183 GLC(m_context, m_context->deleteTexture(temporaryTexture)); | 1184 GLC(m_context, m_context->deleteTexture(temporaryTexture)); |
1184 } | 1185 } |
1185 | 1186 |
1186 if (!m_visible) { | 1187 if (!m_visible) { |
1187 TRACE_EVENT0("cc", "CCRendererGL::getFramebufferPixels dropping resource
s after readback"); | 1188 TRACE_EVENT0("cc", "CCRendererGL::getFramebufferPixels dropping resource
s after readback"); |
1188 discardFramebuffer(); | 1189 discardFramebuffer(); |
1189 releaseRenderPassTextures(); | 1190 releaseRenderPassTextures(); |
1190 m_client->releaseContentsTextures(); | 1191 m_client->releaseContentsTextures(); |
1191 GLC(m_context, m_context->flush()); | 1192 GLC(m_context, m_context->flush()); |
1192 } | 1193 } |
1193 } | 1194 } |
1194 | 1195 |
1195 bool CCRendererGL::getFramebufferTexture(CCScopedTexture* texture, const IntRect
& deviceRect) | 1196 bool CCRendererGL::getFramebufferTexture(CCScopedTexture* texture, const IntRect
& deviceRect) |
1196 { | 1197 { |
1197 ASSERT(!texture->id() || (texture->size() == deviceRect.size() && texture->f
ormat() == GraphicsContext3D::RGB)); | 1198 ASSERT(!texture->id() || (texture->size() == deviceRect.size() && texture->f
ormat() == GL_RGB)); |
1198 | 1199 |
1199 if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, deviceRect.si
ze(), GraphicsContext3D::RGB, CCResourceProvider::TextureUsageAny)) | 1200 if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, deviceRect.si
ze(), GL_RGB, CCResourceProvider::TextureUsageAny)) |
1200 return false; | 1201 return false; |
1201 | 1202 |
1202 CCResourceProvider::ScopedWriteLockGL lock(m_resourceProvider, texture->id()
); | 1203 CCResourceProvider::ScopedWriteLockGL lock(m_resourceProvider, texture->id()
); |
1203 GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.te
xtureId())); | 1204 GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, lock.textureId())); |
1204 GLC(m_context, m_context->copyTexImage2D(GraphicsContext3D::TEXTURE_2D, 0, t
exture->format(), | 1205 GLC(m_context, m_context->copyTexImage2D(GL_TEXTURE_2D, 0, texture->format()
, |
1205 deviceRect.x(), deviceRect.y(), dev
iceRect.width(), deviceRect.height(), 0)); | 1206 deviceRect.x(), deviceRect.y(), dev
iceRect.width(), deviceRect.height(), 0)); |
1206 return true; | 1207 return true; |
1207 } | 1208 } |
1208 | 1209 |
1209 bool CCRendererGL::useScopedTexture(DrawingFrame& frame, const CCScopedTexture*
texture, const IntRect& viewportRect) | 1210 bool CCRendererGL::useScopedTexture(DrawingFrame& frame, const CCScopedTexture*
texture, const IntRect& viewportRect) |
1210 { | 1211 { |
1211 ASSERT(texture->id()); | 1212 ASSERT(texture->id()); |
1212 frame.currentRenderPass = 0; | 1213 frame.currentRenderPass = 0; |
1213 frame.currentTexture = texture; | 1214 frame.currentTexture = texture; |
1214 | 1215 |
1215 return bindFramebufferToTexture(frame, texture, viewportRect); | 1216 return bindFramebufferToTexture(frame, texture, viewportRect); |
1216 } | 1217 } |
1217 | 1218 |
1218 void CCRendererGL::bindFramebufferToOutputSurface(DrawingFrame& frame) | 1219 void CCRendererGL::bindFramebufferToOutputSurface(DrawingFrame& frame) |
1219 { | 1220 { |
1220 m_currentFramebufferLock.clear(); | 1221 m_currentFramebufferLock.clear(); |
1221 GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)
); | 1222 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, 0)); |
1222 } | 1223 } |
1223 | 1224 |
1224 bool CCRendererGL::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedT
exture* texture, const IntRect& framebufferRect) | 1225 bool CCRendererGL::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedT
exture* texture, const IntRect& framebufferRect) |
1225 { | 1226 { |
1226 ASSERT(texture->id()); | 1227 ASSERT(texture->id()); |
1227 | 1228 |
1228 GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_
offscreenFramebufferId)); | 1229 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, m_offscreenFramebu
fferId)); |
1229 m_currentFramebufferLock = adoptPtr(new CCResourceProvider::ScopedWriteLockG
L(m_resourceProvider, texture->id())); | 1230 m_currentFramebufferLock = adoptPtr(new CCResourceProvider::ScopedWriteLockG
L(m_resourceProvider, texture->id())); |
1230 unsigned textureId = m_currentFramebufferLock->textureId(); | 1231 unsigned textureId = m_currentFramebufferLock->textureId(); |
1231 GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFE
R, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, textureI
d, 0)); | 1232 GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTA
CHMENT0, GL_TEXTURE_2D, textureId, 0)); |
1232 | 1233 |
1233 #if !defined ( NDEBUG ) | 1234 #if !defined ( NDEBUG ) |
1234 if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != Gra
phicsContext3D::FRAMEBUFFER_COMPLETE) { | 1235 if (m_context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMP
LETE) { |
1235 ASSERT_NOT_REACHED(); | 1236 ASSERT_NOT_REACHED(); |
1236 return false; | 1237 return false; |
1237 } | 1238 } |
1238 #endif | 1239 #endif |
1239 | 1240 |
1240 initializeMatrices(frame, framebufferRect, false); | 1241 initializeMatrices(frame, framebufferRect, false); |
1241 setDrawViewportSize(framebufferRect.size()); | 1242 setDrawViewportSize(framebufferRect.size()); |
1242 | 1243 |
1243 return true; | 1244 return true; |
1244 } | 1245 } |
1245 | 1246 |
1246 void CCRendererGL::enableScissorTestRect(const IntRect& scissorRect) | 1247 void CCRendererGL::enableScissorTestRect(const IntRect& scissorRect) |
1247 { | 1248 { |
1248 GLC(m_context, m_context->enable(GraphicsContext3D::SCISSOR_TEST)); | 1249 GLC(m_context, m_context->enable(GL_SCISSOR_TEST)); |
1249 GLC(m_context, m_context->scissor(scissorRect.x(), scissorRect.y(), scissorR
ect.width(), scissorRect.height())); | 1250 GLC(m_context, m_context->scissor(scissorRect.x(), scissorRect.y(), scissorR
ect.width(), scissorRect.height())); |
1250 } | 1251 } |
1251 | 1252 |
1252 void CCRendererGL::disableScissorTest() | 1253 void CCRendererGL::disableScissorTest() |
1253 { | 1254 { |
1254 GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST)); | 1255 GLC(m_context, m_context->disable(GL_SCISSOR_TEST)); |
1255 } | 1256 } |
1256 | 1257 |
1257 void CCRendererGL::setDrawViewportSize(const IntSize& viewportSize) | 1258 void CCRendererGL::setDrawViewportSize(const IntSize& viewportSize) |
1258 { | 1259 { |
1259 GLC(m_context, m_context->viewport(0, 0, viewportSize.width(), viewportSize.
height())); | 1260 GLC(m_context, m_context->viewport(0, 0, viewportSize.width(), viewportSize.
height())); |
1260 } | 1261 } |
1261 | 1262 |
1262 bool CCRendererGL::makeContextCurrent() | 1263 bool CCRendererGL::makeContextCurrent() |
1263 { | 1264 { |
1264 return m_context->makeContextCurrent(); | 1265 return m_context->makeContextCurrent(); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 m_solidColorProgram->cleanup(m_context); | 1515 m_solidColorProgram->cleanup(m_context); |
1515 | 1516 |
1516 if (m_offscreenFramebufferId) | 1517 if (m_offscreenFramebufferId) |
1517 GLC(m_context, m_context->deleteFramebuffer(m_offscreenFramebufferId)); | 1518 GLC(m_context, m_context->deleteFramebuffer(m_offscreenFramebufferId)); |
1518 | 1519 |
1519 releaseRenderPassTextures(); | 1520 releaseRenderPassTextures(); |
1520 } | 1521 } |
1521 | 1522 |
1522 bool CCRendererGL::isContextLost() | 1523 bool CCRendererGL::isContextLost() |
1523 { | 1524 { |
1524 return (m_context->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERRO
R); | 1525 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); |
1525 } | 1526 } |
1526 | 1527 |
1527 } // namespace cc | 1528 } // namespace cc |
OLD | NEW |