2016-01-18 15:50 GMT+01:00 Henri Verbeet hverbeet@gmail.com:
I finally had a look at D3D FSAAViewer on Windows, and I think this makes sense in general.
On 14 January 2016 at 00:00, Matteo Bruni mbruni@codeweavers.com wrote:
+static inline unsigned int popcount(unsigned int v) +{
- v -= v >> 1 & 0x55555555;
- v = (v & 0x33333333) + (v >> 2 & 0x33333333);
- return ((v + (v >> 4)) & 0x0f0f0f0f) * 0x01010101 >> 24;
+}
This is probably at least as good as the existing count_bits(), but it does duplicate that function.
I had the feeling we have a similar function already but somehow I couldn't see it...
GCC's __builtin_popcount() may also be worth a look. I'd probably call it wined3d_popcount() for consistency with e.g. wined3d_log2i().
I'll have a look and come up with a v2 hopefully soon.
BTW, technically the GL_SAMPLES and GL_NUM_SAMPLE_COUNT query are also part of ARB_internalformat_query. I haven't bothered adding a separate extension check for that but I can if you feel it's worthwhile.