| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" |
| 6 | 6 |
| 7 #include "gpu/command_buffer/service/feature_info.h" | 7 #include "gpu/command_buffer/service/feature_info.h" |
| 8 #include "gpu/command_buffer/service/gl_utils.h" | 8 #include "gpu/command_buffer/service/gl_utils.h" |
| 9 #include "ui/gl/gl_version_info.h" | 9 #include "ui/gl/gl_version_info.h" |
| 10 | 10 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 if (feature_info_->IsWebGL2OrES3Context()) { | 196 if (feature_info_->IsWebGL2OrES3Context()) { |
| 197 bound_textures_[GL_TEXTURE_2D_ARRAY].resize(num_texture_units, 0); | 197 bound_textures_[GL_TEXTURE_2D_ARRAY].resize(num_texture_units, 0); |
| 198 bound_textures_[GL_TEXTURE_3D].resize(num_texture_units, 0); | 198 bound_textures_[GL_TEXTURE_3D].resize(num_texture_units, 0); |
| 199 } | 199 } |
| 200 | 200 |
| 201 if (group_->gpu_preferences().enable_gpu_driver_debug_logging && | 201 if (group_->gpu_preferences().enable_gpu_driver_debug_logging && |
| 202 feature_info_->feature_flags().khr_debug) { | 202 feature_info_->feature_flags().khr_debug) { |
| 203 InitializeGLDebugLogging(); | 203 InitializeGLDebugLogging(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 emulated_extensions_.push_back("GL_CHROMIUM_async_pixel_transfers"); | |
| 207 emulated_extensions_.push_back("GL_CHROMIUM_command_buffer_query"); | |
| 208 emulated_extensions_.push_back("GL_CHROMIUM_command_buffer_latency_query"); | |
| 209 emulated_extensions_.push_back("GL_CHROMIUM_get_error_query"); | |
| 210 emulated_extensions_.push_back("GL_CHROMIUM_lose_context"); | |
| 211 emulated_extensions_.push_back("GL_CHROMIUM_pixel_transfer_buffer_object"); | |
| 212 emulated_extensions_.push_back("GL_CHROMIUM_resource_safe"); | |
| 213 emulated_extensions_.push_back("GL_CHROMIUM_strict_attribs"); | |
| 214 emulated_extensions_.push_back("GL_CHROMIUM_texture_mailbox"); | |
| 215 emulated_extensions_.push_back("GL_CHROMIUM_trace_marker"); | |
| 216 BuildExtensionsString(); | |
| 217 | |
| 218 set_initialized(); | 206 set_initialized(); |
| 219 return true; | 207 return true; |
| 220 } | 208 } |
| 221 | 209 |
| 222 void GLES2DecoderPassthroughImpl::Destroy(bool have_context) { | 210 void GLES2DecoderPassthroughImpl::Destroy(bool have_context) { |
| 223 image_manager_.reset(); | 211 image_manager_.reset(); |
| 224 | 212 |
| 225 DeleteServiceObjects( | 213 DeleteServiceObjects( |
| 226 &framebuffer_id_map_, have_context, | 214 &framebuffer_id_map_, have_context, |
| 227 [](GLuint framebuffer) { glDeleteFramebuffersEXT(1, &framebuffer); }); | 215 [](GLuint framebuffer) { glDeleteFramebuffersEXT(1, &framebuffer); }); |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 error::Error GLES2DecoderPassthroughImpl::PatchGetNumericResults(GLenum pname, | 562 error::Error GLES2DecoderPassthroughImpl::PatchGetNumericResults(GLenum pname, |
| 575 GLsizei length, | 563 GLsizei length, |
| 576 T* params) { | 564 T* params) { |
| 577 // Likely a gl error if no parameters were returned | 565 // Likely a gl error if no parameters were returned |
| 578 if (length < 1) { | 566 if (length < 1) { |
| 579 return error::kNoError; | 567 return error::kNoError; |
| 580 } | 568 } |
| 581 | 569 |
| 582 switch (pname) { | 570 switch (pname) { |
| 583 case GL_NUM_EXTENSIONS: | 571 case GL_NUM_EXTENSIONS: |
| 584 *params = *params + static_cast<T>(emulated_extensions_.size()); | 572 // Currently handled on the client side. |
| 573 params[0] = 0; |
| 585 break; | 574 break; |
| 586 | 575 |
| 587 case GL_TEXTURE_BINDING_2D: | 576 case GL_TEXTURE_BINDING_2D: |
| 588 case GL_TEXTURE_BINDING_CUBE_MAP: | 577 case GL_TEXTURE_BINDING_CUBE_MAP: |
| 589 case GL_TEXTURE_BINDING_2D_ARRAY: | 578 case GL_TEXTURE_BINDING_2D_ARRAY: |
| 590 case GL_TEXTURE_BINDING_3D: | 579 case GL_TEXTURE_BINDING_3D: |
| 591 if (!GetClientID(&resources_->texture_id_map, *params, params)) { | 580 if (!GetClientID(&resources_->texture_id_map, *params, params)) { |
| 592 return error::kInvalidArguments; | 581 return error::kInvalidArguments; |
| 593 } | 582 } |
| 594 break; | 583 break; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 } | 693 } |
| 705 } break; | 694 } break; |
| 706 | 695 |
| 707 default: | 696 default: |
| 708 break; | 697 break; |
| 709 } | 698 } |
| 710 | 699 |
| 711 return error::kNoError; | 700 return error::kNoError; |
| 712 } | 701 } |
| 713 | 702 |
| 714 void GLES2DecoderPassthroughImpl::BuildExtensionsString() { | |
| 715 std::ostringstream combined_string_stream; | |
| 716 combined_string_stream << reinterpret_cast<const char*>( | |
| 717 glGetString(GL_EXTENSIONS)) | |
| 718 << " "; | |
| 719 std::copy(emulated_extensions_.begin(), emulated_extensions_.end(), | |
| 720 std::ostream_iterator<std::string>(combined_string_stream, " ")); | |
| 721 extension_string_ = combined_string_stream.str(); | |
| 722 } | |
| 723 | |
| 724 void GLES2DecoderPassthroughImpl::InsertError(GLenum error, | 703 void GLES2DecoderPassthroughImpl::InsertError(GLenum error, |
| 725 const std::string&) { | 704 const std::string&) { |
| 726 // Message ignored for now | 705 // Message ignored for now |
| 727 errors_.insert(error); | 706 errors_.insert(error); |
| 728 } | 707 } |
| 729 | 708 |
| 730 GLenum GLES2DecoderPassthroughImpl::PopError() { | 709 GLenum GLES2DecoderPassthroughImpl::PopError() { |
| 731 GLenum error = GL_NO_ERROR; | 710 GLenum error = GL_NO_ERROR; |
| 732 if (!errors_.empty()) { | 711 if (!errors_.empty()) { |
| 733 error = *errors_.begin(); | 712 error = *errors_.begin(); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 }, /* NOLINT */ | 840 }, /* NOLINT */ |
| 862 | 841 |
| 863 const GLES2DecoderPassthroughImpl::CommandInfo | 842 const GLES2DecoderPassthroughImpl::CommandInfo |
| 864 GLES2DecoderPassthroughImpl::command_info[] = { | 843 GLES2DecoderPassthroughImpl::command_info[] = { |
| 865 GLES2_COMMAND_LIST(GLES2_CMD_OP)}; | 844 GLES2_COMMAND_LIST(GLES2_CMD_OP)}; |
| 866 | 845 |
| 867 #undef GLES2_CMD_OP | 846 #undef GLES2_CMD_OP |
| 868 | 847 |
| 869 } // namespace gles2 | 848 } // namespace gles2 |
| 870 } // namespace gpu | 849 } // namespace gpu |
| OLD | NEW |