2019-03-28 03:59:54 +00:00
|
|
|
#version 300 es
|
|
|
|
|
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"
|
|
|
|
|
2019-03-28 03:59:54 +00:00
|
|
|
in highp vec2 uv;
|
|
|
|
out highp vec4 color;
|
|
|
|
|
|
|
|
uniform sampler2D sampler1;
|
2019-04-19 01:23:51 +00:00
|
|
|
|
2021-02-21 00:50:59 +00:00
|
|
|
uniform int scaleAlgo;
|
2021-08-10 03:08:54 +00:00
|
|
|
uniform highp ivec2 textureSize;
|
2019-04-19 01:23:51 +00:00
|
|
|
|
2019-03-28 13:15:14 +00:00
|
|
|
uniform highp float nvGain;
|
2020-11-08 19:59:54 +00:00
|
|
|
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:
|
2021-08-10 03:08:54 +00:00
|
|
|
color = texelFetch(sampler1, ivec2(uv * vec2(textureSize)), 0);
|
2021-02-21 00:50:59 +00:00
|
|
|
break;
|
|
|
|
|
2021-02-22 04:56:51 +00:00
|
|
|
case EGL_SCALE_LINEAR:
|
2021-08-03 00:45:47 +00:00
|
|
|
color = texture(sampler1, uv);
|
2021-02-21 00:50:59 +00:00
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
{
|
|
|
|
highp float lumi = 1.0 - (0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b);
|
|
|
|
color *= 1.0 + lumi;
|
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
|
|
|
}
|