Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(606)

Unified Diff: media/video/gpu_memory_buffer_video_frame_pool.cc

Issue 1605423002: Make 'kVideoImageTextureTarget' a list of texture targets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/renderers/mock_gpu_video_accelerator_factories.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/video/gpu_memory_buffer_video_frame_pool.cc
diff --git a/media/video/gpu_memory_buffer_video_frame_pool.cc b/media/video/gpu_memory_buffer_video_frame_pool.cc
index 76b95352f06d8843f57bf701f96553940689647f..d8d3946c65d17b99b66a772e4ad82de8fae436e1 100644
--- a/media/video/gpu_memory_buffer_video_frame_pool.cc
+++ b/media/video/gpu_memory_buffer_video_frame_pool.cc
@@ -49,7 +49,6 @@ class GpuMemoryBufferVideoFramePool::PoolImpl
: media_task_runner_(media_task_runner),
worker_task_runner_(worker_task_runner),
gpu_factories_(gpu_factories),
- texture_target_(gpu_factories->ImageTextureTarget()),
output_format_(PIXEL_FORMAT_UNKNOWN) {
DCHECK(media_task_runner_);
DCHECK(worker_task_runner_);
@@ -149,7 +148,6 @@ class GpuMemoryBufferVideoFramePool::PoolImpl
// Pool of resources.
std::list<FrameResources*> resources_pool_;
- const unsigned texture_target_;
// TODO(dcastagna): change the following type from VideoPixelFormat to
// BufferFormat.
VideoPixelFormat output_format_;
@@ -540,8 +538,11 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::
// Set up the planes creating the mailboxes needed to refer to the textures.
for (size_t i = 0; i < num_planes; i += planes_per_copy) {
PlaneResource& plane_resource = frame_resources->plane_resources[i];
+ const gfx::BufferFormat buffer_format =
+ GpuMemoryBufferFormat(output_format_, i);
+ unsigned texture_target = gpu_factories_->ImageTextureTarget(buffer_format);
// Bind the texture and create or rebind the image.
- gles2->BindTexture(texture_target_, plane_resource.texture_id);
+ gles2->BindTexture(texture_target, plane_resource.texture_id);
if (plane_resource.gpu_memory_buffer && !plane_resource.image_id) {
const size_t width =
@@ -552,13 +553,12 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::
plane_resource.gpu_memory_buffer->AsClientBuffer(), width, height,
ImageInternalFormat(output_format_, i));
} else if (plane_resource.image_id) {
- gles2->ReleaseTexImage2DCHROMIUM(texture_target_,
- plane_resource.image_id);
+ gles2->ReleaseTexImage2DCHROMIUM(texture_target, plane_resource.image_id);
}
if (plane_resource.image_id)
- gles2->BindTexImage2DCHROMIUM(texture_target_, plane_resource.image_id);
+ gles2->BindTexImage2DCHROMIUM(texture_target, plane_resource.image_id);
mailbox_holders[i] = gpu::MailboxHolder(plane_resource.mailbox,
- gpu::SyncToken(), texture_target_);
+ gpu::SyncToken(), texture_target);
}
// Insert a sync_token, this is needed to make sure that the textures the
@@ -666,14 +666,15 @@ GpuMemoryBufferVideoFramePool::PoolImpl::GetOrCreateFrameResources(
plane_resource.size, buffer_format,
gfx::BufferUsage::GPU_READ_CPU_READ_WRITE);
+ unsigned texture_target = gpu_factories_->ImageTextureTarget(buffer_format);
gles2->GenTextures(1, &plane_resource.texture_id);
- gles2->BindTexture(texture_target_, plane_resource.texture_id);
- gles2->TexParameteri(texture_target_, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- gles2->TexParameteri(texture_target_, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- gles2->TexParameteri(texture_target_, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- gles2->TexParameteri(texture_target_, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ gles2->BindTexture(texture_target, plane_resource.texture_id);
+ gles2->TexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ gles2->TexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ gles2->TexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ gles2->TexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
gles2->GenMailboxCHROMIUM(plane_resource.mailbox.name);
- gles2->ProduceTextureCHROMIUM(texture_target_, plane_resource.mailbox.name);
+ gles2->ProduceTextureCHROMIUM(texture_target, plane_resource.mailbox.name);
}
return frame_resources;
}
« no previous file with comments | « media/renderers/mock_gpu_video_accelerator_factories.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698