React to changes in either width or height in iOS Metal renderer.

Bug: webrtc:10024
Change-Id: Ia17ab43887fc1dfdf4058bed097c05b396a6d895
Reviewed-on: https://webrtc-review.googlesource.com/c/112281
Reviewed-by: Peter Hanspers <peterhanspers@webrtc.org>
Commit-Queue: Anders Carlsson <andersc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25824}
This commit is contained in:
Anders Carlsson
2018-11-28 13:55:55 +01:00
committed by Commit Bot
parent 071edf317e
commit 48fcf943fd

View File

@ -118,7 +118,7 @@ static NSString *const shaderSource = MTL_STRINGIFY(
id<RTCI420Buffer> buffer = [frame.buffer toI420]; id<RTCI420Buffer> buffer = [frame.buffer toI420];
// Luma (y) texture. // Luma (y) texture.
if (!_descriptor || (_width != frame.width && _height != frame.height)) { if (!_descriptor || _width != frame.width || _height != frame.height) {
_width = frame.width; _width = frame.width;
_height = frame.height; _height = frame.height;
_descriptor = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatR8Unorm _descriptor = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatR8Unorm
@ -135,8 +135,7 @@ static NSString *const shaderSource = MTL_STRINGIFY(
withBytes:buffer.dataY withBytes:buffer.dataY
bytesPerRow:buffer.strideY]; bytesPerRow:buffer.strideY];
if (!_chromaDescriptor || if (!_chromaDescriptor || _chromaWidth != frame.width / 2 || _chromaHeight != frame.height / 2) {
(_chromaWidth != frame.width / 2 && _chromaHeight != frame.height / 2)) {
_chromaWidth = frame.width / 2; _chromaWidth = frame.width / 2;
_chromaHeight = frame.height / 2; _chromaHeight = frame.height / 2;
_chromaDescriptor = _chromaDescriptor =