move texcoord offset caclulations to vertex; should be a little faster

This commit is contained in:
hunterk 2017-04-01 13:19:21 -05:00
parent c4ef3b795d
commit 558f3364c2
2 changed files with 27 additions and 9 deletions

View File

@ -181,18 +181,18 @@ float c_df(vec3 c1, vec3 c2) {
return df.r + df.g + df.b;
}
in vec2 tc;
in vec4 xyp_1_2_3;
in vec4 xyp_6_7_8;
in vec4 xyp_11_12_13;
in vec4 xyp_16_17_18;
in vec4 xyp_21_22_23;
in vec4 xyp_5_10_15;
in vec4 xyp_9_14_9;
//sabr
vec4 get_texel_sabr()
{
vec2 tc = vec2(frag_texture_coord.x, frag_texture_coord.y);// * vec2(1.00001);
vec4 xyp_1_2_3 = tc.xxxy + vec4( -1., 0.0, 1., -2.0 * 1.);
vec4 xyp_6_7_8 = tc.xxxy + vec4( -1., 0.0, 1., -1.);
vec4 xyp_11_12_13 = tc.xxxy + vec4( -1., 0.0, 1., 0.0);
vec4 xyp_16_17_18 = tc.xxxy + vec4( -1., 0.0, 1., 1.);
vec4 xyp_21_22_23 = tc.xxxy + vec4( -1., 0.0, 1., 2.0 * 1.);
vec4 xyp_5_10_15 = tc.xyyy + vec4(-2.0 * 1., -1., 0.0, 1.);
vec4 xyp_9_14_9 = tc.xyyy + vec4( 2.0 * 1., -1., 0.0, 1.);
// Store mask values
vec3 P1 = sample_texel(xyp_1_2_3.xw ).rgb;
vec3 P2 = sample_texel(xyp_1_2_3.yw ).rgb;

View File

@ -26,6 +26,15 @@ flat out uint frag_dither;
flat out uint frag_semi_transparent;
flat out uvec4 frag_texture_window;
out vec2 tc;
out vec4 xyp_1_2_3;
out vec4 xyp_6_7_8;
out vec4 xyp_11_12_13;
out vec4 xyp_16_17_18;
out vec4 xyp_21_22_23;
out vec4 xyp_5_10_15;
out vec4 xyp_9_14_9;
void main() {
vec2 pos = position.xy + vec2(offset);
@ -55,4 +64,13 @@ void main() {
frag_dither = dither;
frag_semi_transparent = semi_transparent;
frag_texture_window = texture_window;
tc = frag_texture_coord.xy;
xyp_1_2_3 = tc.xxxy + vec4( -1., 0.0, 1., -2.0 * 1.);
xyp_6_7_8 = tc.xxxy + vec4( -1., 0.0, 1., -1.);
xyp_11_12_13 = tc.xxxy + vec4( -1., 0.0, 1., 0.0);
xyp_16_17_18 = tc.xxxy + vec4( -1., 0.0, 1., 1.);
xyp_21_22_23 = tc.xxxy + vec4( -1., 0.0, 1., 2.0 * 1.);
xyp_5_10_15 = tc.xyyy + vec4(-2.0 * 1., -1., 0.0, 1.);
xyp_9_14_9 = tc.xyyy + vec4( 2.0 * 1., -1., 0.0, 1.);
});