I've run into two (possibly related) problems involving mipmaps in BC7 RGBA Unorm textures.
The first, and more serious, is a crash when uploading the last mipmap level of a texture. Thus far this has only happened on two machines, both running Catalina. Also, only certain textures cause the crash, but there doesn't seem to be anything unusual about them. From the crash reports:
MacOS 10.15.7 19H1519, Intel Graphics 4000 (this is from a debug, single-threaded build)
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.driver.AppleIntelHD4000GraphicsMTLDriver 0x00007fff25cff33d CpuSwizzleBlt + 11667
1 com.apple.driver.AppleIntelHD4000GraphicsMTLDriver 0x00007fff25ce7ca0 -[MTLIGAccelTexture replaceRegion:mipmapLevel:slice:withBytes:bytesPerRow:bytesPerImage:] + 1387
2 com.apple.driver.AppleIntelHD4000GraphicsMTLDriver 0x00007fff25ce7e2f -[MTLIGAccelTexture replaceRegion:mipmapLevel:withBytes:bytesPerRow:] + 74
MacOS 10.15.7 19H1419, Intel Graphics 5000 (this is from a release, multi-threaded build)
Thread 9 Crashed:
0 com.apple.driver.AppleIntelHD5000GraphicsMTLDriver 0x00007fff2973b9c0 CpuSwizzleBlt + 9224
1 com.apple.driver.AppleIntelHD5000GraphicsMTLDriver 0x00007fff2972714b -[MTLIGAccelTexture replaceRegion:mipmapLevel:slice:withBytes:bytesPerRow:bytesPerImage:] + 1385
2 com.apple.driver.AppleIntelHD5000GraphicsMTLDriver 0x00007fff297272c3 -[MTLIGAccelTexture replaceRegion:mipmapLevel:withBytes:bytesPerRow:] + 64
I'll post the full crash reports to Feedback Assistant.
The second problem only happens on Mojave, and results in what looks like garbled pixel data in the mipmaps (I don't have access to the machine to do a frame capture). I can work around this issue by disabling mipmaps in the texture sampler.
There are no Metal validation errors, and neither problem happens on Big Sur (I don't yet have a Monterey machine). Uncompressed textures are fine, as well, although mipmaps for those are generated on-the-fly rather than uploaded.
Padding the source pixel data doesn't help, so the seg fault likely isn't caused by a too-large or unaligned read.
Has anyone else run into problems with mipmaps in BC7 compressed textures?