Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.h

Issue 14456004: GPU client side changes for GpuMemoryBuffers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@glapi
Patch Set: Rollback decoder changes Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/gpu_memory_buffer_factory.h"
19 #include "../client/gles2_cmd_helper.h" 20 #include "../client/gles2_cmd_helper.h"
20 #include "../client/gles2_interface.h" 21 #include "../client/gles2_interface.h"
21 #include "../client/query_tracker.h" 22 #include "../client/query_tracker.h"
22 #include "../client/ref_counted.h" 23 #include "../client/ref_counted.h"
23 #include "../client/ring_buffer.h" 24 #include "../client/ring_buffer.h"
24 #include "../client/share_group.h" 25 #include "../client/share_group.h"
25 #include "../common/compiler_specific.h" 26 #include "../common/compiler_specific.h"
26 #include "../common/debug_marker_manager.h" 27 #include "../common/debug_marker_manager.h"
27 #include "../common/gles2_cmd_utils.h" 28 #include "../common/gles2_cmd_utils.h"
28 #include "gles2_impl_export.h" 29 #include "gles2_impl_export.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 struct GLUniformDefinitionCHROMIUM; 96 struct GLUniformDefinitionCHROMIUM;
96 97
97 namespace gpu { 98 namespace gpu {
98 99
99 class MappedMemoryManager; 100 class MappedMemoryManager;
100 class ScopedTransferBufferPtr; 101 class ScopedTransferBufferPtr;
101 class TransferBufferInterface; 102 class TransferBufferInterface;
102 103
103 namespace gles2 { 104 namespace gles2 {
104 105
106 class GpuMemoryBufferTracker;
105 class VertexArrayObjectManager; 107 class VertexArrayObjectManager;
106 108
107 // This class emulates GLES2 over command buffers. It can be used by a client 109 // This class emulates GLES2 over command buffers. It can be used by a client
108 // program so that the program does not need deal with shared memory and command 110 // program so that the program does not need deal with shared memory and command
109 // buffer management. See gl2_lib.h. Note that there is a performance gain to 111 // buffer management. See gl2_lib.h. Note that there is a performance gain to
110 // be had by changing your code to use command buffers directly by using the 112 // be had by changing your code to use command buffers directly by using the
111 // GLES2CmdHelper but that entails changing your code to use and deal with 113 // GLES2CmdHelper but that entails changing your code to use and deal with
112 // shared memory and synchronization issues. 114 // shared memory and synchronization issues.
113 class GLES2_IMPL_EXPORT GLES2Implementation : public GLES2Interface { 115 class GLES2_IMPL_EXPORT GLES2Implementation : public GLES2Interface {
114 public: 116 public:
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 SetGpuMemoryBufferFactory(scoped_ptr<GpuMemoryBufferFactory> factory) {
226 gpu_memory_buffer_factory_ = factory.Pass();
227 }
228
222 private: 229 private:
223 friend class GLES2ImplementationTest; 230 friend class GLES2ImplementationTest;
224 friend class VertexArrayObjectManager; 231 friend class VertexArrayObjectManager;
225 232
226 // Used to track whether an extension is available 233 // Used to track whether an extension is available
227 enum ExtensionStatus { 234 enum ExtensionStatus {
228 kAvailableExtensionStatus, 235 kAvailableExtensionStatus,
229 kUnavailableExtensionStatus, 236 kUnavailableExtensionStatus,
230 kUnknownExtensionStatus 237 kUnknownExtensionStatus
231 }; 238 };
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 bool BindRenderbufferHelper(GLenum target, GLuint texture); 407 bool BindRenderbufferHelper(GLenum target, GLuint texture);
401 bool BindTextureHelper(GLenum target, GLuint texture); 408 bool BindTextureHelper(GLenum target, GLuint texture);
402 bool BindVertexArrayHelper(GLuint array); 409 bool BindVertexArrayHelper(GLuint array);
403 410
404 void GenBuffersHelper(GLsizei n, const GLuint* buffers); 411 void GenBuffersHelper(GLsizei n, const GLuint* buffers);
405 void GenFramebuffersHelper(GLsizei n, const GLuint* framebuffers); 412 void GenFramebuffersHelper(GLsizei n, const GLuint* framebuffers);
406 void GenRenderbuffersHelper(GLsizei n, const GLuint* renderbuffers); 413 void GenRenderbuffersHelper(GLsizei n, const GLuint* renderbuffers);
407 void GenTexturesHelper(GLsizei n, const GLuint* textures); 414 void GenTexturesHelper(GLsizei n, const GLuint* textures);
408 void GenVertexArraysOESHelper(GLsizei n, const GLuint* arrays); 415 void GenVertexArraysOESHelper(GLsizei n, const GLuint* arrays);
409 void GenQueriesEXTHelper(GLsizei n, const GLuint* queries); 416 void GenQueriesEXTHelper(GLsizei n, const GLuint* queries);
417 void GenImageBuffersHelper(GLsizei n, const GLuint* imagebuffers);
410 418
411 void DeleteBuffersHelper(GLsizei n, const GLuint* buffers); 419 void DeleteBuffersHelper(GLsizei n, const GLuint* buffers);
412 void DeleteFramebuffersHelper(GLsizei n, const GLuint* framebuffers); 420 void DeleteFramebuffersHelper(GLsizei n, const GLuint* framebuffers);
413 void DeleteRenderbuffersHelper(GLsizei n, const GLuint* renderbuffers); 421 void DeleteRenderbuffersHelper(GLsizei n, const GLuint* renderbuffers);
414 void DeleteTexturesHelper(GLsizei n, const GLuint* textures); 422 void DeleteTexturesHelper(GLsizei n, const GLuint* textures);
415 bool DeleteProgramHelper(GLuint program); 423 bool DeleteProgramHelper(GLuint program);
416 bool DeleteShaderHelper(GLuint shader); 424 bool DeleteShaderHelper(GLuint shader);
417 void DeleteQueriesEXTHelper(GLsizei n, const GLuint* queries); 425 void DeleteQueriesEXTHelper(GLsizei n, const GLuint* queries);
418 void DeleteVertexArraysOESHelper(GLsizei n, const GLuint* arrays); 426 void DeleteVertexArraysOESHelper(GLsizei n, const GLuint* arrays);
419 427
420 void DeleteBuffersStub(GLsizei n, const GLuint* buffers); 428 void DeleteBuffersStub(GLsizei n, const GLuint* buffers);
421 void DeleteFramebuffersStub(GLsizei n, const GLuint* framebuffers); 429 void DeleteFramebuffersStub(GLsizei n, const GLuint* framebuffers);
422 void DeleteRenderbuffersStub(GLsizei n, const GLuint* renderbuffers); 430 void DeleteRenderbuffersStub(GLsizei n, const GLuint* renderbuffers);
423 void DeleteTexturesStub(GLsizei n, const GLuint* textures); 431 void DeleteTexturesStub(GLsizei n, const GLuint* textures);
424 void DeleteProgramStub(GLsizei n, const GLuint* programs); 432 void DeleteProgramStub(GLsizei n, const GLuint* programs);
425 void DeleteShaderStub(GLsizei n, const GLuint* shaders); 433 void DeleteShaderStub(GLsizei n, const GLuint* shaders);
426 // TODO(gman): Remove this as queries are not shared. 434 // TODO(gman): Remove this as queries are not shared.
427 void DeleteQueriesStub(GLsizei n, const GLuint* queries); 435 void DeleteQueriesStub(GLsizei n, const GLuint* queries);
428 void DeleteVertexArraysOESStub(GLsizei n, const GLuint* arrays); 436 void DeleteVertexArraysOESStub(GLsizei n, const GLuint* arrays);
429 437
430 void BufferDataHelper( 438 void BufferDataHelper(
431 GLenum target, GLsizeiptr size, const void* data, GLenum usage); 439 GLenum target, GLsizeiptr size, const void* data, GLenum usage);
432 void BufferSubDataHelper( 440 void BufferSubDataHelper(
433 GLenum target, GLintptr offset, GLsizeiptr size, const void* data); 441 GLenum target, GLintptr offset, GLsizeiptr size, const void* data);
434 void BufferSubDataHelperImpl( 442 void BufferSubDataHelperImpl(
435 GLenum target, GLintptr offset, GLsizeiptr size, const void* data, 443 GLenum target, GLintptr offset, GLsizeiptr size, const void* data,
436 ScopedTransferBufferPtr* buffer); 444 ScopedTransferBufferPtr* buffer);
437 445
446 GLuint CreateImageCHROMIUMHelper(GLsizei width, GLsizei height);
447 void DestroyImageCHROMIUMHelper(GLuint image_id);
448 void* MapImageCHROMIUMHelper(GLuint image_id, GLenum access);
449 GLboolean UnmapImageCHROMIUMHelper(GLuint image_id);
450 void GetImageParameterivCHROMIUMHelper(
451 GLuint image_id, GLenum pname, GLint* params);
452
438 // Helper for GetVertexAttrib 453 // Helper for GetVertexAttrib
439 bool GetVertexAttribHelper(GLuint index, GLenum pname, uint32* param); 454 bool GetVertexAttribHelper(GLuint index, GLenum pname, uint32* param);
440 455
441 GLuint GetMaxValueInBufferCHROMIUMHelper( 456 GLuint GetMaxValueInBufferCHROMIUMHelper(
442 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset); 457 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset);
443 458
444 void RestoreElementAndArrayBuffers(bool restore); 459 void RestoreElementAndArrayBuffers(bool restore);
445 void RestoreArrayBuffer(bool restrore); 460 void RestoreArrayBuffer(bool restrore);
446 461
447 // The pixels pointer should already account for unpack skip rows and skip 462 // The pixels pointer should already account for unpack skip rows and skip
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 ShaderPrecisionCacheMap; 608 ShaderPrecisionCacheMap;
594 ShaderPrecisionCacheMap shader_precision_cache_; 609 ShaderPrecisionCacheMap shader_precision_cache_;
595 610
596 scoped_refptr<ShareGroup> share_group_; 611 scoped_refptr<ShareGroup> share_group_;
597 612
598 scoped_ptr<QueryTracker> query_tracker_; 613 scoped_ptr<QueryTracker> query_tracker_;
599 QueryTracker::Query* current_query_; 614 QueryTracker::Query* current_query_;
600 615
601 scoped_ptr<BufferTracker> buffer_tracker_; 616 scoped_ptr<BufferTracker> buffer_tracker_;
602 617
618 scoped_ptr<GpuMemoryBufferTracker> gpu_memory_buffer_tracker_;
619
603 ErrorMessageCallback* error_message_callback_; 620 ErrorMessageCallback* error_message_callback_;
604 621
605 scoped_ptr<std::string> current_trace_name_; 622 scoped_ptr<std::string> current_trace_name_;
606 623
624 scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory_;
625
607 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); 626 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation);
608 }; 627 };
609 628
610 inline bool GLES2Implementation::GetBufferParameterivHelper( 629 inline bool GLES2Implementation::GetBufferParameterivHelper(
611 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { 630 GLenum /* target */, GLenum /* pname */, GLint* /* params */) {
612 return false; 631 return false;
613 } 632 }
614 633
615 inline bool GLES2Implementation::GetFramebufferAttachmentParameterivHelper( 634 inline bool GLES2Implementation::GetFramebufferAttachmentParameterivHelper(
616 GLenum /* target */, 635 GLenum /* target */,
(...skipping 20 matching lines...) Expand all
637 656
638 inline bool GLES2Implementation::GetTexParameterivHelper( 657 inline bool GLES2Implementation::GetTexParameterivHelper(
639 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { 658 GLenum /* target */, GLenum /* pname */, GLint* /* params */) {
640 return false; 659 return false;
641 } 660 }
642 661
643 } // namespace gles2 662 } // namespace gles2
644 } // namespace gpu 663 } // namespace gpu
645 664
646 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ 665 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698