Both the GLSL 4.6 and GLSL ES 3.2 spec say:
The range and granularity of offsets supported by this function [interpolateAtOffset] is implementation-dependent.
This seems too open-ended to be useful. How am I expected to know what will actually work across multiple vendors? Is there at least a minimum supported range specified somewhere in the standards? If not, is there something de-facto supported by the major vendors that I can rely on?
For Vulkan, the 1.2 specification requires the range and granularity to be reported with minInterpolationOffset
, maxInterpolationOffset
, and subPixelInterpolationOffsetBits
, where:
The values
minInterpolationOffset
andmaxInterpolationOffset
describe the closed interval of supported interpolation offsets: [minInterpolationOffset
,maxInterpolationOffset
]. The ULP is determined bysubPixelInterpolationOffsetBits
. IfsubPixelInterpolationOffsetBits
is 4, this provides increments of (1/24) = 0.0625, and thus the range of supported interpolation offsets would be [-0.5, 0.4375].
Based on the minimum values of these required by the specification, you can rely on at least [-0.5, 0.4375] being available if sampleRateShading
is supported.
For OpenGL, the 4.6 specification says:
The built-in function interpolateAtOffset will sample variables at a specified (x, y) offset relative to the center of the pixel. The range and granularity of offsets supported by this function is implementation-dependent. If either component of the specified offset is less than the value of
MIN_FRAGMENT_INTERPOLATION_OFFSET
or greater than the value ofMAX_FRAGMENT_INTERPOLATION_OFFSET
, the position used to interpolate the variable is undefined. Not all values of offset may be supported; x and y offsets may be rounded to fixed-point values with the number of fraction bits given by the value of the implementation-dependent constantFRAGMENT_INTERPOLATION_OFFSET_BITS
.
The required minimums are the same as Vulkan.
Trying to search through PDFs is painful so I won't bother looking at the ES spec, I would assume it's the same.