3D Images

I’m back with another basic question.

I’m trying to use 3D images in my compute shader to store information later used by my fragment shader. This worked fine while it was a 2D image but now it is failing to compile.

Before I was declaring my images as “uniform image2D image;”. Which worked fine. Now when I’m declaring it as “uniform image3D image;” instead I’m getting errors on my imageStore() call as follows:


O(56) : error C1115: unable to find compatible overloaded function "imageStore(struct image3D, vec3, vec4)"

From what I’ve managed to gather this is because the compiler is assuming that image3D is a struct and not the built in type provided by GLSL. I’ve found some references saying that you need to specify the layout for image3D for it to be valid along the lines of “layout(rgba8) uniform image3D image;” however this only changes the error message to say “… struct unimage3D4x8 …”. I saw mentions that specifying the layout was only needed if the image was not write only. And in this shader I am only writing to the images (of which there are 6).

Any ideas?

(Edit: I’m using #version 430 in case that matters.)

(Edit 2: Turns out this was simply because I yet again forgot that images wants indexes in the range of [0, width) and so on not [0,1). In other words the indexes should be a ivec3 not a vec3.)