| 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 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
| 6 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 6 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 typedef GetVertexAttribiv::Result Result; | 119 typedef GetVertexAttribiv::Result Result; |
| 120 Result* result = GetResultAs<Result*>(); | 120 Result* result = GetResultAs<Result*>(); |
| 121 result->SetNumResults(0); | 121 result->SetNumResults(0); |
| 122 helper_->GetVertexAttribiv( | 122 helper_->GetVertexAttribiv( |
| 123 index, pname, result_shm_id(), result_shm_offset()); | 123 index, pname, result_shm_id(), result_shm_offset()); |
| 124 WaitForCmd(); | 124 WaitForCmd(); |
| 125 result->CopyResult(params); | 125 result->CopyResult(params); |
| 126 } | 126 } |
| 127 #endif | 127 #endif |
| 128 | 128 |
| 129 // Makes a set of Ids for glGen___ functions. | 129 void MakeIds(IdAllocator* id_allocator, GLsizei n, GLuint* ids); |
| 130 void MakeIds(GLsizei n, GLuint* ids); | |
| 131 | 130 |
| 132 // Frees a set of Ids for glDelete___ functions. | 131 void FreeIds(IdAllocator* id_allocator, GLsizei n, const GLuint* ids); |
| 133 void FreeIds(GLsizei n, const GLuint* ids); | 132 |
| 133 GLuint MakeTextureId() { |
| 134 return texture_id_allocator_.AllocateID(); |
| 135 } |
| 136 |
| 137 void FreeTextureId(GLuint id) { |
| 138 texture_id_allocator_.FreeID(id); |
| 139 } |
| 134 | 140 |
| 135 private: | 141 private: |
| 136 // Wraps FencedAllocatorWrapper to provide aligned allocations. | 142 // Wraps FencedAllocatorWrapper to provide aligned allocations. |
| 137 class AlignedFencedAllocator : public FencedAllocatorWrapper { | 143 class AlignedFencedAllocator : public FencedAllocatorWrapper { |
| 138 public: | 144 public: |
| 139 AlignedFencedAllocator(unsigned int size, | 145 AlignedFencedAllocator(unsigned int size, |
| 140 CommandBufferHelper *helper, | 146 CommandBufferHelper *helper, |
| 141 void *base) | 147 void *base) |
| 142 : FencedAllocatorWrapper(size, helper, base) { | 148 : FencedAllocatorWrapper(size, helper, base) { |
| 143 } | 149 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 void SetBucketAsCString(uint32 bucket_id, const char* str); | 202 void SetBucketAsCString(uint32 bucket_id, const char* str); |
| 197 | 203 |
| 198 // Gets the contents of a bucket as a string. Returns false if there is no | 204 // Gets the contents of a bucket as a string. Returns false if there is no |
| 199 // string available which is a separate case from the empty string. | 205 // string available which is a separate case from the empty string. |
| 200 bool GetBucketAsString(uint32 bucket_id, std::string* str); | 206 bool GetBucketAsString(uint32 bucket_id, std::string* str); |
| 201 | 207 |
| 202 // Sets the contents of a bucket as a string. | 208 // Sets the contents of a bucket as a string. |
| 203 void SetBucketAsString(uint32 bucket_id, const std::string& str); | 209 void SetBucketAsString(uint32 bucket_id, const std::string& str); |
| 204 | 210 |
| 205 // Returns true if id is reserved. | 211 // Returns true if id is reserved. |
| 206 bool IsReservedId(GLuint id); | 212 bool IsBufferReservedId(GLuint id); |
| 213 bool IsFramebufferReservedId(GLuint id) { return false; } |
| 214 bool IsRenderbufferReservedId(GLuint id) { return false; } |
| 215 bool IsTextureReservedId(GLuint id) { return false; } |
| 207 | 216 |
| 208 #if defined(GLES2_SUPPORT_CLIENT_SIDE_BUFFERS) | 217 #if defined(GLES2_SUPPORT_CLIENT_SIDE_BUFFERS) |
| 209 // Helper for GetVertexAttrib | 218 // Helper for GetVertexAttrib |
| 210 bool GetVertexAttribHelper(GLuint index, GLenum pname, uint32* param); | 219 bool GetVertexAttribHelper(GLuint index, GLenum pname, uint32* param); |
| 211 | 220 |
| 212 // Asks the service for the max index in an element array buffer. | 221 // Asks the service for the max index in an element array buffer. |
| 213 GLsizei GetMaxIndexInElementArrayBuffer( | 222 GLsizei GetMaxIndexInElementArrayBuffer( |
| 214 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset); | 223 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset); |
| 215 #endif | 224 #endif |
| 216 | 225 |
| 217 GLES2Util util_; | 226 GLES2Util util_; |
| 218 GLES2CmdHelper* helper_; | 227 GLES2CmdHelper* helper_; |
| 219 IdAllocator id_allocator_; | 228 IdAllocator buffer_id_allocator_; |
| 229 IdAllocator framebuffer_id_allocator_; |
| 230 IdAllocator renderbuffer_id_allocator_; |
| 231 IdAllocator program_and_shader_id_allocator_; |
| 232 IdAllocator texture_id_allocator_; |
| 220 AlignedFencedAllocator transfer_buffer_; | 233 AlignedFencedAllocator transfer_buffer_; |
| 221 int transfer_buffer_id_; | 234 int transfer_buffer_id_; |
| 222 void* result_buffer_; | 235 void* result_buffer_; |
| 223 uint32 result_shm_offset_; | 236 uint32 result_shm_offset_; |
| 224 | 237 |
| 225 // pack alignment as last set by glPixelStorei | 238 // pack alignment as last set by glPixelStorei |
| 226 GLint pack_alignment_; | 239 GLint pack_alignment_; |
| 227 | 240 |
| 228 // unpack alignment as last set by glPixelStorei | 241 // unpack alignment as last set by glPixelStorei |
| 229 GLint unpack_alignment_; | 242 GLint unpack_alignment_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 251 GLStringMap gl_strings_; | 264 GLStringMap gl_strings_; |
| 252 | 265 |
| 253 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); | 266 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); |
| 254 }; | 267 }; |
| 255 | 268 |
| 256 } // namespace gles2 | 269 } // namespace gles2 |
| 257 } // namespace gpu | 270 } // namespace gpu |
| 258 | 271 |
| 259 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 272 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
| 260 | 273 |
| OLD | NEW |