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

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

Issue 661220: Added support for glGetString, glGetShaderSource,... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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 | Annotate | Revision Log
OLDNEW
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 <string> 9 #include <string>
9 #include <vector> 10 #include <vector>
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 11 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
11 #include "gpu/command_buffer/client/gles2_cmd_helper.h" 12 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
12 #include "gpu/command_buffer/client/id_allocator.h" 13 #include "gpu/command_buffer/client/id_allocator.h"
13 #include "gpu/command_buffer/client/fenced_allocator.h" 14 #include "gpu/command_buffer/client/fenced_allocator.h"
14 15
15 namespace gpu { 16 namespace gpu {
16 namespace gles2 { 17 namespace gles2 {
17 18
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 56 }
56 57
57 // Gets the shared memory offset for the result buffer. 58 // Gets the shared memory offset for the result buffer.
58 uint32 result_shm_offset() const { 59 uint32 result_shm_offset() const {
59 return result_shm_offset_; 60 return result_shm_offset_;
60 } 61 }
61 62
62 // Gets the value of the result. 63 // Gets the value of the result.
63 template <typename T> 64 template <typename T>
64 T GetResultAs() const { 65 T GetResultAs() const {
65 return *static_cast<T*>(result_buffer_); 66 return static_cast<T>(result_buffer_);
66 } 67 }
67 68
69 // Gets the GLError through our wrapper.
70 GLenum GetGLError();
71
72 // Sets our wrapper for the GLError.
73 void SetGLError(GLenum error);
74
68 // Waits for all commands to execute. 75 // Waits for all commands to execute.
69 void WaitForCmd(); 76 void WaitForCmd();
70 77
71 // TODO(gman): These bucket functions really seem like they belong in 78 // TODO(gman): These bucket functions really seem like they belong in
72 // CommandBufferHelper (or maybe BucketHelper?). Unfortunately they need 79 // CommandBufferHelper (or maybe BucketHelper?). Unfortunately they need
73 // a transfer buffer to function which is currently managed by this class. 80 // a transfer buffer to function which is currently managed by this class.
74 81
75 // Gets the contents of a bucket. 82 // Gets the contents of a bucket.
76 void GetBucketContents(uint32 bucket_id, std::vector<int8>* data); 83 void GetBucketContents(uint32 bucket_id, std::vector<int8>* data);
77 84
78 // Sets the contents of a bucket. 85 // Sets the contents of a bucket.
79 void SetBucketContents(uint32 bucket_id, const void* data, size_t size); 86 void SetBucketContents(uint32 bucket_id, const void* data, size_t size);
80 87
81 // Gets the contents of a bucket as a string. 88 // Gets the contents of a bucket as a string. Returns false if there is no
82 std::string GetBucketAsString(uint32 bucket_id); 89 // string available which is a separate case from the empty string.
90 bool GetBucketAsString(uint32 bucket_id, std::string* str);
83 91
84 // Sets the contents of a bucket as a string. 92 // Sets the contents of a bucket as a string.
85 void SetBucketAsString(uint32 bucket_id, const std::string& str); 93 void SetBucketAsString(uint32 bucket_id, const std::string& str);
86 94
87 // The maxiumum result size from simple GL get commands. 95 // The maxiumum result size from simple GL get commands.
88 static const size_t kMaxSizeOfSimpleResult = 16 * sizeof(uint32); // NOLINT. 96 static const size_t kMaxSizeOfSimpleResult = 16 * sizeof(uint32); // NOLINT.
89 static const uint32 kResultBucketId = 1; 97 static const uint32 kResultBucketId = 1;
90 98
91 GLES2Util util_; 99 GLES2Util util_;
92 GLES2CmdHelper* helper_; 100 GLES2CmdHelper* helper_;
93 IdAllocator id_allocator_; 101 IdAllocator id_allocator_;
94 FencedAllocatorWrapper transfer_buffer_; 102 FencedAllocatorWrapper transfer_buffer_;
95 int transfer_buffer_id_; 103 int transfer_buffer_id_;
96 void* result_buffer_; 104 void* result_buffer_;
97 uint32 result_shm_offset_; 105 uint32 result_shm_offset_;
98 106
99 // pack alignment as last set by glPixelStorei 107 // pack alignment as last set by glPixelStorei
100 GLint pack_alignment_; 108 GLint pack_alignment_;
101 109
102 // unpack alignment as last set by glPixelStorei 110 // unpack alignment as last set by glPixelStorei
103 GLint unpack_alignment_; 111 GLint unpack_alignment_;
104 112
113 // Current GL error bits.
114 uint32 error_bits_;
115
116 // Map of GLenum to Strings for glGetString. We need to cache these because
117 // the pointer passed back to the client has to remain valid for eternity.
118 typedef std::map<uint32, std::string> GLStringMap;
119 GLStringMap gl_strings_;
120
105 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); 121 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation);
106 }; 122 };
107 123
108
109 } // namespace gles2 124 } // namespace gles2
110 } // namespace gpu 125 } // namespace gpu
111 126
112 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ 127 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_
113 128
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_cmd_helper_autogen.h ('k') | gpu/command_buffer/client/gles2_implementation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698