rtoumazet / saturnin

Saturnin is a Sega Saturn emulator
Apache License 2.0
2 stars 0 forks source link

Use clamp function instead of manual code in shaders #261

Closed rtoumazet closed 1 year ago

rtoumazet commented 1 year ago

Tip from @FCare : Replace this code

if(out_color.r > 1.0) out_color.r = 1.0;
if(out_color.g > 1.0) out_color.g = 1.0;
if(out_color.b > 1.0) out_color.b = 1.0;
if(out_color.r < 0.0) out_color.r = 0.0;
if(out_color.g < 0.0) out_color.g = 0.0;
if(out_color.b < 0.0) out_color.b = 0.0;

by this one which is way more efficient out_color.rgb = clamp(out_color.rgb, vec3(0.0), vec3(1.0));