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

Side by Side Diff: gpu/command_buffer/tests/gl_manager.cc

Issue 1135943002: Pull in various gpu/command_buffer fixes from chromium (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 | « gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc ('k') | gpu/config/BUILD.gn » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "gpu/command_buffer/tests/gl_manager.h" 5 #include "gpu/command_buffer/tests/gl_manager.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 #include <GLES2/gl2extchromium.h> 9 #include <GLES2/gl2extchromium.h>
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 GpuMemoryBufferImpl(base::RefCountedBytes* bytes, 65 GpuMemoryBufferImpl(base::RefCountedBytes* bytes,
66 const gfx::Size& size, 66 const gfx::Size& size,
67 gfx::GpuMemoryBuffer::Format format) 67 gfx::GpuMemoryBuffer::Format format)
68 : bytes_(bytes), size_(size), format_(format), mapped_(false) {} 68 : bytes_(bytes), size_(size), format_(format), mapped_(false) {}
69 69
70 static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer) { 70 static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer) {
71 return reinterpret_cast<GpuMemoryBufferImpl*>(buffer); 71 return reinterpret_cast<GpuMemoryBufferImpl*>(buffer);
72 } 72 }
73 73
74 // Overridden from gfx::GpuMemoryBuffer: 74 // Overridden from gfx::GpuMemoryBuffer:
75 void* Map() override { 75 bool Map(void** data) override {
76 mapped_ = true; 76 mapped_ = true;
77 return &bytes_->data().front(); 77 *data = &bytes_->data().front();
78 return true;
78 } 79 }
79 void Unmap() override { mapped_ = false; } 80 void Unmap() override { mapped_ = false; }
80 bool IsMapped() const override { return mapped_; } 81 bool IsMapped() const override { return mapped_; }
81 Format GetFormat() const override { return format_; } 82 Format GetFormat() const override { return format_; }
82 uint32 GetStride() const override { 83 void GetStride(uint32* stride) const override {
83 return StrideInBytes(size_.width(), format_); 84 *stride = StrideInBytes(size_.width(), format_);
84 } 85 }
85 gfx::GpuMemoryBufferHandle GetHandle() const override { 86 gfx::GpuMemoryBufferHandle GetHandle() const override {
86 NOTREACHED(); 87 NOTREACHED();
87 return gfx::GpuMemoryBufferHandle(); 88 return gfx::GpuMemoryBufferHandle();
88 } 89 }
89 ClientBuffer AsClientBuffer() override { 90 ClientBuffer AsClientBuffer() override {
90 return reinterpret_cast<ClientBuffer>(this); 91 return reinterpret_cast<ClientBuffer>(this);
91 } 92 }
92 93
93 base::RefCountedBytes* bytes() { return bytes_.get(); } 94 base::RefCountedBytes* bytes() { return bytes_.get(); }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 if (gles2_implementation_.get()) { 328 if (gles2_implementation_.get()) {
328 MakeCurrent(); 329 MakeCurrent();
329 EXPECT_TRUE(glGetError() == GL_NONE); 330 EXPECT_TRUE(glGetError() == GL_NONE);
330 gles2_implementation_->Flush(); 331 gles2_implementation_->Flush();
331 gles2_implementation_.reset(); 332 gles2_implementation_.reset();
332 } 333 }
333 transfer_buffer_.reset(); 334 transfer_buffer_.reset();
334 gles2_helper_.reset(); 335 gles2_helper_.reset();
335 command_buffer_.reset(); 336 command_buffer_.reset();
336 if (decoder_.get()) { 337 if (decoder_.get()) {
337 decoder_->MakeCurrent(); 338 bool have_context = decoder_->GetGLContext()->MakeCurrent(surface_.get());
338 decoder_->Destroy(true); 339 decoder_->Destroy(have_context);
339 decoder_.reset(); 340 decoder_.reset();
340 } 341 }
341 } 342 }
342 343
343 const gpu::gles2::FeatureInfo::Workarounds& GLManager::workarounds() const { 344 const gpu::gles2::FeatureInfo::Workarounds& GLManager::workarounds() const {
344 return decoder_->GetContextGroup()->feature_info()->workarounds(); 345 return decoder_->GetContextGroup()->feature_info()->workarounds();
345 } 346 }
346 347
347 void GLManager::PumpCommands() { 348 void GLManager::PumpCommands() {
348 if (!decoder_->MakeCurrent()) { 349 if (!decoder_->MakeCurrent()) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 uint32 GLManager::CreateStreamTexture(uint32 texture_id) { 436 uint32 GLManager::CreateStreamTexture(uint32 texture_id) {
436 NOTIMPLEMENTED(); 437 NOTIMPLEMENTED();
437 return 0; 438 return 0;
438 } 439 }
439 440
440 void GLManager::SetLock(base::Lock*) { 441 void GLManager::SetLock(base::Lock*) {
441 NOTIMPLEMENTED(); 442 NOTIMPLEMENTED();
442 } 443 }
443 444
444 } // namespace gpu 445 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc ('k') | gpu/config/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698