mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2025-02-23 18:17:44 +11:00
fix(cross): rename identifiers for SPIRV-Cross compatibility
This commit is contained in:
parent
656c08b465
commit
14e9028e33
3 changed files with 12 additions and 12 deletions
|
@ -9,7 +9,7 @@ layout(push_constant) uniform Push
|
||||||
float NOGAMMA;
|
float NOGAMMA;
|
||||||
float MASKING;
|
float MASKING;
|
||||||
float BILINEAR;
|
float BILINEAR;
|
||||||
} param;
|
} params;
|
||||||
|
|
||||||
layout(std140, set = 0, binding = 0) uniform UBO
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
{
|
{
|
||||||
|
@ -76,7 +76,7 @@ vec3 linear2srgb(vec3 linear) {
|
||||||
#define BS 0.0722
|
#define BS 0.0722
|
||||||
|
|
||||||
vec3 rgb2vry(vec3 rgb) {
|
vec3 rgb2vry(vec3 rgb) {
|
||||||
if (param.NOGAMMA == 1.0)
|
if (params.NOGAMMA == 1.0)
|
||||||
return rgb;
|
return rgb;
|
||||||
|
|
||||||
// https://en.wikipedia.org/wiki/Opponent_process
|
// https://en.wikipedia.org/wiki/Opponent_process
|
||||||
|
@ -94,7 +94,7 @@ vec3 rgb2vry(vec3 rgb) {
|
||||||
return vry;
|
return vry;
|
||||||
}
|
}
|
||||||
vec3 vry2rgb(vec3 vry) {
|
vec3 vry2rgb(vec3 vry) {
|
||||||
if (param.NOGAMMA == 1.0)
|
if (params.NOGAMMA == 1.0)
|
||||||
return vry;
|
return vry;
|
||||||
|
|
||||||
// Magic.
|
// Magic.
|
||||||
|
@ -110,7 +110,7 @@ vec3 vry2rgb(vec3 vry) {
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 vry_interp(vec3 first, vec3 second, float frac) {
|
vec3 vry_interp(vec3 first, vec3 second, float frac) {
|
||||||
if (param.NOGAMMA == 1.0)
|
if (params.NOGAMMA == 1.0)
|
||||||
return first*NOT(frac) + second*YES(frac);
|
return first*NOT(frac) + second*YES(frac);
|
||||||
|
|
||||||
// Because the chroma values were generated on linear light, but the luma must be interpolated in perceptual gamma (3)
|
// Because the chroma values were generated on linear light, but the luma must be interpolated in perceptual gamma (3)
|
||||||
|
@ -131,7 +131,7 @@ vec3 vry_interp(vec3 first, vec3 second, float frac) {
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 percent(float ssize, float tsize, float coord) {
|
vec3 percent(float ssize, float tsize, float coord) {
|
||||||
if (param.BILINEAR == 1.0)
|
if (params.BILINEAR == 1.0)
|
||||||
tsize = ssize;
|
tsize = ssize;
|
||||||
|
|
||||||
float minfull = (coord*tsize - 0.5)/tsize*ssize;
|
float minfull = (coord*tsize - 0.5)/tsize*ssize;
|
||||||
|
@ -153,7 +153,7 @@ vec3 percent(float ssize, float tsize, float coord) {
|
||||||
void main() {
|
void main() {
|
||||||
vec2 viewportSize = global.OutputSize.xy;
|
vec2 viewportSize = global.OutputSize.xy;
|
||||||
vec2 gameCoord = vTexCoord;
|
vec2 gameCoord = vTexCoord;
|
||||||
if (param.MASKING == 1.0) {
|
if (params.MASKING == 1.0) {
|
||||||
float hscale = viewportSize.x/global.SourceSize.x;
|
float hscale = viewportSize.x/global.SourceSize.x;
|
||||||
float vscale = viewportSize.y/global.SourceSize.y;
|
float vscale = viewportSize.y/global.SourceSize.y;
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,7 @@ void main()
|
||||||
|
|
||||||
vec4 hori = vec4(low.x < max(D.w, A.w), low.x < max(E.w, B.w), low.z < max(E.w, H.w), low.z < max(D.w, G.w)) * clr; // horizontal edges
|
vec4 hori = vec4(low.x < max(D.w, A.w), low.x < max(E.w, B.w), low.z < max(E.w, H.w), low.z < max(D.w, G.w)) * clr; // horizontal edges
|
||||||
vec4 vert = vec4(low.w < max(E.y, D.y), low.y < max(E.y, F.y), low.y < max(H.y, I.y), low.w < max(H.y, G.y)) * clr; // vertical edges
|
vec4 vert = vec4(low.w < max(E.y, D.y), low.y < max(E.y, F.y), low.y < max(H.y, I.y), low.w < max(H.y, G.y)) * clr; // vertical edges
|
||||||
vec4 or = vec4(A.w < D.y, B.w <= F.y, H.w < I.y, G.w <= G.y); // orientation
|
vec4 orie = vec4(A.w < D.y, B.w <= F.y, H.w < I.y, G.w <= G.y); // orientation
|
||||||
|
|
||||||
FragColor = (res + 2.0 * hori + 4.0 * vert + 8.0 * or) / 15.0;
|
FragColor = (res + 2.0 * hori + 4.0 * vert + 8.0 * orie) / 15.0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,9 +151,9 @@ void main()
|
||||||
vec4 h = vec4(min(D.w, A.w), min(E.w, B.w), min(E.w, H.w), min(D.w, G.w));
|
vec4 h = vec4(min(D.w, A.w), min(E.w, B.w), min(E.w, H.w), min(D.w, G.w));
|
||||||
vec4 v = vec4(min(E.y, D.y), min(E.y, F.y), min(H.y, I.y), min(H.y, G.y));
|
vec4 v = vec4(min(E.y, D.y), min(E.y, F.y), min(H.y, I.y), min(H.y, G.y));
|
||||||
|
|
||||||
vec4 or = GE(h + vec4(D.w, E.w, E.w, D.w), v + vec4(E.y, E.y, H.y, H.y)); // orientation
|
vec4 orien = GE(h + vec4(D.w, E.w, E.w, D.w), v + vec4(E.y, E.y, H.y, H.y)); // orientation
|
||||||
vec4 hori = LE(h, v) * clr; // horizontal edges
|
vec4 hori = LE(h, v) * clr; // horizontal edges
|
||||||
vec4 vert = GE(h, v) * clr; // vertical edges
|
vec4 vert = GE(h, v) * clr; // vertical edges
|
||||||
|
|
||||||
FragColor = (res + 2 * hori + 4 * vert + 8 * or) / 15;
|
FragColor = (res + 2 * hori + 4 * vert + 8 * orien) / 15;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue