Difference(s) between texelFetch and imageLoad?

Is there a fundamental difference between these two shaders:


layout(rgba32f) readonly uniform image1D imgData;
...
vec4 data = imageLoad(imgData, someTexel);


uniform sampler1D sData;
...
vec4 data = texelFetch(sData, someTexel, sameLodAsImage);

Supposing the texture image bound in these programs was written to by a pass earlier in the pipeline, what’s the best approach : bind it as texture, or as an image aferwards?

You might want to read this
http://www.opengl.org/registry/specs/EXT/shader_image_load_store.txt

I have not used this but it looks very much like DirectX compute shaders.

FetchTexel is just for reading while the image load/store allows you to modify the texture; so it serves a different purpose. Whether that results in a speed difference between FetchTextel and imageLoad, I don’t know.

First, shader_image_load_store is not the same a compute shaders. Second, the question isn’t about what the difference between regular textures and image loads are in general. He’s asking about this specific case.

In any case, the answer to the question is, “it is not known.” I would say this as a general rule for image_load_store: if you can do the same thing with textures (without significant pain, like multipassing or whatever), then you should. Texture access will be the optimized case and therefore image_load_store is at best going to be no faster than the texture case.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.