OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "gpu/command_buffer/service/framebuffer_manager.h" | 5 #include "gpu/command_buffer/service/framebuffer_manager.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 7 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
8 | 8 |
9 namespace gpu { | 9 namespace gpu { |
10 namespace gles2 { | 10 namespace gles2 { |
11 | 11 |
12 void FramebufferManager::CreateFramebufferInfo(GLuint framebuffer_id) { | 12 void FramebufferManager::CreateFramebufferInfo( |
| 13 GLuint client_id, GLuint service_id) { |
13 std::pair<FramebufferInfoMap::iterator, bool> result = | 14 std::pair<FramebufferInfoMap::iterator, bool> result = |
14 framebuffer_infos_.insert( | 15 framebuffer_infos_.insert( |
15 std::make_pair( | 16 std::make_pair( |
16 framebuffer_id, | 17 client_id, |
17 FramebufferInfo::Ref(new FramebufferInfo(framebuffer_id)))); | 18 FramebufferInfo::Ref(new FramebufferInfo(service_id)))); |
18 DCHECK(result.second); | 19 DCHECK(result.second); |
19 } | 20 } |
20 | 21 |
21 FramebufferManager::FramebufferInfo* FramebufferManager::GetFramebufferInfo( | 22 FramebufferManager::FramebufferInfo* FramebufferManager::GetFramebufferInfo( |
22 GLuint framebuffer_id) { | 23 GLuint client_id) { |
23 FramebufferInfoMap::iterator it = framebuffer_infos_.find(framebuffer_id); | 24 FramebufferInfoMap::iterator it = framebuffer_infos_.find(client_id); |
24 return it != framebuffer_infos_.end() ? it->second : NULL; | 25 return it != framebuffer_infos_.end() ? it->second : NULL; |
25 } | 26 } |
26 | 27 |
27 void FramebufferManager::RemoveFramebufferInfo(GLuint framebuffer_id) { | 28 void FramebufferManager::RemoveFramebufferInfo(GLuint client_id) { |
28 FramebufferInfoMap::iterator it = framebuffer_infos_.find(framebuffer_id); | 29 FramebufferInfoMap::iterator it = framebuffer_infos_.find(client_id); |
29 if (it != framebuffer_infos_.end()) { | 30 if (it != framebuffer_infos_.end()) { |
30 it->second->MarkAsDeleted(); | 31 it->second->MarkAsDeleted(); |
31 framebuffer_infos_.erase(framebuffer_id); | 32 framebuffer_infos_.erase(it); |
32 } | 33 } |
33 } | 34 } |
34 | 35 |
35 void FramebufferManager::FramebufferInfo::AttachRenderbuffer( | 36 void FramebufferManager::FramebufferInfo::AttachRenderbuffer( |
36 GLenum attachment, RenderbufferManager::RenderbufferInfo* renderbuffer) { | 37 GLenum attachment, RenderbufferManager::RenderbufferInfo* renderbuffer) { |
37 DCHECK(attachment == GL_COLOR_ATTACHMENT0 || | 38 DCHECK(attachment == GL_COLOR_ATTACHMENT0 || |
38 attachment == GL_DEPTH_ATTACHMENT || | 39 attachment == GL_DEPTH_ATTACHMENT || |
39 attachment == GL_STENCIL_ATTACHMENT); | 40 attachment == GL_STENCIL_ATTACHMENT); |
40 if (renderbuffer) { | 41 if (renderbuffer) { |
41 renderbuffers_[attachment] = | 42 renderbuffers_[attachment] = |
42 RenderbufferManager::RenderbufferInfo::Ref(renderbuffer); | 43 RenderbufferManager::RenderbufferInfo::Ref(renderbuffer); |
43 } else { | 44 } else { |
44 renderbuffers_.erase(attachment); | 45 renderbuffers_.erase(attachment); |
45 } | 46 } |
46 } | 47 } |
47 | 48 |
48 } // namespace gles2 | 49 } // namespace gles2 |
49 } // namespace gpu | 50 } // namespace gpu |
50 | 51 |
51 | 52 |
OLD | NEW |