mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-01 22:58:38 -04:00
render/vulkan: add Vulkan renderer
This new renderer is implemented with the existing wlr_renderer API (which is known to be sub-optimal for some operations). It's not used by default, but users can opt-in by setting WLR_RENDERER=vulkan. The renderer depends on VK_EXT_image_drm_format_modifier and VK_EXT_physical_device_drm. Co-authored-by: Simon Ser <contact@emersion.fr> Co-authored-by: Jan Beich <jbeich@FreeBSD.org>
This commit is contained in:
parent
2edf468aeb
commit
8e34692250
21 changed files with 3704 additions and 2 deletions
25
render/vulkan/shaders/texture.frag
Normal file
25
render/vulkan/shaders/texture.frag
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#version 450
|
||||
|
||||
layout(set = 0, binding = 0) uniform sampler2D tex;
|
||||
|
||||
layout(location = 0) in vec2 uv;
|
||||
layout(location = 0) out vec4 out_color;
|
||||
|
||||
layout(push_constant) uniform UBO {
|
||||
layout(offset = 80) float alpha;
|
||||
} data;
|
||||
|
||||
void main() {
|
||||
out_color = textureLod(tex, uv, 0);
|
||||
|
||||
// We expect this shader to output pre-alpha-multiplied color values.
|
||||
// alpha < 0.0 means that this shader should ignore the texture's alpha
|
||||
// value.
|
||||
if (data.alpha < 0.0) {
|
||||
out_color.a = -data.alpha;
|
||||
out_color.rgb *= -data.alpha;
|
||||
} else {
|
||||
out_color *= data.alpha;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue