OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // The bulk of this file is support code; sorry about that. Here's an overview | 5 // The bulk of this file is support code; sorry about that. Here's an overview |
6 // to hopefully help readers of this code: | 6 // to hopefully help readers of this code: |
7 // - RenderingHelper is charged with interacting with X11, EGL, and GLES2. | 7 // - RenderingHelper is charged with interacting with X11, EGL, and GLES2. |
8 // - ClientState is an enum for the state of the decode client used by the test. | 8 // - ClientState is an enum for the state of the decode client used by the test. |
9 // - ClientStateNotification is a barrier abstraction that allows the test code | 9 // - ClientStateNotification is a barrier abstraction that allows the test code |
10 // to be written sequentially and wait for the decode client to see certain | 10 // to be written sequentially and wait for the decode client to see certain |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 } | 301 } |
302 CHECK(eglMakeCurrent(egl_display_, egl_surfaces_[window_id], | 302 CHECK(eglMakeCurrent(egl_display_, egl_surfaces_[window_id], |
303 egl_surfaces_[window_id], egl_context_)) | 303 egl_surfaces_[window_id], egl_context_)) |
304 << eglGetError(); | 304 << eglGetError(); |
305 glGenTextures(1, texture_id); | 305 glGenTextures(1, texture_id); |
306 glBindTexture(GL_TEXTURE_2D, *texture_id); | 306 glBindTexture(GL_TEXTURE_2D, *texture_id); |
307 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width_, height_, 0, GL_RGBA, | 307 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width_, height_, 0, GL_RGBA, |
308 GL_UNSIGNED_BYTE, NULL); | 308 GL_UNSIGNED_BYTE, NULL); |
309 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 309 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
310 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 310 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| 311 // OpenGLES2.0.25 section 3.8.2 requires CLAMP_TO_EDGE for NPOT textures. |
| 312 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 313 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
311 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); | 314 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); |
312 CHECK(texture_id_to_surface_index_.insert( | 315 CHECK(texture_id_to_surface_index_.insert( |
313 std::make_pair(*texture_id, window_id)).second); | 316 std::make_pair(*texture_id, window_id)).second); |
314 done->Signal(); | 317 done->Signal(); |
315 } | 318 } |
316 | 319 |
317 void RenderingHelper::RenderTexture(GLuint texture_id) { | 320 void RenderingHelper::RenderTexture(GLuint texture_id) { |
318 CHECK_EQ(MessageLoop::current(), message_loop_); | 321 CHECK_EQ(MessageLoop::current(), message_loop_); |
319 glActiveTexture(GL_TEXTURE0); | 322 glActiveTexture(GL_TEXTURE0); |
320 glBindTexture(GL_TEXTURE_2D, texture_id); | 323 glBindTexture(GL_TEXTURE_2D, texture_id); |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 std::make_pair(15, 1))); | 749 std::make_pair(15, 1))); |
747 | 750 |
748 // TODO(fischman, vrk): add more tests! In particular: | 751 // TODO(fischman, vrk): add more tests! In particular: |
749 // - Test life-cycle: Seek/Stop/Pause/Play/RePlay for a single decoder. | 752 // - Test life-cycle: Seek/Stop/Pause/Play/RePlay for a single decoder. |
750 // - Test for memory leaks (valgrind) | 753 // - Test for memory leaks (valgrind) |
751 // - Test alternate configurations | 754 // - Test alternate configurations |
752 // - Test failure conditions. | 755 // - Test failure conditions. |
753 // - Test frame size changes mid-stream | 756 // - Test frame size changes mid-stream |
754 | 757 |
755 } // namespace | 758 } // namespace |
OLD | NEW |