mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-29 13:26:33 +01:00
Make opengl targets ios-only.
Bug: b/288827308 Change-Id: I5d37db079646eb8276d4f66a0fc33a585aad38e9 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/311100 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/main@{#40385}
This commit is contained in:
parent
415e30fdbb
commit
becfe2e571
5 changed files with 48 additions and 96 deletions
sdk
BUILD.gn
objc/components/renderer/opengl
103
sdk/BUILD.gn
103
sdk/BUILD.gn
|
@ -419,6 +419,53 @@ if (is_ios || is_mac) {
|
|||
"../rtc_base/system:gcd_helpers",
|
||||
]
|
||||
}
|
||||
|
||||
rtc_library("opengl_objc") {
|
||||
sources = [
|
||||
"objc/components/renderer/opengl/RTCDefaultShader.h",
|
||||
"objc/components/renderer/opengl/RTCDefaultShader.mm",
|
||||
"objc/components/renderer/opengl/RTCI420TextureCache.h",
|
||||
"objc/components/renderer/opengl/RTCI420TextureCache.mm",
|
||||
"objc/components/renderer/opengl/RTCNV12TextureCache.h",
|
||||
"objc/components/renderer/opengl/RTCNV12TextureCache.m",
|
||||
"objc/components/renderer/opengl/RTCOpenGLDefines.h",
|
||||
"objc/components/renderer/opengl/RTCShader.h",
|
||||
"objc/components/renderer/opengl/RTCShader.mm",
|
||||
"objc/components/renderer/opengl/RTCVideoViewShading.h",
|
||||
]
|
||||
frameworks = [
|
||||
"CoreVideo.framework",
|
||||
"GLKit.framework",
|
||||
"OpenGLES.framework",
|
||||
"QuartzCore.framework",
|
||||
]
|
||||
|
||||
# TODO(bugs.webrtc.org/12937): Remove OpenGL deprecation warning
|
||||
# workaround.
|
||||
defines = [ "GLES_SILENCE_DEPRECATION" ]
|
||||
|
||||
deps = [
|
||||
":base_objc",
|
||||
":helpers_objc",
|
||||
":mediaconstraints_objc",
|
||||
":native_video",
|
||||
":videoframebuffer_objc",
|
||||
":videosource_objc",
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api/video:video_frame",
|
||||
"../api/video:video_rtp_headers",
|
||||
"../common_video",
|
||||
"../media:rtc_media_base",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:logging",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
|
||||
configs += [
|
||||
"..:common_objc",
|
||||
":used_from_extension",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
rtc_source_set("audio_device_api_objc") {
|
||||
|
@ -547,62 +594,6 @@ if (is_ios || is_mac) {
|
|||
]
|
||||
}
|
||||
|
||||
rtc_library("opengl_objc") {
|
||||
sources = [
|
||||
"objc/components/renderer/opengl/RTCDefaultShader.h",
|
||||
"objc/components/renderer/opengl/RTCDefaultShader.mm",
|
||||
"objc/components/renderer/opengl/RTCI420TextureCache.h",
|
||||
"objc/components/renderer/opengl/RTCI420TextureCache.mm",
|
||||
"objc/components/renderer/opengl/RTCOpenGLDefines.h",
|
||||
"objc/components/renderer/opengl/RTCShader.h",
|
||||
"objc/components/renderer/opengl/RTCShader.mm",
|
||||
"objc/components/renderer/opengl/RTCVideoViewShading.h",
|
||||
]
|
||||
frameworks = [ "CoreVideo.framework" ]
|
||||
if (is_ios) {
|
||||
sources += [
|
||||
"objc/components/renderer/opengl/RTCNV12TextureCache.h",
|
||||
"objc/components/renderer/opengl/RTCNV12TextureCache.m",
|
||||
]
|
||||
frameworks += [
|
||||
"GLKit.framework",
|
||||
"OpenGLES.framework",
|
||||
"QuartzCore.framework",
|
||||
]
|
||||
} else if (is_mac) {
|
||||
frameworks += [
|
||||
"CoreMedia.framework",
|
||||
"OpenGL.framework",
|
||||
]
|
||||
}
|
||||
|
||||
# TODO(bugs.webrtc.org/12937): Remove OpenGL deprecation warning
|
||||
# workaround.
|
||||
defines = [ "GLES_SILENCE_DEPRECATION" ]
|
||||
|
||||
deps = [
|
||||
":base_objc",
|
||||
":helpers_objc",
|
||||
":mediaconstraints_objc",
|
||||
":native_video",
|
||||
":videoframebuffer_objc",
|
||||
":videosource_objc",
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api/video:video_frame",
|
||||
"../api/video:video_rtp_headers",
|
||||
"../common_video",
|
||||
"../media:rtc_media_base",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:logging",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
|
||||
configs += [
|
||||
"..:common_objc",
|
||||
":used_from_extension",
|
||||
]
|
||||
}
|
||||
|
||||
rtc_library("metal_objc") {
|
||||
visibility = [ "*" ]
|
||||
allow_poison = [
|
||||
|
|
|
@ -10,11 +10,7 @@
|
|||
|
||||
#import "RTCDefaultShader.h"
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#import <OpenGLES/ES3/gl.h>
|
||||
#else
|
||||
#import <OpenGL/gl3.h>
|
||||
#endif
|
||||
|
||||
#import "RTCOpenGLDefines.h"
|
||||
#import "RTCShader.h"
|
||||
|
@ -139,9 +135,7 @@ static const char kNV12FragmentShaderSource[] =
|
|||
RTCLog(@"Failed to setup vertex buffer");
|
||||
return NO;
|
||||
}
|
||||
#if !TARGET_OS_IPHONE
|
||||
glBindVertexArray(_vertexArray);
|
||||
#endif
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
|
||||
if (!_currentRotation || rotation != *_currentRotation) {
|
||||
_currentRotation = absl::optional<RTCVideoRotation>(rotation);
|
||||
|
|
|
@ -10,11 +10,7 @@
|
|||
|
||||
#import "RTCI420TextureCache.h"
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#import <OpenGLES/ES3/gl.h>
|
||||
#else
|
||||
#import <OpenGL/gl3.h>
|
||||
#endif
|
||||
|
||||
#import "base/RTCI420Buffer.h"
|
||||
#import "base/RTCVideoFrameBuffer.h"
|
||||
|
@ -51,11 +47,7 @@ static const GLsizei kNumTextures = kNumTexturesPerSet * kNumTextureSets;
|
|||
|
||||
- (instancetype)initWithContext:(GlContextType *)context {
|
||||
if (self = [super init]) {
|
||||
#if TARGET_OS_IPHONE
|
||||
_hasUnpackRowLength = (context.API == kEAGLRenderingAPIOpenGLES3);
|
||||
#else
|
||||
_hasUnpackRowLength = YES;
|
||||
#endif
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
[self setupTextures];
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#define RTC_PIXEL_FORMAT GL_LUMINANCE
|
||||
#define SHADER_VERSION
|
||||
#define VERTEX_SHADER_IN "attribute"
|
||||
|
@ -22,16 +21,3 @@
|
|||
|
||||
@class EAGLContext;
|
||||
typedef EAGLContext GlContextType;
|
||||
#else
|
||||
#define RTC_PIXEL_FORMAT GL_RED
|
||||
#define SHADER_VERSION "#version 150\n"
|
||||
#define VERTEX_SHADER_IN "in"
|
||||
#define VERTEX_SHADER_OUT "out"
|
||||
#define FRAGMENT_SHADER_IN "in"
|
||||
#define FRAGMENT_SHADER_OUT "out vec4 fragColor;\n"
|
||||
#define FRAGMENT_SHADER_COLOR "fragColor"
|
||||
#define FRAGMENT_SHADER_TEXTURE "texture"
|
||||
|
||||
@class NSOpenGLContext;
|
||||
typedef NSOpenGLContext GlContextType;
|
||||
#endif
|
||||
|
|
|
@ -10,11 +10,7 @@
|
|||
|
||||
#import "RTCShader.h"
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#import <OpenGLES/ES3/gl.h>
|
||||
#else
|
||||
#import <OpenGL/gl3.h>
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
|
@ -125,13 +121,6 @@ GLuint RTCCreateProgramFromFragmentSource(const char fragmentShaderSource[]) {
|
|||
}
|
||||
|
||||
BOOL RTCCreateVertexBuffer(GLuint *vertexBuffer, GLuint *vertexArray) {
|
||||
#if !TARGET_OS_IPHONE
|
||||
glGenVertexArrays(1, vertexArray);
|
||||
if (*vertexArray == 0) {
|
||||
return NO;
|
||||
}
|
||||
glBindVertexArray(*vertexArray);
|
||||
#endif
|
||||
glGenBuffers(1, vertexBuffer);
|
||||
if (*vertexBuffer == 0) {
|
||||
glDeleteVertexArrays(1, vertexArray);
|
||||
|
|
Loading…
Reference in a new issue