| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #import "RTCDefaultShader.h" | 11 #import "RTCDefaultShader.h" |
| 12 | 12 |
| 13 #if TARGET_OS_IPHONE | 13 #if TARGET_OS_IPHONE |
| 14 #import <OpenGLES/ES3/gl.h> | 14 #import <OpenGLES/ES3/gl.h> |
| 15 #else | 15 #else |
| 16 #import <OpenGL/gl3.h> | 16 #import <OpenGL/gl3.h> |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 #import "RTCOpenGLDefines.h" | 19 #import "RTCOpenGLDefines.h" |
| 20 #import "RTCShader.h" | 20 #import "RTCShader.h" |
| 21 #import "WebRTC/RTCLogging.h" | 21 #import "WebRTC/RTCLogging.h" |
| 22 | 22 |
| 23 #include "webrtc/rtc_base/optional.h" | 23 #include "webrtc/api/optional.h" |
| 24 | 24 |
| 25 static const int kYTextureUnit = 0; | 25 static const int kYTextureUnit = 0; |
| 26 static const int kUTextureUnit = 1; | 26 static const int kUTextureUnit = 1; |
| 27 static const int kVTextureUnit = 2; | 27 static const int kVTextureUnit = 2; |
| 28 static const int kUvTextureUnit = 1; | 28 static const int kUvTextureUnit = 1; |
| 29 | 29 |
| 30 // Fragment shader converts YUV values from input textures into a final RGB | 30 // Fragment shader converts YUV values from input textures into a final RGB |
| 31 // pixel. The conversion formula is from http://www.fourcc.org/fccyvrgb.php. | 31 // pixel. The conversion formula is from http://www.fourcc.org/fccyvrgb.php. |
| 32 static const char kI420FragmentShaderSource[] = | 32 static const char kI420FragmentShaderSource[] = |
| 33 SHADER_VERSION | 33 SHADER_VERSION |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 glActiveTexture(static_cast<GLenum>(GL_TEXTURE0 + kYTextureUnit)); | 198 glActiveTexture(static_cast<GLenum>(GL_TEXTURE0 + kYTextureUnit)); |
| 199 glBindTexture(GL_TEXTURE_2D, yPlane); | 199 glBindTexture(GL_TEXTURE_2D, yPlane); |
| 200 | 200 |
| 201 glActiveTexture(static_cast<GLenum>(GL_TEXTURE0 + kUvTextureUnit)); | 201 glActiveTexture(static_cast<GLenum>(GL_TEXTURE0 + kUvTextureUnit)); |
| 202 glBindTexture(GL_TEXTURE_2D, uvPlane); | 202 glBindTexture(GL_TEXTURE_2D, uvPlane); |
| 203 | 203 |
| 204 glDrawArrays(GL_TRIANGLE_FAN, 0, 4); | 204 glDrawArrays(GL_TRIANGLE_FAN, 0, 4); |
| 205 } | 205 } |
| 206 | 206 |
| 207 @end | 207 @end |
| OLD | NEW |