Mercurial > mplayer.hg
comparison libvo/gl_common.c @ 25885:fa24feceb3f9
Allow for larger fragment programs.
author | reimar |
---|---|
date | Tue, 29 Jan 2008 18:00:20 +0000 |
parents | b3edb59e089f |
children | 606adc08ee6d |
comparison
equal
deleted
inserted
replaced
25884:f6697d25b040 | 25885:fa24feceb3f9 |
---|---|
1149 mp_msg(MSGT_VO, MSGL_V, "[gl] %s: %i/%i\n", progstats[i].name, cur, max); | 1149 mp_msg(MSGT_VO, MSGL_V, "[gl] %s: %i/%i\n", progstats[i].name, cur, max); |
1150 } | 1150 } |
1151 return 1; | 1151 return 1; |
1152 } | 1152 } |
1153 | 1153 |
1154 #define MAX_PROGSZ (1024*1024) | |
1155 | |
1154 /** | 1156 /** |
1155 * \brief setup a fragment program that will do YUV->RGB conversion | 1157 * \brief setup a fragment program that will do YUV->RGB conversion |
1156 * \param brightness brightness adjustment offset | 1158 * \param brightness brightness adjustment offset |
1157 * \param contrast contrast adjustment factor | 1159 * \param contrast contrast adjustment factor |
1158 * \param uvcos used for saturation and hue adjustment | 1160 * \param uvcos used for saturation and hue adjustment |
1162 */ | 1164 */ |
1163 static void glSetupYUVFragprog(float brightness, float contrast, | 1165 static void glSetupYUVFragprog(float brightness, float contrast, |
1164 float uvcos, float uvsin, float rgamma, | 1166 float uvcos, float uvsin, float rgamma, |
1165 float ggamma, float bgamma, int type, int rect, | 1167 float ggamma, float bgamma, int type, int rect, |
1166 int texw, int texh) { | 1168 int texw, int texh) { |
1167 char yuv_prog[4000] = | 1169 static const char prog_hdr[] = |
1168 "!!ARBfp1.0\n" | 1170 "!!ARBfp1.0\n" |
1169 "OPTION ARB_precision_hint_fastest;" | 1171 "OPTION ARB_precision_hint_fastest;" |
1170 // all scaler variables must go here so they aren't defined | 1172 // all scaler variables must go here so they aren't defined |
1171 // multiple times when the same scaler is used more than once | 1173 // multiple times when the same scaler is used more than once |
1172 "TEMP coord, coord2, cdelta, parmx, parmy, a, b, yuv;"; | 1174 "TEMP coord, coord2, cdelta, parmx, parmy, a, b, yuv;"; |
1173 int prog_remain = sizeof(yuv_prog) - strlen(yuv_prog); | 1175 int prog_remain; |
1174 char *prog_pos = &yuv_prog[strlen(yuv_prog)]; | 1176 char *yuv_prog, *prog_pos; |
1175 int cur_texu = 3; | 1177 int cur_texu = 3; |
1176 char lum_scale_texs[1]; | 1178 char lum_scale_texs[1]; |
1177 char chrom_scale_texs[1]; | 1179 char chrom_scale_texs[1]; |
1178 char conv_texs[1]; | 1180 char conv_texs[1]; |
1179 GLint i; | 1181 GLint i; |
1196 cur_texu, i); | 1198 cur_texu, i); |
1197 if (!ProgramString) { | 1199 if (!ProgramString) { |
1198 mp_msg(MSGT_VO, MSGL_FATAL, "[gl] ProgramString function missing!\n"); | 1200 mp_msg(MSGT_VO, MSGL_FATAL, "[gl] ProgramString function missing!\n"); |
1199 return; | 1201 return; |
1200 } | 1202 } |
1203 yuv_prog = malloc(MAX_PROGSZ); | |
1204 strcpy(yuv_prog, prog_hdr); | |
1205 prog_pos = yuv_prog + sizeof(prog_hdr) - 1; | |
1206 prog_remain = MAX_PROGSZ - sizeof(prog_hdr); | |
1201 add_scaler(YUV_LUM_SCALER(type), &prog_pos, &prog_remain, lum_scale_texs, | 1207 add_scaler(YUV_LUM_SCALER(type), &prog_pos, &prog_remain, lum_scale_texs, |
1202 '0', 'r', rect, texw, texh); | 1208 '0', 'r', rect, texw, texh); |
1203 add_scaler(YUV_CHROM_SCALER(type), &prog_pos, &prog_remain, chrom_scale_texs, | 1209 add_scaler(YUV_CHROM_SCALER(type), &prog_pos, &prog_remain, chrom_scale_texs, |
1204 '1', 'g', rect, texw / 2, texh / 2); | 1210 '1', 'g', rect, texw / 2, texh / 2); |
1205 add_scaler(YUV_CHROM_SCALER(type), &prog_pos, &prog_remain, chrom_scale_texs, | 1211 add_scaler(YUV_CHROM_SCALER(type), &prog_pos, &prog_remain, chrom_scale_texs, |
1228 mp_msg(MSGT_VO, MSGL_ERR, "[gl] unknown conversion type %i\n", YUV_CONVERSION(type)); | 1234 mp_msg(MSGT_VO, MSGL_ERR, "[gl] unknown conversion type %i\n", YUV_CONVERSION(type)); |
1229 break; | 1235 break; |
1230 } | 1236 } |
1231 mp_msg(MSGT_VO, MSGL_V, "[gl] generated fragment program:\n%s\n", yuv_prog); | 1237 mp_msg(MSGT_VO, MSGL_V, "[gl] generated fragment program:\n%s\n", yuv_prog); |
1232 loadGPUProgram(GL_FRAGMENT_PROGRAM, yuv_prog); | 1238 loadGPUProgram(GL_FRAGMENT_PROGRAM, yuv_prog); |
1239 free(yuv_prog); | |
1233 } | 1240 } |
1234 | 1241 |
1235 /** | 1242 /** |
1236 * \brief little helper function to create a lookup table for gamma | 1243 * \brief little helper function to create a lookup table for gamma |
1237 * \param map buffer to create map into | 1244 * \param map buffer to create map into |