From 10d6d5f0ca282f8d44c26505dc2e26d1b75fff6e Mon Sep 17 00:00:00 2001 From: Cephas Reis Date: Tue, 27 Dec 2016 14:42:35 -0600 Subject: [PATCH] obs-filters.c: Fix color correction filter OpenGL crash When using this filter in/on OpenGL situations can cause crashes with an "int to vec4" cast. This fix should resolve that issue. Closes jp9000/obs-studio#739 --- .../data/color_correction_filter.effect | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/plugins/obs-filters/data/color_correction_filter.effect b/plugins/obs-filters/data/color_correction_filter.effect index fd04a2bfc..7d599b683 100644 --- a/plugins/obs-filters/data/color_correction_filter.effect +++ b/plugins/obs-filters/data/color_correction_filter.effect @@ -35,10 +35,6 @@ struct VertData { float2 uv : TEXCOORD0; }; -struct CurrentPixel { - float4 current_pixel; -}; - VertData VSDefault(VertData vert_in) { VertData vert_out; @@ -49,23 +45,20 @@ VertData VSDefault(VertData vert_in) float4 PSColorFilterRGBA(VertData vert_in) : TARGET { - /* Realize the struct. */ - CurrentPixel pixel = (CurrentPixel) 0; - /* Grab the current pixel to perform operations on. */ - pixel.current_pixel = image.Sample(textureSampler, vert_in.uv); + float4 currentPixel = image.Sample(textureSampler, vert_in.uv); /* Always address the gamma first. */ - pixel.current_pixel.rgb = pow(pixel.current_pixel.rgb, gamma); + currentPixel.rgb = pow(currentPixel.rgb, gamma); /* Much easier to manipulate pixels for these types of operations * when in a matrix such as the below. See * http://www.graficaobscura.com/matrix/index.html and * https://docs.rainmeter.net/tips/colormatrix-guide/for more info. */ - pixel.current_pixel = mul(color_matrix, pixel.current_pixel); + currentPixel = mul(color_matrix, currentPixel); - return pixel.current_pixel; + return currentPixel; } technique Draw