MVKBuffer: Force managed storage for linear textures on shared buffers.

Shared storage on textures is disallowed on macOS.

Fixes #573.
This commit is contained in:
Chip Davis 2019-04-29 23:09:30 -05:00
parent 1b60679104
commit 787086351f

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) ) {