Barycentrics12 DirectX 12 GCN Shader Extension Sample

SDKs & Libraries

6021_295X2_artistic_008_radeon_polys

The Barycentrics12 sample shows how to enable new intrinsic instructions in your DirectX 12 HLSL code. In particular it shows how to read the barycentric coordinates from the hardware rasterizer. The barycentric coordinates are used to interpolate vertex attributes in your triangles. The interpolation type can be linear or perspective corrected. The barycentric coordinates can be computed for the pixel’s center, the sample position, or the centroid. As suggested by Michal Drobot in his Low Level Optimizations for GCN presentation, this opens the door to new interpolation and attribute packing methods. Also, many algorithms that were only possible in the geometry shader can now be implemented in the pixel shader. For example:

  • Parallax curvature estimation
  • (Closest) distance to edge (for AA)
  • (Closest) distance to vertex
  • Spline-interpolated normals/curvature

The new intrinsic instructions are enabled through the AMD GPU Services (AGS) library. For more information on AGS, visit GPUOpen’s AGS page.

System requirements

  • AMD Radeon™ GCN-based GPU (HD 7000 series or newer)
  • 64-bit Windows® 10
  • Visual Studio® 2013 or Visual Studio® 2015
  • Graphics driver with GCN shader extension support
    • For example, AMD Radeon Software Crimson Edition 16.9.1 or later
  • The Windows 10 SDK must be installed

Technical Blogs

Resources