Adaptive multisampling based on vertex attributes
Systems, apparatuses and methods may provide for technology that selects an anti-aliasing mode for a vertex of a primitive based on a parameter associated with the vertex and generates a coverage mask based on the selected anti-aliasing mode. Additionally, one or more pixels corresponding to the vertex may be shaded based at least partly on the coverage mask, wherein the selected anti-aliasing mode varies across a plurality of vertices in the primitive.
1. An apparatus comprising:
a substrate; and
logic coupled to the substrate, wherein the logic is implemented in one or more of configurable storage or fixed-functionality hardware, the logic coupled to the substrate to:
select an anti-aliasing mode for a vertex of a primitive based on a parameter associated with the vertex, wherein the parameter indicates a number of samples to be taken with respect to a pixel corresponding to the vertex, and wherein the pixel is shaded based on color samples taken from various positions within the pixel and combined to obtain a single color value for the pixel;
retrieve sample offset data from a lookup table based on the parameter;
generate a coverage mask based on the selected anti-aliasing mode; and
shade one or more pixels corresponding to the vertex based on the coverage mask and the sample offset data, wherein the selected anti-aliasing mode is non-uniform.
2. The apparatus of claim 1 , wherein the logic coupled to the substrate is further to interpolate the number of samples.
3. The apparatus of claim 2 , wherein the logic coupled to the substrate is further to quantize the interpolated number of samples.
4. The apparatus of claim 1 , wherein the logic coupled to the substrate is further to determine a coverage percentage of the one or more pixels based on a number of ones in the coverage mask.
5. A system comprising:
a display to present visual content;
a memory to store a set of instructions; and
a host processor to generate a parameter associated with a vertex of a primitive corresponding to the visual content, wherein the parameter indicates a number of samples to be taken with respect to a pixel corresponding to the vertex; and
a graphics processor including logic to,
select an anti-aliasing mode for the vertex based on the parameter, wherein the pixel is shaded based on color samples taken from various positions within the pixel and combined to obtain a single color value for the pixel,
generate a coverage mask based on the selected anti-aliasing mode, and
shade one or more pixels corresponding to the vertex based at least partly on the coverage mask, wherein the selected anti-aliasing mode is non-uniform.
6. The system of claim 5 , wherein the parameter indicates a number of samples.
7. The system of claim 6 , wherein the logic is further to interpolate the number of samples.
8. The system of claim 7 , wherein the logic is further to quantize the interpolated number of samples.
9. The system of claim 5 , wherein the logic is further to retrieve sample offset data from a lookup table based on the parameter, and wherein the one or more pixels are shaded further based on the sample offset data.
10. The system of claim 5 , wherein the logic is further to determine a coverage percentage of the one or more pixels based on a number of ones in the coverage mask.
11. The system of claim 5 , wherein the coverage mask is further to be a render target independent coverage mask.
12. An apparatus comprising:
a substrate; and
logic coupled to the substrate, wherein the logic is implemented in one or more of configurable logic or fixed-functionality hardware logic, the logic coupled to the substrate to:
select an anti-aliasing mode for a vertex of a primitive based on a parameter associated with the vertex, wherein the parameter indicates a number of samples to be taken with respect to a pixel corresponding to the vertex, and wherein the pixel is shaded based on color samples taken from various positions within the pixel and combined to obtain a single color value for the pixel;
generate a coverage mask based on the selected anti-aliasing mode; and
shade one or more pixels corresponding to the vertex based at least partly on the coverage mask, wherein the selected anti-aliasing mode is non-uniform.
13. The apparatus of claim 12 , wherein the parameter indicates a number of samples.
14. The apparatus of claim 13 , wherein the logic coupled to the substrate is further to interpolate the number of samples.
15. The apparatus of claim 14 , wherein the logic coupled to the substrate is further to quantize the interpolated number of samples.
16. The apparatus of claim 12 , wherein the logic coupled to the substrate is further to retrieve sample offset data from a lookup table based on the parameter, and wherein the one or more pixels are shaded further based on the sample offset data.
17. The apparatus of claim 12 , wherein the logic coupled to the substrate is further to determine a coverage percentage of the one or more pixels based on a number of ones in the coverage mask.
18. The apparatus of claim 12 , wherein the coverage mask is a render target independent coverage mask.
19. A method comprising:
selecting, via a logic of a graphics processor, an anti-aliasing mode for a vertex of a primitive based on a parameter associated with the vertex, wherein the parameter indicates a number of samples to be taken with respect to a pixel corresponding to the vertex, and wherein the pixel is shaded based on color samples taken from various positions within the pixel and combined to obtain a single color value for the pixel;
generating a coverage mask based on the selected anti-aliasing mode; and
shading one or more pixels corresponding to the vertex based at least partly on the coverage mask, wherein the selected anti-aliasing mode is non-uniform.
20. The method of claim 19 , wherein the parameter indicates a number of samples.
21. The method of claim 20 , further including interpolating the number of samples.
22. The method of claim 21 , further including quantizing the interpolated number of samples.
23. The method of claim 19 , further including retrieving sample offset data from a lookup table based on the parameter, wherein the one or more pixels are shaded further based on the sample offset data.
24. The method of claim 19 , wherein shading the one or more pixels includes determining a coverage percentage of the one or more pixels based on a number of ones in the coverage mask.
25. The method of claim 19 , wherein the coverage mask is a render target independent coverage mask.