vulkan: add support for blend buffers
This commit is contained in:
parent
1220539a41
commit
cb9da22ec2
20 changed files with 638 additions and 78 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#version 450
|
||||
|
||||
#include "frag_spec_const.glsl"
|
||||
#include "transfer_functions.glsl"
|
||||
#include "tex.common.glsl"
|
||||
|
||||
layout(set = 0, binding = 0) uniform sampler2D tex;
|
||||
|
|
@ -8,13 +9,22 @@ layout(location = 0) in vec2 tex_pos;
|
|||
layout(location = 0) out vec4 out_color;
|
||||
|
||||
void main() {
|
||||
vec4 c = textureLod(tex, tex_pos, 0);
|
||||
if (color_management) {
|
||||
if (src_has_alpha) {
|
||||
c.rgb /= mix(c.a, 1.0, c.a == 0.0);
|
||||
}
|
||||
c.rgb = eotf_srgb(c.rgb);
|
||||
if (src_has_alpha) {
|
||||
c.rgb *= c.a;
|
||||
}
|
||||
}
|
||||
if (has_alpha_multiplier) {
|
||||
if (src_has_alpha) {
|
||||
out_color = textureLod(tex, tex_pos, 0) * data.mul;
|
||||
c *= data.mul;
|
||||
} else {
|
||||
out_color = vec4(textureLod(tex, tex_pos, 0).rgb * data.mul, data.mul);
|
||||
c = vec4(c.rgb * data.mul, data.mul);
|
||||
}
|
||||
} else {
|
||||
out_color = textureLod(tex, tex_pos, 0);
|
||||
}
|
||||
out_color = c;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue