summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-01-29 18:00:20 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-01-29 18:00:20 +0000
commit174aeba480eae67973c2d83dcd93d8996fb550b8 (patch)
tree21e89df5e8144550907faf08560e5876193939f5 /libvo
parent92dd21a14d78bd4726abea29feb238733f4b26b7 (diff)
downloadmpv-174aeba480eae67973c2d83dcd93d8996fb550b8.tar.bz2
mpv-174aeba480eae67973c2d83dcd93d8996fb550b8.tar.xz
Allow for larger fragment programs.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25913 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/gl_common.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index 57d73588bc..e989163064 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -1151,6 +1151,8 @@ int loadGPUProgram(GLenum target, char *prog) {
return 1;
}
+#define MAX_PROGSZ (1024*1024)
+
/**
* \brief setup a fragment program that will do YUV->RGB conversion
* \param brightness brightness adjustment offset
@@ -1164,14 +1166,14 @@ static void glSetupYUVFragprog(float brightness, float contrast,
float uvcos, float uvsin, float rgamma,
float ggamma, float bgamma, int type, int rect,
int texw, int texh) {
- char yuv_prog[4000] =
+ static const char prog_hdr[] =
"!!ARBfp1.0\n"
"OPTION ARB_precision_hint_fastest;"
// all scaler variables must go here so they aren't defined
// multiple times when the same scaler is used more than once
"TEMP coord, coord2, cdelta, parmx, parmy, a, b, yuv;";
- int prog_remain = sizeof(yuv_prog) - strlen(yuv_prog);
- char *prog_pos = &yuv_prog[strlen(yuv_prog)];
+ int prog_remain;
+ char *yuv_prog, *prog_pos;
int cur_texu = 3;
char lum_scale_texs[1];
char chrom_scale_texs[1];
@@ -1198,6 +1200,10 @@ static void glSetupYUVFragprog(float brightness, float contrast,
mp_msg(MSGT_VO, MSGL_FATAL, "[gl] ProgramString function missing!\n");
return;
}
+ yuv_prog = malloc(MAX_PROGSZ);
+ strcpy(yuv_prog, prog_hdr);
+ prog_pos = yuv_prog + sizeof(prog_hdr) - 1;
+ prog_remain = MAX_PROGSZ - sizeof(prog_hdr);
add_scaler(YUV_LUM_SCALER(type), &prog_pos, &prog_remain, lum_scale_texs,
'0', 'r', rect, texw, texh);
add_scaler(YUV_CHROM_SCALER(type), &prog_pos, &prog_remain, chrom_scale_texs,
@@ -1230,6 +1236,7 @@ static void glSetupYUVFragprog(float brightness, float contrast,
}
mp_msg(MSGT_VO, MSGL_V, "[gl] generated fragment program:\n%s\n", yuv_prog);
loadGPUProgram(GL_FRAGMENT_PROGRAM, yuv_prog);
+ free(yuv_prog);
}
/**