mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-28 09:59:32 -06:00
VideoCommon: allow custom shaders to set the alpha value for use when blending is enabled
This commit is contained in:
@ -1506,6 +1506,24 @@ ShaderCode GenPixelShader(APIType api_type, const ShaderHostConfig& host_config,
|
||||
" }}\n"
|
||||
"\n");
|
||||
|
||||
for (std::size_t i = 0; i < custom_details.shaders.size(); i++)
|
||||
{
|
||||
const auto& shader_details = custom_details.shaders[i];
|
||||
|
||||
if (!shader_details.custom_shader.empty())
|
||||
{
|
||||
out.Write("\t{{\n");
|
||||
out.Write("\t\tcustom_data.final_color = float4(TevResult.r / 255.0, TevResult.g / 255.0, "
|
||||
"TevResult.b / 255.0, TevResult.a / 255.0);\n");
|
||||
out.Write("\t\tCustomShaderOutput custom_output = {}_{}(custom_data);\n",
|
||||
CUSTOM_PIXELSHADER_COLOR_FUNC, i);
|
||||
out.Write(
|
||||
"\t\tTevResult = int4(custom_output.main_rt.r * 255, custom_output.main_rt.g * 255, "
|
||||
"custom_output.main_rt.b * 255, custom_output.main_rt.a * 255);\n");
|
||||
out.Write("\t}}\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (use_framebuffer_fetch)
|
||||
{
|
||||
static constexpr std::array<const char*, 16> logic_op_mode{
|
||||
@ -1594,31 +1612,6 @@ ShaderCode GenPixelShader(APIType api_type, const ShaderHostConfig& host_config,
|
||||
}
|
||||
}
|
||||
|
||||
for (std::size_t i = 0; i < custom_details.shaders.size(); i++)
|
||||
{
|
||||
const auto& shader_details = custom_details.shaders[i];
|
||||
|
||||
if (!shader_details.custom_shader.empty())
|
||||
{
|
||||
out.Write("\t{{\n");
|
||||
if (uid_data->uint_output)
|
||||
{
|
||||
out.Write("\t\tcustom_data.final_color = float4(ocol0.x / 255.0, ocol0.y / 255.0, ocol0.z "
|
||||
"/ 255.0, ocol0.w / 255.0);\n");
|
||||
out.Write("\t\tfloat3 custom_output = {}_{}(custom_data).xyz;\n",
|
||||
CUSTOM_PIXELSHADER_COLOR_FUNC, i);
|
||||
out.Write("\t\tocol0.xyz = uint3(custom_output.x * 255, custom_output.y * 255, "
|
||||
"custom_output.z * 255);\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
out.Write("\t\tcustom_data.final_color = ocol0;\n");
|
||||
out.Write("\t\tocol0.xyz = {}_{}(custom_data).xyz;\n", CUSTOM_PIXELSHADER_COLOR_FUNC, i);
|
||||
}
|
||||
out.Write("\t}}\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (bounding_box)
|
||||
{
|
||||
out.Write(" if (bpmem_bounding_box) {{\n"
|
||||
|
Reference in New Issue
Block a user