What's more optimal - sampling one channel at a time or all channels at once? I'm going through and optimizing some of my glsl code for a project, and have come across a scenario several times that I am not sure how best to optimize.

In summary - Is it faster to sample a texture once with .rgba vs 4 times with simply .r at the end?

Here's what I have now:

mat4 getLightProjectionMatrix(int lightIndex){
    mat4 m;

    m[0][0] = texelFetch( projMatricies , ivec2( 0 , lightIndex ) , 0 ).r;
    m[0][1] = texelFetch( projMatricies , ivec2( 1 , lightIndex ) , 0 ).r;
    m[0][2] = texelFetch( projMatricies , ivec2( 2 , lightIndex ) , 0 ).r;
    m[0][3] = texelFetch( projMatricies , ivec2( 3 , lightIndex ) , 0 ).r;

    m[1][0] = texelFetch( projMatricies , ivec2( 4 , lightIndex ) , 0 ).r;
    m[1][1] = texelFetch( projMatricies , ivec2( 5 , lightIndex ) , 0 ).r;
    m[1][2] = texelFetch( projMatricies , ivec2( 6 , lightIndex ) , 0 ).r;
    m[1][3] = texelFetch( projMatricies , ivec2( 7 , lightIndex ) , 0 ).r;

    m[2][0] = texelFetch( projMatricies , ivec2( 8 , lightIndex ) , 0 ).r;
    m[2][1] = texelFetch( projMatricies , ivec2( 9 , lightIndex ) , 0 ).r;
    m[2][2] = texelFetch( projMatricies , ivec2( 10 , lightIndex ) , 0 ).r;
    m[2][3] = texelFetch( projMatricies , ivec2( 11 , lightIndex ) , 0 ).r;

    m[3][0] = texelFetch( projMatricies , ivec2( 12 , lightIndex ) , 0 ).r;
    m[3][1] = texelFetch( projMatricies , ivec2( 13 , lightIndex ) , 0 ).r;
    m[3][2] = texelFetch( projMatricies , ivec2( 14 , lightIndex ) , 0 ).r;
    m[3][3] = texelFetch( projMatricies , ivec2( 15 , lightIndex ) , 0 ).r;

    return m;
}


Here's what I'm considering doing:

mat4 getLightProjectionMatrix(int lightIndex){
    mat4 m;

    vec4 A = texelFetch( projMatricies , ivec2( 0 , lightIndex ) , 0 ).rgba;
    m[0][0] = A[0];
    m[0][1] = A[1];
    m[0][2] = A[2];
    m[0][3] = A[3];

    vec4 B = texelFetch( projMatricies , ivec2( 0 , lightIndex ) , 0 ).rgba;
    m[1][0] = B[0];
    m[1][1] = B[1];
    m[1][2] = B[2];
    m[1][3] = B[3];

    vec4 C = texelFetch( projMatricies , ivec2( 0 , lightIndex ) , 0 ).rgba;
    m[2][0] = C[0];
    m[2][1] = C[1];
    m[2][2] = C[2];
    m[2][3] = C[3];

    vec4 D = texelFetch( projMatricies , ivec2( 0 , lightIndex ) , 0 ).rgba;
    m[3][0] = D[0];
    m[3][1] = D[1];
    m[3][2] = D[2];
    m[3][3] = D[3];

    return m;
}


Does the compiler know how to optimize both of these into the same thing in the end? or would it be more efficient to pack more data into a texture fetch no matter what?

Thanks!
It should be significantly faster to sample one RGBA value from one location in a texture than four R values from different locations in the texture.