OpenCL 1.2 2D image array

I’m currently planning to use a 2D image array (image2d_array_t) to store read-only material information, i.e. one slice for each material, however I am having difficulties understanding how to sample it properly. Is there a way to enable linear filtering on the x- and y- dimensions, but disable sampling in the z-dimension? Something akin to:

read_imagef(my_image, my_sampler, (float2)(x, y), (int)(slice_index))

Or do I need to use the old +0.5 offset trick to exactly sample the desired slice so that other slices don’t “bleed” on the result?

I would imagine there is a way to select the desired slice, since otherwise 2D image arrays would be equivalent to 3D images and thus redundant, yet I cannot find any indication of that in the spec.

The addressing & filter mode specified in the sampler only get applied to the x and y dimensions of a 2D image array. The z dimension (for a 2D image array) is only clamped and no filtering is performed between the image slices of the 2D image array. Refer to section 8.4 on how an image layer is selected from an image array.

Hello, that is good news, and thank you for the reference, I will read up on it.