commit | 10cf66556532c6332cf0be0d4393274435f652bd | [log] [tgz] |
---|---|---|
author | Nicolas Capens <capn@google.com> | Tue Sep 24 15:46:28 2019 -0500 |
committer | Nicolas Capens <nicolascapens@google.com> | Tue Sep 24 20:54:02 2019 +0000 |
tree | 857567ed8a271051444e89a673e1a64a86c8b04d | |
parent | 645a8dea641aae363ee9e47fa7fcb9c930312365 [diff] |
Fix WSI present on MacOS As documented at https://developer.apple.com/documentation/quartzcore/cametallayer/1478168-framebufferonly: "If the value is true (the default), the CAMetalLayer class allocates its MTLTexture objects in ways that are optimized for display purposes. However, you may not sample, read from, or write to those textures. To support sampling and pixel read/write operations on the layer’s textures (at a cost to performance), set this value to false." Since we call replaceRegion in MacOSSurfaceMVK::present() to write pixels from system memory, we need to set this flag to false explicitly. Bug: b/137673628 Change-Id: I83e28a2940261d9eedf30d7c96427c23d85ac639 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/36608 Tested-by: Nicolas Capens <nicolascapens@google.com> Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/WSI/MacOSSurfaceMVK.mm b/src/WSI/MacOSSurfaceMVK.mm index 090cc20..7db42c1 100644 --- a/src/WSI/MacOSSurfaceMVK.mm +++ b/src/WSI/MacOSSurfaceMVK.mm
@@ -44,6 +44,7 @@ if ([obj isKindOfClass: [CAMetalLayer class]]) { layer = (CAMetalLayer*)[obj retain]; + layer.framebufferOnly = false; } else {