Skip to content

Commit

Permalink
[hud] Pre-multiply alpha before color space conversion
Browse files Browse the repository at this point in the history
Derp.
  • Loading branch information
doitsujin committed Nov 11, 2024
1 parent 3756e83 commit 757081a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/dxvk/hud/shaders/hud_chunk_frag_background.frag
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ void main() {
}

o_color.a *= opacity;
o_color = linear_to_output(o_color);
o_color.rgb *= o_color.a;
o_color = linear_to_output(o_color);
}
2 changes: 1 addition & 1 deletion src/dxvk/hud/shaders/hud_chunk_frag_visualize.frag
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ void main() {

float blendFactor = 0.5f * float(bitsSet) / max(float(bitsTotal), 1.0f);
o_color = vec4(mix(color.rgb, vec3(1.0f), blendFactor), color.a * opacity);
o_color = linear_to_output(o_color);
o_color.rgb *= o_color.a;
o_color = linear_to_output(o_color);
}
3 changes: 2 additions & 1 deletion src/dxvk/hud/shaders/hud_graph_frag.frag
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ void main() {
float diff = (diff_lo + diff_hi) + y_delta;
o_color = mix(bg_color, line_color, clamp(diff / y_delta, 0.0f, 1.0f));

o_color = linear_to_output(o_color);
o_color.a *= opacity;
o_color.rgb *= o_color.a;

o_color = linear_to_output(o_color);
}

0 comments on commit 757081a

Please sign in to comment.