| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 ? make_scoped_ptr(new SyncQuery(gl_)) | 481 ? make_scoped_ptr(new SyncQuery(gl_)) |
| 482 : available_sync_queries_.take_front(); | 482 : available_sync_queries_.take_front(); |
| 483 | 483 |
| 484 read_lock_fence = current_sync_query_->Begin(); | 484 read_lock_fence = current_sync_query_->Begin(); |
| 485 } else { | 485 } else { |
| 486 read_lock_fence = | 486 read_lock_fence = |
| 487 make_scoped_refptr(new ResourceProvider::SynchronousFence(gl_)); | 487 make_scoped_refptr(new ResourceProvider::SynchronousFence(gl_)); |
| 488 } | 488 } |
| 489 resource_provider_->SetReadLockFence(read_lock_fence.get()); | 489 resource_provider_->SetReadLockFence(read_lock_fence.get()); |
| 490 | 490 |
| 491 // Insert WaitSyncPointCHROMIUM on quad resources prior to drawing the frame, | 491 // Insert WaitSyncTokenCHROMIUM on quad resources prior to drawing the frame, |
| 492 // so that drawing can proceed without GL context switching interruptions. | 492 // so that drawing can proceed without GL context switching interruptions. |
| 493 ResourceProvider* resource_provider = resource_provider_; | 493 ResourceProvider* resource_provider = resource_provider_; |
| 494 for (const auto& pass : *frame->render_passes_in_draw_order) { | 494 for (const auto& pass : *frame->render_passes_in_draw_order) { |
| 495 for (const auto& quad : pass->quad_list) { | 495 for (const auto& quad : pass->quad_list) { |
| 496 for (ResourceId resource_id : quad->resources) | 496 for (ResourceId resource_id : quad->resources) |
| 497 resource_provider->WaitSyncPointIfNeeded(resource_id); | 497 resource_provider->WaitSyncTokenIfNeeded(resource_id); |
| 498 } | 498 } |
| 499 } | 499 } |
| 500 | 500 |
| 501 // TODO(enne): Do we need to reinitialize all of this state per frame? | 501 // TODO(enne): Do we need to reinitialize all of this state per frame? |
| 502 ReinitializeGLState(); | 502 ReinitializeGLState(); |
| 503 } | 503 } |
| 504 | 504 |
| 505 void GLRenderer::DoDrawQuad(DrawingFrame* frame, | 505 void GLRenderer::DoDrawQuad(DrawingFrame* frame, |
| 506 const DrawQuad* quad, | 506 const DrawQuad* quad, |
| 507 const gfx::QuadF* clip_region) { | 507 const gfx::QuadF* clip_region) { |
| (...skipping 2186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2694 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 2694 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 2695 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 2695 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| 2696 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 2696 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 2697 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 2697 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 2698 gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 2698 gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
| 2699 } else { | 2699 } else { |
| 2700 mailbox = request->texture_mailbox().mailbox(); | 2700 mailbox = request->texture_mailbox().mailbox(); |
| 2701 DCHECK_EQ(static_cast<unsigned>(GL_TEXTURE_2D), | 2701 DCHECK_EQ(static_cast<unsigned>(GL_TEXTURE_2D), |
| 2702 request->texture_mailbox().target()); | 2702 request->texture_mailbox().target()); |
| 2703 DCHECK(!mailbox.IsZero()); | 2703 DCHECK(!mailbox.IsZero()); |
| 2704 unsigned incoming_sync_point = request->texture_mailbox().sync_point(); | 2704 const gpu::SyncToken& incoming_sync_token = |
| 2705 if (incoming_sync_point) | 2705 request->texture_mailbox().sync_token(); |
| 2706 gl_->WaitSyncPointCHROMIUM(incoming_sync_point); | 2706 if (incoming_sync_token.HasData()) |
| 2707 gl_->WaitSyncTokenCHROMIUM(incoming_sync_token.GetConstData()); |
| 2707 | 2708 |
| 2708 texture_id = | 2709 texture_id = |
| 2709 gl_->CreateAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 2710 gl_->CreateAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
| 2710 } | 2711 } |
| 2711 GetFramebufferTexture(texture_id, RGBA_8888, window_rect); | 2712 GetFramebufferTexture(texture_id, RGBA_8888, window_rect); |
| 2712 | 2713 |
| 2713 unsigned sync_point = gl_->InsertSyncPointCHROMIUM(); | 2714 unsigned sync_point = gl_->InsertSyncPointCHROMIUM(); |
| 2714 TextureMailbox texture_mailbox(mailbox, GL_TEXTURE_2D, sync_point); | 2715 TextureMailbox texture_mailbox(mailbox, gpu::SyncToken(sync_point), |
| 2716 GL_TEXTURE_2D); |
| 2715 | 2717 |
| 2716 scoped_ptr<SingleReleaseCallback> release_callback; | 2718 scoped_ptr<SingleReleaseCallback> release_callback; |
| 2717 if (own_mailbox) { | 2719 if (own_mailbox) { |
| 2718 gl_->BindTexture(GL_TEXTURE_2D, 0); | 2720 gl_->BindTexture(GL_TEXTURE_2D, 0); |
| 2719 release_callback = texture_mailbox_deleter_->GetReleaseCallback( | 2721 release_callback = texture_mailbox_deleter_->GetReleaseCallback( |
| 2720 output_surface_->context_provider(), texture_id); | 2722 output_surface_->context_provider(), texture_id); |
| 2721 } else { | 2723 } else { |
| 2722 gl_->DeleteTextures(1, &texture_id); | 2724 gl_->DeleteTextures(1, &texture_id); |
| 2723 } | 2725 } |
| 2724 | 2726 |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3542 texture_id = pending_overlay_resources_.back()->texture_id(); | 3544 texture_id = pending_overlay_resources_.back()->texture_id(); |
| 3543 } | 3545 } |
| 3544 | 3546 |
| 3545 context_support_->ScheduleOverlayPlane( | 3547 context_support_->ScheduleOverlayPlane( |
| 3546 overlay.plane_z_order, overlay.transform, texture_id, | 3548 overlay.plane_z_order, overlay.transform, texture_id, |
| 3547 ToNearestRect(overlay.display_rect), overlay.uv_rect); | 3549 ToNearestRect(overlay.display_rect), overlay.uv_rect); |
| 3548 } | 3550 } |
| 3549 } | 3551 } |
| 3550 | 3552 |
| 3551 } // namespace cc | 3553 } // namespace cc |
| OLD | NEW |