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

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

Issue 7633060: Add option to not generate resources on bind in OpenGL ES (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nacl fix Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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>
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // Base class for IdHandlers 80 // Base class for IdHandlers
81 class IdHandlerInterface { 81 class IdHandlerInterface {
82 public: 82 public:
83 IdHandlerInterface() { } 83 IdHandlerInterface() { }
84 virtual ~IdHandlerInterface() { } 84 virtual ~IdHandlerInterface() { }
85 85
86 // Makes some ids at or above id_offset. 86 // Makes some ids at or above id_offset.
87 virtual void MakeIds(GLuint id_offset, GLsizei n, GLuint* ids) = 0; 87 virtual void MakeIds(GLuint id_offset, GLsizei n, GLuint* ids) = 0;
88 88
89 // Frees some ids. 89 // Frees some ids.
90 virtual void FreeIds(GLsizei n, const GLuint* ids) = 0; 90 virtual bool FreeIds(GLsizei n, const GLuint* ids) = 0;
91 91
92 // Marks an id as used for glBind functions. id = 0 does nothing. 92 // Marks an id as used for glBind functions. id = 0 does nothing.
93 virtual bool MarkAsUsedForBind(GLuint id) = 0; 93 virtual bool MarkAsUsedForBind(GLuint id) = 0;
94 }; 94 };
95 95
96 // This class emulates GLES2 over command buffers. It can be used by a client 96 // This class emulates GLES2 over command buffers. It can be used by a client
97 // program so that the program does not need deal with shared memory and command 97 // program so that the program does not need deal with shared memory and command
98 // buffer management. See gl2_lib.h. Note that there is a performance gain to 98 // buffer management. See gl2_lib.h. Note that there is a performance gain to
99 // be had by changing your code to use command buffers directly by using the 99 // be had by changing your code to use command buffers directly by using the
100 // GLES2CmdHelper but that entails changing your code to use and deal with 100 // GLES2CmdHelper but that entails changing your code to use and deal with
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 static const GLuint kClientSideElementArrayId = 0xFEDCBA99u; 149 static const GLuint kClientSideElementArrayId = 0xFEDCBA99u;
150 150
151 // Number of swap buffers allowed before waiting. 151 // Number of swap buffers allowed before waiting.
152 static const size_t kMaxSwapBuffers = 2; 152 static const size_t kMaxSwapBuffers = 2;
153 153
154 GLES2Implementation( 154 GLES2Implementation(
155 GLES2CmdHelper* helper, 155 GLES2CmdHelper* helper,
156 size_t transfer_buffer_size, 156 size_t transfer_buffer_size,
157 void* transfer_buffer, 157 void* transfer_buffer,
158 int32 transfer_buffer_id, 158 int32 transfer_buffer_id,
159 bool share_resources); 159 bool share_resources,
160 bool bind_generates_resource = true); // Will remove in 2 CLs!
160 161
161 ~GLES2Implementation(); 162 ~GLES2Implementation();
162 163
163 // The GLES2CmdHelper being used by this GLES2Implementation. You can use 164 // The GLES2CmdHelper being used by this GLES2Implementation. You can use
164 // this to issue cmds at a lower level for certain kinds of optimization. 165 // this to issue cmds at a lower level for certain kinds of optimization.
165 GLES2CmdHelper* helper() const { 166 GLES2CmdHelper* helper() const {
166 return helper_; 167 return helper_;
167 } 168 }
168 169
169 // Include the auto-generated part of this class. We split this because 170 // Include the auto-generated part of this class. We split this because
170 // it means we can easily edit the non-auto generated parts right here in 171 // it means we can easily edit the non-auto generated parts right here in
171 // this file instead of having to edit some template or the code generator. 172 // this file instead of having to edit some template or the code generator.
172 #include "../client/gles2_implementation_autogen.h" 173 #include "../client/gles2_implementation_autogen.h"
173 174
174 void DisableVertexAttribArray(GLuint index); 175 void DisableVertexAttribArray(GLuint index);
175 void EnableVertexAttribArray(GLuint index); 176 void EnableVertexAttribArray(GLuint index);
176 void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params); 177 void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params);
177 void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params); 178 void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params);
178 179
179 void GetProgramInfoCHROMIUMHelper(GLuint program, std::vector<int8>* result); 180 void GetProgramInfoCHROMIUMHelper(GLuint program, std::vector<int8>* result);
180 void DeleteProgramOrShaderHelper(GLuint program_or_shader);
181 GLint GetAttribLocationHelper(GLuint program, const char* name); 181 GLint GetAttribLocationHelper(GLuint program, const char* name);
182 GLint GetUniformLocationHelper(GLuint program, const char* name); 182 GLint GetUniformLocationHelper(GLuint program, const char* name);
183 bool GetActiveAttribHelper( 183 bool GetActiveAttribHelper(
184 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, 184 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length,
185 GLint* size, GLenum* type, char* name); 185 GLint* size, GLenum* type, char* name);
186 bool GetActiveUniformHelper( 186 bool GetActiveUniformHelper(
187 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, 187 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length,
188 GLint* size, GLenum* type, char* name); 188 GLint* size, GLenum* type, char* name);
189 189
190 GLuint MakeTextureId() { 190 GLuint MakeTextureId() {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 376
377 void BindBufferHelper(GLenum target, GLuint texture); 377 void BindBufferHelper(GLenum target, GLuint texture);
378 void BindFramebufferHelper(GLenum target, GLuint texture); 378 void BindFramebufferHelper(GLenum target, GLuint texture);
379 void BindRenderbufferHelper(GLenum target, GLuint texture); 379 void BindRenderbufferHelper(GLenum target, GLuint texture);
380 void BindTextureHelper(GLenum target, GLuint texture); 380 void BindTextureHelper(GLenum target, GLuint texture);
381 381
382 void DeleteBuffersHelper(GLsizei n, const GLuint* buffers); 382 void DeleteBuffersHelper(GLsizei n, const GLuint* buffers);
383 void DeleteFramebuffersHelper(GLsizei n, const GLuint* framebuffers); 383 void DeleteFramebuffersHelper(GLsizei n, const GLuint* framebuffers);
384 void DeleteRenderbuffersHelper(GLsizei n, const GLuint* renderbuffers); 384 void DeleteRenderbuffersHelper(GLsizei n, const GLuint* renderbuffers);
385 void DeleteTexturesHelper(GLsizei n, const GLuint* textures); 385 void DeleteTexturesHelper(GLsizei n, const GLuint* textures);
386 bool DeleteProgramHelper(GLuint program);
387 bool DeleteShaderHelper(GLuint shader);
386 388
387 // Helper for GetVertexAttrib 389 // Helper for GetVertexAttrib
388 bool GetVertexAttribHelper(GLuint index, GLenum pname, uint32* param); 390 bool GetVertexAttribHelper(GLuint index, GLenum pname, uint32* param);
389 391
390 // Asks the service for the max index in an element array buffer. 392 // Asks the service for the max index in an element array buffer.
391 GLsizei GetMaxIndexInElementArrayBuffer( 393 GLsizei GetMaxIndexInElementArrayBuffer(
392 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset); 394 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset);
393 395
394 bool CopyRectToBufferFlipped( 396 bool CopyRectToBufferFlipped(
395 const void* pixels, GLsizei width, GLsizei height, GLenum format, 397 const void* pixels, GLsizei width, GLsizei height, GLenum format,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 469
468 // Current GL error bits. 470 // Current GL error bits.
469 uint32 error_bits_; 471 uint32 error_bits_;
470 472
471 // Whether or not to print debugging info. 473 // Whether or not to print debugging info.
472 bool debug_; 474 bool debug_;
473 475
474 // Whether or not this context is sharing resources. 476 // Whether or not this context is sharing resources.
475 bool sharing_resources_; 477 bool sharing_resources_;
476 478
479 bool bind_generates_resource_;
480
477 // Map of GLenum to Strings for glGetString. We need to cache these because 481 // Map of GLenum to Strings for glGetString. We need to cache these because
478 // the pointer passed back to the client has to remain valid for eternity. 482 // the pointer passed back to the client has to remain valid for eternity.
479 typedef std::map<uint32, std::set<std::string> > GLStringMap; 483 typedef std::map<uint32, std::set<std::string> > GLStringMap;
480 GLStringMap gl_strings_; 484 GLStringMap gl_strings_;
481 485
482 // Similar cache for glGetRequestableExtensionsCHROMIUM. We don't 486 // Similar cache for glGetRequestableExtensionsCHROMIUM. We don't
483 // have an enum for this so handle it separately. 487 // have an enum for this so handle it separately.
484 std::set<std::string> requestable_extensions_set_; 488 std::set<std::string> requestable_extensions_set_;
485 489
486 typedef std::map<const void*, MappedBuffer> MappedBufferMap; 490 typedef std::map<const void*, MappedBuffer> MappedBufferMap;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 530
527 inline bool GLES2Implementation::GetTexParameterivHelper( 531 inline bool GLES2Implementation::GetTexParameterivHelper(
528 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { 532 GLenum /* target */, GLenum /* pname */, GLint* /* params */) {
529 return false; 533 return false;
530 } 534 }
531 535
532 } // namespace gles2 536 } // namespace gles2
533 } // namespace gpu 537 } // namespace gpu
534 538
535 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ 539 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_demo.cc ('k') | gpu/command_buffer/client/gles2_implementation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698