We're getting some strange rendering crashes on various devices running both ios16 and ios17 beta.
The problems all appear when compiling with any of the Xcode 15 betas, including 8. This code has worked fine for years.
The clearest error we get is on the iPhone X and XR where newRenderPipelineStateWithDescriptor returns: "Inlining all functions due to use of indirect argument bufferbuffer(15): Unable to map argument buffer access to resource"
Buffer 15 is where we stash our textures and looks like this:
typedef struct RegularTextures {
// A bit per texture that's present
uint32_t texPresent [[ id(WKSTexBufTexPresent) ]];
// Texture indirection (for accessing sub-textures)
const metal::array<float, 2*WKSTextureMax> offset [[ id(WKSTexBuffIndirectOffset) ]];
const metal::array<float, 2*WKSTextureMax> scale [[ id(WKSTexBuffIndirectScale) ]];
const metal::array<metal::texture2d<float, metal::access::sample>, WKSTextureMax> tex [[ id(WKSTexBuffTextures) ]];
} RegularTextures;
The program we're trying to set up looks like this:
vertex ProjVertexTriB vertexTri_multiTex(
VertexTriB vert [[stage_in]],
constant Uniforms &uniforms [[ buffer(WKSVertUniformArgBuffer) ]],
constant Lighting &lighting [[ buffer(WKSVertLightingArgBuffer) ]],
constant VertexTriArgBufferB & vertArgs [[buffer(WKSVertexArgBuffer)]],
constant RegularTextures & texArgs [[buffer(WKSVertTextureArgBuffer)]])
{
// Do things
}
Fairly benign as these things go.
Even more curiously, a different program with the same RegularTextures argument buffer is sometimes set up first without complaint.
I strongly suspect Apple introduced a bug here, but with the impending release, we're just trying to figure out how to work around it.