Skip to content

Add ability to bounds-check input coordinates when sampling

This needs to go into both the pl_shader API (pl_sample_src) and the pl_renderer API (pl_render_params). Sometimes users have textures where physically only parts of the texture are valid contents, for example to embed NPOT textures into larger texture objects.

To handle these sorts of cases correctly, it would be useful to be able to guarantee libplacebo won't sample outside the actual sampled area. We could do this in a reasonably straightforward manner by manually bounds checking the input area before sampling from the texture, at the cost of a performance hit.