diff --git a/src/platform/linux/cuda.cpp b/src/platform/linux/cuda.cpp index 492adbd1238..61c31e47c8f 100644 --- a/src/platform/linux/cuda.cpp +++ b/src/platform/linux/cuda.cpp @@ -504,7 +504,7 @@ namespace cuda { * @brief Configures shader parameters for the specified colorspace. */ void apply_colorspace() override { - sws.apply_colorspace(colorspace); + sws.apply_colorspace(colorspace, is_yuv444); } file_t file; diff --git a/src/platform/linux/graphics.cpp b/src/platform/linux/graphics.cpp index e2077595112..395d4528cc3 100644 --- a/src/platform/linux/graphics.cpp +++ b/src/platform/linux/graphics.cpp @@ -856,7 +856,7 @@ namespace egl { return yuv444; } - void sws_t::apply_colorspace(const video::sunshine_colorspace_t &colorspace) { + void sws_t::apply_colorspace(const video::sunshine_colorspace_t &colorspace, bool is_yuv444) { auto color_p = video::color_vectors_from_colorspace(colorspace, true); std::string_view members[] { @@ -869,9 +869,11 @@ namespace egl { color_matrix.update(members, sizeof(members) / sizeof(decltype(members[0]))); - program[0].bind(color_matrix); - program[1].bind(color_matrix); - program[2].bind(color_matrix); + int planesCount = is_yuv444 ? 3 : 2; + + for (int i = 0; i < planesCount; i++) { + program[i].bind(color_matrix); + } } int configure_sws_pipeline(sws_t &sws, const video::color_t *color_p, gl::tex_t &&tex, bool is_yuv444) { diff --git a/src/platform/linux/graphics.h b/src/platform/linux/graphics.h index 7455cf11f3e..33fcaa79f8d 100644 --- a/src/platform/linux/graphics.h +++ b/src/platform/linux/graphics.h @@ -375,7 +375,7 @@ namespace egl { void load_ram(platf::img_t &img); void load_vram(img_descriptor_t &img, int offset_x, int offset_y, int texture, bool is_yuv444); - void apply_colorspace(const video::sunshine_colorspace_t &colorspace); + void apply_colorspace(const video::sunshine_colorspace_t &colorspace, bool is_yuv444); // The first texture is the monitor image. // The second texture is the cursor image diff --git a/src/platform/linux/vaapi.cpp b/src/platform/linux/vaapi.cpp index 55c6a5aee18..63167abd3d2 100644 --- a/src/platform/linux/vaapi.cpp +++ b/src/platform/linux/vaapi.cpp @@ -381,7 +381,7 @@ namespace va { } void apply_colorspace() override { - sws.apply_colorspace(colorspace); + sws.apply_colorspace(colorspace, false); } va::display_t::pointer va_display;