Just to add. I have turned off all my shaders and Kernels. So when draw() fires nothing happens in my app.
And I still see the error pop up in my console.
I have added a report to Feedback Assistant.
Post
Replies
Boosts
Views
Activity
Yes... I have shader validation enabled. Did a little more digging. too. It seems to be being caused by a Compute function I am using (non-graphic rendering), which would seem to added to your theory it is an issue outside of my code. I will fill out report.
Stan
Just to add one thing.
It is really tough to debug this, because every time I try to use the Metal Debugger to capture the frame state my app crashes and I get the following message:
[GPUDebug] Null texture access executing kernel function "ColorCorrection" encoder: "Keyframing.SurfaceWarpFuser.InverseWarpKeyframe", dispatch: 2
Message from debugger: Terminated due to signal 9
Nevermind... In the Universe's long running joke for me, I found the answer right after I posted the question on SO (despite looking like crazy before I posted).
To quote the Smiths, "That joke isn't funny anymore Blorgar!"
Go here if you are curious - https://stackoverflow.com/questions/47719468/get-the-up-vector-of-the-camera-in-arkit
But thanks anyway.
Stan
Hey Michael,
Thanks for posting, I was going nuts thinking I can't be the only one this is happening to.
My official answer is 'No and Yes', I will explain.
No: Because I still do not understand what is going wrong. The problem always seems to manifest as the input size of the data I send into the function grows. Like 16, or 64 inputs, fine... anything larger no. The only thing in common is that the problem has something to do with how the compiler plans for the buffer data alignment. However, as to what I am not sure. Whenever the problem happens I can rewrite a couple of lines a code then later completely revert those lines back to the original and everything would be fine, for no rhyme or reason.
However,
Yes: I can suggest a few things you can try, which might resolve the problem. But if you look for a cause and effect reasoning to why they work it might drive you more insane then the original problem.
(Prior to suggestion.) Implement the GPU debugging from the recent WWDC - https://developer.apple.com/videos/play/wwdc2020/10616/. This will probably not give you the answer, but it may help a little in pointing to the cause of the issue.
Suggestions:
First. Rename the shader function. It can be something as small as 'trivialFunctionName()' to 'trivialFunctionName_a()' but it needs to be changed so the shader compiler is forced to rebuild the function.
Second: Clean the build, even to going as far as manually deleting the derived data folder.
Third: (This seems to be significant) Completely quit out of Xcode and restart it before you rebuild. (Do this especially if Xcode has been open a long time).
Fourth: Once Xcode is reopened, rebuild the project while you still have the 'trivialFunctionName_a()' version of the shader name.
Fifth: Once it is built, you can rename the function back to its original name and rebuild the project again (maybe even clean the build again before you do).
Optionally: While you are doing all that, comment out everything in the shader function to the bare minimum, and build all the buffers (the makeBuffer() function and coping the data into the buffers lines) on the Swift side locally to encoding the GPU command, just so you can make sure everything matches up.
If you can do all that and it starts working with the bare minimum you can begin adding everything back in.
The closest I can figure is the problem lies somewhere in how one of the compilers (Swift or Metal's, probably Metal) handles reserving placement of the function in memory especially if Xcode has been open a long time. You have to force the compiler to rebuild the function to get it to align everything correctly. (I admit this is really a wild guess, but it is the only thing that describes the problem from my CS knowledge).
If you are lucky everything will work, but I will admit this issue will drive you nuts. You can write the EXACT same code in a brand-new project before you do any of the suggestions and everything will work fine. Or you can revert your original code back to what you had in the first place (after you take all the steps), and everything will be fine. But the whole time Xcode (even with the GPU debugging) with be no help. It will probably report an '(IOAF code 11)' error and that is it.
I will I could give a more definite answer, but I hope my suggestions can get you past the problem. Doing those steps are the only things that have worked for me.
Stan
Thanks Bobjt!That was it!Much apprecaited!Stan
I did some more testing, and I think there is a bug or something with AVAudioEnvironmentNode.listenerVectorOrientation.If I set listenerVectorOrientation, the audio positioning just goes everywhere. But if I convert the Vectors to Euler angles, and use listenerAngularOrientation everything works more or less correctly.Similarly... Is AVAudioEnvironmentNode fixed for portrait position, or something because the Camera's Yaw, Pitch, and Roll, do not correspond to the AVEnviromentNode's.Currently I am having to map.cameraPitch => audioYawcameraRoll => audioPitchcameraYaw => audioRoll.and that really doesn't seem right.