generateMipmapsForTexture for 3D textures?

Hello,


I'm attempting to use the generateMipmapsForTexture method of the MTLBlitCommandEncoder to generate the mipmap chain of a 3D texture. I'm seeing no results - it's as if the operation has no effect. The debug runtime and the documentation don't say anything about this not working. Is this action supported?


My texture format is RGBA16F. I'm able to verify that mip level 0 is correct (contains my data), but mip levels 1 thru N simply appear black.


Any advice would be appreciated. I'd be happy to be told that this should work and that I might be doing something else wrong.


Thank you

Replies

-[MTLBlitCommandEncoder generateMipmaps:] should just work for 3D textures. Can you provide some more info on how you've created your texture and how you're sampling from it in the shader?

Thanks for the reply Dan.


The volume is used for voxelization of a 3D scene, so mip level 0 is filled with calls to texture write() in a voxelization shader. This seems to work without issue. The volume is somewhat large, in typical cases 160x160x480 or more.


Since the blit command for generating mipmaps didn't seem to work, I've written a compute shader pass to produce mipmaps for the 3D volume, and this DOES work - the mip levels appear as I would expect in the rendered result. But if I switch back to the blit command, I get blank mips again.


Since I can't really share the whole source to my project in order to reproduce this, I'm working on a simple test bed that I'm hoping will isolate the problem (or, if it works, show me what I was doing wrong originally). If I find something interesting I'll post it here and/or file a bug report.

I've filed a bug for this issue: 32284894


I also managed to write a simple project that reproduces the bug. That can be had here, for anyone interested: https://drive.google.com/file/d/0B82_DrWLVtZiUkYySlpiNW5yWWs/view?usp=sharing

https://forums.developer.apple.com/thread/77728


can you give me some help ? thank you !

I just ran your sample and it seems to be working for me (Everything is green). Whether a bug occurs or not is hightly dependant on the GPU your using. Make sure you've added your system configuration to the bug so that we know where to try it on.

Interesting! Thanks for running the test.


I included a sysdiagnose report with the bug report.