mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 06:21:14 +00:00
8207c548cc
This reverts most of commit f420c143e0
again because it turns out GPUs like combined images and samplers.
But: The one thing we don't revert is allowing the C code to select any
combination of sampler and image:
gsk_vulkan_render_get_image_descriptor() now takes a 2nd argument
specifying the sampler.
This allows the same flexibility as before, we just combine things
early.
This change was inspired by
https://developer.nvidia.com/blog/vulkan-dos-donts/
27 lines
828 B
GLSL
27 lines
828 B
GLSL
#version 450
|
|
|
|
#include "common.frag.glsl"
|
|
#include "clip.frag.glsl"
|
|
#include "rect.frag.glsl"
|
|
|
|
layout(location = 0) in vec2 inPos;
|
|
layout(location = 1) in Rect inStartRect;
|
|
layout(location = 2) in Rect inEndRect;
|
|
layout(location = 3) in vec2 inStartTexCoord;
|
|
layout(location = 4) in vec2 inEndTexCoord;
|
|
layout(location = 5) flat in uint inStartTexId;
|
|
layout(location = 6) flat in uint inEndTexId;
|
|
layout(location = 7) in float inProgress;
|
|
|
|
layout(location = 0) out vec4 color;
|
|
|
|
void main()
|
|
{
|
|
float start_alpha = rect_coverage (inStartRect, inPos);
|
|
vec4 start = texture (get_sampler (inStartTexId), inStartTexCoord) * start_alpha;
|
|
float end_alpha = rect_coverage (inEndRect, inPos);
|
|
vec4 end = texture (get_sampler (inEndTexId), inEndTexCoord) * end_alpha;
|
|
|
|
color = clip_scaled (inPos, mix (start, end, inProgress));
|
|
}
|