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

Side by Side Diff: gpu/command_buffer/service/gpu_control_service.cc

Issue 255713008: Change glimage to accept a type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: First draft Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/service/gpu_control_service.h" 5 #include "gpu/command_buffer/service/gpu_control_service.h"
6 6
7 #include "gpu/command_buffer/client/gpu_memory_buffer_factory.h" 7 #include "gpu/command_buffer/client/gpu_memory_buffer_factory.h"
8 #include "gpu/command_buffer/service/gpu_memory_buffer_manager.h" 8 #include "gpu/command_buffer/service/gpu_memory_buffer_manager.h"
9 #include "gpu/command_buffer/service/mailbox_manager.h" 9 #include "gpu/command_buffer/service/mailbox_manager.h"
10 #include "gpu/command_buffer/service/query_manager.h" 10 #include "gpu/command_buffer/service/query_manager.h"
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 31
32 gpu::Capabilities GpuControlService::GetCapabilities() { 32 gpu::Capabilities GpuControlService::GetCapabilities() {
33 return capabilities_; 33 return capabilities_;
34 } 34 }
35 35
36 gfx::GpuMemoryBuffer* GpuControlService::CreateGpuMemoryBuffer( 36 gfx::GpuMemoryBuffer* GpuControlService::CreateGpuMemoryBuffer(
37 size_t width, 37 size_t width,
38 size_t height, 38 size_t height,
39 unsigned internalformat, 39 unsigned internalformat,
40 gfx::GpuMemoryBuffer::Usage usage,
40 int32* id) { 41 int32* id) {
41 *id = -1; 42 *id = -1;
42 43
43 CHECK(gpu_memory_buffer_factory_) << "No GPU memory buffer factory provided"; 44 CHECK(gpu_memory_buffer_factory_) << "No GPU memory buffer factory provided";
44 linked_ptr<gfx::GpuMemoryBuffer> buffer = make_linked_ptr( 45 linked_ptr<gfx::GpuMemoryBuffer> buffer =
45 gpu_memory_buffer_factory_->CreateGpuMemoryBuffer(width, 46 make_linked_ptr(gpu_memory_buffer_factory_->CreateGpuMemoryBuffer(
46 height, 47 width, height, internalformat, usage));
47 internalformat));
48 if (!buffer.get()) 48 if (!buffer.get())
49 return NULL; 49 return NULL;
50 50
51 static int32 next_id = 1; 51 static int32 next_id = 1;
52 *id = next_id++; 52 *id = next_id++;
53 53
54 if (!RegisterGpuMemoryBuffer(*id, 54 if (!RegisterGpuMemoryBuffer(
55 buffer->GetHandle(), 55 *id, buffer->GetHandle(), width, height, internalformat, usage)) {
56 width,
57 height,
58 internalformat)) {
59 *id = -1; 56 *id = -1;
60 return NULL; 57 return NULL;
61 } 58 }
62 59
63 gpu_memory_buffers_[*id] = buffer; 60 gpu_memory_buffers_[*id] = buffer;
64 return buffer.get(); 61 return buffer.get();
65 } 62 }
66 63
67 void GpuControlService::DestroyGpuMemoryBuffer(int32 id) { 64 void GpuControlService::DestroyGpuMemoryBuffer(int32 id) {
68 GpuMemoryBufferMap::iterator it = gpu_memory_buffers_.find(id); 65 GpuMemoryBufferMap::iterator it = gpu_memory_buffers_.find(id);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 uint32 GpuControlService::CreateStreamTexture(uint32 texture_id) { 105 uint32 GpuControlService::CreateStreamTexture(uint32 texture_id) {
109 NOTREACHED(); 106 NOTREACHED();
110 return 0; 107 return 0;
111 } 108 }
112 109
113 bool GpuControlService::RegisterGpuMemoryBuffer( 110 bool GpuControlService::RegisterGpuMemoryBuffer(
114 int32 id, 111 int32 id,
115 gfx::GpuMemoryBufferHandle buffer, 112 gfx::GpuMemoryBufferHandle buffer,
116 size_t width, 113 size_t width,
117 size_t height, 114 size_t height,
118 unsigned internalformat) { 115 unsigned internalformat,
119 return gpu_memory_buffer_manager_->RegisterGpuMemoryBuffer(id, 116 unsigned usage) {
120 buffer, 117 return gpu_memory_buffer_manager_->RegisterGpuMemoryBuffer(
121 width, 118 id, buffer, width, height, internalformat, usage);
122 height,
123 internalformat);
124 } 119 }
125 120
126 } // namespace gpu 121 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698