[Mesa-dev] [RFC PATCH 0/5] ARB_gpu_shader5 interpolateAt* GLSL plumbing

Chris Forbes chrisf at ijw.co.nz
Sun Nov 10 00:51:06 PST 2013

Here is the driver-independent part of ARB_gpu_shader5's
interpolateAtCentroid, interpolateAtOffset builtins.

Before I go further with this approach, I'd like feedback on the following:

1) I've (ab)used ir_var_shader_in variable mode in function signatures to
enforce the strange restrictions interpolateAt* have. Is this crazy/awful?

2) I intend to implement interpolateAtSample() by:

- Adding a new builtin uniform (perhaps "gl_SamplePositionsMESA"); which
   will be an array of vec2, containing the full palette of current sample
   positions. This could be formally exposed by another extension at a later

- Compiling interpolateAtSample(x, sample_num) as if the shader author wrote:
   interpolateAtOffset(x, gl_SamplePositionsMESA[sample_num] - vec2(0.5))

Is this sensible?

Does it match what other hardware will need to do? (it makes sense for i965,
where the fragment shader payload otherwise does not have access to a full
palette of sample positions.)

More information about the mesa-dev mailing list