Skip to content

Commit

Permalink
GPU/HW: Clear alpha channel in opaque replacements
Browse files Browse the repository at this point in the history
This is the value for bit15 in the framebuffer. Silent Hill
needs it to be zero, I'm not aware of anything that needs
specific values yet. If it did, we'd need a different dumping
technique.
  • Loading branch information
stenzek committed Jan 16, 2025
1 parent a0c075e commit cd8a160
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/core/gpu_hw_shadergen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1880,11 +1880,14 @@ std::string GPU_HW_ShaderGen::GenerateReplacementMergeFragmentShader(bool semitr
o_col0.a = (color.a <= 0.95f) ? 1.0f : 0.0f;
o_col0.a = VECTOR_EQ(color, float4(0.0, 0.0, 0.0, 0.0)) ? 0.0f : o_col0.a;
#else
// Map anything with an alpha below 0.5 to transparent.
// Leave (0,0,0,0) as 0000 for opaque replacements for cutout alpha.
o_col0.a = color.a;
o_col0.rgb = lerp(o_col0.rgb, float3(0.0, 0.0, 0.0), float(color.a < 0.5));
// Map anything with an alpha below 0.5 to transparent.
o_col0 = lerp(o_col0, float4(0.0, 0.0, 0.0, 0.0), float(o_col0.a < 0.5));
// Clear alpha channel. This is the value for bit15 in the framebuffer.
// Silent Hill needs it to be zero, I'm not aware of anything that needs
// specific values yet. If it did, we'd need a different dumping technique.
o_col0.a = 0.0;
#endif
}
)";
Expand Down

0 comments on commit cd8a160

Please sign in to comment.