Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <GLES2/gl2.h> | 8 #include <GLES2/gl2.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <queue> | 11 #include <queue> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "../client/buffer_tracker.h" | 17 #include "../client/buffer_tracker.h" |
| 18 #include "../client/client_context_state.h" | 18 #include "../client/client_context_state.h" |
| 19 #include "../client/gles2_cmd_helper.h" | 19 #include "../client/gles2_cmd_helper.h" |
| 20 #include "../client/gles2_interface.h" | 20 #include "../client/gles2_interface.h" |
| 21 #include "../client/gpu_memory_buffer_tracker.h" | |
| 22 #include "../client/image_factory.h" | |
| 21 #include "../client/query_tracker.h" | 23 #include "../client/query_tracker.h" |
| 22 #include "../client/ref_counted.h" | 24 #include "../client/ref_counted.h" |
| 23 #include "../client/ring_buffer.h" | 25 #include "../client/ring_buffer.h" |
| 24 #include "../client/share_group.h" | 26 #include "../client/share_group.h" |
| 25 #include "../common/compiler_specific.h" | 27 #include "../common/compiler_specific.h" |
| 26 #include "../common/debug_marker_manager.h" | 28 #include "../common/debug_marker_manager.h" |
| 27 #include "../common/gles2_cmd_utils.h" | 29 #include "../common/gles2_cmd_utils.h" |
| 28 #include "gles2_impl_export.h" | 30 #include "gles2_impl_export.h" |
| 29 | 31 |
| 30 #if !defined(NDEBUG) && !defined(__native_client__) && !defined(GLES2_CONFORMANC E_TESTS) // NOLINT | 32 #if !defined(NDEBUG) && !defined(__native_client__) && !defined(GLES2_CONFORMANC E_TESTS) // NOLINT |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 void FreeEverything(); | 214 void FreeEverything(); |
| 213 | 215 |
| 214 void SetErrorMessageCallback(ErrorMessageCallback* callback) { | 216 void SetErrorMessageCallback(ErrorMessageCallback* callback) { |
| 215 error_message_callback_ = callback; | 217 error_message_callback_ = callback; |
| 216 } | 218 } |
| 217 | 219 |
| 218 ShareGroup* share_group() const { | 220 ShareGroup* share_group() const { |
| 219 return share_group_.get(); | 221 return share_group_.get(); |
| 220 } | 222 } |
| 221 | 223 |
| 224 // GLES2Implementation owns the |factory|. | |
| 225 void SetImageFactory(scoped_ptr<ImageFactory> factory) { | |
|
reveman
2013/05/10 02:06:16
Changing the ImageFactory during the lifetime of a
kaanb
2013/05/13 23:00:36
Done.
| |
| 226 image_factory_ = factory.Pass(); | |
| 227 } | |
| 228 | |
| 229 // GLES2Implementation owns the |tracker|. | |
|
no sievers
2013/05/10 01:21:51
nit: maybe put 'for testing' here?
Because it see
kaanb
2013/05/13 23:00:36
Removed this method.
| |
| 230 void SetGpuMemoryBufferTracker(scoped_ptr<GpuMemoryBufferTracker> tracker) { | |
| 231 gpu_memory_buffer_tracker_ = tracker.Pass(); | |
| 232 } | |
| 233 | |
| 222 private: | 234 private: |
| 223 friend class GLES2ImplementationTest; | 235 friend class GLES2ImplementationTest; |
| 224 friend class VertexArrayObjectManager; | 236 friend class VertexArrayObjectManager; |
| 225 | 237 |
| 226 // Used to track whether an extension is available | 238 // Used to track whether an extension is available |
| 227 enum ExtensionStatus { | 239 enum ExtensionStatus { |
| 228 kAvailableExtensionStatus, | 240 kAvailableExtensionStatus, |
| 229 kUnavailableExtensionStatus, | 241 kUnavailableExtensionStatus, |
| 230 kUnknownExtensionStatus | 242 kUnknownExtensionStatus |
| 231 }; | 243 }; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 bool BindRenderbufferHelper(GLenum target, GLuint texture); | 412 bool BindRenderbufferHelper(GLenum target, GLuint texture); |
| 401 bool BindTextureHelper(GLenum target, GLuint texture); | 413 bool BindTextureHelper(GLenum target, GLuint texture); |
| 402 bool BindVertexArrayHelper(GLuint array); | 414 bool BindVertexArrayHelper(GLuint array); |
| 403 | 415 |
| 404 void GenBuffersHelper(GLsizei n, const GLuint* buffers); | 416 void GenBuffersHelper(GLsizei n, const GLuint* buffers); |
| 405 void GenFramebuffersHelper(GLsizei n, const GLuint* framebuffers); | 417 void GenFramebuffersHelper(GLsizei n, const GLuint* framebuffers); |
| 406 void GenRenderbuffersHelper(GLsizei n, const GLuint* renderbuffers); | 418 void GenRenderbuffersHelper(GLsizei n, const GLuint* renderbuffers); |
| 407 void GenTexturesHelper(GLsizei n, const GLuint* textures); | 419 void GenTexturesHelper(GLsizei n, const GLuint* textures); |
| 408 void GenVertexArraysOESHelper(GLsizei n, const GLuint* arrays); | 420 void GenVertexArraysOESHelper(GLsizei n, const GLuint* arrays); |
| 409 void GenQueriesEXTHelper(GLsizei n, const GLuint* queries); | 421 void GenQueriesEXTHelper(GLsizei n, const GLuint* queries); |
| 422 void GenImageBuffersHelper(GLsizei n, const GLuint* imagebuffers); | |
|
no sievers
2013/05/10 01:21:51
not used or defined?
kaanb
2013/05/13 23:00:36
Removed.
| |
| 410 | 423 |
| 411 void DeleteBuffersHelper(GLsizei n, const GLuint* buffers); | 424 void DeleteBuffersHelper(GLsizei n, const GLuint* buffers); |
| 412 void DeleteFramebuffersHelper(GLsizei n, const GLuint* framebuffers); | 425 void DeleteFramebuffersHelper(GLsizei n, const GLuint* framebuffers); |
| 413 void DeleteRenderbuffersHelper(GLsizei n, const GLuint* renderbuffers); | 426 void DeleteRenderbuffersHelper(GLsizei n, const GLuint* renderbuffers); |
| 414 void DeleteTexturesHelper(GLsizei n, const GLuint* textures); | 427 void DeleteTexturesHelper(GLsizei n, const GLuint* textures); |
| 415 bool DeleteProgramHelper(GLuint program); | 428 bool DeleteProgramHelper(GLuint program); |
| 416 bool DeleteShaderHelper(GLuint shader); | 429 bool DeleteShaderHelper(GLuint shader); |
| 417 void DeleteQueriesEXTHelper(GLsizei n, const GLuint* queries); | 430 void DeleteQueriesEXTHelper(GLsizei n, const GLuint* queries); |
| 418 void DeleteVertexArraysOESHelper(GLsizei n, const GLuint* arrays); | 431 void DeleteVertexArraysOESHelper(GLsizei n, const GLuint* arrays); |
| 419 | 432 |
| 420 void DeleteBuffersStub(GLsizei n, const GLuint* buffers); | 433 void DeleteBuffersStub(GLsizei n, const GLuint* buffers); |
| 421 void DeleteFramebuffersStub(GLsizei n, const GLuint* framebuffers); | 434 void DeleteFramebuffersStub(GLsizei n, const GLuint* framebuffers); |
| 422 void DeleteRenderbuffersStub(GLsizei n, const GLuint* renderbuffers); | 435 void DeleteRenderbuffersStub(GLsizei n, const GLuint* renderbuffers); |
| 423 void DeleteTexturesStub(GLsizei n, const GLuint* textures); | 436 void DeleteTexturesStub(GLsizei n, const GLuint* textures); |
| 424 void DeleteProgramStub(GLsizei n, const GLuint* programs); | 437 void DeleteProgramStub(GLsizei n, const GLuint* programs); |
| 425 void DeleteShaderStub(GLsizei n, const GLuint* shaders); | 438 void DeleteShaderStub(GLsizei n, const GLuint* shaders); |
| 426 // TODO(gman): Remove this as queries are not shared. | 439 // TODO(gman): Remove this as queries are not shared. |
| 427 void DeleteQueriesStub(GLsizei n, const GLuint* queries); | 440 void DeleteQueriesStub(GLsizei n, const GLuint* queries); |
| 428 void DeleteVertexArraysOESStub(GLsizei n, const GLuint* arrays); | 441 void DeleteVertexArraysOESStub(GLsizei n, const GLuint* arrays); |
| 429 | 442 |
| 430 void BufferDataHelper( | 443 void BufferDataHelper( |
| 431 GLenum target, GLsizeiptr size, const void* data, GLenum usage); | 444 GLenum target, GLsizeiptr size, const void* data, GLenum usage); |
| 432 void BufferSubDataHelper( | 445 void BufferSubDataHelper( |
| 433 GLenum target, GLintptr offset, GLsizeiptr size, const void* data); | 446 GLenum target, GLintptr offset, GLsizeiptr size, const void* data); |
| 434 void BufferSubDataHelperImpl( | 447 void BufferSubDataHelperImpl( |
| 435 GLenum target, GLintptr offset, GLsizeiptr size, const void* data, | 448 GLenum target, GLintptr offset, GLsizeiptr size, const void* data, |
| 436 ScopedTransferBufferPtr* buffer); | 449 ScopedTransferBufferPtr* buffer); |
| 437 | 450 |
| 451 GLuint CreateImageCHROMIUMHelper(GLsizei width, GLsizei height); | |
| 452 void DestroyImageCHROMIUMHelper(GLuint image_id); | |
| 453 void* MapImageCHROMIUMHelper(GLuint image_id, GLenum access); | |
| 454 GLboolean UnmapImageCHROMIUMHelper(GLuint image_id); | |
| 455 void GetImageParameterivCHROMIUMHelper( | |
| 456 GLuint image_id, GLenum pname, GLint* params); | |
| 457 | |
| 438 // Helper for GetVertexAttrib | 458 // Helper for GetVertexAttrib |
| 439 bool GetVertexAttribHelper(GLuint index, GLenum pname, uint32* param); | 459 bool GetVertexAttribHelper(GLuint index, GLenum pname, uint32* param); |
| 440 | 460 |
| 441 GLuint GetMaxValueInBufferCHROMIUMHelper( | 461 GLuint GetMaxValueInBufferCHROMIUMHelper( |
| 442 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset); | 462 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset); |
| 443 | 463 |
| 444 void RestoreElementAndArrayBuffers(bool restore); | 464 void RestoreElementAndArrayBuffers(bool restore); |
| 445 void RestoreArrayBuffer(bool restrore); | 465 void RestoreArrayBuffer(bool restrore); |
| 446 | 466 |
| 447 // The pixels pointer should already account for unpack skip rows and skip | 467 // The pixels pointer should already account for unpack skip rows and skip |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 593 ShaderPrecisionCacheMap; | 613 ShaderPrecisionCacheMap; |
| 594 ShaderPrecisionCacheMap shader_precision_cache_; | 614 ShaderPrecisionCacheMap shader_precision_cache_; |
| 595 | 615 |
| 596 scoped_refptr<ShareGroup> share_group_; | 616 scoped_refptr<ShareGroup> share_group_; |
| 597 | 617 |
| 598 scoped_ptr<QueryTracker> query_tracker_; | 618 scoped_ptr<QueryTracker> query_tracker_; |
| 599 QueryTracker::Query* current_query_; | 619 QueryTracker::Query* current_query_; |
| 600 | 620 |
| 601 scoped_ptr<BufferTracker> buffer_tracker_; | 621 scoped_ptr<BufferTracker> buffer_tracker_; |
| 602 | 622 |
| 623 scoped_ptr<GpuMemoryBufferTracker> gpu_memory_buffer_tracker_; | |
| 624 | |
| 603 ErrorMessageCallback* error_message_callback_; | 625 ErrorMessageCallback* error_message_callback_; |
| 604 | 626 |
| 605 scoped_ptr<std::string> current_trace_name_; | 627 scoped_ptr<std::string> current_trace_name_; |
| 606 | 628 |
| 629 scoped_ptr<ImageFactory> image_factory_; | |
| 630 | |
| 607 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); | 631 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); |
| 608 }; | 632 }; |
| 609 | 633 |
| 610 inline bool GLES2Implementation::GetBufferParameterivHelper( | 634 inline bool GLES2Implementation::GetBufferParameterivHelper( |
| 611 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 635 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
| 612 return false; | 636 return false; |
| 613 } | 637 } |
| 614 | 638 |
| 615 inline bool GLES2Implementation::GetFramebufferAttachmentParameterivHelper( | 639 inline bool GLES2Implementation::GetFramebufferAttachmentParameterivHelper( |
| 616 GLenum /* target */, | 640 GLenum /* target */, |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 637 | 661 |
| 638 inline bool GLES2Implementation::GetTexParameterivHelper( | 662 inline bool GLES2Implementation::GetTexParameterivHelper( |
| 639 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 663 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
| 640 return false; | 664 return false; |
| 641 } | 665 } |
| 642 | 666 |
| 643 } // namespace gles2 | 667 } // namespace gles2 |
| 644 } // namespace gpu | 668 } // namespace gpu |
| 645 | 669 |
| 646 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 670 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
| OLD | NEW |