16. Fragment Density Map Operations

16.1. Fragment Density Map Operations Overview


16.2. Fetch Density Value


\(i = \lfloor{\frac{x}{fragmentDensityTexelSize_{width}}}\rfloor\)

\(j = \lfloor{\frac{y}{fragmentDensityTexelSize_{height}}}\rfloor\)

Where the size of each region in the framebuffer is:

\(fragmentDensityTexelSize'_{width} = {2^{\lceil{\log_2(\frac{framebuffer_{width}}{fragmentDensityMap_{width}})}\rceil}}\)

\(fragmentDensityTexelSize'_{height} = {2^{\lceil{\log_2(\frac{framebuffer_{height}}{fragmentDensityMap_{height}})}\rceil}}\)


\(fragmentDensityTexelSize_{width} = \mathbin{clamp}(fragmentDensityTexelSize'_{width},minFragmentDensityTexelSize_{width},maxFragmentDensityTexelSize_{width})\)

\(fragmentDensityTexelSize_{height} = \mathbin{clamp}(fragmentDensityTexelSize'_{height},minFragmentDensityTexelSize_{height},maxFragmentDensityTexelSize_{height})\)


\(layer = baseArrayLayer + ViewIndex\)


\(layer = baseArrayLayer\)


16.2.1. Component Swizzle


16.2.2. Component Mapping

The swizzled texel’s components are mapped to a density value:

\(densityValue_{xy} = (C'_{r},C'_{g})\)

16.3. Fragment Area Conversion


\(fragmentArea_{wh} = \frac{1.0}{densityValue_{xy}}\)

16.3.1. Fragment Area Filter



16.3.2. Fragment Area Clamp




The clamped fragment area is assigned to the corresponding framebuffer region.