OLD | NEW |
---|---|
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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 13009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13020 GLboolean unpack_premultiply_alpha, | 13020 GLboolean unpack_premultiply_alpha, |
13021 GLboolean unpack_unmultiply_alpha) { | 13021 GLboolean unpack_unmultiply_alpha) { |
13022 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopyTextureCHROMIUM"); | 13022 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopyTextureCHROMIUM"); |
13023 | 13023 |
13024 TextureRef* source_texture_ref = GetTexture(source_id); | 13024 TextureRef* source_texture_ref = GetTexture(source_id); |
13025 TextureRef* dest_texture_ref = GetTexture(dest_id); | 13025 TextureRef* dest_texture_ref = GetTexture(dest_id); |
13026 Texture* source_texture = source_texture_ref->texture(); | 13026 Texture* source_texture = source_texture_ref->texture(); |
13027 Texture* dest_texture = dest_texture_ref->texture(); | 13027 Texture* dest_texture = dest_texture_ref->texture(); |
13028 int source_width = 0; | 13028 int source_width = 0; |
13029 int source_height = 0; | 13029 int source_height = 0; |
13030 gl::GLImage* image = | 13030 if (!source_texture->GetLevelSize(source_texture->target(), 0, &source_width, |
13031 source_texture->GetLevelImage(source_texture->target(), 0); | 13031 &source_height, nullptr)) { |
13032 if (image) { | 13032 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopyTextureChromium", |
13033 gfx::Size size = image->GetSize(); | 13033 "source texture has no level 0"); |
dshwang
2015/11/07 15:53:03
As SetSize hack just update size of GLImage, this
| |
13034 source_width = size.width(); | 13034 return; |
13035 source_height = size.height(); | 13035 } |
13036 if (source_width <= 0 || source_height <= 0) { | |
13037 LOCAL_SET_GL_ERROR( | |
13038 GL_INVALID_VALUE, | |
13039 "glCopyTextureChromium", "invalid image size"); | |
13040 return; | |
13041 } | |
13042 } else { | |
13043 if (!source_texture->GetLevelSize(source_texture->target(), 0, | |
13044 &source_width, &source_height, nullptr)) { | |
13045 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, | |
13046 "glCopyTextureChromium", | |
13047 "source texture has no level 0"); | |
13048 return; | |
13049 } | |
13050 | 13036 |
13051 // Check that this type of texture is allowed. | 13037 // Check that this type of texture is allowed. |
13052 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, | 13038 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, |
13053 source_width, source_height, 1)) { | 13039 source_width, source_height, 1)) { |
13054 LOCAL_SET_GL_ERROR( | 13040 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopyTextureCHROMIUM", |
13055 GL_INVALID_VALUE, "glCopyTextureCHROMIUM", "Bad dimensions"); | 13041 "Bad dimensions"); |
13056 return; | 13042 return; |
13057 } | |
13058 } | 13043 } |
13059 | 13044 |
13060 GLenum source_type = 0; | 13045 GLenum source_type = 0; |
13061 GLenum source_internal_format = 0; | 13046 GLenum source_internal_format = 0; |
13062 source_texture->GetLevelType( | 13047 source_texture->GetLevelType( |
13063 source_texture->target(), 0, &source_type, &source_internal_format); | 13048 source_texture->target(), 0, &source_type, &source_internal_format); |
13064 | 13049 |
13065 if (dest_texture->IsImmutable()) { | 13050 if (dest_texture->IsImmutable()) { |
13066 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCopyTextureCHROMIUM", | 13051 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCopyTextureCHROMIUM", |
13067 "texture is immutable"); | 13052 "texture is immutable"); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13124 texture_manager()->SetLevelInfo( | 13109 texture_manager()->SetLevelInfo( |
13125 dest_texture_ref, GL_TEXTURE_2D, 0, internal_format, source_width, | 13110 dest_texture_ref, GL_TEXTURE_2D, 0, internal_format, source_width, |
13126 source_height, 1, 0, internal_format, dest_type, | 13111 source_height, 1, 0, internal_format, dest_type, |
13127 gfx::Rect(source_width, source_height)); | 13112 gfx::Rect(source_width, source_height)); |
13128 } else { | 13113 } else { |
13129 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, | 13114 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, |
13130 true); | 13115 true); |
13131 } | 13116 } |
13132 | 13117 |
13133 // Try using GLImage::CopyTexImage when possible. | 13118 // Try using GLImage::CopyTexImage when possible. |
13119 gl::GLImage* image = | |
13120 source_texture->GetLevelImage(source_texture->target(), 0); | |
13134 bool unpack_premultiply_alpha_change = | 13121 bool unpack_premultiply_alpha_change = |
13135 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; | 13122 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; |
13136 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { | 13123 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { |
13137 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); | 13124 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); |
13138 if (image->CopyTexImage(GL_TEXTURE_2D)) | 13125 if (image->CopyTexImage(GL_TEXTURE_2D)) |
13139 return; | 13126 return; |
13140 } | 13127 } |
13141 | 13128 |
13142 DoCopyTexImageIfNeeded(source_texture, source_texture->target()); | 13129 DoCopyTexImageIfNeeded(source_texture, source_texture->target()); |
13143 | 13130 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13178 GLboolean unpack_premultiply_alpha, | 13165 GLboolean unpack_premultiply_alpha, |
13179 GLboolean unpack_unmultiply_alpha) { | 13166 GLboolean unpack_unmultiply_alpha) { |
13180 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopySubTextureCHROMIUM"); | 13167 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopySubTextureCHROMIUM"); |
13181 | 13168 |
13182 TextureRef* source_texture_ref = GetTexture(source_id); | 13169 TextureRef* source_texture_ref = GetTexture(source_id); |
13183 TextureRef* dest_texture_ref = GetTexture(dest_id); | 13170 TextureRef* dest_texture_ref = GetTexture(dest_id); |
13184 Texture* source_texture = source_texture_ref->texture(); | 13171 Texture* source_texture = source_texture_ref->texture(); |
13185 Texture* dest_texture = dest_texture_ref->texture(); | 13172 Texture* dest_texture = dest_texture_ref->texture(); |
13186 int source_width = 0; | 13173 int source_width = 0; |
13187 int source_height = 0; | 13174 int source_height = 0; |
13188 gl::GLImage* image = | 13175 if (!source_texture->GetLevelSize(source_texture->target(), 0, &source_width, |
13189 source_texture->GetLevelImage(source_texture->target(), 0); | 13176 &source_height, nullptr)) { |
13190 if (image) { | 13177 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", |
13191 gfx::Size size = image->GetSize(); | 13178 "source texture has no level 0"); |
13192 source_width = size.width(); | 13179 return; |
13193 source_height = size.height(); | 13180 } |
13194 if (source_width <= 0 || source_height <= 0) { | |
13195 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", | |
13196 "invalid image size"); | |
13197 return; | |
13198 } | |
13199 } else { | |
13200 if (!source_texture->GetLevelSize(source_texture->target(), 0, | |
13201 &source_width, &source_height, nullptr)) { | |
13202 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", | |
13203 "source texture has no level 0"); | |
13204 return; | |
13205 } | |
13206 | 13181 |
13207 // Check that this type of texture is allowed. | 13182 // Check that this type of texture is allowed. |
13208 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, | 13183 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, |
13209 source_width, source_height, 1)) { | 13184 source_width, source_height, 1)) { |
13210 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", | 13185 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", |
13211 "source texture bad dimensions"); | 13186 "source texture bad dimensions"); |
13212 return; | 13187 return; |
13213 } | |
13214 } | 13188 } |
13215 | 13189 |
13216 GLenum source_type = 0; | 13190 GLenum source_type = 0; |
13217 GLenum source_internal_format = 0; | 13191 GLenum source_internal_format = 0; |
13218 source_texture->GetLevelType(source_texture->target(), 0, &source_type, | 13192 source_texture->GetLevelType(source_texture->target(), 0, &source_type, |
13219 &source_internal_format); | 13193 &source_internal_format); |
13220 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, | 13194 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, |
dshwang
2015/11/07 15:53:03
In addition, this code has bug due to SetSize hack
| |
13221 width, height, 1)) { | 13195 width, height, 1)) { |
13222 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", | 13196 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", |
13223 "source texture bad dimensions."); | 13197 "source texture bad dimensions."); |
13224 return; | 13198 return; |
13225 } | 13199 } |
13226 | 13200 |
13227 GLenum dest_type = 0; | 13201 GLenum dest_type = 0; |
13228 GLenum dest_internal_format = 0; | 13202 GLenum dest_internal_format = 0; |
13229 bool dest_level_defined = dest_texture->GetLevelType( | 13203 bool dest_level_defined = dest_texture->GetLevelType( |
13230 dest_texture->target(), 0, &dest_type, &dest_internal_format); | 13204 dest_texture->target(), 0, &dest_type, &dest_internal_format); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13288 "destination texture dimensions too big"); | 13262 "destination texture dimensions too big"); |
13289 return; | 13263 return; |
13290 } | 13264 } |
13291 } | 13265 } |
13292 } else { | 13266 } else { |
13293 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, | 13267 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, |
13294 true); | 13268 true); |
13295 } | 13269 } |
13296 | 13270 |
13297 // Try using GLImage::CopyTexSubImage when possible. | 13271 // Try using GLImage::CopyTexSubImage when possible. |
13272 gl::GLImage* image = | |
13273 source_texture->GetLevelImage(source_texture->target(), 0); | |
13298 bool unpack_premultiply_alpha_change = | 13274 bool unpack_premultiply_alpha_change = |
13299 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; | 13275 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; |
13300 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { | 13276 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { |
13301 ScopedTextureBinder binder( | 13277 ScopedTextureBinder binder( |
13302 &state_, dest_texture->service_id(), GL_TEXTURE_2D); | 13278 &state_, dest_texture->service_id(), GL_TEXTURE_2D); |
13303 if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(xoffset, yoffset), | 13279 if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(xoffset, yoffset), |
13304 gfx::Rect(x, y, width, height))) { | 13280 gfx::Rect(x, y, width, height))) { |
13305 return; | 13281 return; |
13306 } | 13282 } |
13307 } | 13283 } |
(...skipping 16 matching lines...) Expand all Loading... | |
13324 GLuint source_id, | 13300 GLuint source_id, |
13325 GLuint dest_id) { | 13301 GLuint dest_id) { |
13326 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM"); | 13302 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM"); |
13327 | 13303 |
13328 TextureRef* source_texture_ref = GetTexture(source_id); | 13304 TextureRef* source_texture_ref = GetTexture(source_id); |
13329 TextureRef* dest_texture_ref = GetTexture(dest_id); | 13305 TextureRef* dest_texture_ref = GetTexture(dest_id); |
13330 Texture* source_texture = source_texture_ref->texture(); | 13306 Texture* source_texture = source_texture_ref->texture(); |
13331 Texture* dest_texture = dest_texture_ref->texture(); | 13307 Texture* dest_texture = dest_texture_ref->texture(); |
13332 int source_width = 0; | 13308 int source_width = 0; |
13333 int source_height = 0; | 13309 int source_height = 0; |
13334 gl::GLImage* image = | 13310 if (!source_texture->GetLevelSize(source_texture->target(), 0, &source_width, |
13335 source_texture->GetLevelImage(source_texture->target(), 0); | 13311 &source_height, nullptr)) { |
13336 if (image) { | 13312 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopyTextureCHROMIUM", |
13337 gfx::Size size = image->GetSize(); | 13313 "source texture has no level 0"); |
13338 source_width = size.width(); | 13314 return; |
13339 source_height = size.height(); | 13315 } |
13340 if (source_width <= 0 || source_height <= 0) { | |
13341 LOCAL_SET_GL_ERROR( | |
13342 GL_INVALID_VALUE, | |
13343 "glCompressedCopyTextureCHROMIUM", "invalid image size"); | |
13344 return; | |
13345 } | |
13346 } else { | |
13347 if (!source_texture->GetLevelSize(source_texture->target(), 0, | |
13348 &source_width, &source_height, nullptr)) { | |
13349 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, | |
13350 "glCompressedCopyTextureCHROMIUM", | |
13351 "source texture has no level 0"); | |
13352 return; | |
13353 } | |
13354 | 13316 |
13355 // Check that this type of texture is allowed. | 13317 // Check that this type of texture is allowed. |
13356 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, | 13318 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, |
13357 source_width, source_height, 1)) { | 13319 source_width, source_height, 1)) { |
13358 LOCAL_SET_GL_ERROR( | 13320 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopyTextureCHROMIUM", |
13359 GL_INVALID_VALUE, "glCompressedCopyTextureCHROMIUM", | 13321 "Bad dimensions"); |
13360 "Bad dimensions"); | 13322 return; |
13361 return; | |
13362 } | |
13363 } | 13323 } |
13364 | 13324 |
13365 GLenum source_type = 0; | 13325 GLenum source_type = 0; |
13366 GLenum source_internal_format = 0; | 13326 GLenum source_internal_format = 0; |
13367 source_texture->GetLevelType( | 13327 source_texture->GetLevelType( |
13368 source_texture->target(), 0, &source_type, &source_internal_format); | 13328 source_texture->target(), 0, &source_type, &source_internal_format); |
13369 | 13329 |
13370 if (dest_texture->IsImmutable()) { | 13330 if (dest_texture->IsImmutable()) { |
13371 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, | 13331 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |
13372 "glCompressedCopyTextureCHROMIUM", | 13332 "glCompressedCopyTextureCHROMIUM", |
(...skipping 24 matching lines...) Expand all Loading... | |
13397 source_texture->target(), 0)) { | 13357 source_texture->target(), 0)) { |
13398 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCompressedCopyTextureCHROMIUM", | 13358 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCompressedCopyTextureCHROMIUM", |
13399 "dimensions too big"); | 13359 "dimensions too big"); |
13400 return; | 13360 return; |
13401 } | 13361 } |
13402 | 13362 |
13403 ScopedTextureBinder binder( | 13363 ScopedTextureBinder binder( |
13404 &state_, dest_texture->service_id(), GL_TEXTURE_2D); | 13364 &state_, dest_texture->service_id(), GL_TEXTURE_2D); |
13405 | 13365 |
13406 // Try using GLImage::CopyTexImage when possible. | 13366 // Try using GLImage::CopyTexImage when possible. |
13367 gl::GLImage* image = | |
13368 source_texture->GetLevelImage(source_texture->target(), 0); | |
13407 if (image) { | 13369 if (image) { |
13408 GLenum dest_type = 0; | 13370 GLenum dest_type = 0; |
13409 GLenum dest_internal_format = 0; | 13371 GLenum dest_internal_format = 0; |
13410 int dest_width = 0; | 13372 int dest_width = 0; |
13411 int dest_height = 0; | 13373 int dest_height = 0; |
13412 bool dest_level_defined = dest_texture->GetLevelSize( | 13374 bool dest_level_defined = dest_texture->GetLevelSize( |
13413 GL_TEXTURE_2D, 0, &dest_width, &dest_height, nullptr); | 13375 GL_TEXTURE_2D, 0, &dest_width, &dest_height, nullptr); |
13414 | 13376 |
13415 if (dest_level_defined) { | 13377 if (dest_level_defined) { |
13416 dest_texture->GetLevelType(GL_TEXTURE_2D, 0, &dest_type, | 13378 dest_texture->GetLevelType(GL_TEXTURE_2D, 0, &dest_type, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13500 GLsizei width, | 13462 GLsizei width, |
13501 GLsizei height) { | 13463 GLsizei height) { |
13502 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM"); | 13464 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM"); |
13503 | 13465 |
13504 TextureRef* source_texture_ref = GetTexture(source_id); | 13466 TextureRef* source_texture_ref = GetTexture(source_id); |
13505 TextureRef* dest_texture_ref = GetTexture(dest_id); | 13467 TextureRef* dest_texture_ref = GetTexture(dest_id); |
13506 Texture* source_texture = source_texture_ref->texture(); | 13468 Texture* source_texture = source_texture_ref->texture(); |
13507 Texture* dest_texture = dest_texture_ref->texture(); | 13469 Texture* dest_texture = dest_texture_ref->texture(); |
13508 int source_width = 0; | 13470 int source_width = 0; |
13509 int source_height = 0; | 13471 int source_height = 0; |
13510 gl::GLImage* image = | 13472 if (!source_texture->GetLevelSize(source_texture->target(), 0, &source_width, |
13511 source_texture->GetLevelImage(source_texture->target(), 0); | 13473 &source_height, nullptr)) { |
13512 if (image) { | 13474 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", |
13513 gfx::Size size = image->GetSize(); | 13475 "source texture has no level 0"); |
13514 source_width = size.width(); | 13476 return; |
13515 source_height = size.height(); | 13477 } |
13516 if (source_width <= 0 || source_height <= 0) { | |
13517 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", | |
13518 "invalid image size"); | |
13519 return; | |
13520 } | |
13521 } else { | |
13522 if (!source_texture->GetLevelSize(source_texture->target(), 0, | |
13523 &source_width, &source_height, nullptr)) { | |
13524 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", | |
13525 "source texture has no level 0"); | |
13526 return; | |
13527 } | |
13528 | 13478 |
13529 // Check that this type of texture is allowed. | 13479 // Check that this type of texture is allowed. |
13530 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, | 13480 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, |
13531 source_width, source_height, 1)) { | 13481 source_width, source_height, 1)) { |
13532 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", | 13482 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", |
13533 "source texture bad dimensions"); | 13483 "source texture bad dimensions"); |
13534 return; | 13484 return; |
13535 } | |
13536 } | 13485 } |
13537 | 13486 |
13538 GLenum source_type = 0; | 13487 GLenum source_type = 0; |
13539 GLenum source_internal_format = 0; | 13488 GLenum source_internal_format = 0; |
13540 source_texture->GetLevelType(source_texture->target(), 0, &source_type, | 13489 source_texture->GetLevelType(source_texture->target(), 0, &source_type, |
13541 &source_internal_format); | 13490 &source_internal_format); |
13542 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, | 13491 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, |
13543 width, height, 1)) { | 13492 width, height, 1)) { |
13544 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", | 13493 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", |
13545 "source texture bad dimensions."); | 13494 "source texture bad dimensions."); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13630 } | 13579 } |
13631 } else { | 13580 } else { |
13632 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, | 13581 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, |
13633 true); | 13582 true); |
13634 } | 13583 } |
13635 | 13584 |
13636 ScopedTextureBinder binder( | 13585 ScopedTextureBinder binder( |
13637 &state_, dest_texture->service_id(), GL_TEXTURE_2D); | 13586 &state_, dest_texture->service_id(), GL_TEXTURE_2D); |
13638 | 13587 |
13639 // Try using GLImage::CopyTexSubImage when possible. | 13588 // Try using GLImage::CopyTexSubImage when possible. |
13589 gl::GLImage* image = | |
13590 source_texture->GetLevelImage(source_texture->target(), 0); | |
13640 if (image && | 13591 if (image && |
13641 image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(xoffset, yoffset), | 13592 image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(xoffset, yoffset), |
13642 gfx::Rect(x, y, width, height))) { | 13593 gfx::Rect(x, y, width, height))) { |
13643 return; | 13594 return; |
13644 } | 13595 } |
13645 | 13596 |
13646 TRACE_EVENT0( | 13597 TRACE_EVENT0( |
13647 "gpu", | 13598 "gpu", |
13648 "GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM, fallback"); | 13599 "GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM, fallback"); |
13649 | 13600 |
(...skipping 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15600 return error::kNoError; | 15551 return error::kNoError; |
15601 } | 15552 } |
15602 | 15553 |
15603 // Include the auto-generated part of this file. We split this because it means | 15554 // Include the auto-generated part of this file. We split this because it means |
15604 // we can easily edit the non-auto generated parts right here in this file | 15555 // we can easily edit the non-auto generated parts right here in this file |
15605 // instead of having to edit some template or the code generator. | 15556 // instead of having to edit some template or the code generator. |
15606 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15557 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
15607 | 15558 |
15608 } // namespace gles2 | 15559 } // namespace gles2 |
15609 } // namespace gpu | 15560 } // namespace gpu |
OLD | NEW |