MTLRenderCommandEncoder's setfragmenttexture does not update texture.

Hi, I have 7 rects with 7 different textures. I use single RenderCommandEncoder to bind each rect's texture to 0th index of my fragment function by calling setfragmenttexture as given below:

[ renderCommandEncoder setfragmenttexture:rects[i].mtltexture atIndex:0]

Then what happens rects[0], rects[1] get rendered with rects[0]'s texture and rects[2], rects[3] get rendered with rects[1]'s texture and so on.

While each rect must be rendered with own texture because I set it everytime in loop correctly. But it is not happening. I am not able to understand why setfragmenttexture is not updating correct texture. Please help me what could be the issue here ?

Hi guarav2289, I would suggest taking a look at our GPU tooling in Xcode. This WWDC session explains how to use GPU Frame capture. It might give you insight in what is happening in a frame in your application.

If the problem still occurs and it seems to be a Metal issue, please file a Feedback Assistant ticket with:

  • The macOS and/or iOS version version that was used for both development and running the application.
  • The Xcode version used for development.
  • If possible, a sample project that reproduces the issue for you.

If you file a ticket, please share the Feedback Assistant ID here.

MTLRenderCommandEncoder's setfragmenttexture does not update texture.
 
 
Q