I was playing around with the number of interactions in a loop for a shader which initially reported 32 WR and 54 UR registers by malioc.
As the number of iterations increased the number of allocated UR kept on increasing to 58,60,64 and so on whereas the WR number remained 32.
What is the reason for this behaviour? Since according to the use case of UR, we generally don't expect constants and uniform data to increase as the number of iterations increase.
Hard to be certain without seeing the code - the refactored code needing more constants (including compiler generated ones, like address offsets), or having more ability to promote loads to uniform registers are the two most likely options.
Hi Pete ,
Thanks for responding !
Here is a link to a shader that demonstrates a similar behaviour.
I changed the the NUM_SAMPLES and compiled with "malioc -c Mali-G710 --vulkan combine.frag" to get following result :
NUM_SAMPLES WR. UR
12. 31. 14
14. 31. 18
16. 31. 20
17. 31. 22
Looking forward to your input.
For that shader, I'd expect that the loop is getting fully unrolled, at which point "i / NUM_SAMPLES" is a constant than can be precomputed and stored in uniform registers.