2019-03-28 03:59:54 +00:00
|
|
|
#version 300 es
|
2023-03-08 22:20:01 +00:00
|
|
|
#extension GL_OES_EGL_image_external_essl3 : enable
|
|
|
|
|
2023-03-05 03:10:21 +00:00
|
|
|
precision highp float;
|
2019-03-28 03:59:54 +00:00
|
|
|
|
2021-02-22 04:56:51 +00:00
|
|
|
#define EGL_SCALE_AUTO 0
|
|
|
|
#define EGL_SCALE_NEAREST 1
|
|
|
|
#define EGL_SCALE_LINEAR 2
|
|
|
|
#define EGL_SCALE_MAX 3
|
2021-02-21 00:50:59 +00:00
|
|
|
|
2021-08-09 09:15:42 +00:00
|
|
|
#include "color_blind.h"
|
|
|
|
|
2021-08-11 10:41:56 +00:00
|
|
|
in vec2 uv;
|
|
|
|
out vec4 color;
|
2019-03-28 03:59:54 +00:00
|
|
|
|
|
|
|
uniform sampler2D sampler1;
|
2019-04-19 01:23:51 +00:00
|
|
|
|
2021-08-11 10:41:56 +00:00
|
|
|
uniform int scaleAlgo;
|
2019-04-19 01:23:51 +00:00
|
|
|
|
2021-08-11 10:41:56 +00:00
|
|
|
uniform float nvGain;
|
|
|
|
uniform int cbMode;
|
2019-03-28 03:59:54 +00:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2021-02-21 00:50:59 +00:00
|
|
|
switch (scaleAlgo)
|
|
|
|
{
|
2021-02-22 04:56:51 +00:00
|
|
|
case EGL_SCALE_NEAREST:
|
2023-03-08 22:20:01 +00:00
|
|
|
{
|
2021-11-11 20:41:59 +00:00
|
|
|
vec2 ts = vec2(textureSize(sampler1, 0));
|
|
|
|
color = texelFetch(sampler1, ivec2(uv * ts), 0);
|
2021-02-21 00:50:59 +00:00
|
|
|
break;
|
2023-03-08 22:20:01 +00:00
|
|
|
}
|
2021-02-21 00:50:59 +00:00
|
|
|
|
2021-02-22 04:56:51 +00:00
|
|
|
case EGL_SCALE_LINEAR:
|
2023-03-08 22:20:01 +00:00
|
|
|
{
|
2021-08-03 00:45:47 +00:00
|
|
|
color = texture(sampler1, uv);
|
2021-02-21 00:50:59 +00:00
|
|
|
break;
|
2023-03-08 22:20:01 +00:00
|
|
|
}
|
2021-02-21 00:50:59 +00:00
|
|
|
}
|
2019-03-30 13:08:52 +00:00
|
|
|
|
2020-11-08 19:59:54 +00:00
|
|
|
if (cbMode > 0)
|
2021-08-09 09:15:42 +00:00
|
|
|
color = cbTransform(color, cbMode);
|
2020-11-08 19:59:54 +00:00
|
|
|
|
2021-08-09 04:08:10 +00:00
|
|
|
if (nvGain > 0.0)
|
2019-03-30 13:08:52 +00:00
|
|
|
{
|
2022-01-26 12:03:35 +00:00
|
|
|
highp float lumi = (0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b);
|
|
|
|
if (lumi < 0.5)
|
|
|
|
color *= atanh((1.0 - lumi) * 2.0 - 1.0) + 1.0;
|
2019-03-28 13:15:14 +00:00
|
|
|
color *= nvGain;
|
2019-03-30 13:08:52 +00:00
|
|
|
}
|
2021-01-27 02:49:22 +00:00
|
|
|
|
|
|
|
color.a = 1.0;
|
2019-03-28 03:59:54 +00:00
|
|
|
}
|