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

Side by Side Diff: components/display_compositor/buffer_queue.cc

Issue 2388653002: gpu: Add CHROMIUM_texture_from_image spec and fence support.
Patch Set: rebase Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/display_compositor/buffer_queue.h" 5 #include "components/display_compositor/buffer_queue.h"
6 6
7 #include "base/containers/adapters.h" 7 #include "base/containers/adapters.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "components/display_compositor/gl_helper.h" 10 #include "components/display_compositor/gl_helper.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 gl_->CreateImageCHROMIUM(buffer->AsClientBuffer(), size_.width(), 231 gl_->CreateImageCHROMIUM(buffer->AsClientBuffer(), size_.width(),
232 size_.height(), internal_format_); 232 size_.height(), internal_format_);
233 if (!id) { 233 if (!id) {
234 LOG(ERROR) << "Failed to allocate backing image surface"; 234 LOG(ERROR) << "Failed to allocate backing image surface";
235 gl_->DeleteTextures(1, &texture); 235 gl_->DeleteTextures(1, &texture);
236 return nullptr; 236 return nullptr;
237 } 237 }
238 238
239 allocated_count_++; 239 allocated_count_++;
240 gl_->BindTexture(texture_target_, texture); 240 gl_->BindTexture(texture_target_, texture);
241 gl_->BindTexImage2DCHROMIUM(texture_target_, id); 241 gl_->BindTexImage2DCHROMIUM(texture_target_, id, 0);
242 return base::MakeUnique<AllocatedSurface>(this, std::move(buffer), texture, 242 return base::MakeUnique<AllocatedSurface>(this, std::move(buffer), texture,
243 id, gfx::Rect(size_)); 243 id, gfx::Rect(size_));
244 } 244 }
245 245
246 BufferQueue::AllocatedSurface::AllocatedSurface( 246 BufferQueue::AllocatedSurface::AllocatedSurface(
247 BufferQueue* buffer_queue, 247 BufferQueue* buffer_queue,
248 std::unique_ptr<gfx::GpuMemoryBuffer> buffer, 248 std::unique_ptr<gfx::GpuMemoryBuffer> buffer,
249 uint32_t texture, 249 uint32_t texture,
250 uint32_t image, 250 uint32_t image,
251 const gfx::Rect& rect) 251 const gfx::Rect& rect)
252 : buffer_queue(buffer_queue), 252 : buffer_queue(buffer_queue),
253 buffer(buffer.release()), 253 buffer(buffer.release()),
254 texture(texture), 254 texture(texture),
255 image(image), 255 image(image),
256 damage(rect) {} 256 damage(rect) {}
257 257
258 BufferQueue::AllocatedSurface::~AllocatedSurface() { 258 BufferQueue::AllocatedSurface::~AllocatedSurface() {
259 buffer_queue->FreeSurfaceResources(this); 259 buffer_queue->FreeSurfaceResources(this);
260 } 260 }
261 261
262 } // namespace display_compositor 262 } // namespace display_compositor
OLDNEW
« no previous file with comments | « cc/test/test_web_graphics_context_3d.h ('k') | components/display_compositor/buffer_queue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698