From 9859b44b1c777f211168dc66617e45547b081a05 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Sat, 27 Nov 2021 01:34:57 +0100 Subject: [PATCH] obs/gs/mipmapper: Enable support for sRGB mip-mapping --- source/obs/gs/gs-mipmapper.cpp | 35 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/source/obs/gs/gs-mipmapper.cpp b/source/obs/gs/gs-mipmapper.cpp index f6f0e9e2..f5880475 100644 --- a/source/obs/gs/gs-mipmapper.cpp +++ b/source/obs/gs/gs-mipmapper.cpp @@ -284,6 +284,21 @@ void streamfx::obs::gs::mipmapper::rebuild(std::shared_ptr(cwidth); float_t iheight = 1.f / static_cast(cheight); - // Set up rendering state. - gs_blend_state_push(); - gs_reset_blend_state(); - gs_enable_blending(false); - gs_blend_function(GS_BLEND_ONE, GS_BLEND_ZERO); - gs_enable_color(true, true, true, true); - gs_enable_depth_test(false); - gs_enable_stencil_test(false); - gs_enable_stencil_write(false); - gs_set_cull_mode(GS_NEITHER); - try { auto op = _rt->render(cwidth, cheight); gs_ortho(0, 1, 0, 1, 0, 1); - _effect.get_parameter("image").set_texture(target); + _effect.get_parameter("image").set_texture(target, gs_get_linear_srgb()); _effect.get_parameter("imageTexel").set_float2(iwidth, iheight); _effect.get_parameter("level").set_int(int32_t(mip - 1)); while (gs_effect_loop(_effect.get_object(), "Draw")) { @@ -320,9 +324,6 @@ void streamfx::obs::gs::mipmapper::rebuild(std::shared_ptr