OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // A class to emluate GLES2 over command buffers. | 5 // A class to emluate GLES2 over command buffers. |
6 | 6 |
7 #include "../client/gles2_implementation.h" | 7 #include "../client/gles2_implementation.h" |
8 #include <GLES2/gles2_command_buffer.h> | 8 #include <GLES2/gles2_command_buffer.h> |
9 #include "../client/mapped_memory.h" | 9 #include "../client/mapped_memory.h" |
10 #include "../common/gles2_cmd_utils.h" | 10 #include "../common/gles2_cmd_utils.h" |
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1574 return; | 1574 return; |
1575 } | 1575 } |
1576 const MappedTexture& mt = it->second; | 1576 const MappedTexture& mt = it->second; |
1577 helper_->TexSubImage2D( | 1577 helper_->TexSubImage2D( |
1578 mt.target, mt.level, mt.xoffset, mt.yoffset, mt.width, mt.height, | 1578 mt.target, mt.level, mt.xoffset, mt.yoffset, mt.width, mt.height, |
1579 mt.format, mt.type, mt.shm_id, mt.shm_offset); | 1579 mt.format, mt.type, mt.shm_id, mt.shm_offset); |
1580 mapped_memory_->FreePendingToken(mt.shm_memory, helper_->InsertToken()); | 1580 mapped_memory_->FreePendingToken(mt.shm_memory, helper_->InsertToken()); |
1581 mapped_textures_.erase(it); | 1581 mapped_textures_.erase(it); |
1582 } | 1582 } |
1583 | 1583 |
| 1584 const GLchar* GLES2Implementation::GetRequestableExtensionsCHROMIUM() { |
| 1585 const char* result = NULL; |
| 1586 // Clear the bucket so if the command fails nothing will be in it. |
| 1587 helper_->SetBucketSize(kResultBucketId, 0); |
| 1588 helper_->GetRequestableExtensionsCHROMIUM(kResultBucketId); |
| 1589 std::string str; |
| 1590 if (GetBucketAsString(kResultBucketId, &str)) { |
| 1591 // The set of requestable extensions shrinks as we enable |
| 1592 // them. Because we don't know when the client will stop referring |
| 1593 // to a previous one it queries (see GetString) we need to cache |
| 1594 // the unique results. |
| 1595 std::set<std::string>::const_iterator sit = |
| 1596 requestable_extensions_set_.find(str); |
| 1597 if (sit != requestable_extensions_set_.end()) { |
| 1598 result = sit->c_str(); |
| 1599 } else { |
| 1600 std::pair<std::set<std::string>::const_iterator, bool> insert_result = |
| 1601 requestable_extensions_set_.insert(str); |
| 1602 GPU_DCHECK(insert_result.second); |
| 1603 result = insert_result.first->c_str(); |
| 1604 } |
| 1605 } |
| 1606 return reinterpret_cast<const GLchar*>(result); |
| 1607 } |
| 1608 |
| 1609 void GLES2Implementation::RequestExtensionCHROMIUM(const char* extension) { |
| 1610 SetBucketAsCString(kResultBucketId, extension); |
| 1611 helper_->RequestExtensionCHROMIUM(kResultBucketId); |
| 1612 helper_->SetBucketSize(kResultBucketId, 0); |
| 1613 } |
| 1614 |
1584 } // namespace gles2 | 1615 } // namespace gles2 |
1585 } // namespace gpu | 1616 } // namespace gpu |
OLD | NEW |