1. A method, comprising: generating a fragment for each pixel that is covered, at least in part, by a primitive; determining coverage information for each fragment corresponding to the primitive; and for each fragment: generating a sample mask by a fragment shader, replacing the coverage information for the fragment with the sample mask, and writing, based on the sample mask, a result generated by the fragment shader to a memory.