From the API point of view the number of samples per pixel is fixed. The hardware may use some kind of sample compression though. That information would have to be sampled as well, and how do you present it to the shader?Yeah I saw that too, but what I didn't see is if there's a way to query how many MSAA samples there are at a single pixel... or whether you just have to resolve them all which seems rather wasteful (considering that it's supposed to be MSAA, no SSAA).
I guess it would be possible to add another sample method to Texture2DMS that returns a bool. If the return value is true, all samples for that pixel are identical so you only need to read sample 0. But reading any other sample # would return the same value.