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