Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: cc/output/gl_renderer.cc

Issue 371463009: Making use of bindless variants mailbox produce/consume on remainders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix cc tests Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/resources/video_resource_updater.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after
2364 gfx::Rect window_rect = MoveFromDrawToWindowSpace(rect); 2364 gfx::Rect window_rect = MoveFromDrawToWindowSpace(rect);
2365 DCHECK_GE(window_rect.x(), 0); 2365 DCHECK_GE(window_rect.x(), 0);
2366 DCHECK_GE(window_rect.y(), 0); 2366 DCHECK_GE(window_rect.y(), 0);
2367 DCHECK_LE(window_rect.right(), current_surface_size_.width()); 2367 DCHECK_LE(window_rect.right(), current_surface_size_.width());
2368 DCHECK_LE(window_rect.bottom(), current_surface_size_.height()); 2368 DCHECK_LE(window_rect.bottom(), current_surface_size_.height());
2369 2369
2370 if (!request->force_bitmap_result()) { 2370 if (!request->force_bitmap_result()) {
2371 bool own_mailbox = !request->has_texture_mailbox(); 2371 bool own_mailbox = !request->has_texture_mailbox();
2372 2372
2373 GLuint texture_id = 0; 2373 GLuint texture_id = 0;
2374 gl_->GenTextures(1, &texture_id);
2375
2376 gpu::Mailbox mailbox; 2374 gpu::Mailbox mailbox;
2377 if (own_mailbox) { 2375 if (own_mailbox) {
2378 GLC(gl_, gl_->GenMailboxCHROMIUM(mailbox.name)); 2376 GLC(gl_, gl_->GenMailboxCHROMIUM(mailbox.name));
2379 } else { 2377 gl_->GenTextures(1, &texture_id);
2380 mailbox = request->texture_mailbox().mailbox(); 2378 GLC(gl_, gl_->BindTexture(GL_TEXTURE_2D, texture_id));
2381 DCHECK_EQ(static_cast<unsigned>(GL_TEXTURE_2D),
2382 request->texture_mailbox().target());
2383 DCHECK(!mailbox.IsZero());
2384 unsigned incoming_sync_point = request->texture_mailbox().sync_point();
2385 if (incoming_sync_point)
2386 GLC(gl_, gl_->WaitSyncPointCHROMIUM(incoming_sync_point));
2387 }
2388 2379
2389 GLC(gl_, gl_->BindTexture(GL_TEXTURE_2D, texture_id));
2390 if (own_mailbox) {
2391 GLC(gl_, 2380 GLC(gl_,
2392 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); 2381 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
2393 GLC(gl_, 2382 GLC(gl_,
2394 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); 2383 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
2395 GLC(gl_, 2384 GLC(gl_,
2396 gl_->TexParameteri( 2385 gl_->TexParameteri(
2397 GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); 2386 GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
2398 GLC(gl_, 2387 GLC(gl_,
2399 gl_->TexParameteri( 2388 gl_->TexParameteri(
2400 GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)); 2389 GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
2401 GLC(gl_, gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name)); 2390 GLC(gl_, gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name));
2402 } else { 2391 } else {
2403 GLC(gl_, gl_->ConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name)); 2392 mailbox = request->texture_mailbox().mailbox();
2393 DCHECK_EQ(static_cast<unsigned>(GL_TEXTURE_2D),
2394 request->texture_mailbox().target());
2395 DCHECK(!mailbox.IsZero());
2396 unsigned incoming_sync_point = request->texture_mailbox().sync_point();
2397 if (incoming_sync_point)
2398 GLC(gl_, gl_->WaitSyncPointCHROMIUM(incoming_sync_point));
2399
2400 texture_id = GLC(
2401 gl_,
2402 gl_->CreateAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name));
2404 } 2403 }
2405 GetFramebufferTexture(texture_id, RGBA_8888, window_rect); 2404 GetFramebufferTexture(texture_id, RGBA_8888, window_rect);
2406 GLC(gl_, gl_->BindTexture(GL_TEXTURE_2D, 0));
2407 2405
2408 unsigned sync_point = gl_->InsertSyncPointCHROMIUM(); 2406 unsigned sync_point = gl_->InsertSyncPointCHROMIUM();
2409 TextureMailbox texture_mailbox(mailbox, GL_TEXTURE_2D, sync_point); 2407 TextureMailbox texture_mailbox(mailbox, GL_TEXTURE_2D, sync_point);
2410 2408
2411 scoped_ptr<SingleReleaseCallback> release_callback; 2409 scoped_ptr<SingleReleaseCallback> release_callback;
2412 if (own_mailbox) { 2410 if (own_mailbox) {
2411 GLC(gl_, gl_->BindTexture(GL_TEXTURE_2D, 0));
2413 release_callback = texture_mailbox_deleter_->GetReleaseCallback( 2412 release_callback = texture_mailbox_deleter_->GetReleaseCallback(
2414 output_surface_->context_provider(), texture_id); 2413 output_surface_->context_provider(), texture_id);
2415 } else { 2414 } else {
2416 gl_->DeleteTextures(1, &texture_id); 2415 gl_->DeleteTextures(1, &texture_id);
2417 } 2416 }
2418 2417
2419 request->SendTextureResult( 2418 request->SendTextureResult(
2420 window_rect.size(), texture_mailbox, release_callback.Pass()); 2419 window_rect.size(), texture_mailbox, release_callback.Pass());
2421 return; 2420 return;
2422 } 2421 }
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
3171 context_support_->ScheduleOverlayPlane( 3170 context_support_->ScheduleOverlayPlane(
3172 overlay.plane_z_order, 3171 overlay.plane_z_order,
3173 overlay.transform, 3172 overlay.transform,
3174 pending_overlay_resources_.back()->texture_id(), 3173 pending_overlay_resources_.back()->texture_id(),
3175 overlay.display_rect, 3174 overlay.display_rect,
3176 overlay.uv_rect); 3175 overlay.uv_rect);
3177 } 3176 }
3178 } 3177 }
3179 3178
3180 } // namespace cc 3179 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/resources/video_resource_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698