OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/renderer/pepper/video_decoder_shim.h" | 5 #include "content/renderer/pepper/video_decoder_shim.h" |
6 | 6 |
7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
9 #include <GLES2/gl2extchromium.h> | 9 #include <GLES2/gl2extchromium.h> |
10 #include <utility> | 10 #include <utility> |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 DCHECK(yuv_matrix_loc_ != -1); | 309 DCHECK(yuv_matrix_loc_ != -1); |
310 | 310 |
311 yuv_adjust_loc_ = gl_->GetUniformLocation(program, "yuv_adjust"); | 311 yuv_adjust_loc_ = gl_->GetUniformLocation(program, "yuv_adjust"); |
312 DCHECK(yuv_adjust_loc_ != -1); | 312 DCHECK(yuv_adjust_loc_ != -1); |
313 | 313 |
314 return program; | 314 return program; |
315 } | 315 } |
316 | 316 |
317 bool VideoDecoderShim::YUVConverter::Initialize() { | 317 bool VideoDecoderShim::YUVConverter::Initialize() { |
318 // If texture_rg extension is not available, use slower GL_LUMINANCE. | 318 // If texture_rg extension is not available, use slower GL_LUMINANCE. |
319 if (context_provider_->ContextCapabilities().gpu.texture_rg) { | 319 if (context_provider_->ContextCapabilities().texture_rg) { |
320 internal_format_ = GL_RED_EXT; | 320 internal_format_ = GL_RED_EXT; |
321 format_ = GL_RED_EXT; | 321 format_ = GL_RED_EXT; |
322 } else { | 322 } else { |
323 internal_format_ = GL_LUMINANCE; | 323 internal_format_ = GL_LUMINANCE; |
324 format_ = GL_LUMINANCE; | 324 format_ = GL_LUMINANCE; |
325 } | 325 } |
326 | 326 |
327 if (context_provider_->ContextCapabilities().gpu.max_texture_image_units < | 327 if (context_provider_->ContextCapabilities().max_texture_image_units < 4) { |
328 4) { | |
329 // We support YUVA textures and require 4 texture units in the fragment | 328 // We support YUVA textures and require 4 texture units in the fragment |
330 // stage. | 329 // stage. |
331 return false; | 330 return false; |
332 } | 331 } |
333 | 332 |
334 gl_->TraceBeginCHROMIUM("YUVConverter", "YUVConverterContext"); | 333 gl_->TraceBeginCHROMIUM("YUVConverter", "YUVConverterContext"); |
335 gl_->GenFramebuffers(1, &frame_buffer_); | 334 gl_->GenFramebuffers(1, &frame_buffer_); |
336 | 335 |
337 y_texture_ = CreateTexture(); | 336 y_texture_ = CreateTexture(); |
338 u_texture_ = CreateTexture(); | 337 u_texture_ = CreateTexture(); |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { | 1117 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { |
1119 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); | 1118 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); |
1120 gles2->DeleteTextures(1, &texture_id); | 1119 gles2->DeleteTextures(1, &texture_id); |
1121 } | 1120 } |
1122 | 1121 |
1123 void VideoDecoderShim::FlushCommandBuffer() { | 1122 void VideoDecoderShim::FlushCommandBuffer() { |
1124 context_provider_->ContextGL()->Flush(); | 1123 context_provider_->ContextGL()->Flush(); |
1125 } | 1124 } |
1126 | 1125 |
1127 } // namespace content | 1126 } // namespace content |
OLD | NEW |