The image_load_store extension provides load/store functions with *vec4
access only. If I have layout(rgba32f) uniform image2D myimage;
for example, it seems like I have to write to the entire pixel at once:
imageStore(myimage, coord, vec4(1,1,1,1));
and if I want to set only the red channel to 1
, I need to do this:
vec4 pixel = imageLoad(myimage, coord);
pixel.r = 1;
imageStore(myimage, coord, pixel);
which introduces a fair amount of overhead with the extra read.
Is there a mechanism I can use to write only to a specific channel?
Something similar to glColorMask
, or perhaps binding the data with a different format such as a larger GL_R32F
image2D
or imageBuffer
? If so, what are some of the overhead implications (e.g. conversion/transfer/cache issues)?