| Index: content/common/gpu/media/rendering_helper.cc
|
| ===================================================================
|
| --- content/common/gpu/media/rendering_helper.cc (revision 235426)
|
| +++ content/common/gpu/media/rendering_helper.cc (working copy)
|
| @@ -330,21 +330,13 @@
|
| });
|
|
|
| #if GL_VARIANT_EGL
|
| - static const char kFragmentShader[] =
|
| - "#extension GL_OES_EGL_image_external : enable\n"
|
| - "precision mediump float;\n"
|
| - "varying vec2 interp_tc;\n"
|
| - "uniform sampler2D tex;\n"
|
| - "#ifdef GL_OES_EGL_image_external\n"
|
| - "uniform samplerExternalOES tex_external;\n"
|
| - "#endif\n"
|
| - "void main() {\n"
|
| - " vec4 color = texture2D(tex, interp_tc);\n"
|
| - "#ifdef GL_OES_EGL_image_external\n"
|
| - " color += texture2D(tex_external, interp_tc);\n"
|
| - "#endif\n"
|
| - " gl_FragColor = color;\n"
|
| - "}\n";
|
| + static const char kFragmentShader[] = STRINGIZE(
|
| + precision mediump float;
|
| + varying vec2 interp_tc;
|
| + uniform sampler2D tex;
|
| + void main() {
|
| + gl_FragColor = texture2D(tex, interp_tc);
|
| + });
|
| #else
|
| static const char kFragmentShader[] = STRINGIZE(
|
| varying vec2 interp_tc;
|
| @@ -373,10 +365,6 @@
|
|
|
| glUniform1i(glGetUniformLocation(program_, "tex_flip"), 0);
|
| glUniform1i(glGetUniformLocation(program_, "tex"), 0);
|
| - GLint tex_external = glGetUniformLocation(program_, "tex_external");
|
| - if (tex_external != -1) {
|
| - glUniform1i(tex_external, 1);
|
| - }
|
| int pos_location = glGetAttribLocation(program_, "in_pos");
|
| glEnableVertexAttribArray(pos_location);
|
| glVertexAttribPointer(pos_location, 2, GL_FLOAT, GL_FALSE, 0, kVertices);
|
| @@ -418,33 +406,32 @@
|
| window_id, texture_target, texture_id, done));
|
| return;
|
| }
|
| + CHECK_EQ(static_cast<uint32>(GL_TEXTURE_2D), texture_target);
|
| MakeCurrent(window_id);
|
| glGenTextures(1, texture_id);
|
| - glBindTexture(texture_target, *texture_id);
|
| + glBindTexture(GL_TEXTURE_2D, *texture_id);
|
| int dimensions_id = window_id % frame_dimensions_.size();
|
| - if (texture_target == GL_TEXTURE_2D) {
|
| - glTexImage2D(GL_TEXTURE_2D,
|
| - 0,
|
| - GL_RGBA,
|
| - frame_dimensions_[dimensions_id].width(),
|
| - frame_dimensions_[dimensions_id].height(),
|
| - 0,
|
| - GL_RGBA,
|
| - GL_UNSIGNED_BYTE,
|
| - NULL);
|
| - }
|
| - glTexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
| - glTexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
| + glTexImage2D(GL_TEXTURE_2D,
|
| + 0,
|
| + GL_RGBA,
|
| + frame_dimensions_[dimensions_id].width(),
|
| + frame_dimensions_[dimensions_id].height(),
|
| + 0,
|
| + GL_RGBA,
|
| + GL_UNSIGNED_BYTE,
|
| + NULL);
|
| + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
| + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
| // OpenGLES2.0.25 section 3.8.2 requires CLAMP_TO_EDGE for NPOT textures.
|
| - glTexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
| - glTexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
| + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
| + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
| CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR);
|
| CHECK(texture_id_to_surface_index_.insert(
|
| std::make_pair(*texture_id, window_id)).second);
|
| done->Signal();
|
| }
|
|
|
| -void RenderingHelper::RenderTexture(uint32 texture_target, uint32 texture_id) {
|
| +void RenderingHelper::RenderTexture(uint32 texture_id) {
|
| CHECK_EQ(base::MessageLoop::current(), message_loop_);
|
| size_t window_id = texture_id_to_surface_index_[texture_id];
|
| MakeCurrent(window_id);
|
| @@ -473,19 +460,8 @@
|
| glUniform1i(glGetUniformLocation(program_, "tex_flip"), 1);
|
| }
|
|
|
| - // Unbound texture samplers default to (0, 0, 0, 1). Use this fact to switch
|
| - // between GL_TEXTURE_2D and GL_TEXTURE_EXTERNAL_OES as appopriate.
|
| - if (texture_target == GL_TEXTURE_2D) {
|
| - glActiveTexture(GL_TEXTURE0 + 0);
|
| - glBindTexture(GL_TEXTURE_2D, texture_id);
|
| - glActiveTexture(GL_TEXTURE0 + 1);
|
| - glBindTexture(texture_target, 0);
|
| - } else if (texture_target == GL_TEXTURE_EXTERNAL_OES) {
|
| - glActiveTexture(GL_TEXTURE0 + 0);
|
| - glBindTexture(GL_TEXTURE_2D, 0);
|
| - glActiveTexture(GL_TEXTURE0 + 1);
|
| - glBindTexture(texture_target, texture_id);
|
| - }
|
| + glActiveTexture(GL_TEXTURE0);
|
| + glBindTexture(GL_TEXTURE_2D, texture_id);
|
| glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
| CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR);
|
|
|
| @@ -497,10 +473,7 @@
|
| glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
|
| glViewport(0, 0, width, height);
|
| glScissor(0, 0, width, height);
|
| - glActiveTexture(GL_TEXTURE0 + 0);
|
| glBindTexture(GL_TEXTURE_2D, thumbnails_texture_id_);
|
| - glActiveTexture(GL_TEXTURE0 + 1);
|
| - glBindTexture(texture_target, 0);
|
| glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
| }
|
|
|
| @@ -579,7 +552,6 @@
|
| GL_RGBA,
|
| GL_UNSIGNED_BYTE,
|
| &rgba[0]);
|
| - glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
|
| rgb->resize(num_pixels * 3);
|
| // Drop the alpha channel, but check as we go that it is all 0xff.
|
| bool solid = true;
|
|
|