2022-10-25 04:31:35 +00:00
|
|
|
#version 420 core
|
2022-11-13 23:52:13 +00:00
|
|
|
#extension GL_EXT_samplerless_texture_functions : enable
|
2022-10-25 04:31:35 +00:00
|
|
|
|
|
|
|
layout(set = 0, binding = 0)
|
|
|
|
uniform texture2D source_texture;
|
|
|
|
|
|
|
|
layout(location = 0) in vec2 source_coords;
|
|
|
|
|
|
|
|
layout(location = 0) out vec4 target_color;
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
// We get free nonlinear -> linear conversion when sampling from srgb texture;
|
|
|
|
vec4 linear = texelFetch(source_texture, ivec2(source_coords), 0);
|
|
|
|
vec4 premultiplied_linear = vec4(linear.rgb * linear.a, linear.a);
|
|
|
|
// We get free linear -> nonlinear conversion rendering to srgb texture.
|
|
|
|
target_color = premultiplied_linear;
|
|
|
|
}
|