mirror of
https://github.com/libretro/Lakka-LibreELEC.git
synced 2025-04-02 10:41:46 -04:00
169 lines
9.4 KiB
Diff
169 lines
9.4 KiB
Diff
--- a/yabause/src/yglshaderes.c 2020-09-09 14:36:46.111779788 +0200
|
|
+++ b/yabause/src/yglshaderes.c 2020-09-09 14:39:01.142478640 +0200
|
|
@@ -297,7 +297,7 @@
|
|
"{\n"
|
|
" vec4 txindex = texelFetch( s_texture, ivec2(int(v_texcoord.x),int(v_texcoord.y)) ,0 );\n"
|
|
" if(txindex.a == 0.0) { discard; }\n"
|
|
-" vec4 txcol = texelFetch( s_color, ivec2( ( int(txindex.g*65280.0) | int(txindex.r*255.0)) ,0 ) , 0 );\n"
|
|
+" vec4 txcol = texelFetch( s_color, ivec2( ( int(round(txindex.g*65280.0)) | int(round(txindex.r*255.0)) ) ,0 ) , 0 );\n"
|
|
" fragColor = clamp(txcol+u_color_offset,vec4(0.0),vec4(1.0));\n"
|
|
" fragColor.a = txindex.a;\n"
|
|
"}\n";
|
|
@@ -319,7 +319,7 @@
|
|
"{\n"
|
|
" vec4 txindex = texelFetch( s_texture, ivec2(int(v_texcoord.x),int(v_texcoord.y)) ,0 );\n"
|
|
" if(txindex.a == 0.0) { discard; }\n"
|
|
-" vec4 txcol = texelFetch( s_color, ivec2( ( int(txindex.g*65280.0) | int(txindex.r*255.0)) ,0 ) , 0 );\n"
|
|
+" vec4 txcol = texelFetch( s_color, ivec2( ( int(round(txindex.g*65280.0)) | int(round(txindex.r*255.0))) ,0 ) , 0 );\n"
|
|
" fragColor = clamp(txcol+u_color_offset,vec4(0.0),vec4(1.0));\n"
|
|
" fragColor.a = txindex.a;\n"
|
|
" gl_FragDepth = ((txindex.b*255.0/10.0) +1.0)/2.0 ; \n"
|
|
@@ -408,7 +408,7 @@
|
|
"{\n"
|
|
" vec4 txindex = texelFetch( s_texture, ivec2(int(v_texcoord.x),int(v_texcoord.y)) ,0 );\n"
|
|
" if(txindex.a == 0.0) { discard; }\n"
|
|
-" vec4 txcol = texelFetch( s_color, ivec2( ( int(txindex.g*65280.0) | int(txindex.r*255.0)) ,0 ) , 0 );\n"
|
|
+" vec4 txcol = texelFetch( s_color, ivec2( ( int(round(txindex.g*65280.0)) | int(round(txindex.r*255.0)) ) ,0 ) , 0 );\n"
|
|
" vec4 color_offset = texelFetch( s_linetexture, ivec2( int(v_texcoord.q), 0), 0 ); \n"
|
|
" fragColor.r = txcol.r + (color_offset.r-0.5)*2.0;\n"
|
|
" fragColor.g = txcol.g + (color_offset.g-0.5)*2.0;\n"
|
|
@@ -467,7 +467,7 @@
|
|
"{\n"
|
|
" vec4 txindex = texelFetch( s_texture, ivec2(int(v_texcoord.x),int(v_texcoord.y)) ,0 );\n"
|
|
" if(txindex.a == 0.0) { discard; }\n"
|
|
-" vec4 txcol = texelFetch( s_color, ivec2( ( int(txindex.g*65280.0) | int(txindex.r*255.0)) ,0 ) , 0 );\n"
|
|
+" vec4 txcol = texelFetch( s_color, ivec2( ( int(round(txindex.g*65280.0)) | int(round(txindex.r*255.0)) ) ,0 ) , 0 );\n"
|
|
" fragColor = txcol+u_color_offset;\n"
|
|
" if( txindex.a > 0.5) { fragColor.a = 1.0;} else {fragColor.a = 0.0;}\n"
|
|
"}\n";
|
|
@@ -553,14 +553,14 @@
|
|
"{\n"
|
|
" vec4 txindex = texelFetch( s_texture, ivec2(int(v_texcoord.x),int(v_texcoord.y)) ,0 ); \n"
|
|
" if(txindex.a > 0.0) {\n"
|
|
-" highp int highg = int(txindex.g*255.0);"
|
|
+" highp int highg = int(round(txindex.g*255.0));"
|
|
" vec4 txcol = texelFetch( s_color, ivec2( ((highg&0x7F)<<8) | int(txindex.r*255.0) , 0 ) , 0 );\n"
|
|
" txcol.a = txindex.a; \n"
|
|
" if( (highg & 0x80) != 0) {\n"
|
|
-" int coef = int(txindex.b*255.0);\n"
|
|
+" int coef = int(round(txindex.b*255.0));\n"
|
|
" vec4 linecol;\n"
|
|
" vec4 lineindex = texelFetch( s_line_texture, ivec2( int(v_texcoord.z),int(v_texcoord.w)) ,0 );\n"
|
|
-" int lineparam = ((int(lineindex.g*255.0) & 0x7F)<<8) | int(lineindex.r*255.0); \n"
|
|
+" int lineparam = (( int(round(lineindex.g*255.0)) & 0x7F)<<8) | int(round(lineindex.r*255.0)) ; \n"
|
|
" if( (coef & 0x80) != 0 ){\n"
|
|
" int caddr = (lineparam&0x780) | (coef&0x7F);\n "
|
|
" linecol = texelFetch( s_color, ivec2( caddr,0 ) , 0 );\n"
|
|
@@ -1327,7 +1327,7 @@
|
|
" vec4 spriteColor = texture(u_sprite,addr); \n"
|
|
" if( spriteColor.a == 0.0 ) discard; \n"
|
|
" vec4 fboColor = texture(u_fbo,faddr); \n"
|
|
- " int additional = int(fboColor.a * 255.0);\n"
|
|
+ " int additional = int(round(fboColor.a * 255.0));\n"
|
|
" spriteColor += vec4(v_vtxcolor.r,v_vtxcolor.g,v_vtxcolor.b,0.0);\n"
|
|
" if( (additional & 0x40) == 0 ) \n"
|
|
" { \n"
|
|
@@ -1392,7 +1392,7 @@
|
|
" vec4 spriteColor = texture(u_sprite,addr); \n"
|
|
" if( spriteColor.a == 0.0 ) discard; \n"
|
|
" vec4 fboColor = texture(u_fbo,faddr); \n"
|
|
- " int additional = int(fboColor.a * 255.0);\n"
|
|
+ " int additional = int(round(fboColor.a * 255.0));\n"
|
|
" if( (additional & 0x40) == 0 ) \n"
|
|
" { \n"
|
|
" fragColor = spriteColor*0.5 + fboColor*0.5; \n"
|
|
@@ -1603,13 +1603,13 @@
|
|
" addr.s = addr.s / (v_texcoord.q);\n"
|
|
" addr.t = addr.t / (v_texcoord.q);\n"
|
|
" vec4 spriteColor = texture(u_sprite,addr);\n"
|
|
-" if( spriteColor.a == 0.0 ){ discard; }\n"
|
|
+" if( spriteColor.a == 0.0 ) discard;\n"
|
|
" vec4 fboColor = texture(u_fbo,faddr);\n"
|
|
-" int additional = int(fboColor.a * 255.0);\n"
|
|
+" int additional = int(round(fboColor.a * 255.0));\n"
|
|
" if( ((additional & 0xC0)==0x80) ) { \n"
|
|
" fragColor = vec4(fboColor.r*0.5,fboColor.g*0.5,fboColor.b*0.5,fboColor.a);\n"
|
|
" }else{\n"
|
|
-" discard;\n"
|
|
+" discard;"
|
|
" }\n"
|
|
"}\n";
|
|
const GLchar * pYglprg_vdp1_shadow_f[] = { Yglprg_vdp1_shadow_f, NULL };
|
|
@@ -1758,7 +1758,7 @@
|
|
"{\n"
|
|
" vec2 addr = v_texcoord;\n"
|
|
" highp vec4 fbColor = texture(s_vdp1FrameBuffer,addr);\n"
|
|
-" int additional = int(fbColor.a * 255.0);\n"
|
|
+" int additional = int(round(fbColor.a * 255.0));\n"
|
|
" highp float alpha = float((additional/8)*8)/255.0;\n"
|
|
" highp float depth = (float(additional&0x07)/10.0) + 0.05;\n"
|
|
" if( depth < u_from || depth > u_to ){\n"
|
|
@@ -1818,7 +1818,7 @@
|
|
"{\n"
|
|
" vec2 addr = v_texcoord;\n"
|
|
" highp vec4 fbColor = texture(s_vdp1FrameBuffer,addr);\n"
|
|
-" int additional = int(fbColor.a * 255.0);\n"
|
|
+" int additional = int(round(fbColor.a * 255.0));\n"
|
|
" if( (additional & 0x80) == 0 ){ discard; } // show? \n"
|
|
" int prinumber = (additional&0x07); "
|
|
" highp float depth = u_pri[ prinumber ];\n"
|
|
@@ -1826,7 +1826,7 @@
|
|
" vec4 txcol=vec4(0.0,0.0,0.0,1.0);\n"
|
|
" if( (additional & 0x40) != 0 ){ // index color? \n"
|
|
" if( fbColor.b != 0.0 ) {discard;} // draw shadow last path \n"
|
|
-" int colindex = ( int(fbColor.g*65280.0) | int(fbColor.r*255.0)); \n"
|
|
+" int colindex = ( int(round(fbColor.g*65280.0)) | int(round(fbColor.r*255.0)) ); \n"
|
|
" if( colindex == 0 ){ if( u_sprite_window != 0 || prinumber == 0) { discard;} } // hard/vdp1/hon/p02_11.htm 0 data is ignoerd \n"
|
|
" colindex = colindex + u_color_ram_offset; \n"
|
|
" txcol = texelFetch( s_color, ivec2( colindex ,0 ) , 0 );\n"
|
|
@@ -1944,7 +1944,7 @@
|
|
" vec4 linetex = texelFetch( s_line, linepos,0 ); "
|
|
" vec2 addr = v_texcoord;\n"
|
|
" highp vec4 fbColor = texture(s_vdp1FrameBuffer,addr);\n"
|
|
-" int additional = int(fbColor.a * 255.0);\n"
|
|
+" int additional = int(round(fbColor.a * 255.0));\n"
|
|
" if( (additional & 0x80) == 0 ){ discard; } // show? \n"
|
|
" highp vec4 linepri = texelFetch( s_line, ivec2(linepos.x,1+(additional&0x07)) ,0 ); \n"
|
|
" if( linepri.a == 0.0 ) discard; \n"
|
|
@@ -1953,7 +1953,7 @@
|
|
" vec4 txcol=vec4(0.0,0.0,0.0,1.0);\n"
|
|
" if( (additional & 0x40) != 0 ){ // index color? \n"
|
|
" if( fbColor.b != 0.0 ) {discard;} // draw shadow last path \n"
|
|
-" int colindex = ( int(fbColor.g*65280.0) | int(fbColor.r*255.0)); \n"
|
|
+" int colindex = ( int(round(fbColor.g*65280.0)) | int(round(fbColor.r*255.0)) ); \n"
|
|
" if( colindex == 0 ){ if( u_sprite_window != 0 || (additional&0x07) == 0 ) { discard;} } // hard/vdp1/hon/p02_11.htm 0 data is ignoerd \n"
|
|
" colindex = colindex + u_color_ram_offset; \n"
|
|
" txcol = texelFetch( s_color, ivec2( colindex ,0 ) , 0 );\n"
|
|
@@ -2072,7 +2072,7 @@
|
|
"{\n"
|
|
" vec2 addr = v_texcoord;\n"
|
|
" highp vec4 fbColor = texture(s_vdp1FrameBuffer,addr);\n"
|
|
-" int additional = int(fbColor.a * 255.0);\n"
|
|
+" int additional = int(round(fbColor.a * 255.0));\n"
|
|
" if( (additional & 0x80) == 0 ){ discard; } // show? \n"
|
|
" highp float depth = u_pri[ (additional&0x07) ];\n"
|
|
" if( (additional & 0x40) != 0 && fbColor.b != 0.0 ){ // index color and shadow? \n"
|
|
@@ -2528,7 +2528,7 @@
|
|
"{\n"
|
|
" vec2 addr = v_texcoord;\n"
|
|
" highp vec4 fbColor = texture(s_vdp1FrameBuffer,addr);\n"
|
|
-" highp int additional = int(fbColor.a * 255.0);\n"
|
|
+" highp int additional = int(round(fbColor.a * 255.0));\n"
|
|
" highp float alpha = float((additional/8)*8)/255.0;\n"
|
|
" highp float depth = ((float(additional&0x07))/10.0) + 0.05;\n"
|
|
" if( depth < u_from || depth > u_to ){ discard;return;}\n"
|
|
@@ -2634,12 +2634,12 @@
|
|
" fragColor.a =txcol.a;\n";
|
|
|
|
const GLchar Yglprg_linecol_main_cram_f[] =
|
|
-" vec4 txcolc = texelFetch( s_color, ivec2( ( int(txcol.g*65280.0) | int(txcol.r*255.0)) ,0 ) , 0 );\n"
|
|
+" vec4 txcolc = texelFetch( s_color, ivec2( ( int(round(txcol.g*65280.0)) | int(round(txcol.r*255.0)) ) ,0 ) , 0 );\n"
|
|
" fragColor = txcolc+u_color_offset+lncol;\n"
|
|
" fragColor.a = 1.0;\n";
|
|
|
|
const GLchar Yglprg_linecol_destalpha_cram_f[] =
|
|
-" vec4 txcolc = texelFetch( s_color, ivec2( ( int(txcol.g*65280.0) | int(txcol.r*255.0)) ,0 ) , 0 );\n"
|
|
+" vec4 txcolc = texelFetch( s_color, ivec2( ( int(round(txcol.g*65280.0)) | int(round(txcol.r*255.0)) ) ,0 ) , 0 );\n"
|
|
" fragColor = (txcolc * (1.0-lncol.a))+(lncol*lncol.a)+u_color_offset;\n"
|
|
" fragColor.a =txcol.a;\n";
|
|
|