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 "cc/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 stats.bytesVisibleAndNearby = bytes_visible_and_nearby; | 228 stats.bytesVisibleAndNearby = bytes_visible_and_nearby; |
229 stats.bytesAllocated = bytes_allocated; | 229 stats.bytesAllocated = bytes_allocated; |
230 stats.backbufferRequested = !is_backbuffer_discarded_; | 230 stats.backbufferRequested = !is_backbuffer_discarded_; |
231 context_->sendManagedMemoryStatsCHROMIUM(&stats); | 231 context_->sendManagedMemoryStatsCHROMIUM(&stats); |
232 } | 232 } |
233 | 233 |
234 void GLRenderer::ReleaseRenderPassTextures() { render_pass_textures_.clear(); } | 234 void GLRenderer::ReleaseRenderPassTextures() { render_pass_textures_.clear(); } |
235 | 235 |
236 void GLRenderer::ViewportChanged() { is_viewport_changed_ = true; } | 236 void GLRenderer::ViewportChanged() { is_viewport_changed_ = true; } |
237 | 237 |
238 void GLRenderer::ClearFramebuffer(DrawingFrame& frame) { | 238 void GLRenderer::ClearFramebuffer(DrawingFrame* frame) { |
239 // On DEBUG builds, opaque render passes are cleared to blue to easily see | 239 // On DEBUG builds, opaque render passes are cleared to blue to easily see |
240 // regions that were not drawn on the screen. | 240 // regions that were not drawn on the screen. |
241 if (frame.current_render_pass->has_transparent_background) | 241 if (frame->current_render_pass->has_transparent_background) |
242 GLC(context_, context_->clearColor(0, 0, 0, 0)); | 242 GLC(context_, context_->clearColor(0, 0, 0, 0)); |
243 else | 243 else |
244 GLC(context_, context_->clearColor(0, 0, 1, 1)); | 244 GLC(context_, context_->clearColor(0, 0, 1, 1)); |
245 | 245 |
246 #ifdef NDEBUG | 246 #ifdef NDEBUG |
247 if (frame.current_render_pass->has_transparent_background) | 247 if (frame->current_render_pass->has_transparent_background) |
248 #endif | 248 #endif |
249 context_->clear(GL_COLOR_BUFFER_BIT); | 249 context_->clear(GL_COLOR_BUFFER_BIT); |
250 } | 250 } |
251 | 251 |
252 void GLRenderer::BeginDrawingFrame(DrawingFrame& frame) { | 252 void GLRenderer::BeginDrawingFrame(DrawingFrame* frame) { |
253 // FIXME: Remove this once backbuffer is automatically recreated on first use | 253 // FIXME: Remove this once backbuffer is automatically recreated on first use |
254 EnsureBackbuffer(); | 254 EnsureBackbuffer(); |
255 | 255 |
256 if (ViewportSize().IsEmpty()) | 256 if (ViewportSize().IsEmpty()) |
257 return; | 257 return; |
258 | 258 |
259 TRACE_EVENT0("cc", "GLRenderer::DrawLayers"); | 259 TRACE_EVENT0("cc", "GLRenderer::DrawLayers"); |
260 if (is_viewport_changed_) { | 260 if (is_viewport_changed_) { |
261 // Only reshape when we know we are going to draw. Otherwise, the reshape | 261 // Only reshape when we know we are going to draw. Otherwise, the reshape |
262 // can leave the window at the wrong size if we never draw and the proper | 262 // can leave the window at the wrong size if we never draw and the proper |
(...skipping 14 matching lines...) Expand all Loading... |
277 GLC(context_, context_->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); | 277 GLC(context_, context_->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); |
278 GLC(Context(), Context()->activeTexture(GL_TEXTURE0)); | 278 GLC(Context(), Context()->activeTexture(GL_TEXTURE0)); |
279 program_shadow_ = 0; | 279 program_shadow_ = 0; |
280 } | 280 } |
281 | 281 |
282 void GLRenderer::DoNoOp() { | 282 void GLRenderer::DoNoOp() { |
283 GLC(context_, context_->bindFramebuffer(GL_FRAMEBUFFER, 0)); | 283 GLC(context_, context_->bindFramebuffer(GL_FRAMEBUFFER, 0)); |
284 GLC(context_, context_->flush()); | 284 GLC(context_, context_->flush()); |
285 } | 285 } |
286 | 286 |
287 void GLRenderer::DoDrawQuad(DrawingFrame& frame, const DrawQuad* quad) { | 287 void GLRenderer::DoDrawQuad(DrawingFrame* frame, const DrawQuad* quad) { |
288 DCHECK(quad->rect.Contains(quad->visible_rect)); | 288 DCHECK(quad->rect.Contains(quad->visible_rect)); |
289 if (quad->material != DrawQuad::TEXTURE_CONTENT) { | 289 if (quad->material != DrawQuad::TEXTURE_CONTENT) { |
290 FlushTextureQuadCache(); | 290 FlushTextureQuadCache(); |
291 } | 291 } |
292 | 292 |
293 switch (quad->material) { | 293 switch (quad->material) { |
294 case DrawQuad::INVALID: | 294 case DrawQuad::INVALID: |
295 NOTREACHED(); | 295 NOTREACHED(); |
296 break; | 296 break; |
297 case DrawQuad::CHECKERBOARD: | 297 case DrawQuad::CHECKERBOARD: |
(...skipping 19 matching lines...) Expand all Loading... |
317 break; | 317 break; |
318 case DrawQuad::TILED_CONTENT: | 318 case DrawQuad::TILED_CONTENT: |
319 DrawTileQuad(frame, TileDrawQuad::MaterialCast(quad)); | 319 DrawTileQuad(frame, TileDrawQuad::MaterialCast(quad)); |
320 break; | 320 break; |
321 case DrawQuad::YUV_VIDEO_CONTENT: | 321 case DrawQuad::YUV_VIDEO_CONTENT: |
322 DrawYUVVideoQuad(frame, YUVVideoDrawQuad::MaterialCast(quad)); | 322 DrawYUVVideoQuad(frame, YUVVideoDrawQuad::MaterialCast(quad)); |
323 break; | 323 break; |
324 } | 324 } |
325 } | 325 } |
326 | 326 |
327 void GLRenderer::DrawCheckerboardQuad(const DrawingFrame& frame, | 327 void GLRenderer::DrawCheckerboardQuad(const DrawingFrame* frame, |
328 const CheckerboardDrawQuad* quad) { | 328 const CheckerboardDrawQuad* quad) { |
329 SetBlendEnabled(quad->ShouldDrawWithBlending()); | 329 SetBlendEnabled(quad->ShouldDrawWithBlending()); |
330 | 330 |
331 const TileCheckerboardProgram* program = GetTileCheckerboardProgram(); | 331 const TileCheckerboardProgram* program = GetTileCheckerboardProgram(); |
332 DCHECK(program && (program->initialized() || IsContextLost())); | 332 DCHECK(program && (program->initialized() || IsContextLost())); |
333 SetUseProgram(program->program()); | 333 SetUseProgram(program->program()); |
334 | 334 |
335 SkColor color = quad->color; | 335 SkColor color = quad->color; |
336 GLC(Context(), | 336 GLC(Context(), |
337 Context()->uniform4f(program->fragment_shader().color_location(), | 337 Context()->uniform4f(program->fragment_shader().color_location(), |
(...skipping 22 matching lines...) Expand all Loading... |
360 frequency)); | 360 frequency)); |
361 | 361 |
362 SetShaderOpacity(quad->opacity(), | 362 SetShaderOpacity(quad->opacity(), |
363 program->fragment_shader().alpha_location()); | 363 program->fragment_shader().alpha_location()); |
364 DrawQuadGeometry(frame, | 364 DrawQuadGeometry(frame, |
365 quad->quadTransform(), | 365 quad->quadTransform(), |
366 quad->rect, | 366 quad->rect, |
367 program->vertex_shader().matrix_location()); | 367 program->vertex_shader().matrix_location()); |
368 } | 368 } |
369 | 369 |
370 void GLRenderer::DrawDebugBorderQuad(const DrawingFrame& frame, | 370 void GLRenderer::DrawDebugBorderQuad(const DrawingFrame* frame, |
371 const DebugBorderDrawQuad* quad) { | 371 const DebugBorderDrawQuad* quad) { |
372 SetBlendEnabled(quad->ShouldDrawWithBlending()); | 372 SetBlendEnabled(quad->ShouldDrawWithBlending()); |
373 | 373 |
374 static float gl_matrix[16]; | 374 static float gl_matrix[16]; |
375 const DebugBorderProgram* program = GetDebugBorderProgram(); | 375 const DebugBorderProgram* program = GetDebugBorderProgram(); |
376 DCHECK(program && (program->initialized() || IsContextLost())); | 376 DCHECK(program && (program->initialized() || IsContextLost())); |
377 SetUseProgram(program->program()); | 377 SetUseProgram(program->program()); |
378 | 378 |
379 // Use the full quad_rect for debug quads to not move the edges based on | 379 // Use the full quad_rect for debug quads to not move the edges based on |
380 // partial swaps. | 380 // partial swaps. |
381 gfx::Rect layer_rect = quad->rect; | 381 gfx::Rect layer_rect = quad->rect; |
382 gfx::Transform render_matrix = quad->quadTransform(); | 382 gfx::Transform render_matrix = quad->quadTransform(); |
383 render_matrix.Translate(0.5f * layer_rect.width() + layer_rect.x(), | 383 render_matrix.Translate(0.5f * layer_rect.width() + layer_rect.x(), |
384 0.5f * layer_rect.height() + layer_rect.y()); | 384 0.5f * layer_rect.height() + layer_rect.y()); |
385 render_matrix.Scale(layer_rect.width(), layer_rect.height()); | 385 render_matrix.Scale(layer_rect.width(), layer_rect.height()); |
386 GLRenderer::ToGLMatrix(&gl_matrix[0], | 386 GLRenderer::ToGLMatrix(&gl_matrix[0], |
387 frame.projection_matrix * render_matrix); | 387 frame->projection_matrix * render_matrix); |
388 GLC(Context(), | 388 GLC(Context(), |
389 Context()->uniformMatrix4fv( | 389 Context()->uniformMatrix4fv( |
390 program->vertex_shader().matrix_location(), 1, false, &gl_matrix[0])); | 390 program->vertex_shader().matrix_location(), 1, false, &gl_matrix[0])); |
391 | 391 |
392 SkColor color = quad->color; | 392 SkColor color = quad->color; |
393 float alpha = SkColorGetA(color) * (1.0f / 255.0f); | 393 float alpha = SkColorGetA(color) * (1.0f / 255.0f); |
394 | 394 |
395 GLC(Context(), | 395 GLC(Context(), |
396 Context()->uniform4f(program->fragment_shader().color_location(), | 396 Context()->uniform4f(program->fragment_shader().color_location(), |
397 (SkColorGetR(color) * (1.0f / 255.0f)) * alpha, | 397 (SkColorGetR(color) * (1.0f / 255.0f)) * alpha, |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 // visible in the compositor's context. | 522 // visible in the compositor's context. |
523 offscreen_contexts->Context3d()->flush(); | 523 offscreen_contexts->Context3d()->flush(); |
524 | 524 |
525 // Use the compositor's GL context again. | 525 // Use the compositor's GL context again. |
526 renderer->resource_provider()->GraphicsContext3D()->makeContextCurrent(); | 526 renderer->resource_provider()->GraphicsContext3D()->makeContextCurrent(); |
527 | 527 |
528 return device.accessBitmap(false); | 528 return device.accessBitmap(false); |
529 } | 529 } |
530 | 530 |
531 scoped_ptr<ScopedResource> GLRenderer::DrawBackgroundFilters( | 531 scoped_ptr<ScopedResource> GLRenderer::DrawBackgroundFilters( |
532 DrawingFrame& frame, | 532 DrawingFrame* frame, |
533 const RenderPassDrawQuad* quad, | 533 const RenderPassDrawQuad* quad, |
534 const gfx::Transform& contents_device_transform, | 534 const gfx::Transform& contents_device_transform, |
535 const gfx::Transform& contents_device_transform_inverse) { | 535 const gfx::Transform& contents_device_transform_inverse) { |
536 // This method draws a background filter, which applies a filter to any pixels | 536 // This method draws a background filter, which applies a filter to any pixels |
537 // behind the quad and seen through its background. The algorithm works as | 537 // behind the quad and seen through its background. The algorithm works as |
538 // follows: | 538 // follows: |
539 // 1. Compute a bounding box around the pixels that will be visible through | 539 // 1. Compute a bounding box around the pixels that will be visible through |
540 // the quad. | 540 // the quad. |
541 // 2. Read the pixels in the bounding box into a buffer R. | 541 // 2. Read the pixels in the bounding box into a buffer R. |
542 // 3. Apply the background filter to R, so that it is applied in the pixels' | 542 // 3. Apply the background filter to R, so that it is applied in the pixels' |
(...skipping 13 matching lines...) Expand all Loading... |
556 // FIXME: When this algorithm changes, update | 556 // FIXME: When this algorithm changes, update |
557 // LayerTreeHost::prioritizeTextures() accordingly. | 557 // LayerTreeHost::prioritizeTextures() accordingly. |
558 | 558 |
559 const WebKit::WebFilterOperations& filters = quad->background_filters; | 559 const WebKit::WebFilterOperations& filters = quad->background_filters; |
560 if (filters.isEmpty()) | 560 if (filters.isEmpty()) |
561 return scoped_ptr<ScopedResource>(); | 561 return scoped_ptr<ScopedResource>(); |
562 | 562 |
563 // FIXME: We only allow background filters on an opaque render surface because | 563 // FIXME: We only allow background filters on an opaque render surface because |
564 // other surfaces may contain translucent pixels, and the contents behind | 564 // other surfaces may contain translucent pixels, and the contents behind |
565 // those translucent pixels wouldn't have the filter applied. | 565 // those translucent pixels wouldn't have the filter applied. |
566 if (frame.current_render_pass->has_transparent_background) | 566 if (frame->current_render_pass->has_transparent_background) |
567 return scoped_ptr<ScopedResource>(); | 567 return scoped_ptr<ScopedResource>(); |
568 DCHECK(!frame.current_texture); | 568 DCHECK(!frame->current_texture); |
569 | 569 |
570 // FIXME: Do a single readback for both the surface and replica and cache the | 570 // FIXME: Do a single readback for both the surface and replica and cache the |
571 // filtered results (once filter textures are not reused). | 571 // filtered results (once filter textures are not reused). |
572 gfx::Rect device_rect = gfx::ToEnclosingRect(MathUtil::MapClippedRect( | 572 gfx::Rect device_rect = gfx::ToEnclosingRect(MathUtil::MapClippedRect( |
573 contents_device_transform, SharedGeometryQuad().BoundingBox())); | 573 contents_device_transform, SharedGeometryQuad().BoundingBox())); |
574 | 574 |
575 int top, right, bottom, left; | 575 int top, right, bottom, left; |
576 filters.getOutsets(top, right, bottom, left); | 576 filters.getOutsets(top, right, bottom, left); |
577 device_rect.Inset(-left, -top, -right, -bottom); | 577 device_rect.Inset(-left, -top, -right, -bottom); |
578 | 578 |
579 device_rect.Intersect(frame.current_render_pass->output_rect); | 579 device_rect.Intersect(frame->current_render_pass->output_rect); |
580 | 580 |
581 scoped_ptr<ScopedResource> device_background_texture = | 581 scoped_ptr<ScopedResource> device_background_texture = |
582 ScopedResource::create(resource_provider_); | 582 ScopedResource::create(resource_provider_); |
583 if (!GetFramebufferTexture(device_background_texture.get(), device_rect)) | 583 if (!GetFramebufferTexture(device_background_texture.get(), device_rect)) |
584 return scoped_ptr<ScopedResource>(); | 584 return scoped_ptr<ScopedResource>(); |
585 | 585 |
586 SkBitmap filtered_device_background = | 586 SkBitmap filtered_device_background = |
587 ApplyFilters(this, filters, device_background_texture.get()); | 587 ApplyFilters(this, filters, device_background_texture.get()); |
588 if (!filtered_device_background.getTexture()) | 588 if (!filtered_device_background.getTexture()) |
589 return scoped_ptr<ScopedResource>(); | 589 return scoped_ptr<ScopedResource>(); |
590 | 590 |
591 GrTexture* texture = | 591 GrTexture* texture = |
592 reinterpret_cast<GrTexture*>(filtered_device_background.getTexture()); | 592 reinterpret_cast<GrTexture*>(filtered_device_background.getTexture()); |
593 int filtered_device_background_texture_id = texture->getTextureHandle(); | 593 int filtered_device_background_texture_id = texture->getTextureHandle(); |
594 | 594 |
595 scoped_ptr<ScopedResource> background_texture = | 595 scoped_ptr<ScopedResource> background_texture = |
596 ScopedResource::create(resource_provider_); | 596 ScopedResource::create(resource_provider_); |
597 if (!background_texture->Allocate(quad->rect.size(), | 597 if (!background_texture->Allocate(quad->rect.size(), |
598 GL_RGBA, | 598 GL_RGBA, |
599 ResourceProvider::TextureUsageFramebuffer)) | 599 ResourceProvider::TextureUsageFramebuffer)) |
600 return scoped_ptr<ScopedResource>(); | 600 return scoped_ptr<ScopedResource>(); |
601 | 601 |
602 const RenderPass* target_render_pass = frame.current_render_pass; | 602 const RenderPass* target_render_pass = frame->current_render_pass; |
603 bool using_background_texture = | 603 bool using_background_texture = |
604 UseScopedTexture(frame, background_texture.get(), quad->rect); | 604 UseScopedTexture(frame, background_texture.get(), quad->rect); |
605 | 605 |
606 if (using_background_texture) { | 606 if (using_background_texture) { |
607 // Copy the readback pixels from device to the background texture for the | 607 // Copy the readback pixels from device to the background texture for the |
608 // surface. | 608 // surface. |
609 gfx::Transform device_to_framebuffer_transform; | 609 gfx::Transform device_to_framebuffer_transform; |
610 device_to_framebuffer_transform.Translate( | 610 device_to_framebuffer_transform.Translate( |
611 quad->rect.width() * 0.5f + quad->rect.x(), | 611 quad->rect.width() * 0.5f + quad->rect.x(), |
612 quad->rect.height() * 0.5f + quad->rect.y()); | 612 quad->rect.height() * 0.5f + quad->rect.y()); |
(...skipping 13 matching lines...) Expand all Loading... |
626 device_to_framebuffer_transform); | 626 device_to_framebuffer_transform); |
627 } | 627 } |
628 | 628 |
629 UseRenderPass(frame, target_render_pass); | 629 UseRenderPass(frame, target_render_pass); |
630 | 630 |
631 if (!using_background_texture) | 631 if (!using_background_texture) |
632 return scoped_ptr<ScopedResource>(); | 632 return scoped_ptr<ScopedResource>(); |
633 return background_texture.Pass(); | 633 return background_texture.Pass(); |
634 } | 634 } |
635 | 635 |
636 void GLRenderer::DrawRenderPassQuad(DrawingFrame& frame, | 636 void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, |
637 const RenderPassDrawQuad* quad) { | 637 const RenderPassDrawQuad* quad) { |
638 SetBlendEnabled(quad->ShouldDrawWithBlending()); | 638 SetBlendEnabled(quad->ShouldDrawWithBlending()); |
639 | 639 |
640 CachedResource* contents_texture = | 640 CachedResource* contents_texture = |
641 render_pass_textures_.get(quad->render_pass_id); | 641 render_pass_textures_.get(quad->render_pass_id); |
642 if (!contents_texture || !contents_texture->id()) | 642 if (!contents_texture || !contents_texture->id()) |
643 return; | 643 return; |
644 | 644 |
645 gfx::Transform quad_rect_matrix; | 645 gfx::Transform quad_rect_matrix; |
646 QuadRectTransform(&quad_rect_matrix, quad->quadTransform(), quad->rect); | 646 QuadRectTransform(&quad_rect_matrix, quad->quadTransform(), quad->rect); |
647 gfx::Transform contents_device_transform = | 647 gfx::Transform contents_device_transform = |
648 frame.window_matrix * frame.projection_matrix * quad_rect_matrix; | 648 frame->window_matrix * frame->projection_matrix * quad_rect_matrix; |
649 contents_device_transform.FlattenTo2d(); | 649 contents_device_transform.FlattenTo2d(); |
650 | 650 |
651 // Can only draw surface if device matrix is invertible. | 651 // Can only draw surface if device matrix is invertible. |
652 gfx::Transform contents_device_transform_inverse( | 652 gfx::Transform contents_device_transform_inverse( |
653 gfx::Transform::kSkipInitialization); | 653 gfx::Transform::kSkipInitialization); |
654 if (!contents_device_transform.GetInverse(&contents_device_transform_inverse)) | 654 if (!contents_device_transform.GetInverse(&contents_device_transform_inverse)) |
655 return; | 655 return; |
656 | 656 |
657 scoped_ptr<ScopedResource> background_texture = | 657 scoped_ptr<ScopedResource> background_texture = |
658 DrawBackgroundFilters(frame, | 658 DrawBackgroundFilters(frame, |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 DCHECK(did_invert); | 946 DCHECK(did_invert); |
947 *local_quad = MathUtil::MapQuad( | 947 *local_quad = MathUtil::MapQuad( |
948 inverse_device_transform, device_quad.ToQuadF(), &clipped); | 948 inverse_device_transform, device_quad.ToQuadF(), &clipped); |
949 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may | 949 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may |
950 // cause device_quad to become clipped. To our knowledge this scenario does | 950 // cause device_quad to become clipped. To our knowledge this scenario does |
951 // not need to be handled differently than the unclipped case. | 951 // not need to be handled differently than the unclipped case. |
952 | 952 |
953 return true; | 953 return true; |
954 } | 954 } |
955 | 955 |
956 void GLRenderer::DrawSolidColorQuad(const DrawingFrame& frame, | 956 void GLRenderer::DrawSolidColorQuad(const DrawingFrame* frame, |
957 const SolidColorDrawQuad* quad) { | 957 const SolidColorDrawQuad* quad) { |
958 SetBlendEnabled(quad->ShouldDrawWithBlending()); | 958 SetBlendEnabled(quad->ShouldDrawWithBlending()); |
959 gfx::Rect tile_rect = quad->visible_rect; | 959 gfx::Rect tile_rect = quad->visible_rect; |
960 | 960 |
961 gfx::Transform device_transform = | 961 gfx::Transform device_transform = |
962 frame.window_matrix * frame.projection_matrix * quad->quadTransform(); | 962 frame->window_matrix * frame->projection_matrix * quad->quadTransform(); |
963 device_transform.FlattenTo2d(); | 963 device_transform.FlattenTo2d(); |
964 if (!device_transform.IsInvertible()) | 964 if (!device_transform.IsInvertible()) |
965 return; | 965 return; |
966 | 966 |
967 gfx::QuadF local_quad = gfx::QuadF(gfx::RectF(tile_rect)); | 967 gfx::QuadF local_quad = gfx::QuadF(gfx::RectF(tile_rect)); |
968 float edge[24]; | 968 float edge[24]; |
969 bool use_aa = SetupQuadForAntialiasing( | 969 bool use_aa = SetupQuadForAntialiasing( |
970 device_transform, quad, &local_quad, edge); | 970 device_transform, quad, &local_quad, edge); |
971 | 971 |
972 SolidColorProgramUniforms uniforms; | 972 SolidColorProgramUniforms uniforms; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 uniforms->matrix_location = program->vertex_shader().matrix_location(); | 1029 uniforms->matrix_location = program->vertex_shader().matrix_location(); |
1030 uniforms->point_location = program->vertex_shader().point_location(); | 1030 uniforms->point_location = program->vertex_shader().point_location(); |
1031 | 1031 |
1032 uniforms->sampler_location = program->fragment_shader().sampler_location(); | 1032 uniforms->sampler_location = program->fragment_shader().sampler_location(); |
1033 uniforms->alpha_location = program->fragment_shader().alpha_location(); | 1033 uniforms->alpha_location = program->fragment_shader().alpha_location(); |
1034 uniforms->fragment_tex_transform_location = | 1034 uniforms->fragment_tex_transform_location = |
1035 program->fragment_shader().fragment_tex_transform_location(); | 1035 program->fragment_shader().fragment_tex_transform_location(); |
1036 uniforms->edge_location = program->fragment_shader().edge_location(); | 1036 uniforms->edge_location = program->fragment_shader().edge_location(); |
1037 } | 1037 } |
1038 | 1038 |
1039 void GLRenderer::DrawTileQuad(const DrawingFrame& frame, | 1039 void GLRenderer::DrawTileQuad(const DrawingFrame* frame, |
1040 const TileDrawQuad* quad) { | 1040 const TileDrawQuad* quad) { |
1041 gfx::Rect tile_rect = quad->visible_rect; | 1041 gfx::Rect tile_rect = quad->visible_rect; |
1042 | 1042 |
1043 gfx::RectF tex_coord_rect = quad->tex_coord_rect; | 1043 gfx::RectF tex_coord_rect = quad->tex_coord_rect; |
1044 float tex_to_geom_scale_x = quad->rect.width() / tex_coord_rect.width(); | 1044 float tex_to_geom_scale_x = quad->rect.width() / tex_coord_rect.width(); |
1045 float tex_to_geom_scale_y = quad->rect.height() / tex_coord_rect.height(); | 1045 float tex_to_geom_scale_y = quad->rect.height() / tex_coord_rect.height(); |
1046 | 1046 |
1047 // tex_coord_rect corresponds to quad_rect, but quad_visible_rect may be | 1047 // tex_coord_rect corresponds to quad_rect, but quad_visible_rect may be |
1048 // smaller than quad_rect due to occlusion or clipping. Adjust | 1048 // smaller than quad_rect due to occlusion or clipping. Adjust |
1049 // tex_coord_rect to match. | 1049 // tex_coord_rect to match. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 float vertex_tex_scale_y = tile_rect.height() / clamp_geom_rect.height(); | 1081 float vertex_tex_scale_y = tile_rect.height() / clamp_geom_rect.height(); |
1082 | 1082 |
1083 // Map to normalized texture coordinates. | 1083 // Map to normalized texture coordinates. |
1084 gfx::Size texture_size = quad->texture_size; | 1084 gfx::Size texture_size = quad->texture_size; |
1085 float fragment_tex_translate_x = clamp_tex_rect.x() / texture_size.width(); | 1085 float fragment_tex_translate_x = clamp_tex_rect.x() / texture_size.width(); |
1086 float fragment_tex_translate_y = clamp_tex_rect.y() / texture_size.height(); | 1086 float fragment_tex_translate_y = clamp_tex_rect.y() / texture_size.height(); |
1087 float fragment_tex_scale_x = clamp_tex_rect.width() / texture_size.width(); | 1087 float fragment_tex_scale_x = clamp_tex_rect.width() / texture_size.width(); |
1088 float fragment_tex_scale_y = clamp_tex_rect.height() / texture_size.height(); | 1088 float fragment_tex_scale_y = clamp_tex_rect.height() / texture_size.height(); |
1089 | 1089 |
1090 gfx::Transform device_transform = | 1090 gfx::Transform device_transform = |
1091 frame.window_matrix * frame.projection_matrix * quad->quadTransform(); | 1091 frame->window_matrix * frame->projection_matrix * quad->quadTransform(); |
1092 device_transform.FlattenTo2d(); | 1092 device_transform.FlattenTo2d(); |
1093 if (!device_transform.IsInvertible()) | 1093 if (!device_transform.IsInvertible()) |
1094 return; | 1094 return; |
1095 | 1095 |
1096 gfx::QuadF local_quad = gfx::QuadF(gfx::RectF(tile_rect)); | 1096 gfx::QuadF local_quad = gfx::QuadF(gfx::RectF(tile_rect)); |
1097 float edge[24]; | 1097 float edge[24]; |
1098 bool use_aa = SetupQuadForAntialiasing( | 1098 bool use_aa = SetupQuadForAntialiasing( |
1099 device_transform, quad, &local_quad, edge); | 1099 device_transform, quad, &local_quad, edge); |
1100 | 1100 |
1101 TileProgramUniforms uniforms; | 1101 TileProgramUniforms uniforms; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 // un-antialiased quad should have and which vertex this is and the float | 1177 // un-antialiased quad should have and which vertex this is and the float |
1178 // quad passed in via uniform is the actual geometry that gets used to draw | 1178 // quad passed in via uniform is the actual geometry that gets used to draw |
1179 // it. This is why this centered rect is used and not the original quad_rect. | 1179 // it. This is why this centered rect is used and not the original quad_rect. |
1180 gfx::RectF centered_rect( | 1180 gfx::RectF centered_rect( |
1181 gfx::PointF(-0.5f * tile_rect.width(), -0.5f * tile_rect.height()), | 1181 gfx::PointF(-0.5f * tile_rect.width(), -0.5f * tile_rect.height()), |
1182 tile_rect.size()); | 1182 tile_rect.size()); |
1183 DrawQuadGeometry( | 1183 DrawQuadGeometry( |
1184 frame, quad->quadTransform(), centered_rect, uniforms.matrix_location); | 1184 frame, quad->quadTransform(), centered_rect, uniforms.matrix_location); |
1185 } | 1185 } |
1186 | 1186 |
1187 void GLRenderer::DrawYUVVideoQuad(const DrawingFrame& frame, | 1187 void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame, |
1188 const YUVVideoDrawQuad* quad) { | 1188 const YUVVideoDrawQuad* quad) { |
1189 SetBlendEnabled(quad->ShouldDrawWithBlending()); | 1189 SetBlendEnabled(quad->ShouldDrawWithBlending()); |
1190 | 1190 |
1191 const VideoYUVProgram* program = GetVideoYUVProgram(); | 1191 const VideoYUVProgram* program = GetVideoYUVProgram(); |
1192 DCHECK(program && (program->initialized() || IsContextLost())); | 1192 DCHECK(program && (program->initialized() || IsContextLost())); |
1193 | 1193 |
1194 const VideoLayerImpl::FramePlane& y_plane = quad->y_plane; | 1194 const VideoLayerImpl::FramePlane& y_plane = quad->y_plane; |
1195 const VideoLayerImpl::FramePlane& u_plane = quad->u_plane; | 1195 const VideoLayerImpl::FramePlane& u_plane = quad->u_plane; |
1196 const VideoLayerImpl::FramePlane& v_plane = quad->v_plane; | 1196 const VideoLayerImpl::FramePlane& v_plane = quad->v_plane; |
1197 | 1197 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 program->fragment_shader().alpha_location()); | 1245 program->fragment_shader().alpha_location()); |
1246 DrawQuadGeometry(frame, | 1246 DrawQuadGeometry(frame, |
1247 quad->quadTransform(), | 1247 quad->quadTransform(), |
1248 quad->rect, | 1248 quad->rect, |
1249 program->vertex_shader().matrix_location()); | 1249 program->vertex_shader().matrix_location()); |
1250 | 1250 |
1251 // Reset active texture back to texture 0. | 1251 // Reset active texture back to texture 0. |
1252 GLC(Context(), Context()->activeTexture(GL_TEXTURE0)); | 1252 GLC(Context(), Context()->activeTexture(GL_TEXTURE0)); |
1253 } | 1253 } |
1254 | 1254 |
1255 void GLRenderer::DrawStreamVideoQuad(const DrawingFrame& frame, | 1255 void GLRenderer::DrawStreamVideoQuad(const DrawingFrame* frame, |
1256 const StreamVideoDrawQuad* quad) { | 1256 const StreamVideoDrawQuad* quad) { |
1257 SetBlendEnabled(quad->ShouldDrawWithBlending()); | 1257 SetBlendEnabled(quad->ShouldDrawWithBlending()); |
1258 | 1258 |
1259 static float gl_matrix[16]; | 1259 static float gl_matrix[16]; |
1260 | 1260 |
1261 DCHECK(capabilities_.using_egl_image); | 1261 DCHECK(capabilities_.using_egl_image); |
1262 | 1262 |
1263 const VideoStreamTextureProgram* program = GetVideoStreamTextureProgram(); | 1263 const VideoStreamTextureProgram* program = GetVideoStreamTextureProgram(); |
1264 SetUseProgram(program->program()); | 1264 SetUseProgram(program->program()); |
1265 | 1265 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 if (!draw_cache_.use_premultiplied_alpha) | 1379 if (!draw_cache_.use_premultiplied_alpha) |
1380 GLC(context_, context_->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); | 1380 GLC(context_, context_->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); |
1381 | 1381 |
1382 // Clear the cache. | 1382 // Clear the cache. |
1383 draw_cache_.program_id = 0; | 1383 draw_cache_.program_id = 0; |
1384 draw_cache_.uv_xform_data.resize(0); | 1384 draw_cache_.uv_xform_data.resize(0); |
1385 draw_cache_.vertex_opacity_data.resize(0); | 1385 draw_cache_.vertex_opacity_data.resize(0); |
1386 draw_cache_.matrix_data.resize(0); | 1386 draw_cache_.matrix_data.resize(0); |
1387 } | 1387 } |
1388 | 1388 |
1389 void GLRenderer::EnqueueTextureQuad(const DrawingFrame& frame, | 1389 void GLRenderer::EnqueueTextureQuad(const DrawingFrame* frame, |
1390 const TextureDrawQuad* quad) { | 1390 const TextureDrawQuad* quad) { |
1391 // Choose the correct texture program binding | 1391 // Choose the correct texture program binding |
1392 TexTransformTextureProgramBinding binding; | 1392 TexTransformTextureProgramBinding binding; |
1393 if (quad->flipped) | 1393 if (quad->flipped) |
1394 binding.Set(GetTextureProgramFlip(), Context()); | 1394 binding.Set(GetTextureProgramFlip(), Context()); |
1395 else | 1395 else |
1396 binding.Set(GetTextureProgram(), Context()); | 1396 binding.Set(GetTextureProgram(), Context()); |
1397 | 1397 |
1398 int resource_id = quad->resource_id; | 1398 int resource_id = quad->resource_id; |
1399 | 1399 |
(...skipping 23 matching lines...) Expand all Loading... |
1423 // Generate the vertex opacity | 1423 // Generate the vertex opacity |
1424 const float opacity = quad->opacity(); | 1424 const float opacity = quad->opacity(); |
1425 draw_cache_.vertex_opacity_data.push_back(quad->vertex_opacity[0] * opacity); | 1425 draw_cache_.vertex_opacity_data.push_back(quad->vertex_opacity[0] * opacity); |
1426 draw_cache_.vertex_opacity_data.push_back(quad->vertex_opacity[1] * opacity); | 1426 draw_cache_.vertex_opacity_data.push_back(quad->vertex_opacity[1] * opacity); |
1427 draw_cache_.vertex_opacity_data.push_back(quad->vertex_opacity[2] * opacity); | 1427 draw_cache_.vertex_opacity_data.push_back(quad->vertex_opacity[2] * opacity); |
1428 draw_cache_.vertex_opacity_data.push_back(quad->vertex_opacity[3] * opacity); | 1428 draw_cache_.vertex_opacity_data.push_back(quad->vertex_opacity[3] * opacity); |
1429 | 1429 |
1430 // Generate the transform matrix | 1430 // Generate the transform matrix |
1431 gfx::Transform quad_rect_matrix; | 1431 gfx::Transform quad_rect_matrix; |
1432 QuadRectTransform(&quad_rect_matrix, quad->quadTransform(), quad->rect); | 1432 QuadRectTransform(&quad_rect_matrix, quad->quadTransform(), quad->rect); |
1433 quad_rect_matrix = frame.projection_matrix * quad_rect_matrix; | 1433 quad_rect_matrix = frame->projection_matrix * quad_rect_matrix; |
1434 | 1434 |
1435 Float16 m; | 1435 Float16 m; |
1436 quad_rect_matrix.matrix().asColMajorf(m.data); | 1436 quad_rect_matrix.matrix().asColMajorf(m.data); |
1437 draw_cache_.matrix_data.push_back(m); | 1437 draw_cache_.matrix_data.push_back(m); |
1438 } | 1438 } |
1439 | 1439 |
1440 void GLRenderer::DrawTextureQuad(const DrawingFrame& frame, | 1440 void GLRenderer::DrawTextureQuad(const DrawingFrame* frame, |
1441 const TextureDrawQuad* quad) { | 1441 const TextureDrawQuad* quad) { |
1442 TexTransformTextureProgramBinding binding; | 1442 TexTransformTextureProgramBinding binding; |
1443 if (quad->flipped) | 1443 if (quad->flipped) |
1444 binding.Set(GetTextureProgramFlip(), Context()); | 1444 binding.Set(GetTextureProgramFlip(), Context()); |
1445 else | 1445 else |
1446 binding.Set(GetTextureProgram(), Context()); | 1446 binding.Set(GetTextureProgram(), Context()); |
1447 SetUseProgram(binding.program_id); | 1447 SetUseProgram(binding.program_id); |
1448 GLC(Context(), Context()->uniform1i(binding.sampler_location, 0)); | 1448 GLC(Context(), Context()->uniform1i(binding.sampler_location, 0)); |
1449 gfx::PointF uv0 = quad->uv_top_left; | 1449 gfx::PointF uv0 = quad->uv_top_left; |
1450 gfx::PointF uv1 = quad->uv_bottom_right; | 1450 gfx::PointF uv1 = quad->uv_bottom_right; |
(...skipping 27 matching lines...) Expand all Loading... |
1478 GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ONE)); | 1478 GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ONE)); |
1479 } | 1479 } |
1480 | 1480 |
1481 DrawQuadGeometry( | 1481 DrawQuadGeometry( |
1482 frame, quad->quadTransform(), quad->rect, binding.matrix_location); | 1482 frame, quad->quadTransform(), quad->rect, binding.matrix_location); |
1483 | 1483 |
1484 if (!quad->premultiplied_alpha) | 1484 if (!quad->premultiplied_alpha) |
1485 GLC(context_, context_->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); | 1485 GLC(context_, context_->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); |
1486 } | 1486 } |
1487 | 1487 |
1488 void GLRenderer::DrawIOSurfaceQuad(const DrawingFrame& frame, | 1488 void GLRenderer::DrawIOSurfaceQuad(const DrawingFrame* frame, |
1489 const IOSurfaceDrawQuad* quad) { | 1489 const IOSurfaceDrawQuad* quad) { |
1490 SetBlendEnabled(quad->ShouldDrawWithBlending()); | 1490 SetBlendEnabled(quad->ShouldDrawWithBlending()); |
1491 | 1491 |
1492 TexTransformTextureProgramBinding binding; | 1492 TexTransformTextureProgramBinding binding; |
1493 binding.Set(GetTextureIOSurfaceProgram(), Context()); | 1493 binding.Set(GetTextureIOSurfaceProgram(), Context()); |
1494 | 1494 |
1495 SetUseProgram(binding.program_id); | 1495 SetUseProgram(binding.program_id); |
1496 GLC(Context(), Context()->uniform1i(binding.sampler_location, 0)); | 1496 GLC(Context(), Context()->uniform1i(binding.sampler_location, 0)); |
1497 if (quad->orientation == IOSurfaceDrawQuad::FLIPPED) { | 1497 if (quad->orientation == IOSurfaceDrawQuad::FLIPPED) { |
1498 GLC(Context(), | 1498 GLC(Context(), |
(...skipping 20 matching lines...) Expand all Loading... |
1519 GLC(Context(), | 1519 GLC(Context(), |
1520 Context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, | 1520 Context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, |
1521 quad->io_surface_texture_id)); | 1521 quad->io_surface_texture_id)); |
1522 | 1522 |
1523 DrawQuadGeometry( | 1523 DrawQuadGeometry( |
1524 frame, quad->quadTransform(), quad->rect, binding.matrix_location); | 1524 frame, quad->quadTransform(), quad->rect, binding.matrix_location); |
1525 | 1525 |
1526 GLC(Context(), Context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, 0)); | 1526 GLC(Context(), Context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, 0)); |
1527 } | 1527 } |
1528 | 1528 |
1529 void GLRenderer::FinishDrawingFrame(DrawingFrame& frame) { | 1529 void GLRenderer::FinishDrawingFrame(DrawingFrame* frame) { |
1530 current_framebuffer_lock_.reset(); | 1530 current_framebuffer_lock_.reset(); |
1531 swap_buffer_rect_.Union(gfx::ToEnclosingRect(frame.root_damage_rect)); | 1531 swap_buffer_rect_.Union(gfx::ToEnclosingRect(frame->root_damage_rect)); |
1532 | 1532 |
1533 GLC(context_, context_->disable(GL_BLEND)); | 1533 GLC(context_, context_->disable(GL_BLEND)); |
1534 blend_shadow_ = false; | 1534 blend_shadow_ = false; |
1535 | 1535 |
1536 if (Settings().compositor_frame_message) { | 1536 if (Settings().compositor_frame_message) { |
1537 CompositorFrame compositor_frame; | 1537 CompositorFrame compositor_frame; |
1538 compositor_frame.metadata = client_->MakeCompositorFrameMetadata(); | 1538 compositor_frame.metadata = client_->MakeCompositorFrameMetadata(); |
1539 output_surface_->SendFrameToParentCompositor(&compositor_frame); | 1539 output_surface_->SendFrameToParentCompositor(&compositor_frame); |
1540 } | 1540 } |
1541 } | 1541 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 blend_shadow_ = enabled; | 1598 blend_shadow_ = enabled; |
1599 } | 1599 } |
1600 | 1600 |
1601 void GLRenderer::SetUseProgram(unsigned program) { | 1601 void GLRenderer::SetUseProgram(unsigned program) { |
1602 if (program == program_shadow_) | 1602 if (program == program_shadow_) |
1603 return; | 1603 return; |
1604 GLC(context_, context_->useProgram(program)); | 1604 GLC(context_, context_->useProgram(program)); |
1605 program_shadow_ = program; | 1605 program_shadow_ = program; |
1606 } | 1606 } |
1607 | 1607 |
1608 void GLRenderer::DrawQuadGeometry(const DrawingFrame& frame, | 1608 void GLRenderer::DrawQuadGeometry(const DrawingFrame* frame, |
1609 const gfx::Transform& draw_transform, | 1609 const gfx::Transform& draw_transform, |
1610 const gfx::RectF& quad_rect, | 1610 const gfx::RectF& quad_rect, |
1611 int matrix_location) { | 1611 int matrix_location) { |
1612 gfx::Transform quad_rect_matrix; | 1612 gfx::Transform quad_rect_matrix; |
1613 QuadRectTransform(&quad_rect_matrix, draw_transform, quad_rect); | 1613 QuadRectTransform(&quad_rect_matrix, draw_transform, quad_rect); |
1614 static float gl_matrix[16]; | 1614 static float gl_matrix[16]; |
1615 ToGLMatrix(&gl_matrix[0], frame.projection_matrix * quad_rect_matrix); | 1615 ToGLMatrix(&gl_matrix[0], frame->projection_matrix * quad_rect_matrix); |
1616 GLC(context_, | 1616 GLC(context_, |
1617 context_->uniformMatrix4fv(matrix_location, 1, false, &gl_matrix[0])); | 1617 context_->uniformMatrix4fv(matrix_location, 1, false, &gl_matrix[0])); |
1618 | 1618 |
1619 GLC(context_, context_->drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0)); | 1619 GLC(context_, context_->drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0)); |
1620 } | 1620 } |
1621 | 1621 |
1622 void GLRenderer::CopyTextureToFramebuffer(const DrawingFrame& frame, | 1622 void GLRenderer::CopyTextureToFramebuffer(const DrawingFrame* frame, |
1623 int texture_id, | 1623 int texture_id, |
1624 gfx::Rect rect, | 1624 gfx::Rect rect, |
1625 const gfx::Transform& draw_matrix) { | 1625 const gfx::Transform& draw_matrix) { |
1626 const RenderPassProgram* program = GetRenderPassProgram(); | 1626 const RenderPassProgram* program = GetRenderPassProgram(); |
1627 | 1627 |
1628 GLC(Context(), Context()->bindTexture(GL_TEXTURE_2D, texture_id)); | 1628 GLC(Context(), Context()->bindTexture(GL_TEXTURE_2D, texture_id)); |
1629 | 1629 |
1630 SetUseProgram(program->program()); | 1630 SetUseProgram(program->program()); |
1631 GLC(Context(), | 1631 GLC(Context(), |
1632 Context()->uniform1i(program->fragment_shader().sampler_location(), 0)); | 1632 Context()->uniform1i(program->fragment_shader().sampler_location(), 0)); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1880 0, | 1880 0, |
1881 texture->format(), | 1881 texture->format(), |
1882 device_rect.x(), | 1882 device_rect.x(), |
1883 device_rect.y(), | 1883 device_rect.y(), |
1884 device_rect.width(), | 1884 device_rect.width(), |
1885 device_rect.height(), | 1885 device_rect.height(), |
1886 0)); | 1886 0)); |
1887 return true; | 1887 return true; |
1888 } | 1888 } |
1889 | 1889 |
1890 bool GLRenderer::UseScopedTexture(DrawingFrame& frame, | 1890 bool GLRenderer::UseScopedTexture(DrawingFrame* frame, |
1891 const ScopedResource* texture, | 1891 const ScopedResource* texture, |
1892 gfx::Rect viewport_rect) { | 1892 gfx::Rect viewport_rect) { |
1893 DCHECK(texture->id()); | 1893 DCHECK(texture->id()); |
1894 frame.current_render_pass = 0; | 1894 frame->current_render_pass = NULL; |
1895 frame.current_texture = texture; | 1895 frame->current_texture = texture; |
1896 | 1896 |
1897 return BindFramebufferToTexture(frame, texture, viewport_rect); | 1897 return BindFramebufferToTexture(frame, texture, viewport_rect); |
1898 } | 1898 } |
1899 | 1899 |
1900 void GLRenderer::BindFramebufferToOutputSurface(DrawingFrame& frame) { | 1900 void GLRenderer::BindFramebufferToOutputSurface(DrawingFrame* frame) { |
1901 current_framebuffer_lock_.reset(); | 1901 current_framebuffer_lock_.reset(); |
1902 output_surface_->BindFramebuffer(); | 1902 output_surface_->BindFramebuffer(); |
1903 } | 1903 } |
1904 | 1904 |
1905 bool GLRenderer::BindFramebufferToTexture(DrawingFrame& frame, | 1905 bool GLRenderer::BindFramebufferToTexture(DrawingFrame* frame, |
1906 const ScopedResource* texture, | 1906 const ScopedResource* texture, |
1907 gfx::Rect framebuffer_rect) { | 1907 gfx::Rect framebuffer_rect) { |
1908 DCHECK(texture->id()); | 1908 DCHECK(texture->id()); |
1909 | 1909 |
1910 GLC(context_, | 1910 GLC(context_, |
1911 context_->bindFramebuffer(GL_FRAMEBUFFER, offscreen_framebuffer_id_)); | 1911 context_->bindFramebuffer(GL_FRAMEBUFFER, offscreen_framebuffer_id_)); |
1912 current_framebuffer_lock_ = | 1912 current_framebuffer_lock_ = |
1913 make_scoped_ptr(new ResourceProvider::ScopedWriteLockGL( | 1913 make_scoped_ptr(new ResourceProvider::ScopedWriteLockGL( |
1914 resource_provider_, texture->id())); | 1914 resource_provider_, texture->id())); |
1915 unsigned texture_id = current_framebuffer_lock_->texture_id(); | 1915 unsigned texture_id = current_framebuffer_lock_->texture_id(); |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2229 GLC(context_, context_->deleteFramebuffer(offscreen_framebuffer_id_)); | 2229 GLC(context_, context_->deleteFramebuffer(offscreen_framebuffer_id_)); |
2230 | 2230 |
2231 ReleaseRenderPassTextures(); | 2231 ReleaseRenderPassTextures(); |
2232 } | 2232 } |
2233 | 2233 |
2234 bool GLRenderer::IsContextLost() { | 2234 bool GLRenderer::IsContextLost() { |
2235 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); | 2235 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); |
2236 } | 2236 } |
2237 | 2237 |
2238 } // namespace cc | 2238 } // namespace cc |
OLD | NEW |