fix(crt-lottes): Rename param -> params for SPIRV-Cross compat

This commit is contained in:
Stuart Carnie 2018-07-14 15:17:50 -07:00
parent 2526a85e14
commit 93d3c10cd0

View file

@ -15,7 +15,7 @@ layout(push_constant) uniform Push
float hardBloomPix;
float bloomAmount;
float shape;
} param;
} params;
#pragma parameter hardScan "hardScan" -8.0 -20.0 0.0 1.0
#pragma parameter hardPix "hardPix" -3.0 -20.0 0.0 1.0
@ -94,7 +94,7 @@ vec3 ToSrgb(vec3 c)
#else
float ToLinear1(float c)
{
if (param.scaleInLinearGamma == 0)
if (params.scaleInLinearGamma == 0)
return c;
return(c<=0.04045) ? c/12.92 : pow((c + 0.055)/1.055, 2.4);
@ -102,7 +102,7 @@ float ToLinear1(float c)
vec3 ToLinear(vec3 c)
{
if (param.scaleInLinearGamma==0)
if (params.scaleInLinearGamma==0)
return c;
return vec3(ToLinear1(c.r), ToLinear1(c.g), ToLinear1(c.b));
@ -112,7 +112,7 @@ vec3 ToLinear(vec3 c)
// Assuming using sRGB typed textures this should not be needed.
float ToSrgb1(float c)
{
if (param.scaleInLinearGamma == 0)
if (params.scaleInLinearGamma == 0)
return c;
return(c<0.0031308 ? c*12.92 : 1.055*pow(c, 0.41666) - 0.055);
@ -120,7 +120,7 @@ float ToSrgb1(float c)
vec3 ToSrgb(vec3 c)
{
if (param.scaleInLinearGamma == 0)
if (params.scaleInLinearGamma == 0)
return c;
return vec3(ToSrgb1(c.r), ToSrgb1(c.g), ToSrgb1(c.b));
@ -134,9 +134,9 @@ vec3 ToSrgb(vec3 c)
vec3 Fetch(vec2 pos,vec2 off){
pos=(floor(pos*global.SourceSize.xy+off)+vec2(0.5,0.5))/global.SourceSize.xy;
#ifdef SIMPLE_LINEAR_GAMMA
return ToLinear(param.brightBoost * pow(texture(Source,pos.xy).rgb, vec3(2.2)));
return ToLinear(params.brightBoost * pow(texture(Source,pos.xy).rgb, vec3(2.2)));
#else
return ToLinear(param.brightBoost * texture(Source,pos.xy).rgb);
return ToLinear(params.brightBoost * texture(Source,pos.xy).rgb);
#endif
}
@ -151,7 +151,7 @@ vec2 Dist(vec2 pos)
// 1D Gaussian.
float Gaus(float pos, float scale)
{
return exp2(scale*pow(abs(pos), param.shape));
return exp2(scale*pow(abs(pos), params.shape));
}
// 3-tap Gaussian filter along horz line.
@ -163,7 +163,7 @@ vec3 Horz3(vec2 pos, float off)
float dst = Dist(pos).x;
// Convert distance to weight.
float scale = param.hardPix;
float scale = params.hardPix;
float wb = Gaus(dst-1.0,scale);
float wc = Gaus(dst+0.0,scale);
float wd = Gaus(dst+1.0,scale);
@ -182,7 +182,7 @@ vec3 Horz5(vec2 pos,float off){
float dst = Dist(pos).x;
// Convert distance to weight.
float scale = param.hardPix;
float scale = params.hardPix;
float wa = Gaus(dst - 2.0, scale);
float wb = Gaus(dst - 1.0, scale);
float wc = Gaus(dst + 0.0, scale);
@ -206,7 +206,7 @@ vec3 Horz7(vec2 pos,float off)
float dst = Dist(pos).x;
// Convert distance to weight.
float scale = param.hardBloomPix;
float scale = params.hardBloomPix;
float wa = Gaus(dst - 3.0, scale);
float wb = Gaus(dst - 2.0, scale);
float wc = Gaus(dst - 1.0, scale);
@ -224,7 +224,7 @@ float Scan(vec2 pos, float off)
{
float dst = Dist(pos).y;
return Gaus(dst + off, param.hardScan);
return Gaus(dst + off, params.hardScan);
}
// Return scanline weight for bloom.
@ -232,7 +232,7 @@ float BloomScan(vec2 pos, float off)
{
float dst = Dist(pos).y;
return Gaus(dst + off, param.hardBloomScan);
return Gaus(dst + off, params.hardBloomScan);
}
// Allow nearest three lines to effect pixel.
@ -271,7 +271,7 @@ vec3 Bloom(vec2 pos)
vec2 Warp(vec2 pos)
{
pos = pos*2.0-1.0;
pos *= vec2(1.0 + (pos.y*pos.y)*param.warpX, 1.0 + (pos.x*pos.x)*param.warpY);
pos *= vec2(1.0 + (pos.y*pos.y)*params.warpX, 1.0 + (pos.x*pos.x)*params.warpY);
return pos*0.5 + 0.5;
}
@ -279,56 +279,56 @@ vec2 Warp(vec2 pos)
// Shadow mask.
vec3 Mask(vec2 pos)
{
vec3 mask = vec3(param.maskDark, param.maskDark, param.maskDark);
vec3 mask = vec3(params.maskDark, params.maskDark, params.maskDark);
// Very compressed TV style shadow mask.
if (param.shadowMask == 1.0)
if (params.shadowMask == 1.0)
{
float line = param.maskLight;
float line = params.maskLight;
float odd = 0.0;
if (fract(pos.x*0.166666666) < 0.5) odd = 1.0;
if (fract((pos.y + odd) * 0.5) < 0.5) line = param.maskDark;
if (fract((pos.y + odd) * 0.5) < 0.5) line = params.maskDark;
pos.x = fract(pos.x*0.333333333);
if (pos.x < 0.333) mask.r = param.maskLight;
else if (pos.x < 0.666) mask.g = param.maskLight;
else mask.b = param.maskLight;
if (pos.x < 0.333) mask.r = params.maskLight;
else if (pos.x < 0.666) mask.g = params.maskLight;
else mask.b = params.maskLight;
mask*=line;
}
// Aperture-grille.
else if (param.shadowMask == 2.0)
else if (params.shadowMask == 2.0)
{
pos.x = fract(pos.x*0.333333333);
if (pos.x < 0.333) mask.r = param.maskLight;
else if (pos.x < 0.666) mask.g = param.maskLight;
else mask.b = param.maskLight;
if (pos.x < 0.333) mask.r = params.maskLight;
else if (pos.x < 0.666) mask.g = params.maskLight;
else mask.b = params.maskLight;
}
// Stretched VGA style shadow mask (same as prior shaders).
else if (param.shadowMask == 3.0)
else if (params.shadowMask == 3.0)
{
pos.x += pos.y*3.0;
pos.x = fract(pos.x*0.166666666);
if (pos.x < 0.333) mask.r = param.maskLight;
else if (pos.x < 0.666) mask.g = param.maskLight;
else mask.b = param.maskLight;
if (pos.x < 0.333) mask.r = params.maskLight;
else if (pos.x < 0.666) mask.g = params.maskLight;
else mask.b = params.maskLight;
}
// VGA style shadow mask.
else if (param.shadowMask == 4.0)
else if (params.shadowMask == 4.0)
{
pos.xy = floor(pos.xy*vec2(1.0, 0.5));
pos.x += pos.y*3.0;
pos.x = fract(pos.x*0.166666666);
if (pos.x < 0.333) mask.r = param.maskLight;
else if (pos.x < 0.666) mask.g = param.maskLight;
else mask.b = param.maskLight;
if (pos.x < 0.333) mask.r = params.maskLight;
else if (pos.x < 0.666) mask.g = params.maskLight;
else mask.b = params.maskLight;
}
return mask;
@ -341,10 +341,10 @@ void main()
#ifdef DO_BLOOM
//Add Bloom
outColor.rgb += Bloom(pos)*param.bloomAmount;
outColor.rgb += Bloom(pos)*params.bloomAmount;
#endif
if (param.shadowMask > 0.0)
if (params.shadowMask > 0.0)
outColor.rgb *= Mask(vTexCoord.xy / global.OutputSize.zw * 1.000001);
/* TODO/FIXME - hacky clamp fix */