gtk/gsk/vulkan/resources/texture.frag
Benjamin Otte 8207c548cc vulkan: Combine textures and samplers again
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/
2023-07-16 12:12:36 +02:00

19 lines
438 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 inRect;
layout(location = 2) in vec2 inTexCoord;
layout(location = 3) flat in uint inTexId;
layout(location = 0) out vec4 color;
void main()
{
float alpha = rect_coverage (inRect, inPos);
color = clip_scaled (inPos, texture (get_sampler (inTexId), inTexCoord) * alpha);
}