Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualYours3!f

Posted 27 September 2013 - 01:45 PM

textureGatherOffsets performs a textureGatherOffset for each element in the offsets array, thus, you get 8 gathers for 2 4-element offset arrays.

 

so I can't tell it exactly where to sample from? that is rather bad, well I guess I can still get away with less texture calls. thank you for clarifying this feature of glsl.

 

so if I read the specs correctly this should work correctly, right?

#version 330 core

layout(binding=0) uniform sampler2D tex;

uniform vec2 screen_size;

in vec2 uv;

layout(location=0) out vec4 color;

void main()
{
	/*
	-1  1 | 0  1 | 1  1
	-1  0 | 0  0 | 1  0
	-1 -1 | 0 -1 | 1 -1
	*/ 

	float res = 0;

        /**/
	//gather based approach		
	//fetch the y component
	vec4 res0 = textureGatherOffset( tex, uv, ivec2(-1, -1), 1 );
        vec4 res1 = textureGather( tex, uv, 1 );
        float res2 = texture( tex, uv + vec2(-1, 1) * scale ).y;
        float res3 = texture( tex, uv + vec2(1, -1) * scale ).y;

	res += res0.x + res0.y + res0.z + res0.w + res1.x + res1.y + res1.z + res2 + res3;
	/**/

	color = vec4(res / 9.0);
}

#2Yours3!f

Posted 27 September 2013 - 01:37 PM

textureGatherOffsets performs a textureGatherOffset for each element in the offsets array, thus, you get 8 gathers for 2 4-element offset arrays.

 

so I can't tell it exactly where to sample from? that is rather bad, well I guess I can still get away with less texture calls. thank you for clarifying this feature of glsl.


#1Yours3!f

Posted 27 September 2013 - 01:34 PM

textureGatherOffsets performs a textureGatherOffset for each element in the offsets array, thus, you get 8 gathers for 2 4-element offset arrays.

 

so I can't tell it directly where to sample from? is it the same as calling textureGatherOffset 4 times?


PARTNERS