Mercurial > mplayer.hg
comparison libvo/gl_common.c @ 33928:27b1c4df84bd
Remove pointless pointer indirection for shader program strings.
author | reimar |
---|---|
date | Fri, 26 Aug 2011 19:35:46 +0000 |
parents | 9bb97722d8c7 |
children | fe03e0d5c7d0 |
comparison
equal
deleted
inserted
replaced
33927:9bb97722d8c7 | 33928:27b1c4df84bd |
---|---|
925 mpglTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT); | 925 mpglTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT); |
926 mpglActiveTexture(GL_TEXTURE0); | 926 mpglActiveTexture(GL_TEXTURE0); |
927 free(tex); | 927 free(tex); |
928 } | 928 } |
929 | 929 |
930 static const char *bilin_filt_template = | 930 static const char bilin_filt_template[] = |
931 "TEX yuv.%c, fragment.texcoord[%c], texture[%c], %s;\n"; | 931 "TEX yuv.%c, fragment.texcoord[%c], texture[%c], %s;\n"; |
932 | 932 |
933 #define BICUB_FILT_MAIN(textype) \ | 933 #define BICUB_FILT_MAIN(textype) \ |
934 /* first y-interpolation */ \ | 934 /* first y-interpolation */ \ |
935 "ADD coord, fragment.texcoord[%c].xyxy, cdelta.xyxw;\n" \ | 935 "ADD coord, fragment.texcoord[%c].xyxy, cdelta.xyxw;\n" \ |
942 "LRP a.b, parmy.b, a.rrrr, a.gggg;\n" \ | 942 "LRP a.b, parmy.b, a.rrrr, a.gggg;\n" \ |
943 "LRP a.a, parmy.b, b.rrrr, b.gggg;\n" \ | 943 "LRP a.a, parmy.b, b.rrrr, b.gggg;\n" \ |
944 /* x-interpolation */ \ | 944 /* x-interpolation */ \ |
945 "LRP yuv.%c, parmx.b, a.bbbb, a.aaaa;\n" | 945 "LRP yuv.%c, parmx.b, a.bbbb, a.aaaa;\n" |
946 | 946 |
947 static const char *bicub_filt_template_2D = | 947 static const char bicub_filt_template_2D[] = |
948 "MAD coord.xy, fragment.texcoord[%c], {%e, %e}, {0.5, 0.5};\n" | 948 "MAD coord.xy, fragment.texcoord[%c], {%e, %e}, {0.5, 0.5};\n" |
949 "TEX parmx, coord.x, texture[%c], 1D;\n" | 949 "TEX parmx, coord.x, texture[%c], 1D;\n" |
950 "MUL cdelta.xz, parmx.rrgg, {-%e, 0, %e, 0};\n" | 950 "MUL cdelta.xz, parmx.rrgg, {-%e, 0, %e, 0};\n" |
951 "TEX parmy, coord.y, texture[%c], 1D;\n" | 951 "TEX parmy, coord.y, texture[%c], 1D;\n" |
952 "MUL cdelta.yw, parmy.rrgg, {0, -%e, 0, %e};\n" | 952 "MUL cdelta.yw, parmy.rrgg, {0, -%e, 0, %e};\n" |
953 BICUB_FILT_MAIN("2D"); | 953 BICUB_FILT_MAIN("2D"); |
954 | 954 |
955 static const char *bicub_filt_template_RECT = | 955 static const char bicub_filt_template_RECT[] = |
956 "ADD coord, fragment.texcoord[%c], {0.5, 0.5};\n" | 956 "ADD coord, fragment.texcoord[%c], {0.5, 0.5};\n" |
957 "TEX parmx, coord.x, texture[%c], 1D;\n" | 957 "TEX parmx, coord.x, texture[%c], 1D;\n" |
958 "MUL cdelta.xz, parmx.rrgg, {-1, 0, 1, 0};\n" | 958 "MUL cdelta.xz, parmx.rrgg, {-1, 0, 1, 0};\n" |
959 "TEX parmy, coord.y, texture[%c], 1D;\n" | 959 "TEX parmy, coord.y, texture[%c], 1D;\n" |
960 "MUL cdelta.yw, parmy.rrgg, {0, -1, 0, 1};\n" | 960 "MUL cdelta.yw, parmy.rrgg, {0, -1, 0, 1};\n" |
968 "RCP a.y, "t".w;\n" \ | 968 "RCP a.y, "t".w;\n" \ |
969 "MAD "t".xy, "t".xyxy, a.xyxy, {1, 1, 0, 0};\n" \ | 969 "MAD "t".xy, "t".xyxy, a.xyxy, {1, 1, 0, 0};\n" \ |
970 "ADD "t".x, "t".xxxx, "s";\n" \ | 970 "ADD "t".x, "t".xxxx, "s";\n" \ |
971 "SUB "t".y, "t".yyyy, "s";\n" | 971 "SUB "t".y, "t".yyyy, "s";\n" |
972 | 972 |
973 static const char *bicub_notex_filt_template_2D = | 973 static const char bicub_notex_filt_template_2D[] = |
974 "MAD coord.xy, fragment.texcoord[%c], {%e, %e}, {0.5, 0.5};\n" | 974 "MAD coord.xy, fragment.texcoord[%c], {%e, %e}, {0.5, 0.5};\n" |
975 "FRC coord.xy, coord.xyxy;\n" | 975 "FRC coord.xy, coord.xyxy;\n" |
976 CALCWEIGHTS("parmx", "coord.xxxx") | 976 CALCWEIGHTS("parmx", "coord.xxxx") |
977 "MUL cdelta.xz, parmx.rrgg, {-%e, 0, %e, 0};\n" | 977 "MUL cdelta.xz, parmx.rrgg, {-%e, 0, %e, 0};\n" |
978 CALCWEIGHTS("parmy", "coord.yyyy") | 978 CALCWEIGHTS("parmy", "coord.yyyy") |
979 "MUL cdelta.yw, parmy.rrgg, {0, -%e, 0, %e};\n" | 979 "MUL cdelta.yw, parmy.rrgg, {0, -%e, 0, %e};\n" |
980 BICUB_FILT_MAIN("2D"); | 980 BICUB_FILT_MAIN("2D"); |
981 | 981 |
982 static const char *bicub_notex_filt_template_RECT = | 982 static const char bicub_notex_filt_template_RECT[] = |
983 "ADD coord, fragment.texcoord[%c], {0.5, 0.5};\n" | 983 "ADD coord, fragment.texcoord[%c], {0.5, 0.5};\n" |
984 "FRC coord.xy, coord.xyxy;\n" | 984 "FRC coord.xy, coord.xyxy;\n" |
985 CALCWEIGHTS("parmx", "coord.xxxx") | 985 CALCWEIGHTS("parmx", "coord.xxxx") |
986 "MUL cdelta.xz, parmx.rrgg, {-1, 0, 1, 0};\n" | 986 "MUL cdelta.xz, parmx.rrgg, {-1, 0, 1, 0};\n" |
987 CALCWEIGHTS("parmy", "coord.yyyy") | 987 CALCWEIGHTS("parmy", "coord.yyyy") |
994 "TEX a.r, coord, texture[%c], "textype";\n" \ | 994 "TEX a.r, coord, texture[%c], "textype";\n" \ |
995 "TEX b.r, coord2, texture[%c], "textype";\n" \ | 995 "TEX b.r, coord2, texture[%c], "textype";\n" \ |
996 /* x-interpolation */ \ | 996 /* x-interpolation */ \ |
997 "LRP yuv.%c, parmx.b, a.rrrr, b.rrrr;\n" | 997 "LRP yuv.%c, parmx.b, a.rrrr, b.rrrr;\n" |
998 | 998 |
999 static const char *bicub_x_filt_template_2D = | 999 static const char bicub_x_filt_template_2D[] = |
1000 "MAD coord.x, fragment.texcoord[%c], {%e}, {0.5};\n" | 1000 "MAD coord.x, fragment.texcoord[%c], {%e}, {0.5};\n" |
1001 "TEX parmx, coord, texture[%c], 1D;\n" | 1001 "TEX parmx, coord, texture[%c], 1D;\n" |
1002 "MUL cdelta.xyz, parmx.rrgg, {-%e, 0, %e};\n" | 1002 "MUL cdelta.xyz, parmx.rrgg, {-%e, 0, %e};\n" |
1003 BICUB_X_FILT_MAIN("2D"); | 1003 BICUB_X_FILT_MAIN("2D"); |
1004 | 1004 |
1005 static const char *bicub_x_filt_template_RECT = | 1005 static const char bicub_x_filt_template_RECT[] = |
1006 "ADD coord.x, fragment.texcoord[%c], {0.5};\n" | 1006 "ADD coord.x, fragment.texcoord[%c], {0.5};\n" |
1007 "TEX parmx, coord, texture[%c], 1D;\n" | 1007 "TEX parmx, coord, texture[%c], 1D;\n" |
1008 "MUL cdelta.xyz, parmx.rrgg, {-1, 0, 1};\n" | 1008 "MUL cdelta.xyz, parmx.rrgg, {-1, 0, 1};\n" |
1009 BICUB_X_FILT_MAIN("RECT"); | 1009 BICUB_X_FILT_MAIN("RECT"); |
1010 | 1010 |
1011 static const char *unsharp_filt_template = | 1011 static const char unsharp_filt_template[] = |
1012 "PARAM dcoord%c = {%e, %e, %e, %e};\n" | 1012 "PARAM dcoord%c = {%e, %e, %e, %e};\n" |
1013 "ADD coord, fragment.texcoord[%c].xyxy, dcoord%c;\n" | 1013 "ADD coord, fragment.texcoord[%c].xyxy, dcoord%c;\n" |
1014 "SUB coord2, fragment.texcoord[%c].xyxy, dcoord%c;\n" | 1014 "SUB coord2, fragment.texcoord[%c].xyxy, dcoord%c;\n" |
1015 "TEX a.r, fragment.texcoord[%c], texture[%c], %s;\n" | 1015 "TEX a.r, fragment.texcoord[%c], texture[%c], %s;\n" |
1016 "TEX b.r, coord.xyxy, texture[%c], %s;\n" | 1016 "TEX b.r, coord.xyxy, texture[%c], %s;\n" |
1020 "TEX b.g, coord2.zwzw, texture[%c], %s;\n" | 1020 "TEX b.g, coord2.zwzw, texture[%c], %s;\n" |
1021 "DP3 b, b, {0.25, 0.25, 0.25};\n" | 1021 "DP3 b, b, {0.25, 0.25, 0.25};\n" |
1022 "SUB b.r, a.r, b.r;\n" | 1022 "SUB b.r, a.r, b.r;\n" |
1023 "MAD yuv.%c, b.r, {%e}, a.r;\n"; | 1023 "MAD yuv.%c, b.r, {%e}, a.r;\n"; |
1024 | 1024 |
1025 static const char *unsharp_filt_template2 = | 1025 static const char unsharp_filt_template2[] = |
1026 "PARAM dcoord%c = {%e, %e, %e, %e};\n" | 1026 "PARAM dcoord%c = {%e, %e, %e, %e};\n" |
1027 "PARAM dcoord2%c = {%e, 0, 0, %e};\n" | 1027 "PARAM dcoord2%c = {%e, 0, 0, %e};\n" |
1028 "ADD coord, fragment.texcoord[%c].xyxy, dcoord%c;\n" | 1028 "ADD coord, fragment.texcoord[%c].xyxy, dcoord%c;\n" |
1029 "SUB coord2, fragment.texcoord[%c].xyxy, dcoord%c;\n" | 1029 "SUB coord2, fragment.texcoord[%c].xyxy, dcoord%c;\n" |
1030 "TEX a.r, fragment.texcoord[%c], texture[%c], %s;\n" | 1030 "TEX a.r, fragment.texcoord[%c], texture[%c], %s;\n" |
1044 "TEX b.g, coord2.zwzw, texture[%c], %s;\n" | 1044 "TEX b.g, coord2.zwzw, texture[%c], %s;\n" |
1045 "DP4 b.r, b, {-0.1171875, -0.1171875, -0.1171875, -0.09765625};\n" | 1045 "DP4 b.r, b, {-0.1171875, -0.1171875, -0.1171875, -0.09765625};\n" |
1046 "MAD b.r, a.r, {0.859375}, b.r;\n" | 1046 "MAD b.r, a.r, {0.859375}, b.r;\n" |
1047 "MAD yuv.%c, b.r, {%e}, a.r;\n"; | 1047 "MAD yuv.%c, b.r, {%e}, a.r;\n"; |
1048 | 1048 |
1049 static const char *yuv_prog_template = | 1049 static const char yuv_prog_template[] = |
1050 "PARAM ycoef = {%e, %e, %e};\n" | 1050 "PARAM ycoef = {%e, %e, %e};\n" |
1051 "PARAM ucoef = {%e, %e, %e};\n" | 1051 "PARAM ucoef = {%e, %e, %e};\n" |
1052 "PARAM vcoef = {%e, %e, %e};\n" | 1052 "PARAM vcoef = {%e, %e, %e};\n" |
1053 "PARAM offsets = {%e, %e, %e};\n" | 1053 "PARAM offsets = {%e, %e, %e};\n" |
1054 "TEMP res;\n" | 1054 "TEMP res;\n" |
1055 "MAD res.rgb, yuv.rrrr, ycoef, offsets;\n" | 1055 "MAD res.rgb, yuv.rrrr, ycoef, offsets;\n" |
1056 "MAD res.rgb, yuv.gggg, ucoef, res;\n" | 1056 "MAD res.rgb, yuv.gggg, ucoef, res;\n" |
1057 "MAD res.rgb, yuv.bbbb, vcoef, res;\n"; | 1057 "MAD res.rgb, yuv.bbbb, vcoef, res;\n"; |
1058 | 1058 |
1059 static const char *yuv_pow_prog_template = | 1059 static const char yuv_pow_prog_template[] = |
1060 "PARAM ycoef = {%e, %e, %e};\n" | 1060 "PARAM ycoef = {%e, %e, %e};\n" |
1061 "PARAM ucoef = {%e, %e, %e};\n" | 1061 "PARAM ucoef = {%e, %e, %e};\n" |
1062 "PARAM vcoef = {%e, %e, %e};\n" | 1062 "PARAM vcoef = {%e, %e, %e};\n" |
1063 "PARAM offsets = {%e, %e, %e};\n" | 1063 "PARAM offsets = {%e, %e, %e};\n" |
1064 "PARAM gamma = {%e, %e, %e};\n" | 1064 "PARAM gamma = {%e, %e, %e};\n" |
1068 "MAD_SAT res.rgb, yuv.bbbb, vcoef, res;\n" | 1068 "MAD_SAT res.rgb, yuv.bbbb, vcoef, res;\n" |
1069 "POW res.r, res.r, gamma.r;\n" | 1069 "POW res.r, res.r, gamma.r;\n" |
1070 "POW res.g, res.g, gamma.g;\n" | 1070 "POW res.g, res.g, gamma.g;\n" |
1071 "POW res.b, res.b, gamma.b;\n"; | 1071 "POW res.b, res.b, gamma.b;\n"; |
1072 | 1072 |
1073 static const char *yuv_lookup_prog_template = | 1073 static const char yuv_lookup_prog_template[] = |
1074 "PARAM ycoef = {%e, %e, %e, 0};\n" | 1074 "PARAM ycoef = {%e, %e, %e, 0};\n" |
1075 "PARAM ucoef = {%e, %e, %e, 0};\n" | 1075 "PARAM ucoef = {%e, %e, %e, 0};\n" |
1076 "PARAM vcoef = {%e, %e, %e, 0};\n" | 1076 "PARAM vcoef = {%e, %e, %e, 0};\n" |
1077 "PARAM offsets = {%e, %e, %e, 0.125};\n" | 1077 "PARAM offsets = {%e, %e, %e, 0.125};\n" |
1078 "TEMP res;\n" | 1078 "TEMP res;\n" |
1083 "ADD res.a, res.a, 0.25;\n" | 1083 "ADD res.a, res.a, 0.25;\n" |
1084 "TEX res.g, res.gaaa, texture[%c], 2D;\n" | 1084 "TEX res.g, res.gaaa, texture[%c], 2D;\n" |
1085 "ADD res.a, res.a, 0.25;\n" | 1085 "ADD res.a, res.a, 0.25;\n" |
1086 "TEX res.b, res.baaa, texture[%c], 2D;\n"; | 1086 "TEX res.b, res.baaa, texture[%c], 2D;\n"; |
1087 | 1087 |
1088 static const char *yuv_lookup3d_prog_template = | 1088 static const char yuv_lookup3d_prog_template[] = |
1089 "TEMP res;\n" | 1089 "TEMP res;\n" |
1090 "TEX res, yuv, texture[%c], 3D;\n"; | 1090 "TEX res, yuv, texture[%c], 3D;\n"; |
1091 | 1091 |
1092 static const char *noise_filt_template = | 1092 static const char noise_filt_template[] = |
1093 "MUL coord.xy, fragment.texcoord[0], {%e, %e};\n" | 1093 "MUL coord.xy, fragment.texcoord[0], {%e, %e};\n" |
1094 "TEMP rand;\n" | 1094 "TEMP rand;\n" |
1095 "TEX rand.r, coord.x, texture[%c], 1D;\n" | 1095 "TEX rand.r, coord.x, texture[%c], 1D;\n" |
1096 "ADD rand.r, rand.r, coord.y;\n" | 1096 "ADD rand.r, rand.r, coord.y;\n" |
1097 "TEX rand.r, rand.r, texture[%c], 1D;\n" | 1097 "TEX rand.r, rand.r, texture[%c], 1D;\n" |