| 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 "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 8 // TODO(gman): remove when all functions have been implemented. | 8 // TODO(gman): remove when all functions have been implemented. |
| 9 #include "gpu/command_buffer/client/gles2_implementation_gen.h" | 9 #include "gpu/command_buffer/client/gles2_implementation_gen.h" |
| 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 pack_alignment_(4), | 33 pack_alignment_(4), |
| 34 unpack_alignment_(4) { | 34 unpack_alignment_(4) { |
| 35 // Eat 1 id so we start at 1 instead of 0. | 35 // Eat 1 id so we start at 1 instead of 0. |
| 36 GLuint eat; | 36 GLuint eat; |
| 37 MakeIds(1, &eat); | 37 MakeIds(1, &eat); |
| 38 // Allocate space for simple GL results. | 38 // Allocate space for simple GL results. |
| 39 result_buffer_ = transfer_buffer_.Alloc(kMaxSizeOfSimpleResult); | 39 result_buffer_ = transfer_buffer_.Alloc(kMaxSizeOfSimpleResult); |
| 40 result_shm_offset_ = transfer_buffer_.GetOffset(result_buffer_); | 40 result_shm_offset_ = transfer_buffer_.GetOffset(result_buffer_); |
| 41 } | 41 } |
| 42 | 42 |
| 43 GLES2Implementation::~GLES2Implementation() { |
| 44 transfer_buffer_.Free(result_buffer_); |
| 45 } |
| 46 |
| 43 void GLES2Implementation::MakeIds(GLsizei n, GLuint* ids) { | 47 void GLES2Implementation::MakeIds(GLsizei n, GLuint* ids) { |
| 44 for (GLsizei ii = 0; ii < n; ++ii) { | 48 for (GLsizei ii = 0; ii < n; ++ii) { |
| 45 ids[ii] = id_allocator_.AllocateID(); | 49 ids[ii] = id_allocator_.AllocateID(); |
| 46 } | 50 } |
| 47 } | 51 } |
| 48 | 52 |
| 49 void GLES2Implementation::FreeIds(GLsizei n, const GLuint* ids) { | 53 void GLES2Implementation::FreeIds(GLsizei n, const GLuint* ids) { |
| 50 for (GLsizei ii = 0; ii < n; ++ii) { | 54 for (GLsizei ii = 0; ii < n; ++ii) { |
| 51 id_allocator_.FreeID(ids[ii]); | 55 id_allocator_.FreeID(ids[ii]); |
| 52 } | 56 } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } | 255 } |
| 252 ++yoffset; | 256 ++yoffset; |
| 253 source += padded_row_size; | 257 source += padded_row_size; |
| 254 } | 258 } |
| 255 } | 259 } |
| 256 } | 260 } |
| 257 | 261 |
| 258 | 262 |
| 259 } // namespace gles2 | 263 } // namespace gles2 |
| 260 } // namespace gpu | 264 } // namespace gpu |
| OLD | NEW |