vulkan: rewrite shaders in terms of eotf and oetf
This commit is contained in:
parent
cb9dc4c182
commit
b7f93b37a6
8 changed files with 52 additions and 14 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue