'Refreshing a Variable multiple times a frame(for a texture array in a shader)

I want to Update an integer multiple times in frame so that the fragment-shader can access the right index of a texture array for different objects. I first tried it with a PushConstant but this doesn´t work because it can only be changed one time per record of the commandbuffer.

So it would be very kind if somebody could tell me how to do this or if i should change the process of getting the right textures for an object in a different way.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source