1

I'm interested in selecting textures dynamically within a Vulkan shader (though maybe this question applies equally to OpenGL). I am presently emerging from a long process of being confused by the distinction between a single sampler2DArray and an array of sampler2D objects. The latter, it seems, cannot be dynamically (let alone non-uniformly) indexed unless certain features or extensions are reported by the graphics library to be supported.

But is it allowed to choose a layer from a sampler2DArray in a dynamic, non-uniform way (that is, using completely arbitrary indices), on all hardware, regardless of reported feature support or extension presence? I think I am reading in some places that it is, but this is so confusing that I'd like to be told as explicitly as possible.

mjwach
  • 1,174
  • 2
  • 9
  • 25
  • So much for "as explicitly as possible". Anyway I gather the answer is "no, assuming the index is within the bounds of the array". Excellent! – mjwach Jul 05 '18 at 20:19
  • Read comments in [this Reddit post](https://www.reddit.com/r/vulkan/comments/8kthkc/array_of_sampler2d_variable_index_fails_program/). – Ekzuzy Jul 05 '18 at 20:42

0 Answers0