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_copy_tex_image.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_copy_tex_image.h" |
6 | 6 |
7 #include "gpu/command_buffer/service/texture_manager.h" | 7 #include "gpu/command_buffer/service/texture_manager.h" |
8 #include "ui/gl/gl_version_info.h" | 8 #include "ui/gl/gl_version_info.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 glDeleteFramebuffersEXT(1, &scratch_fbo_); | 133 glDeleteFramebuffersEXT(1, &scratch_fbo_); |
134 scratch_fbo_ = 0; | 134 scratch_fbo_ = 0; |
135 | 135 |
136 glDeleteVertexArraysOES(1, &vao_); | 136 glDeleteVertexArraysOES(1, &vao_); |
137 vao_ = 0; | 137 vao_ = 0; |
138 | 138 |
139 initialized_ = false; | 139 initialized_ = false; |
140 } | 140 } |
141 | 141 |
142 void CopyTexImageResourceManager::DoCopyTexImage2DToLUMAComatabilityTexture( | 142 void CopyTexImageResourceManager::DoCopyTexImage2DToLUMACompatabilityTexture( |
143 const gles2::GLES2Decoder* decoder, | 143 const gles2::GLES2Decoder* decoder, |
144 GLuint dest_texture, | 144 GLuint dest_texture, |
145 GLenum dest_texture_target, | 145 GLenum dest_texture_target, |
146 GLenum dest_target, | 146 GLenum dest_target, |
147 GLenum luma_format, | 147 GLenum luma_format, |
148 GLenum luma_type, | 148 GLenum luma_type, |
149 GLint level, | 149 GLint level, |
150 GLenum internal_format, | 150 GLenum internal_format, |
151 GLint x, | 151 GLint x, |
152 GLint y, | 152 GLint y, |
153 GLsizei width, | 153 GLsizei width, |
154 GLsizei height, | 154 GLsizei height, |
155 GLuint source_framebuffer, | 155 GLuint source_framebuffer, |
156 GLenum source_framebuffer_internal_format) { | 156 GLenum source_framebuffer_internal_format) { |
157 GLenum adjusted_internal_format = | 157 GLenum adjusted_internal_format = |
158 gles2::TextureManager::AdjustTexInternalFormat(feature_info_.get(), | 158 gles2::TextureManager::AdjustTexInternalFormat(feature_info_.get(), |
159 internal_format); | 159 internal_format); |
160 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); | 160 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); |
161 GLenum adjusted_format = gles2::TextureManager::AdjustTexFormat( | 161 GLenum adjusted_format = gles2::TextureManager::AdjustTexFormat( |
162 feature_info_.get(), internal_format); | 162 feature_info_.get(), internal_format); |
163 glTexImage2D(dest_target, level, adjusted_internal_format, width, height, 0, | 163 glTexImage2D(dest_target, level, adjusted_internal_format, width, height, 0, |
164 adjusted_format, luma_type, nullptr); | 164 adjusted_format, luma_type, nullptr); |
165 DoCopyTexSubImage2DToLUMAComatabilityTexture( | 165 DoCopyTexSubImage2DToLUMACompatabilityTexture( |
166 decoder, dest_texture, dest_texture_target, dest_target, luma_format, | 166 decoder, dest_texture, dest_texture_target, dest_target, luma_format, |
167 luma_type, level, 0, 0, x, y, width, height, source_framebuffer, | 167 luma_type, level, 0, 0, x, y, width, height, source_framebuffer, |
168 source_framebuffer_internal_format); | 168 source_framebuffer_internal_format); |
169 } | 169 } |
170 | 170 |
171 void CopyTexImageResourceManager::DoCopyTexSubImage2DToLUMAComatabilityTexture( | 171 void CopyTexImageResourceManager::DoCopyTexSubImage2DToLUMACompatabilityTexture( |
172 const gles2::GLES2Decoder* decoder, | 172 const gles2::GLES2Decoder* decoder, |
173 GLuint dest_texture, | 173 GLuint dest_texture, |
174 GLenum dest_texture_target, | 174 GLenum dest_texture_target, |
175 GLenum dest_target, | 175 GLenum dest_target, |
176 GLenum luma_format, | 176 GLenum luma_format, |
177 GLenum luma_type, | 177 GLenum luma_type, |
178 GLint level, | 178 GLint level, |
179 GLint xoffset, | 179 GLint xoffset, |
180 GLint yoffset, | 180 GLint yoffset, |
181 GLint x, | 181 GLint x, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 case GL_ALPHA: | 264 case GL_ALPHA: |
265 case GL_LUMINANCE_ALPHA: | 265 case GL_LUMINANCE_ALPHA: |
266 return true; | 266 return true; |
267 } | 267 } |
268 } | 268 } |
269 | 269 |
270 return false; | 270 return false; |
271 } | 271 } |
272 | 272 |
273 } // namespace gpu | 273 } // namespace gpu |
OLD | NEW |