[client] egl: move shaders into seperate files and build into objects

This commit is contained in:
Geoffrey McRae
2019-03-28 14:59:54 +11:00
parent 52c4e15c76
commit d5a52241b0
7 changed files with 114 additions and 74 deletions

View File

@@ -0,0 +1,20 @@
#version 300 es
layout(location = 0) in vec3 vertexPosition_modelspace;
layout(location = 1) in vec2 vertexUV;
uniform vec4 position;
out highp vec2 uv;
void main()
{
gl_Position.xyz = vertexPosition_modelspace;
gl_Position.w = 1.0;
gl_Position.x -= position.x;
gl_Position.y -= position.y;
gl_Position.x *= position.z;
gl_Position.y *= position.w;
uv = vertexUV;
}

View File

@@ -0,0 +1,11 @@
#version 300 es
in highp vec2 uv;
out highp vec4 color;
uniform sampler2D sampler1;
void main()
{
color = texture(sampler1, uv);
}

View File

@@ -0,0 +1,27 @@
#version 300 es
in highp vec2 uv;
out highp vec4 color;
uniform sampler2D sampler1;
uniform sampler2D sampler2;
uniform sampler2D sampler3;
void main()
{
highp vec4 yuv = vec4(
texture(sampler1, uv).r,
texture(sampler2, uv).r,
texture(sampler3, uv).r,
1.0
);
highp mat4 yuv_to_rgb = mat4(
1.0, 0.0 , 1.402, -0.701,
1.0, -0.344, -0.714, 0.529,
1.0, 1.772, 0.0 , -0.886,
1.0, 1.0 , 1.0 , 1.0
);
color = yuv * yuv_to_rgb;
}