This isn't marked as a patch, cause it's most likely incorrect in some way. Yet, it also improves the results in some cases.
Namely, it seems that - contrary to the current state - clears with a color with a = 0 shouldn't be no-ops. I'm not sure what color should be used in such case; I'm using opaque black, cause neither transparent black nor transparent white give proper results.
Obviously, a proper testcase is required.