PixelShaderGen: Add support for non-dual source shader blending

This commit is contained in:
OatmealDome 2022-01-06 04:15:07 -05:00
parent bad0283ff7
commit c1d87db6fa
1 changed files with 11 additions and 9 deletions

View File

@ -2018,8 +2018,8 @@ static void WriteBlend(ShaderCode& out, const pixel_shader_uid_data* uid_data)
"float3(1,1,1);", // ONE "float3(1,1,1);", // ONE
"initial_ocol0.rgb;", // DSTCLR "initial_ocol0.rgb;", // DSTCLR
"float3(1,1,1) - initial_ocol0.rgb;", // INVDSTCLR "float3(1,1,1) - initial_ocol0.rgb;", // INVDSTCLR
"ocol1.aaa;", // SRCALPHA "src_color.aaa;", // SRCALPHA
"float3(1,1,1) - ocol1.aaa;", // INVSRCALPHA "float3(1,1,1) - src_color.aaa;", // INVSRCALPHA
"initial_ocol0.aaa;", // DSTALPHA "initial_ocol0.aaa;", // DSTALPHA
"float3(1,1,1) - initial_ocol0.aaa;", // INVDSTALPHA "float3(1,1,1) - initial_ocol0.aaa;", // INVDSTALPHA
}; };
@ -2028,8 +2028,8 @@ static void WriteBlend(ShaderCode& out, const pixel_shader_uid_data* uid_data)
"1.0;", // ONE "1.0;", // ONE
"initial_ocol0.a;", // DSTCLR "initial_ocol0.a;", // DSTCLR
"1.0 - initial_ocol0.a;", // INVDSTCLR "1.0 - initial_ocol0.a;", // INVDSTCLR
"ocol1.a;", // SRCALPHA "src_color.a;", // SRCALPHA
"1.0 - ocol1.a;", // INVSRCALPHA "1.0 - src_color.a;", // INVSRCALPHA
"initial_ocol0.a;", // DSTALPHA "initial_ocol0.a;", // DSTALPHA
"1.0 - initial_ocol0.a;", // INVDSTALPHA "1.0 - initial_ocol0.a;", // INVDSTALPHA
}; };
@ -2038,8 +2038,8 @@ static void WriteBlend(ShaderCode& out, const pixel_shader_uid_data* uid_data)
"float3(1,1,1);", // ONE "float3(1,1,1);", // ONE
"ocol0.rgb;", // SRCCLR "ocol0.rgb;", // SRCCLR
"float3(1,1,1) - ocol0.rgb;", // INVSRCCLR "float3(1,1,1) - ocol0.rgb;", // INVSRCCLR
"ocol1.aaa;", // SRCALHA "src_color.aaa;", // SRCALHA
"float3(1,1,1) - ocol1.aaa;", // INVSRCALPHA "float3(1,1,1) - src_color.aaa;", // INVSRCALPHA
"initial_ocol0.aaa;", // DSTALPHA "initial_ocol0.aaa;", // DSTALPHA
"float3(1,1,1) - initial_ocol0.aaa;", // INVDSTALPHA "float3(1,1,1) - initial_ocol0.aaa;", // INVDSTALPHA
}; };
@ -2048,12 +2048,14 @@ static void WriteBlend(ShaderCode& out, const pixel_shader_uid_data* uid_data)
"1.0;", // ONE "1.0;", // ONE
"ocol0.a;", // SRCCLR "ocol0.a;", // SRCCLR
"1.0 - ocol0.a;", // INVSRCCLR "1.0 - ocol0.a;", // INVSRCCLR
"ocol1.a;", // SRCALPHA "src_color.a;", // SRCALPHA
"1.0 - ocol1.a;", // INVSRCALPHA "1.0 - src_color.a;", // INVSRCALPHA
"initial_ocol0.a;", // DSTALPHA "initial_ocol0.a;", // DSTALPHA
"1.0 - initial_ocol0.a;", // INVDSTALPHA "1.0 - initial_ocol0.a;", // INVDSTALPHA
}; };
out.Write("\tfloat4 blend_src;\n"); out.Write("\tfloat4 src_color = {};\n"
"\tfloat4 blend_src;",
uid_data->useDstAlpha ? "ocol1" : "ocol0");
out.Write("\tblend_src.rgb = {}\n", blend_src_factor[uid_data->blend_src_factor]); out.Write("\tblend_src.rgb = {}\n", blend_src_factor[uid_data->blend_src_factor]);
out.Write("\tblend_src.a = {}\n", blend_src_factor_alpha[uid_data->blend_src_factor_alpha]); out.Write("\tblend_src.a = {}\n", blend_src_factor_alpha[uid_data->blend_src_factor_alpha]);
out.Write("\tfloat4 blend_dst;\n"); out.Write("\tfloat4 blend_dst;\n");