Merge pull request #587 from cdavis5e/shared-linear-textures

MVKBuffer: Force managed storage for linear textures on shared buffers.
This commit is contained in:
Bill Hollings 2019-05-01 17:15:42 -04:00 committed by GitHub
commit cd57b2d816
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -142,7 +142,16 @@ id<MTLTexture> MVKBufferView::getMTLTexture() {
width: _textureSize.width
height: _textureSize.height
mipmapped: NO];
#if MVK_MACOS
// Textures on Mac cannot use shared storage, so force managed.
if (_buffer->getMTLBuffer().storageMode == MTLStorageModeShared) {
mtlTexDesc.storageMode = MTLStorageModeManaged;
} else {
mtlTexDesc.storageMode = _buffer->getMTLBuffer().storageMode;
}
#else
mtlTexDesc.storageMode = _buffer->getMTLBuffer().storageMode;
#endif
mtlTexDesc.cpuCacheMode = _buffer->getMTLBuffer().cpuCacheMode;
mtlTexDesc.usage = MTLTextureUsageShaderRead;
if ( mvkIsAnyFlagEnabled(_buffer->getUsage(), VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT) ) {