2019-10-07 23:12:06 +00:00
|
|
|
// Copyright 2017, James Sarrett.
|
|
|
|
// Copyright 2017, Bastiaan Olij.
|
|
|
|
// Copyright 2019, Collabora, Ltd.
|
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
|
|
// Author: James Sarrett <jsarrett@gmail.com>
|
|
|
|
// Author: Bastiaan Olij <mux213@gmail.com>
|
|
|
|
// Author: Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
|
|
|
|
// Author: Pete Black <pete.black@collabora.com>
|
|
|
|
|
|
|
|
#version 450
|
|
|
|
|
2019-10-23 10:07:33 +00:00
|
|
|
layout (binding = 0) uniform sampler2D tex_sampler;
|
|
|
|
|
2019-10-07 23:12:06 +00:00
|
|
|
layout (binding = 1, std140) uniform UBO
|
|
|
|
{
|
|
|
|
// Distoriton coefficients (PanoTools model) [a,b,c,d]
|
2019-10-23 10:07:33 +00:00
|
|
|
vec4 hmd_warp_param;
|
2019-10-07 23:12:06 +00:00
|
|
|
|
|
|
|
// chromatic distortion post scaling
|
|
|
|
vec4 aberr;
|
|
|
|
|
|
|
|
// Position of lens center in m (usually eye_w/2, eye_h/2)
|
2019-10-23 10:07:33 +00:00
|
|
|
vec2 lens_center[2];
|
2019-10-07 23:12:06 +00:00
|
|
|
|
|
|
|
// Scale from texture co-ords to m (usually eye_w, eye_h)
|
2019-10-23 10:07:33 +00:00
|
|
|
vec2 viewport_scale;
|
2019-10-07 23:12:06 +00:00
|
|
|
|
|
|
|
// Distortion overall scale in m (usually ~eye_w/2)
|
2019-10-23 10:07:33 +00:00
|
|
|
float warp_scale;
|
2019-10-07 23:12:06 +00:00
|
|
|
} ubo;
|
|
|
|
|
2019-10-23 10:07:33 +00:00
|
|
|
layout (location = 0) in vec2 in_ruv;
|
|
|
|
layout (location = 1) in vec2 in_guv;
|
|
|
|
layout (location = 2) in vec2 in_buv;
|
2019-10-17 04:37:58 +00:00
|
|
|
layout (location = 0) out vec4 out_color;
|
2019-10-07 23:12:06 +00:00
|
|
|
|
2019-10-23 10:07:33 +00:00
|
|
|
|
2019-10-07 23:12:06 +00:00
|
|
|
void main()
|
|
|
|
{
|
2019-10-23 10:07:33 +00:00
|
|
|
float r = texture(tex_sampler, in_ruv).x;
|
|
|
|
float g = texture(tex_sampler, in_guv).y;
|
|
|
|
float b = texture(tex_sampler, in_buv).z;
|
2019-10-10 12:04:16 +00:00
|
|
|
|
2019-10-17 04:37:58 +00:00
|
|
|
out_color = vec4(r, g, b, 1.0);
|
2019-10-07 23:12:06 +00:00
|
|
|
}
|