Error when trying to create texture on CPU, "Not Supported on this Device"

I am working on creating a "Volume" application in RealityKit for visionOS. I want to create a texture on the CPU that I can hook into a Material and modify. When I go to create the texture I get this error: Linear textures from shared buffers is not supported on this device

Here is the code:

guard let device = MTLCreateSystemDefaultDevice() else {
                            fatalError("unable to get metal device")
                        }

let textureDescriptor = MTLTextureDescriptor.textureBufferDescriptor(with: .r32Float, width: 64, resourceOptions: .storageModeShared, usage: .shaderRead)
                                        
let buffer = device.makeBuffer(length: 64 * 4)
                                       
return buffer?.makeTexture(descriptor: textureDescriptor, offset: 0, bytesPerRow: 64 * 4)

Hi, I'm not sure exactly why this error is occurring, it is coming from Metal, and I know that the Metal simulator doesn't always support all features that an actual device does. However, you can also take a look at the DrawableQueue API, which will allow you to update a texture per frame like you want. You can get a MTLTexture from the DrawableQueue API, which you can update as you need.

https://developer.apple.com/documentation/realitykit/textureresource/drawablequeue-swift.class

https://developer.apple.com/documentation/realitykit/textureresource/drawable/texture

Error when trying to create texture on CPU, "Not Supported on this Device"
 
 
Q