What will imageLoad() function return if the format qualifier is r32f in GLSL?

Viewed 162

I know if set the format qualifier rgba32f,when call imageLoad(),I get a vec4. If I set format qualifier r16ui, what will I get? Wiki specifies the funcion still returns a four component value, what exactly each component of the value is?

1 Answers

You'll get 0,0,1 for the other three components.

This is what the spec says:

Texture Image Loads and Stores

... Loads always return a value as a vec4, ivec4, or uvec4, ... Data are converted to/from the specified format according to the process described for a TexImage2D or GetTexImage command ... Unused components are filled in with (0,0,0,1) (where 0 and 1 are either floating-point or integer values, depending on the format).

Related