Files
gio/gpu/shaders/common.inc
T
Elias Naur c20c1ab96f gpu/shaders: compensate for GPU Framebuffer => texture transformation
Add fboTextureTransform shader function for cancelling the
implied transformation from fragments output by the fragment
shader and the (u, v) coordinates used to sample from it in a
later pass.

For OpenGL the transformation is the identity.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-02-27 21:22:59 +01:00

18 lines
480 B
PHP

// SPDX-License-Identifier: Unlicense OR MIT
// fboTextureTransform returns a transformation
// that cancels the implied transformation between
// the framebuffer and its texture.
// Only two rows are returned. The last is implied
// to be [0, 0, 1].
vec3[2] fboTextureTransform() {
vec3[2] t;
t[0] = vec3(1.0, 0.0, 0.0);
t[1] = vec3(0.0, 1.0, 0.0);
return t;
}
vec3 transform3x2(vec3[2] t, vec3 v) {
return vec3(dot(t[0], v), dot(t[1], v), dot(vec3(0.0, 0.0, 1.0), v));
}