Hi everyone,
This happens with Xcode 15.3 (15E204a) and visionOS 1.1.2 (21O231).
To reproduce this issue, simply create a new VisionOS app with Metal (see below).
Then simply change the following piece of code in Renderer.swift
:
func renderFrame() {
[...]
// Set the clear color red channel to 1.0 instead of 0.0.
renderPassDescriptor.colorAttachments[0].clearColor = MTLClearColor(red: 1.0, green: 0.0, blue: 0.0, alpha: 0.0)
[...]
}
On the simulator it works as expected while on device it will show a black background with red jagged edges (see below).
Hey everyone, I found a better workaround for this issue. After debugging it further with a GPU Frame capture, it came to my attention that the compositor will create a segmentation mask for safety reason based on the depth of the rendered content. The mask will cut off roughly at the edges where the depth goes from 0.0 to a non-zero value, creating the jaggies seen on the screenshot above. The solution to this problem was to simply set the depth clear value to a very small non-zero value:
depthStateDescriptor.depthCompareFunction = .greater // Back to normal
renderPassDescriptor.depthAttachment.clearDepth = Double.ulpOfOne // slightly-higher-than-zero depth value by default
Hope this helps other people.
The