render/vulkan: add suport for color encoding and range

This commit is contained in:
Simon Ser 2025-10-28 20:44:48 +01:00 committed by Simon Zeni
parent 2a87ec8a35
commit fecaf6d1e8
3 changed files with 70 additions and 29 deletions

View file

@ -681,7 +681,7 @@ static void render_pass_add_rect(struct wlr_render_pass *wlr_pass,
pass->render_setup,
&(struct wlr_vk_pipeline_key) {
.source = WLR_VK_SHADER_SOURCE_SINGLE_COLOR,
.layout = { .ycbcr_format = NULL },
.layout = {0},
});
if (!pipe) {
pass->failed = true;
@ -807,12 +807,26 @@ static void render_pass_add_texture(struct wlr_render_pass *wlr_pass,
break;
}
enum wlr_color_encoding color_encoding = options->color_encoding;
if (texture->format->is_ycbcr && color_encoding == WLR_COLOR_ENCODING_NONE) {
color_encoding = WLR_COLOR_ENCODING_BT601;
}
enum wlr_color_range color_range = options->color_range;
if (texture->format->is_ycbcr && color_range == WLR_COLOR_RANGE_NONE) {
color_range = WLR_COLOR_RANGE_LIMITED;
}
struct wlr_vk_pipeline *pipe = setup_get_or_create_pipeline(
pass->render_setup,
&(struct wlr_vk_pipeline_key) {
.source = WLR_VK_SHADER_SOURCE_TEXTURE,
.layout = {
.ycbcr_format = texture->format->is_ycbcr ? texture->format : NULL,
.ycbcr = {
.format = texture->format->is_ycbcr ? texture->format : NULL,
.encoding = color_encoding,
.range = color_range,
},
.filter_mode = options->filter_mode,
},
.texture_transform = tex_transform,