sampling MTLTextureType3D (macOS) is black since upgrading to MacBook Pro 2019

Hello,


I have an open source game / graphics engine with multiple rendering back ends which has a series of different graphics demos and tests.. https://github.com/polymonster/pmtech


Since I just got a new MacBook Pro 2019 the volume texture example and signed distance field example when used with metal for macOS no longer work because sampling a 3d texture is just returning 0.


The examples still run fine on my MacBook Pro 2017 (Mohave), the OpenGL rendering backend also works fine on the 2019 MacBook Pro (Catalina).. I am not sure if it is the hardware or the OS update that might have introduced the issue in Metal.


GPU frame capture has never worked for me on macOS which is extremely dissapointing, I have tried to perform captures on a variety of hardware and with different code bases to no avail (unexpected replay termination).


Does anyone have working sample code with MTLTextureType3D I can try?

Accepted Reply

I have managed to find a solution and fix the issue, The problem was that MTLTextureDescriptor.swizzle was not initialised. I was not calling init on the MTLTextureDescriptor after allocating so some values mustn't have been set to their defaults.


Luckily I caught this issue when doing some other work which asserted that swizzles were not supported on render targets which led me to double check this.

Replies

I have managed to find a solution and fix the issue, The problem was that MTLTextureDescriptor.swizzle was not initialised. I was not calling init on the MTLTextureDescriptor after allocating so some values mustn't have been set to their defaults.


Luckily I caught this issue when doing some other work which asserted that swizzles were not supported on render targets which led me to double check this.