comparison libvo/gl_common.c @ 16648:5e3e86e8c9b4

Make fragment program snprintf less confusing.
author reimar
date Mon, 03 Oct 2005 14:25:04 +0000
parents 6b0dc40bf961
children 6ea220b10e8e
comparison
equal deleted inserted replaced
16647:e26e80f3031c 16648:5e3e86e8c9b4
621 } 621 }
622 622
623 static const char *yuv_prog_template = 623 static const char *yuv_prog_template =
624 "!!ARBfp1.0\n" 624 "!!ARBfp1.0\n"
625 "OPTION ARB_precision_hint_fastest;" 625 "OPTION ARB_precision_hint_fastest;"
626 "PARAM ycoef = {%.4f, %.4f, %.4f};"
627 "PARAM ucoef = {%.4f, %.4f, %.4f};"
628 "PARAM vcoef = {%.4f, %.4f, %.4f};"
629 "PARAM offsets = {%.4f, %.4f, %.4f};"
630 "PARAM gamma = {%.4f, %.4f, %.4f};"
626 "TEMP res, y, u, v;" 631 "TEMP res, y, u, v;"
627 "TEX y, fragment.texcoord[0], texture[0], %s;" 632 "TEX y, fragment.texcoord[0], texture[0], %s;"
628 "MAD res, y, {%.4f, %.4f, %.4f}, {%.4f, %.4f, %.4f};" 633 "MAD res, y, ycoef, offsets;"
629 "TEX u, fragment.texcoord[1], texture[1], %s;" 634 "TEX u, fragment.texcoord[1], texture[1], %s;"
630 "MAD res, u, {%.4f, %.4f, %.4f}, res;" 635 "MAD res, u, ucoef, res;"
631 "TEX v, fragment.texcoord[2], texture[2], %s;" 636 "TEX v, fragment.texcoord[2], texture[2], %s;"
632 "MAD result.color, v, {%.4f, %.4f, %.4f}, res;" 637 "MAD result.color, v, vcoef, res;"
633 "END"; 638 "END";
634 639
635 static const char *yuv_pow_prog_template = 640 static const char *yuv_pow_prog_template =
636 "!!ARBfp1.0\n" 641 "!!ARBfp1.0\n"
637 "OPTION ARB_precision_hint_fastest;" 642 "OPTION ARB_precision_hint_fastest;"
643 "PARAM ycoef = {%.4f, %.4f, %.4f};"
644 "PARAM ucoef = {%.4f, %.4f, %.4f};"
645 "PARAM vcoef = {%.4f, %.4f, %.4f};"
646 "PARAM offsets = {%.4f, %.4f, %.4f};"
647 "PARAM gamma = {%.4f, %.4f, %.4f};"
638 "TEMP res, y, u, v;" 648 "TEMP res, y, u, v;"
639 "TEX y, fragment.texcoord[0], texture[0], %s;" 649 "TEX y, fragment.texcoord[0], texture[0], %s;"
640 "MAD res, y, {%.4f, %.4f, %.4f}, {%.4f, %.4f, %.4f};" 650 "MAD res, y, ycoef, offsets;"
641 "TEX u, fragment.texcoord[1], texture[1], %s;" 651 "TEX u, fragment.texcoord[1], texture[1], %s;"
642 "MAD res, u, {%.4f, %.4f, %.4f}, res;" 652 "MAD res, u, ucoef, res;"
643 "TEX v, fragment.texcoord[2], texture[2], %s;" 653 "TEX v, fragment.texcoord[2], texture[2], %s;"
644 "MAD_SAT res, v, {%.4f, %.4f, %.4f}, res;" 654 "MAD_SAT res, v, vcoef, res;"
645 "POW result.color.r, res.r, %.4f.r;" 655 "POW result.color.r, res.r, gamma.r;"
646 "POW result.color.g, res.g, %.4f.g;" 656 "POW result.color.g, res.g, gamma.g;"
647 "POW result.color.b, res.b, %.4f.b;" 657 "POW result.color.b, res.b, gamma.b;"
648 "END"; 658 "END";
649 659
650 static const char *yuv_lookup_prog_template = 660 static const char *yuv_lookup_prog_template =
651 "!!ARBfp1.0\n" 661 "!!ARBfp1.0\n"
652 "OPTION ARB_precision_hint_fastest;" 662 "OPTION ARB_precision_hint_fastest;"
663 "PARAM ycoef = {%.4f, %.4f, %.4f, 0};"
664 "PARAM ucoef = {%.4f, %.4f, %.4f, 0};"
665 "PARAM vcoef = {%.4f, %.4f, %.4f, 0};"
666 "PARAM offsets = {%.4f, %.4f, %.4f, 0.125};"
667 "PARAM gamma = {%.4f, %.4f, %.4f};"
653 "TEMP res, y, u, v;" 668 "TEMP res, y, u, v;"
654 "TEX y, fragment.texcoord[0], texture[0], %s;" 669 "TEX y, fragment.texcoord[0], texture[0], %s;"
655 "MAD res, y, {%.4f, %.4f, %.4f, 0}, {%.4f, %.4f, %.4f, 0.125};" 670 "MAD res, y, ycoef, offsets;"
656 "TEX u, fragment.texcoord[1], texture[1], %s;" 671 "TEX u, fragment.texcoord[1], texture[1], %s;"
657 "MAD res, u, {%.4f, %.4f, %.4f, 0}, res;" 672 "MAD res, u, ucoef, res;"
658 "TEX v, fragment.texcoord[2], texture[2], %s;" 673 "TEX v, fragment.texcoord[2], texture[2], %s;"
659 "MAD res, v, {%.4f, %.4f, %.4f, 0}, res;" 674 "MAD res, v, vcoef, res;"
660 "TEX result.color.r, res.raaa, texture[3], 2D;" 675 "TEX result.color.r, res.raaa, texture[3], 2D;"
661 "ADD res.a, res.a, 0.25;" 676 "ADD res.a, res.a, 0.25;"
662 "TEX result.color.g, res.gaaa, texture[3], 2D;" 677 "TEX result.color.g, res.gaaa, texture[3], 2D;"
663 "ADD res.a, res.a, 0.25;" 678 "ADD res.a, res.a, 0.25;"
664 "TEX result.color.b, res.baaa, texture[3], 2D;" 679 "TEX result.color.b, res.baaa, texture[3], 2D;"
724 gc += 0.5 - contrast / 2.0; 739 gc += 0.5 - contrast / 2.0;
725 bc += 0.5 - contrast / 2.0; 740 bc += 0.5 - contrast / 2.0;
726 rgamma = 1.0 / rgamma; 741 rgamma = 1.0 / rgamma;
727 ggamma = 1.0 / ggamma; 742 ggamma = 1.0 / ggamma;
728 bgamma = 1.0 / bgamma; 743 bgamma = 1.0 / bgamma;
729 snprintf(yuv_prog, 1000, prog_template, tex_type, ry, gy, by, rc, gc, bc, 744 snprintf(yuv_prog, 1000, prog_template, ry, gy, by, ru, gu, bu, rv, gv, bv,
730 tex_type, ru, gu, bu, tex_type, rv, gv, bv, rgamma, bgamma, bgamma); 745 rc, gc, bc, rgamma, bgamma, bgamma, tex_type, tex_type, tex_type);
731 ProgramString(GL_FRAGMENT_PROGRAM, GL_PROGRAM_FORMAT_ASCII, 746 ProgramString(GL_FRAGMENT_PROGRAM, GL_PROGRAM_FORMAT_ASCII,
732 strlen(yuv_prog), yuv_prog); 747 strlen(yuv_prog), yuv_prog);
733 glGetIntegerv(GL_PROGRAM_ERROR_POSITION, &i); 748 glGetIntegerv(GL_PROGRAM_ERROR_POSITION, &i);
734 if (i != -1) 749 if (i != -1)
735 mp_msg(MSGT_VO, MSGL_ERR, 750 mp_msg(MSGT_VO, MSGL_ERR,