diff options
author | Alexander Orzechowski <alex@ozal.ski> | 2023-06-19 12:05:11 -0400 |
---|---|---|
committer | Alexander Orzechowski <alex@ozal.ski> | 2023-06-19 12:25:38 -0400 |
commit | 6bd44c4fcd45aa64a757f8797db78252d2fee3b4 (patch) | |
tree | 2b7f4c3e51f00e3234e73435b02ba51b24be884d /render/vulkan | |
parent | 64c0272f818523537fe8e133d97539e50fdfec64 (diff) |
renderer: Introduce wlr_scale_filter_mode
Diffstat (limited to 'render/vulkan')
-rw-r--r-- | render/vulkan/pass.c | 1 | ||||
-rw-r--r-- | render/vulkan/renderer.c | 17 |
2 files changed, 16 insertions, 2 deletions
diff --git a/render/vulkan/pass.c b/render/vulkan/pass.c index acc2a5ae..7ac5cf95 100644 --- a/render/vulkan/pass.c +++ b/render/vulkan/pass.c @@ -547,6 +547,7 @@ static void render_pass_add_texture(struct wlr_render_pass *wlr_pass, .source = WLR_VK_SHADER_SOURCE_TEXTURE, .layout = { .ycbcr_format = texture->format->is_ycbcr ? texture->format : NULL, + .filter_mode = options->filter_mode, }, .texture_transform = texture->transform, }); diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c index 205f40ad..374d6384 100644 --- a/render/vulkan/renderer.c +++ b/render/vulkan/renderer.c @@ -2073,6 +2073,10 @@ static bool pipeline_layout_key_equals( assert(!a->ycbcr_format || a->ycbcr_format->is_ycbcr); assert(!b->ycbcr_format || b->ycbcr_format->is_ycbcr); + if (a->filter_mode != b->filter_mode) { + return false; + } + if (a->ycbcr_format != b->ycbcr_format) { return false; } @@ -2384,12 +2388,21 @@ struct wlr_vk_pipeline_layout *get_or_create_pipeline_layout( pipeline_layout->key = *key; VkResult res; + VkFilter filter; + switch (key->filter_mode) { + case WLR_SCALE_FILTER_BILINEAR: + filter = VK_FILTER_LINEAR; + break; + case WLR_SCALE_FILTER_NEAREST: + filter = VK_FILTER_NEAREST; + break; + } VkSamplerYcbcrConversionInfo conversion_info; VkSamplerCreateInfo sampler_create_info = { .sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, - .magFilter = VK_FILTER_LINEAR, - .minFilter = VK_FILTER_LINEAR, + .magFilter = filter, + .minFilter = filter, .mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST, .addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, .addressModeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, |