Index: ddraw/shadergen.cpp |
— | — | @@ -262,8 +262,7 @@ |
263 | 263 | vec4 specular;\n\
|
264 | 264 | vec4 ambient;\n\
|
265 | 265 | vec3 N;";
|
266 | | -static const char var_color[] = "vec3 color;\n\
|
267 | | -float alpha;\n";
|
| 266 | +static const char var_color[] = "vec4 color;\n";
|
268 | 267 | static const char var_xyzw[] = "vec4 xyzw;\n";
|
269 | 268 | // Operations
|
270 | 269 | static const char op_transform[] = "xyzw = vec4(xyz,1);\n\
|
— | — | @@ -283,9 +282,8 @@ |
284 | 283 | static const char op_colorvert[] = "gl_FrontColor = rgba0.bgra;\n";
|
285 | 284 | static const char op_color2vert[] = "gl_FrontSecondaryColor = rgba1.bgra;\n";
|
286 | 285 | static const char op_colorwhite[] = "gl_FrontColor = vec4(1.0,1.0,1.0,1.0);\n";
|
287 | | -static const char op_colorfragout[] = "gl_FragColor = vec4(color,alpha);\n";
|
288 | | -static const char op_colorfragin[] = "color = gl_Color.rgb;\n\
|
289 | | -alpha = gl_Color.a;\n";
|
| 286 | +static const char op_colorfragout[] = "gl_FragColor = color;\n";
|
| 287 | +static const char op_colorfragin[] = "color = gl_Color;\n";
|
290 | 288 | static const char op_texpassthru1[] = "gl_TexCoord[x] = ";
|
291 | 289 | static const char op_texpassthru2s[] = "vec4(sX,0,0,1);\n";
|
292 | 290 | static const char op_texpassthru2st[] = "vec4(stX,0,1);\n";
|
— | — | @@ -607,8 +605,8 @@ |
608 | 606 | string arg1,arg2;
|
609 | 607 | int args[4];
|
610 | 608 | bool texfail;
|
611 | | - const string blendargs[] = {"color","gl_Color","texture2DProj(texX,gl_TexCoord[Y]).rgb",
|
612 | | - "texture2DProj(texX,gl_TexCoord[Y]).a","texfactor","gl_SecondaryColor","vec3(1,1,1)","1",".rgb",".a","alpha"};
|
| 609 | + const string blendargs[] = {"color.rgb","gl_Color","texture2DProj(texX,gl_TexCoord[Y]).rgb",
|
| 610 | + "texture2DProj(texX,gl_TexCoord[Y]).a","texfactor","gl_SecondaryColor","vec3(1,1,1)","1",".rgb",".a","color.a"};
|
613 | 611 | for(i = 0; i < 8; i++)
|
614 | 612 | {
|
615 | 613 | if((texstate[i].shaderid & 31) == D3DTOP_DISABLE)break;
|
— | — | @@ -678,34 +676,34 @@ |
679 | 677 | default:
|
680 | 678 | break;
|
681 | 679 | case D3DTOP_SELECTARG1:
|
682 | | - fsrc->append("color = " + arg1 + ";\n");
|
| 680 | + fsrc->append("color.rgb = " + arg1 + ";\n");
|
683 | 681 | break;
|
684 | 682 | case D3DTOP_SELECTARG2:
|
685 | | - fsrc->append("color = " + arg2 + ";\n");
|
| 683 | + fsrc->append("color.rgb = " + arg2 + ";\n");
|
686 | 684 | break;
|
687 | 685 | case D3DTOP_MODULATE:
|
688 | | - fsrc->append("color = " + arg1 + " * " + arg2 + ";\n");
|
| 686 | + fsrc->append("color.rgb = " + arg1 + " * " + arg2 + ";\n");
|
689 | 687 | break;
|
690 | 688 | case D3DTOP_MODULATE2X:
|
691 | | - fsrc->append("color = (" + arg1 + " * " + arg2 + ") * 2.0;\n");
|
| 689 | + fsrc->append("color.rgb = (" + arg1 + " * " + arg2 + ") * 2.0;\n");
|
692 | 690 | break;
|
693 | 691 | case D3DTOP_MODULATE4X:
|
694 | | - fsrc->append("color = (" + arg1 + " * " + arg2 + ") * 4.0;\n");
|
| 692 | + fsrc->append("color.rgb = (" + arg1 + " * " + arg2 + ") * 4.0;\n");
|
695 | 693 | break;
|
696 | 694 | case D3DTOP_ADD:
|
697 | | - fsrc->append("color = " + arg1 + " + " + arg2 + ";\n");
|
| 695 | + fsrc->append("color.rgb = " + arg1 + " + " + arg2 + ";\n");
|
698 | 696 | break;
|
699 | 697 | case D3DTOP_ADDSIGNED:
|
700 | | - fsrc->append("color = " + arg1 + " + " + arg2 + " - .5;\n");
|
| 698 | + fsrc->append("color.rgb = " + arg1 + " + " + arg2 + " - .5;\n");
|
701 | 699 | break;
|
702 | 700 | case D3DTOP_ADDSIGNED2X:
|
703 | | - fsrc->append("color = (" + arg1 + " + " + arg2 + " - .5) * 2.0;\n");
|
| 701 | + fsrc->append("color.rgb = (" + arg1 + " + " + arg2 + " - .5) * 2.0;\n");
|
704 | 702 | break;
|
705 | 703 | case D3DTOP_SUBTRACT:
|
706 | | - fsrc->append("color = " + arg1 + " - " + arg2 + ";\n");
|
| 704 | + fsrc->append("color.rgb = " + arg1 + " - " + arg2 + ";\n");
|
707 | 705 | break;
|
708 | 706 | case D3DTOP_ADDSMOOTH:
|
709 | | - fsrc->append("color = " + arg1 + " + " + arg2 + " - " + arg1 + " * " + arg2 + ";\n");
|
| 707 | + fsrc->append("color.rgb = " + arg1 + " + " + arg2 + " - " + arg1 + " * " + arg2 + ";\n");
|
710 | 708 | break;
|
711 | 709 | }
|
712 | 710 | if(((texstate[i].shaderid>>17) & 31) == D3DTOP_DISABLE)break;
|
— | — | @@ -775,34 +773,34 @@ |
776 | 774 | default:
|
777 | 775 | break;
|
778 | 776 | case D3DTOP_SELECTARG1:
|
779 | | - fsrc->append("alpha = " + arg1 + ";\n");
|
| 777 | + fsrc->append("color.a = " + arg1 + ";\n");
|
780 | 778 | break;
|
781 | 779 | case D3DTOP_SELECTARG2:
|
782 | | - fsrc->append("alpha = " + arg2 + ";\n");
|
| 780 | + fsrc->append("color.a = " + arg2 + ";\n");
|
783 | 781 | break;
|
784 | 782 | case D3DTOP_MODULATE:
|
785 | | - fsrc->append("alpha = " + arg1 + " * " + arg2 + ";\n");
|
| 783 | + fsrc->append("color.a = " + arg1 + " * " + arg2 + ";\n");
|
786 | 784 | break;
|
787 | 785 | case D3DTOP_MODULATE2X:
|
788 | | - fsrc->append("alpha = (" + arg1 + " * " + arg2 + ") * 2.0;\n");
|
| 786 | + fsrc->append("color.a = (" + arg1 + " * " + arg2 + ") * 2.0;\n");
|
789 | 787 | break;
|
790 | 788 | case D3DTOP_MODULATE4X:
|
791 | | - fsrc->append("alpha = (" + arg1 + " * " + arg2 + ") * 4.0;\n");
|
| 789 | + fsrc->append("color.a = (" + arg1 + " * " + arg2 + ") * 4.0;\n");
|
792 | 790 | break;
|
793 | 791 | case D3DTOP_ADD:
|
794 | | - fsrc->append("alpha = " + arg1 + " + " + arg2 + ";\n");
|
| 792 | + fsrc->append("color.a = " + arg1 + " + " + arg2 + ";\n");
|
795 | 793 | break;
|
796 | 794 | case D3DTOP_ADDSIGNED:
|
797 | | - fsrc->append("alpha = " + arg1 + " + " + arg2 + " - .5;\n");
|
| 795 | + fsrc->append("color.a = " + arg1 + " + " + arg2 + " - .5;\n");
|
798 | 796 | break;
|
799 | 797 | case D3DTOP_ADDSIGNED2X:
|
800 | | - fsrc->append("alpha = (" + arg1 + " + " + arg2 + " - .5) * 2.0;\n");
|
| 798 | + fsrc->append("color.a = (" + arg1 + " + " + arg2 + " - .5) * 2.0;\n");
|
801 | 799 | break;
|
802 | 800 | case D3DTOP_SUBTRACT:
|
803 | | - fsrc->append("alpha = " + arg1 + " - " + arg2 + ";\n");
|
| 801 | + fsrc->append("color.a = " + arg1 + " - " + arg2 + ";\n");
|
804 | 802 | break;
|
805 | 803 | case D3DTOP_ADDSMOOTH:
|
806 | | - fsrc->append("alpha = " + arg1 + " + " + arg2 + " - " + arg1 + " * " + arg2 + ";\n");
|
| 804 | + fsrc->append("color.a = " + arg1 + " + " + arg2 + " - " + arg1 + " * " + arg2 + ";\n");
|
807 | 805 | break;
|
808 | 806 | }
|
809 | 807 | }
|