From 80242f2e90b4b2bacacee264b17e93fbbef1156e Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 8 Feb 2024 18:06:46 -0600 Subject: [PATCH] Fix Metal debug layer validation errors --- app/streaming/video/ffmpeg-renderers/vt.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/streaming/video/ffmpeg-renderers/vt.mm b/app/streaming/video/ffmpeg-renderers/vt.mm index 90f140b2..7b04111e 100644 --- a/app/streaming/video/ffmpeg-renderers/vt.mm +++ b/app/streaming/video/ffmpeg-renderers/vt.mm @@ -327,7 +327,8 @@ public: }; [m_VideoVertexBuffer release]; - m_VideoVertexBuffer = [m_MetalLayer.device newBufferWithBytes:verts length:sizeof(verts) options:MTLResourceStorageModePrivate]; + auto bufferOptions = MTLCPUCacheModeWriteCombined | MTLResourceStorageModeManaged; + m_VideoVertexBuffer = [m_MetalLayer.device newBufferWithBytes:verts length:sizeof(verts) options:bufferOptions]; if (!m_VideoVertexBuffer) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create video vertex buffer"); @@ -386,7 +387,8 @@ public: // Create the new colorspace parameter buffer for our fragment shader [m_CscParamsBuffer release]; - m_CscParamsBuffer = [m_MetalLayer.device newBufferWithBytes:paramBuffer length:sizeof(CscParams) options:MTLResourceStorageModePrivate]; + auto bufferOptions = MTLCPUCacheModeWriteCombined | MTLResourceStorageModeManaged; + m_CscParamsBuffer = [m_MetalLayer.device newBufferWithBytes:paramBuffer length:sizeof(CscParams) options:bufferOptions]; if (!m_CscParamsBuffer) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create CSC parameters buffer");