From c9766d8e286c4dc1e936fb86d7c2da8b36ed7553 Mon Sep 17 00:00:00 2001 From: jpark37 Date: Tue, 6 Jul 2021 21:46:13 -0700 Subject: [PATCH] libobs: Add DrawSrgbDecompress default technique Useful when the texture does not support SRGB conversion on load. --- libobs/data/default.effect | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libobs/data/default.effect b/libobs/data/default.effect index bc343ad14..86d4c6d82 100644 --- a/libobs/data/default.effect +++ b/libobs/data/default.effect @@ -62,6 +62,13 @@ float4 PSDrawNonlinearAlpha(VertInOut vert_in) : TARGET return rgba; } +float4 PSDrawSrgbDecompress(VertInOut vert_in) : TARGET +{ + float4 rgba = image.Sample(def_sampler, vert_in.uv); + rgba.rgb = srgb_nonlinear_to_linear(rgba.rgb); + return rgba; +} + float4 PSDrawSrgbDecompressPremultiplied(VertInOut vert_in) : TARGET { float4 rgba = image.Sample(def_sampler, vert_in.uv); @@ -97,6 +104,15 @@ technique DrawNonlinearAlpha } } +technique DrawSrgbDecompress +{ + pass + { + vertex_shader = VSDefault(vert_in); + pixel_shader = PSDrawSrgbDecompress(vert_in); + } +} + technique DrawSrgbDecompressPremultiplied { pass