ObjC: Pass in frame resolution to GL shaders

Frame resolution might be interesting for a shader implementation.

Bug: webrtc:7473
Change-Id: If19278b3babe2e5bab1a1f7562fa8b06ab840517
Reviewed-on: https://chromium-review.googlesource.com/524452
Reviewed-by: Daniela Jovanoska Petrenko <denicija@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#18466}
This commit is contained in:
Magnus Jedvert
2017-06-05 17:58:34 +02:00
committed by Commit Bot
parent f53c4cd867
commit 6b9653e63b
4 changed files with 39 additions and 25 deletions

View File

@ -226,7 +226,9 @@
}
if (_nv12TextureCache) {
[_nv12TextureCache uploadFrameToTextures:frame];
[_shader applyShadingForFrameWithRotation:frame.rotation
[_shader applyShadingForFrameWithWidth:frame.width
height:frame.height
rotation:frame.rotation
yPlane:_nv12TextureCache.yTexture
uvPlane:_nv12TextureCache.uvTexture];
[_nv12TextureCache releaseTextures];
@ -236,7 +238,9 @@
_i420TextureCache = [[RTCI420TextureCache alloc] initWithContext:_glContext];
}
[_i420TextureCache uploadFrameToTextures:frame];
[_shader applyShadingForFrameWithRotation:frame.rotation
[_shader applyShadingForFrameWithWidth:frame.width
height:frame.height
rotation:frame.rotation
yPlane:_i420TextureCache.yTexture
uPlane:_i420TextureCache.uTexture
vPlane:_i420TextureCache.vTexture];

View File

@ -141,7 +141,9 @@ static CVReturn OnDisplayLinkFired(CVDisplayLinkRef displayLink,
RTCI420TextureCache *i420TextureCache = self.i420TextureCache;
if (i420TextureCache) {
[i420TextureCache uploadFrameToTextures:frame];
[_shader applyShadingForFrameWithRotation:frame.rotation
[_shader applyShadingForFrameWithWidth:frame.width
height:frame.height
rotation:frame.rotation
yPlane:i420TextureCache.yTexture
uPlane:i420TextureCache.uTexture
vPlane:i420TextureCache.vTexture];

View File

@ -150,7 +150,9 @@ static const char kNV12FragmentShaderSource[] =
return YES;
}
- (void)applyShadingForFrameWithRotation:(RTCVideoRotation)rotation
- (void)applyShadingForFrameWithWidth:(int)width
height:(int)height
rotation:(RTCVideoRotation)rotation
yPlane:(GLuint)yPlane
uPlane:(GLuint)uPlane
vPlane:(GLuint)vPlane {
@ -177,7 +179,9 @@ static const char kNV12FragmentShaderSource[] =
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
- (void)applyShadingForFrameWithRotation:(RTCVideoRotation)rotation
- (void)applyShadingForFrameWithWidth:(int)width
height:(int)height
rotation:(RTCVideoRotation)rotation
yPlane:(GLuint)yPlane
uvPlane:(GLuint)uvPlane {
if (![self prepareVertexBufferWithRotation:rotation]) {

View File

@ -22,13 +22,17 @@ RTC_EXPORT
@protocol RTCVideoViewShading <NSObject>
/** Callback for I420 frames. Each plane is given as a texture. */
- (void)applyShadingForFrameWithRotation:(RTCVideoRotation)rotation
- (void)applyShadingForFrameWithWidth:(int)width
height:(int)height
rotation:(RTCVideoRotation)rotation
yPlane:(GLuint)yPlane
uPlane:(GLuint)uPlane
vPlane:(GLuint)vPlane;
/** Callback for NV12 frames. Each plane is given as a texture. */
- (void)applyShadingForFrameWithRotation:(RTCVideoRotation)rotation
- (void)applyShadingForFrameWithWidth:(int)width
height:(int)height
rotation:(RTCVideoRotation)rotation
yPlane:(GLuint)yPlane
uvPlane:(GLuint)uvPlane;