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

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

Issue 723343002: Update from https://crrev.com/304121 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 <list> 10 #include <list>
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 public: 130 public:
131 enum MappedMemoryLimit { 131 enum MappedMemoryLimit {
132 kNoLimit = MappedMemoryManager::kNoLimit, 132 kNoLimit = MappedMemoryManager::kNoLimit,
133 }; 133 };
134 134
135 // Stores GL state that never changes. 135 // Stores GL state that never changes.
136 struct GLES2_IMPL_EXPORT GLStaticState { 136 struct GLES2_IMPL_EXPORT GLStaticState {
137 GLStaticState(); 137 GLStaticState();
138 ~GLStaticState(); 138 ~GLStaticState();
139 139
140 struct GLES2_IMPL_EXPORT IntState {
141 IntState();
142 GLint max_combined_texture_image_units;
143 GLint max_cube_map_texture_size;
144 GLint max_fragment_uniform_vectors;
145 GLint max_renderbuffer_size;
146 GLint max_texture_image_units;
147 GLint max_texture_size;
148 GLint max_varying_vectors;
149 GLint max_vertex_attribs;
150 GLint max_vertex_texture_image_units;
151 GLint max_vertex_uniform_vectors;
152 GLint num_compressed_texture_formats;
153 GLint num_shader_binary_formats;
154 GLint bind_generates_resource_chromium;
155 };
156 IntState int_state;
157
158 typedef std::pair<GLenum, GLenum> ShaderPrecisionKey; 140 typedef std::pair<GLenum, GLenum> ShaderPrecisionKey;
159 typedef std::map<ShaderPrecisionKey, 141 typedef std::map<ShaderPrecisionKey,
160 cmds::GetShaderPrecisionFormat::Result> 142 cmds::GetShaderPrecisionFormat::Result>
161 ShaderPrecisionMap; 143 ShaderPrecisionMap;
162 ShaderPrecisionMap shader_precisions; 144 ShaderPrecisionMap shader_precisions;
163 }; 145 };
164 146
165 // The maxiumum result size from simple GL get commands. 147 // The maxiumum result size from simple GL get commands.
166 static const size_t kMaxSizeOfSimpleResult = 16 * sizeof(uint32); // NOLINT. 148 static const size_t kMaxSizeOfSimpleResult = 16 * sizeof(uint32); // NOLINT.
167 149
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 // Gets the value of the result. 373 // Gets the value of the result.
392 template <typename T> 374 template <typename T>
393 T GetResultAs() { 375 T GetResultAs() {
394 return static_cast<T>(GetResultBuffer()); 376 return static_cast<T>(GetResultBuffer());
395 } 377 }
396 378
397 void* GetResultBuffer(); 379 void* GetResultBuffer();
398 int32 GetResultShmId(); 380 int32 GetResultShmId();
399 uint32 GetResultShmOffset(); 381 uint32 GetResultShmOffset();
400 382
401 bool QueryAndCacheStaticState();
402
403 // Helpers used to batch synchronous GetIntergerv calls with other
404 // synchronous calls.
405 struct GetMultipleIntegervState {
406 GetMultipleIntegervState(const GLenum* pnames, GLuint pnames_count,
407 GLint* results, GLsizeiptr results_size)
408 : pnames(pnames),
409 pnames_count(pnames_count),
410 results(results),
411 results_size(results_size)
412 { }
413 // inputs
414 const GLenum* pnames;
415 GLuint pnames_count;
416 // outputs
417 GLint* results;
418 GLsizeiptr results_size;
419 // transfer buffer
420 int num_results;
421 int transfer_buffer_size_needed;
422 void* buffer;
423 void* results_buffer;
424 };
425 bool GetMultipleIntegervSetup(
426 GetMultipleIntegervState* state);
427 void GetMultipleIntegervRequest(
428 GetMultipleIntegervState* state);
429 void GetMultipleIntegervOnCompleted(
430 GetMultipleIntegervState* state);
431
432 // Helpers used to batch synchronous GetShaderPrecision calls with other
433 // synchronous calls.
434 struct GetAllShaderPrecisionFormatsState {
435 GetAllShaderPrecisionFormatsState(
436 const GLenum (*precision_params)[2],
437 int precision_params_count)
438 : precision_params(precision_params),
439 precision_params_count(precision_params_count)
440 { }
441 const GLenum (*precision_params)[2];
442 int precision_params_count;
443 int transfer_buffer_size_needed;
444 void* results_buffer;
445 };
446 void GetAllShaderPrecisionFormatsSetup(
447 GetAllShaderPrecisionFormatsState* state);
448 void GetAllShaderPrecisionFormatsRequest(
449 GetAllShaderPrecisionFormatsState* state);
450 void GetAllShaderPrecisionFormatsOnCompleted(
451 GetAllShaderPrecisionFormatsState* state);
452
453 // Lazily determines if GL_ANGLE_pack_reverse_row_order is available 383 // Lazily determines if GL_ANGLE_pack_reverse_row_order is available
454 bool IsAnglePackReverseRowOrderAvailable(); 384 bool IsAnglePackReverseRowOrderAvailable();
455 bool IsChromiumFramebufferMultisampleAvailable(); 385 bool IsChromiumFramebufferMultisampleAvailable();
456 386
457 bool IsExtensionAvailableHelper( 387 bool IsExtensionAvailableHelper(
458 const char* extension, ExtensionStatus* status); 388 const char* extension, ExtensionStatus* status);
459 389
460 // Gets the GLError through our wrapper. 390 // Gets the GLError through our wrapper.
461 GLenum GetGLError(); 391 GLenum GetGLError();
462 392
(...skipping 25 matching lines...) Expand all
488 418
489 // Gets the contents of a bucket as a string. Returns false if there is no 419 // Gets the contents of a bucket as a string. Returns false if there is no
490 // string available which is a separate case from the empty string. 420 // string available which is a separate case from the empty string.
491 bool GetBucketAsString(uint32 bucket_id, std::string* str); 421 bool GetBucketAsString(uint32 bucket_id, std::string* str);
492 422
493 // Sets the contents of a bucket as a string. 423 // Sets the contents of a bucket as a string.
494 void SetBucketAsString(uint32 bucket_id, const std::string& str); 424 void SetBucketAsString(uint32 bucket_id, const std::string& str);
495 425
496 // Returns true if id is reserved. 426 // Returns true if id is reserved.
497 bool IsBufferReservedId(GLuint id); 427 bool IsBufferReservedId(GLuint id);
498 bool IsFramebufferReservedId(GLuint id) { return false; } 428 bool IsFramebufferReservedId(GLuint id) { return false; }
499 bool IsRenderbufferReservedId(GLuint id) { return false; } 429 bool IsRenderbufferReservedId(GLuint id) { return false; }
500 bool IsTextureReservedId(GLuint id) { return false; } 430 bool IsTextureReservedId(GLuint id) { return false; }
501 bool IsVertexArrayReservedId(GLuint id) { return false; } 431 bool IsVertexArrayReservedId(GLuint id) { return false; }
502 bool IsProgramReservedId(GLuint id) { return false; } 432 bool IsProgramReservedId(GLuint id) { return false; }
433 bool IsValuebufferReservedId(GLuint id) { return false; }
503 434
504 bool BindBufferHelper(GLenum target, GLuint texture); 435 bool BindBufferHelper(GLenum target, GLuint texture);
505 bool BindFramebufferHelper(GLenum target, GLuint texture); 436 bool BindFramebufferHelper(GLenum target, GLuint texture);
506 bool BindRenderbufferHelper(GLenum target, GLuint texture); 437 bool BindRenderbufferHelper(GLenum target, GLuint texture);
507 bool BindTextureHelper(GLenum target, GLuint texture); 438 bool BindTextureHelper(GLenum target, GLuint texture);
508 bool BindVertexArrayOESHelper(GLuint array); 439 bool BindVertexArrayOESHelper(GLuint array);
440 bool BindValuebufferCHROMIUMHelper(GLenum target, GLuint valuebuffer);
509 bool UseProgramHelper(GLuint program); 441 bool UseProgramHelper(GLuint program);
510 442
511 void GenBuffersHelper(GLsizei n, const GLuint* buffers); 443 void GenBuffersHelper(GLsizei n, const GLuint* buffers);
512 void GenFramebuffersHelper(GLsizei n, const GLuint* framebuffers); 444 void GenFramebuffersHelper(GLsizei n, const GLuint* framebuffers);
513 void GenRenderbuffersHelper(GLsizei n, const GLuint* renderbuffers); 445 void GenRenderbuffersHelper(GLsizei n, const GLuint* renderbuffers);
514 void GenTexturesHelper(GLsizei n, const GLuint* textures); 446 void GenTexturesHelper(GLsizei n, const GLuint* textures);
515 void GenVertexArraysOESHelper(GLsizei n, const GLuint* arrays); 447 void GenVertexArraysOESHelper(GLsizei n, const GLuint* arrays);
516 void GenQueriesEXTHelper(GLsizei n, const GLuint* queries); 448 void GenQueriesEXTHelper(GLsizei n, const GLuint* queries);
449 void GenValuebuffersCHROMIUMHelper(GLsizei n, const GLuint* valuebuffers);
517 450
518 void DeleteBuffersHelper(GLsizei n, const GLuint* buffers); 451 void DeleteBuffersHelper(GLsizei n, const GLuint* buffers);
519 void DeleteFramebuffersHelper(GLsizei n, const GLuint* framebuffers); 452 void DeleteFramebuffersHelper(GLsizei n, const GLuint* framebuffers);
520 void DeleteRenderbuffersHelper(GLsizei n, const GLuint* renderbuffers); 453 void DeleteRenderbuffersHelper(GLsizei n, const GLuint* renderbuffers);
521 void DeleteTexturesHelper(GLsizei n, const GLuint* textures); 454 void DeleteTexturesHelper(GLsizei n, const GLuint* textures);
522 bool DeleteProgramHelper(GLuint program); 455 bool DeleteProgramHelper(GLuint program);
523 bool DeleteShaderHelper(GLuint shader); 456 bool DeleteShaderHelper(GLuint shader);
524 void DeleteQueriesEXTHelper(GLsizei n, const GLuint* queries); 457 void DeleteQueriesEXTHelper(GLsizei n, const GLuint* queries);
525 void DeleteVertexArraysOESHelper(GLsizei n, const GLuint* arrays); 458 void DeleteVertexArraysOESHelper(GLsizei n, const GLuint* arrays);
459 void DeleteValuebuffersCHROMIUMHelper(GLsizei n, const GLuint* valuebuffers);
526 460
527 void DeleteBuffersStub(GLsizei n, const GLuint* buffers); 461 void DeleteBuffersStub(GLsizei n, const GLuint* buffers);
528 void DeleteFramebuffersStub(GLsizei n, const GLuint* framebuffers); 462 void DeleteFramebuffersStub(GLsizei n, const GLuint* framebuffers);
529 void DeleteRenderbuffersStub(GLsizei n, const GLuint* renderbuffers); 463 void DeleteRenderbuffersStub(GLsizei n, const GLuint* renderbuffers);
530 void DeleteTexturesStub(GLsizei n, const GLuint* textures); 464 void DeleteTexturesStub(GLsizei n, const GLuint* textures);
531 void DeleteProgramStub(GLsizei n, const GLuint* programs); 465 void DeleteProgramStub(GLsizei n, const GLuint* programs);
532 void DeleteShaderStub(GLsizei n, const GLuint* shaders); 466 void DeleteShaderStub(GLsizei n, const GLuint* shaders);
533 void DeleteVertexArraysOESStub(GLsizei n, const GLuint* arrays); 467 void DeleteVertexArraysOESStub(GLsizei n, const GLuint* arrays);
468 void DeleteValuebuffersCHROMIUMStub(GLsizei n, const GLuint* valuebuffers);
534 469
535 void BufferDataHelper( 470 void BufferDataHelper(
536 GLenum target, GLsizeiptr size, const void* data, GLenum usage); 471 GLenum target, GLsizeiptr size, const void* data, GLenum usage);
537 void BufferSubDataHelper( 472 void BufferSubDataHelper(
538 GLenum target, GLintptr offset, GLsizeiptr size, const void* data); 473 GLenum target, GLintptr offset, GLsizeiptr size, const void* data);
539 void BufferSubDataHelperImpl( 474 void BufferSubDataHelperImpl(
540 GLenum target, GLintptr offset, GLsizeiptr size, const void* data, 475 GLenum target, GLintptr offset, GLsizeiptr size, const void* data,
541 ScopedTransferBufferPtr* buffer); 476 ScopedTransferBufferPtr* buffer);
542 477
543 GLuint CreateImageCHROMIUMHelper(ClientBuffer buffer, 478 GLuint CreateImageCHROMIUMHelper(ClientBuffer buffer,
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 bool pack_reverse_row_order_; 627 bool pack_reverse_row_order_;
693 628
694 scoped_ptr<TextureUnit[]> texture_units_; 629 scoped_ptr<TextureUnit[]> texture_units_;
695 630
696 // 0 to gl_state_.max_combined_texture_image_units. 631 // 0 to gl_state_.max_combined_texture_image_units.
697 GLuint active_texture_unit_; 632 GLuint active_texture_unit_;
698 633
699 GLuint bound_framebuffer_; 634 GLuint bound_framebuffer_;
700 GLuint bound_read_framebuffer_; 635 GLuint bound_read_framebuffer_;
701 GLuint bound_renderbuffer_; 636 GLuint bound_renderbuffer_;
637 GLuint bound_valuebuffer_;
702 638
703 // The program in use by glUseProgram 639 // The program in use by glUseProgram
704 GLuint current_program_; 640 GLuint current_program_;
705 641
706 // The currently bound array buffer. 642 // The currently bound array buffer.
707 GLuint bound_array_buffer_id_; 643 GLuint bound_array_buffer_id_;
708 644
709 // The currently bound pixel transfer buffers. 645 // The currently bound pixel transfer buffers.
710 GLuint bound_pixel_pack_transfer_buffer_id_; 646 GLuint bound_pixel_pack_transfer_buffer_id_;
711 GLuint bound_pixel_unpack_transfer_buffer_id_; 647 GLuint bound_pixel_unpack_transfer_buffer_id_;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 749
814 inline bool GLES2Implementation::GetTexParameterivHelper( 750 inline bool GLES2Implementation::GetTexParameterivHelper(
815 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { 751 GLenum /* target */, GLenum /* pname */, GLint* /* params */) {
816 return false; 752 return false;
817 } 753 }
818 754
819 } // namespace gles2 755 } // namespace gles2
820 } // namespace gpu 756 } // namespace gpu
821 757
822 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ 758 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_
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