1
0
Fork 0
forked from wry/wry

vulkan: rewrite shaders in terms of eotf and oetf

This commit is contained in:
Julian Orth 2025-02-25 14:52:43 +01:00
parent cb9dc4c182
commit b7f93b37a6
8 changed files with 52 additions and 14 deletions

View file

@ -1,6 +1,11 @@
#ifndef TRANSFER_FUNCTIONS_GLSL
#define TRANSFER_FUNCTIONS_GLSL
#include "frag_spec_const.glsl"
#define SRGB 0
#define LINEAR 1
vec3 eotf_srgb(vec3 c) {
return mix(
c * vec3(1.0 / 12.92),
@ -18,4 +23,20 @@ vec3 oetf_srgb(vec3 c) {
);
}
vec3 apply_eotf(vec3 c) {
switch (eotf) {
case SRGB: return eotf_srgb(c);
case LINEAR: return c;
default: return c;
}
}
vec3 apply_oetf(vec3 c) {
switch (oetf) {
case SRGB: return oetf_srgb(c);
case LINEAR: return c;
default: return c;
}
}
#endif