interpolateAtOffset() 偏移参数的范围

range of interpolateAtOffset()'s offset parameter

GLSL 4.6 和 GLSL ES 3.2 规范均表示:

The range and granularity of offsets supported by this function [interpolateAtOffset] is implementation-dependent.

这似乎太开放了,没有用处。我如何才能知道跨多个供应商的实际工作原理是什么?标准中是否至少指定了最低支持范围?如果没有,是否有我可以依赖的主要供应商事实上支持的东西?

对于 Vulkan,the 1.2 specification 需要使用 minInterpolationOffsetmaxInterpolationOffsetsubPixelInterpolationOffsetBits 报告范围和粒度,其中:

The values minInterpolationOffset and maxInterpolationOffset describe the closed interval of supported interpolation offsets: [minInterpolationOffset, maxInterpolationOffset]. The ULP is determined by subPixelInterpolationOffsetBits. If subPixelInterpolationOffsetBits is 4, this provides increments of (1/24) = 0.0625, and thus the range of supported interpolation offsets would be [-0.5, 0.4375].

根据规范要求的这些最小值,如果支持 sampleRateShading,您可以依赖至少 [-0.5, 0.4375] 可用。

对于 OpenGL,the 4.6 specification 表示:

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 of MAX_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 constant FRAGMENT_INTERPOLATION_OFFSET_BITS.

最低要求与 Vulkan 相同。

尝试搜索 PDF 很痛苦,所以我不会费心去查看 ES 规范,我认为它是一样的。