| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 resource_id_ = command_buffer::kInvalidResource; | 65 resource_id_ = command_buffer::kInvalidResource; |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 // Allocates a resource ID, and sends the CreateVertexBuffer command. | 69 // Allocates a resource ID, and sends the CreateVertexBuffer command. |
| 70 bool VertexBufferCB::ConcreteAllocate(size_t size_in_bytes) { | 70 bool VertexBufferCB::ConcreteAllocate(size_t size_in_bytes) { |
| 71 ConcreteFree(); | 71 ConcreteFree(); |
| 72 if (size_in_bytes > 0) { | 72 if (size_in_bytes > 0) { |
| 73 resource_id_ = renderer_->vertex_buffer_ids().AllocateID(); | 73 resource_id_ = renderer_->vertex_buffer_ids().AllocateID(); |
| 74 CommandBufferHelper *helper = renderer_->helper(); | 74 CommandBufferHelper *helper = renderer_->helper(); |
| 75 helper->CreateVertexBuffer(resource_id_, size_in_bytes, 0); | 75 helper->CreateVertexBuffer(resource_id_, size_in_bytes, |
| 76 command_buffer::vertex_buffer::kNone); |
| 76 has_data_ = false; | 77 has_data_ = false; |
| 77 } | 78 } |
| 78 return true; | 79 return true; |
| 79 } | 80 } |
| 80 | 81 |
| 81 // Allocates the locked region into the transfer shared memory area. If the | 82 // Allocates the locked region into the transfer shared memory area. If the |
| 82 // buffer resource contains data, copies it back (by sending the | 83 // buffer resource contains data, copies it back (by sending the |
| 83 // GetVertexBufferData command). | 84 // GetVertexBufferData command). |
| 84 bool VertexBufferCB::ConcreteLock(AccessMode access_mode, void **buffer_data) { | 85 bool VertexBufferCB::ConcreteLock(AccessMode access_mode, void **buffer_data) { |
| 85 *buffer_data = NULL; | 86 *buffer_data = NULL; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 143 } |
| 143 | 144 |
| 144 // Allocates a resource ID, and sends the CreateIndexBuffer command. | 145 // Allocates a resource ID, and sends the CreateIndexBuffer command. |
| 145 bool IndexBufferCB::ConcreteAllocate(size_t size_in_bytes) { | 146 bool IndexBufferCB::ConcreteAllocate(size_t size_in_bytes) { |
| 146 ConcreteFree(); | 147 ConcreteFree(); |
| 147 if (size_in_bytes > 0) { | 148 if (size_in_bytes > 0) { |
| 148 resource_id_ = renderer_->index_buffer_ids().AllocateID(); | 149 resource_id_ = renderer_->index_buffer_ids().AllocateID(); |
| 149 CommandBufferHelper *helper = renderer_->helper(); | 150 CommandBufferHelper *helper = renderer_->helper(); |
| 150 helper->CreateIndexBuffer( | 151 helper->CreateIndexBuffer( |
| 151 resource_id_, size_in_bytes, | 152 resource_id_, size_in_bytes, |
| 152 command_buffer::index_buffer::INDEX_32BIT); | 153 command_buffer::index_buffer::kIndex32Bit); |
| 153 has_data_ = false; | 154 has_data_ = false; |
| 154 } | 155 } |
| 155 return true; | 156 return true; |
| 156 } | 157 } |
| 157 | 158 |
| 158 // Allocates the locked region into the transfer shared memory area. If the | 159 // Allocates the locked region into the transfer shared memory area. If the |
| 159 // buffer resource contains data, copies it back (by sending the | 160 // buffer resource contains data, copies it back (by sending the |
| 160 // GetIndexBufferData command). | 161 // GetIndexBufferData command). |
| 161 bool IndexBufferCB::ConcreteLock(AccessMode access_mode, void **buffer_data) { | 162 bool IndexBufferCB::ConcreteLock(AccessMode access_mode, void **buffer_data) { |
| 162 *buffer_data = NULL; | 163 *buffer_data = NULL; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 187 renderer_->transfer_shm_id(), | 188 renderer_->transfer_shm_id(), |
| 188 renderer_->allocator()->GetOffset(lock_pointer_)); | 189 renderer_->allocator()->GetOffset(lock_pointer_)); |
| 189 renderer_->allocator()->FreePendingToken(lock_pointer_, | 190 renderer_->allocator()->FreePendingToken(lock_pointer_, |
| 190 helper->InsertToken()); | 191 helper->InsertToken()); |
| 191 lock_pointer_ = NULL; | 192 lock_pointer_ = NULL; |
| 192 has_data_ = true; | 193 has_data_ = true; |
| 193 return true; | 194 return true; |
| 194 } | 195 } |
| 195 | 196 |
| 196 } // namespace o3d | 197 } // namespace o3d |
| OLD | NEW |