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 "base/strings/string_split.h" | 7 #include "base/strings/string_split.h" |
8 #include "gpu/command_buffer/service/feature_info.h" | 8 #include "gpu/command_buffer/service/feature_info.h" |
9 #include "gpu/command_buffer/service/gl_utils.h" | 9 #include "gpu/command_buffer/service/gl_utils.h" |
10 #include "ui/gl/gl_version_info.h" | 10 #include "ui/gl/gl_version_info.h" |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 glBindTexture(target, service_id); | 878 glBindTexture(target, service_id); |
879 } | 879 } |
880 } | 880 } |
881 | 881 |
882 // Reset the active texture unit if it was changed | 882 // Reset the active texture unit if it was changed |
883 if (cur_texture_unit != active_texture_unit_) { | 883 if (cur_texture_unit != active_texture_unit_) { |
884 glActiveTexture(static_cast<GLenum>(GL_TEXTURE0 + active_texture_unit_)); | 884 glActiveTexture(static_cast<GLenum>(GL_TEXTURE0 + active_texture_unit_)); |
885 } | 885 } |
886 } | 886 } |
887 | 887 |
| 888 error::Error GLES2DecoderPassthroughImpl::BindTexImage2DCHROMIUMImpl( |
| 889 GLenum target, |
| 890 GLenum internalformat, |
| 891 GLint imageId) { |
| 892 if (target != GL_TEXTURE_2D) { |
| 893 InsertError(GL_INVALID_ENUM, "Invalid target"); |
| 894 return error::kNoError; |
| 895 } |
| 896 |
| 897 gl::GLImage* image = image_manager_->LookupImage(imageId); |
| 898 if (image == nullptr) { |
| 899 InsertError(GL_INVALID_OPERATION, "No image found with the given ID"); |
| 900 return error::kNoError; |
| 901 } |
| 902 |
| 903 if (internalformat) { |
| 904 if (!image->BindTexImageWithInternalformat(target, internalformat)) { |
| 905 image->CopyTexImage(target); |
| 906 } |
| 907 } else { |
| 908 if (!image->BindTexImage(target)) { |
| 909 image->CopyTexImage(target); |
| 910 } |
| 911 } |
| 912 |
| 913 return error::kNoError; |
| 914 } |
| 915 |
888 #define GLES2_CMD_OP(name) \ | 916 #define GLES2_CMD_OP(name) \ |
889 { \ | 917 { \ |
890 &GLES2DecoderPassthroughImpl::Handle##name, cmds::name::kArgFlags, \ | 918 &GLES2DecoderPassthroughImpl::Handle##name, cmds::name::kArgFlags, \ |
891 cmds::name::cmd_flags, \ | 919 cmds::name::cmd_flags, \ |
892 sizeof(cmds::name) / sizeof(CommandBufferEntry) - 1, \ | 920 sizeof(cmds::name) / sizeof(CommandBufferEntry) - 1, \ |
893 }, /* NOLINT */ | 921 }, /* NOLINT */ |
894 | 922 |
895 const GLES2DecoderPassthroughImpl::CommandInfo | 923 const GLES2DecoderPassthroughImpl::CommandInfo |
896 GLES2DecoderPassthroughImpl::command_info[] = { | 924 GLES2DecoderPassthroughImpl::command_info[] = { |
897 GLES2_COMMAND_LIST(GLES2_CMD_OP)}; | 925 GLES2_COMMAND_LIST(GLES2_CMD_OP)}; |
898 | 926 |
899 #undef GLES2_CMD_OP | 927 #undef GLES2_CMD_OP |
900 | 928 |
901 } // namespace gles2 | 929 } // namespace gles2 |
902 } // namespace gpu | 930 } // namespace gpu |
OLD | NEW |