mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
render, render/vulkan: add primaries to wlr_render_texture_options
This commit is contained in:
parent
a8144088df
commit
fa1feb447f
2 changed files with 17 additions and 1 deletions
|
|
@ -104,6 +104,8 @@ struct wlr_render_texture_options {
|
|||
enum wlr_render_blend_mode blend_mode;
|
||||
/* Transfer function the source texture is encoded with */
|
||||
enum wlr_color_transfer_function transfer_function;
|
||||
/* Primaries describing the color volume of the source texture */
|
||||
const struct wlr_color_primaries *primaries;
|
||||
|
||||
/* Wait for a timeline synchronization point before texturing.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -833,7 +833,21 @@ static void render_pass_add_texture(struct wlr_render_pass *wlr_pass,
|
|||
}
|
||||
|
||||
float color_matrix[9];
|
||||
wlr_matrix_identity(color_matrix);
|
||||
if (options->primaries != NULL) {
|
||||
struct wlr_color_primaries srgb;
|
||||
wlr_color_primaries_from_named(&srgb, WLR_COLOR_NAMED_PRIMARIES_SRGB);
|
||||
|
||||
float src_primaries_to_xyz[9];
|
||||
wlr_color_primaries_to_xyz(options->primaries, src_primaries_to_xyz);
|
||||
float srgb_to_xyz[9];
|
||||
wlr_color_primaries_to_xyz(&srgb, srgb_to_xyz);
|
||||
float xyz_to_srgb[9];
|
||||
matrix_invert(xyz_to_srgb, srgb_to_xyz);
|
||||
|
||||
wlr_matrix_multiply(color_matrix, xyz_to_srgb, src_primaries_to_xyz);
|
||||
} else {
|
||||
wlr_matrix_identity(color_matrix);
|
||||
}
|
||||
|
||||
struct wlr_vk_frag_texture_pcr_data frag_pcr_data = {
|
||||
.alpha = alpha,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue