Chromium Code Reviews| 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 "media/gpu/ipc/service/gpu_video_decode_accelerator.h" | 5 #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 443 return; | 443 return; |
| 444 } | 444 } |
| 445 if (texture_target_ == GL_TEXTURE_EXTERNAL_OES || | 445 if (texture_target_ == GL_TEXTURE_EXTERNAL_OES || |
| 446 texture_target_ == GL_TEXTURE_RECTANGLE_ARB) { | 446 texture_target_ == GL_TEXTURE_RECTANGLE_ARB) { |
| 447 // These textures have their dimensions defined by the underlying | 447 // These textures have their dimensions defined by the underlying |
| 448 // storage. | 448 // storage. |
| 449 // Use |texture_dimensions_| for this size. | 449 // Use |texture_dimensions_| for this size. |
| 450 texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, GL_RGBA, | 450 texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, GL_RGBA, |
| 451 texture_dimensions_.width(), | 451 texture_dimensions_.width(), |
| 452 texture_dimensions_.height(), 1, 0, | 452 texture_dimensions_.height(), 1, 0, |
| 453 GL_RGBA, 0, gfx::Rect()); | 453 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect()); |
|
qiankun
2017/02/23 09:28:19
I am not sure can this type be GL_FLOAT?
Ken Russell (switch to Gerrit)
2017/03/02 02:38:48
There's ongoing work by aleksandar.stojiljkovic in
| |
| 454 } else { | 454 } else { |
| 455 // For other targets, texture dimensions should already be defined. | 455 // For other targets, texture dimensions should already be defined. |
| 456 GLsizei width = 0, height = 0; | 456 GLsizei width = 0, height = 0; |
| 457 info->GetLevelSize(texture_target_, 0, &width, &height, nullptr); | 457 info->GetLevelSize(texture_target_, 0, &width, &height, nullptr); |
| 458 if (width != texture_dimensions_.width() || | 458 if (width != texture_dimensions_.width() || |
| 459 height != texture_dimensions_.height()) { | 459 height != texture_dimensions_.height()) { |
| 460 DLOG(ERROR) << "Size mismatch for texture id " | 460 DLOG(ERROR) << "Size mismatch for texture id " |
| 461 << buffer_texture_ids[j]; | 461 << buffer_texture_ids[j]; |
| 462 NotifyError(VideoDecodeAccelerator::INVALID_ARGUMENT); | 462 NotifyError(VideoDecodeAccelerator::INVALID_ARGUMENT); |
| 463 return; | 463 return; |
| 464 } | 464 } |
| 465 | 465 |
| 466 // TODO(dshwang): after moving to D3D11, remove this. crbug.com/438691 | 466 // TODO(dshwang): after moving to D3D11, remove this. crbug.com/438691 |
| 467 GLenum format = | 467 GLenum format = |
| 468 video_decode_accelerator_.get()->GetSurfaceInternalFormat(); | 468 video_decode_accelerator_.get()->GetSurfaceInternalFormat(); |
| 469 if (format != GL_RGBA) { | 469 if (format != GL_RGBA) { |
| 470 texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, format, | 470 texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, format, |
| 471 width, height, 1, 0, format, 0, | 471 width, height, 1, 0, format, |
| 472 gfx::Rect()); | 472 GL_UNSIGNED_BYTE, gfx::Rect()); |
| 473 } | 473 } |
| 474 } | 474 } |
| 475 service_ids.push_back(texture_ref->service_id()); | 475 service_ids.push_back(texture_ref->service_id()); |
| 476 current_textures.push_back(texture_ref); | 476 current_textures.push_back(texture_ref); |
| 477 } | 477 } |
| 478 textures.push_back(current_textures); | 478 textures.push_back(current_textures); |
| 479 buffers.push_back(PictureBuffer(buffer_ids[i], texture_dimensions_, | 479 buffers.push_back(PictureBuffer(buffer_ids[i], texture_dimensions_, |
| 480 buffer_texture_ids, service_ids)); | 480 buffer_texture_ids, service_ids)); |
| 481 } | 481 } |
| 482 { | 482 { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 529 for (auto texture_ref : it->second) { | 529 for (auto texture_ref : it->second) { |
| 530 GLenum target = texture_ref->texture()->target(); | 530 GLenum target = texture_ref->texture()->target(); |
| 531 gpu::gles2::TextureManager* texture_manager = | 531 gpu::gles2::TextureManager* texture_manager = |
| 532 stub_->decoder()->GetContextGroup()->texture_manager(); | 532 stub_->decoder()->GetContextGroup()->texture_manager(); |
| 533 texture_manager->SetLevelCleared(texture_ref.get(), target, 0, true); | 533 texture_manager->SetLevelCleared(texture_ref.get(), target, 0, true); |
| 534 } | 534 } |
| 535 uncleared_textures_.erase(it); | 535 uncleared_textures_.erase(it); |
| 536 } | 536 } |
| 537 | 537 |
| 538 } // namespace media | 538 } // namespace media |
| OLD | NEW |