4

If one needs to compute image statistics such as Histogram, is using atomic operations such as atomic load and add as good as accumulating results using repeated blend operations? Does repeated blending in OpenGLES (such as below) or Metal internally uses atomic operations or no?

 glEnable(GL_BLEND);
 glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131

1 Answers1

1

Your mileage may vary on this between hardware and usage case. The best bet is to try both and see what works best. Atomic operations on iOS in general won't be as fast as you might wish.

Note that MetalPerformanceShaders.framework already provides a couple of histogram operations you can just use. These have already been tuned for you by Apple.

Ian Ollmann
  • 1,592
  • 9
  • 16