Ensure that floating point literals are float.

Fixes regression from earlier workaround of std::to_string.
Update reference output.
This commit is contained in:
Hans-Kristian Arntzen 2016-03-12 14:17:19 +01:00
parent 75471fbb98
commit 0ae2bcc3d0
22 changed files with 120 additions and 113 deletions

View File

@ -14,26 +14,26 @@ layout(binding = 3, rgba16f) uniform mediump writeonly image2D iGradJacobian;
mediump float jacobian(mediump vec2 dDdx, mediump vec2 dDdy)
{
return (((1.000000 + dDdx.x) * (1.000000 + dDdy.y)) - (dDdx.y * dDdy.x));
return (((1.0 + dDdx.x) * (1.0 + dDdy.y)) - (dDdx.y * dDdy.x));
}
void main()
{
vec4 uv = ((vec2(gl_GlobalInvocationID.xy) * _46.uInvSize.xy).xyxy + (_46.uInvSize * 0.500000));
float h = textureLod(uHeight, uv.xy, 0.000000).x;
float x0 = textureLodOffset(uHeight, uv.xy, 0.000000, ivec2(-1, 0)).x;
float x1 = textureLodOffset(uHeight, uv.xy, 0.000000, ivec2(1, 0)).x;
float y0 = textureLodOffset(uHeight, uv.xy, 0.000000, ivec2(0, -1)).x;
float y1 = textureLodOffset(uHeight, uv.xy, 0.000000, ivec2(0, 1)).x;
vec2 grad = ((_46.uScale.xy * 0.500000) * vec2((x1 - x0), (y1 - y0)));
vec2 displacement = (textureLod(uDisplacement, uv.zw, 0.000000).xy * 1.200000);
vec2 dDdx = ((textureLodOffset(uDisplacement, uv.zw, 0.000000, ivec2(1, 0)).xy - textureLodOffset(uDisplacement, uv.zw, 0.000000, ivec2(-1, 0)).xy) * 0.600000);
vec2 dDdy = ((textureLodOffset(uDisplacement, uv.zw, 0.000000, ivec2(0, 1)).xy - textureLodOffset(uDisplacement, uv.zw, 0.000000, ivec2(0, -1)).xy) * 0.600000);
vec4 uv = ((vec2(gl_GlobalInvocationID.xy) * _46.uInvSize.xy).xyxy + (_46.uInvSize * 0.5));
float h = textureLod(uHeight, uv.xy, 0.0).x;
float x0 = textureLodOffset(uHeight, uv.xy, 0.0, ivec2(-1, 0)).x;
float x1 = textureLodOffset(uHeight, uv.xy, 0.0, ivec2(1, 0)).x;
float y0 = textureLodOffset(uHeight, uv.xy, 0.0, ivec2(0, -1)).x;
float y1 = textureLodOffset(uHeight, uv.xy, 0.0, ivec2(0, 1)).x;
vec2 grad = ((_46.uScale.xy * 0.5) * vec2((x1 - x0), (y1 - y0)));
vec2 displacement = (textureLod(uDisplacement, uv.zw, 0.0).xy * 1.2000000476837158203125);
vec2 dDdx = ((textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(1, 0)).xy - textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(-1, 0)).xy) * 0.60000002384185791015625);
vec2 dDdy = ((textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(0, 1)).xy - textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(0, -1)).xy) * 0.60000002384185791015625);
vec2 param = (dDdx * _46.uScale.z);
vec2 param_1 = (dDdy * _46.uScale.z);
float j = jacobian(param, param_1);
displacement = vec2(0.000000);
imageStore(iHeightDisplacement, ivec2(gl_GlobalInvocationID.xy), vec4(h, displacement, 0.000000));
imageStore(iGradJacobian, ivec2(gl_GlobalInvocationID.xy), vec4(grad, j, 0.000000));
displacement = vec2(0.0);
imageStore(iHeightDisplacement, ivec2(gl_GlobalInvocationID.xy), vec4(h, displacement, 0.0));
imageStore(iGradJacobian, ivec2(gl_GlobalInvocationID.xy), vec4(grad, j, 0.0));
}

View File

@ -20,7 +20,7 @@ void main()
{
uint ident = gl_GlobalInvocationID.x;
vec4 idata = _23.in_data[ident];
if ((dot(idata, vec4(1.000000, 5.000000, 6.000000, 2.000000)) > 8.200000))
if ((dot(idata, vec4(1.0, 5.0, 6.0, 2.0)) > 8.19999980926513671875))
{
uint _52 = atomicAdd(_48.counter, 1u);
_45.out_data[_52] = idata;

View File

@ -20,7 +20,7 @@ void main()
{
uint ident = gl_GlobalInvocationID.x;
float idata = _22.in_data[ident];
if ((idata > 12.000000))
if ((idata > 12.0))
{
uint _45 = atomicAdd(_41.count, 1u);
_38.out_data[_45] = idata;

View File

@ -42,7 +42,7 @@ uvec2 workaround_mix(uvec2 a, uvec2 b, bvec2 sel)
vec2 alias(vec2 i, vec2 N)
{
return mix(i, (i - N), greaterThan(i, (N * 0.500000)));
return mix(i, (i - N), greaterThan(i, (N * 0.5)));
}
vec2 cmul(vec2 a, vec2 b)
@ -74,7 +74,7 @@ void generate_heightmap()
vec2 param_4 = vec2(N);
vec2 k = (_218.uModTime.xy * alias(param_3, param_4));
float k_len = length(k);
float w = (sqrt((9.810000 * k_len)) * _218.uModTime.z);
float w = (sqrt((9.81000041961669921875 * k_len)) * _218.uModTime.z);
float cw = cos(w);
float sw = sin(w);
vec2 param_5 = a;

View File

@ -35,10 +35,10 @@ void baz(out Foo foo)
void meow(inout Foo foo)
{
foo.a = (foo.a + vec4(10.000000));
foo.b = (foo.b + vec4(20.000000));
foo.c = (foo.c + vec4(30.000000));
foo.d = (foo.d + vec4(40.000000));
foo.a = (foo.a + vec4(10.0));
foo.b = (foo.b + vec4(20.0));
foo.c = (foo.c + vec4(30.0));
foo.d = (foo.d + vec4(40.0));
}
vec4 bar(Foo foo)

View File

@ -9,11 +9,11 @@ layout(binding = 0, std430) buffer SSBO
void main()
{
vec4 v;
v.x = 10.000000;
v.y = 30.000000;
v.z = 70.000000;
v.w = 90.000000;
v.x = 10.0;
v.y = 30.0;
v.z = 70.0;
v.w = 90.0;
_27.out_data[gl_GlobalInvocationID.x] = v;
_27.out_data[gl_GlobalInvocationID.x].y = 20.000000;
_27.out_data[gl_GlobalInvocationID.x].y = 20.0;
}

View File

@ -22,7 +22,7 @@ void main()
int l;
while ((k < 10))
{
idat = (idat * 2.000000);
idat = (idat * 2.0);
k = (k + 1);
}
i = 0u;
@ -63,7 +63,7 @@ void main()
l = (l + 1);
continue;
}
idat = (idat + vec4(1.000000));
idat = (idat + vec4(1.0));
l = (l + 1);
continue;
}

View File

@ -9,6 +9,6 @@ layout(binding = 1, std430) buffer SSBO2
void main()
{
uint ident = gl_GlobalInvocationID.x;
_22.out_data[ident] = mat3(vec3(10.000000), vec3(20.000000), vec3(40.000000));
_22.out_data[ident] = mat3(vec3(10.0), vec3(20.0), vec3(40.0));
}

View File

@ -12,13 +12,13 @@ void main()
int i;
if ((ident == 2u))
{
_27.out_data[ident] = vec4(20.000000);
_27.out_data[ident] = vec4(20.0);
}
else
{
if ((ident == 4u))
{
_27.out_data[ident] = vec4(10.000000);
_27.out_data[ident] = vec4(10.0);
return;
}
}
@ -31,6 +31,6 @@ void main()
}
return;
}
_27.out_data[ident] = vec4(10.000000);
_27.out_data[ident] = vec4(10.0);
}

View File

@ -26,7 +26,7 @@ void main()
k = _40;
if ((_40 < 10))
{
idat = (idat * 2.000000);
idat = (idat * 2.0);
int _47 = k;
k = (_47 + 1);
continue;

View File

@ -18,10 +18,10 @@ vec4 resolve(Foobar f)
void main()
{
highp vec4 indexable[3] = vec4[](vec4(1.000000), vec4(2.000000), vec4(3.000000));
highp vec4 indexable_1[2][2] = vec4[][](vec4[](vec4(1.000000), vec4(2.000000)), vec4[](vec4(8.000000), vec4(10.000000)));
Foobar param = Foobar(10.000000, 20.000000);
Foobar indexable_2[2] = Foobar[](Foobar(10.000000, 40.000000), Foobar(90.000000, 70.000000));
highp vec4 indexable[3] = vec4[](vec4(1.0), vec4(2.0), vec4(3.0));
highp vec4 indexable_1[2][2] = vec4[][](vec4[](vec4(1.0), vec4(2.0)), vec4[](vec4(8.0), vec4(10.0)));
Foobar param = Foobar(10.0, 20.0);
Foobar indexable_2[2] = Foobar[](Foobar(10.0, 40.0), Foobar(90.0, 70.0));
Foobar param_1 = indexable_2[index];
FragColor = (((indexable[index] + indexable_1[index][(index + 1)]) + resolve(param)) + resolve(param_1));
}

View File

@ -11,7 +11,7 @@ layout(location = 0) out vec4 FragColor;
void foo2(out Structy f)
{
f.c = vec4(10.000000);
f.c = vec4(10.0);
}
Structy foo()

View File

@ -23,40 +23,40 @@ layout(location = 1) in vec3 EyeVec;
float saturate(float x)
{
return clamp(x, 0.000000, 1.000000);
return clamp(x, 0.0, 1.0);
}
void Resolve(vec3 Albedo, vec3 Normal, float Roughness, float Metallic)
{
LightingOut = vec4(0.000000);
NormalOut = vec4(((Normal * 0.500000) + vec3(0.500000)), 0.000000);
SpecularOut = vec4(Roughness, Metallic, 0.000000, 0.000000);
AlbedoOut = vec4(Albedo, 1.000000);
LightingOut = vec4(0.0);
NormalOut = vec4(((Normal * 0.5) + vec3(0.5)), 0.0);
SpecularOut = vec4(Roughness, Metallic, 0.0, 0.0);
AlbedoOut = vec4(Albedo, 1.0);
}
void main()
{
vec3 Normal = ((texture(TexNormalmap, TexCoord).xyz * 2.000000) - vec3(1.000000));
vec3 Normal = ((texture(TexNormalmap, TexCoord).xyz * 2.0) - vec3(1.0));
Normal = normalize(Normal);
highp float param = (length(EyeVec) / 1000.000000);
highp float param = (length(EyeVec) / 1000.0);
vec2 scatter_uv;
scatter_uv.x = saturate(param);
vec3 nEye = normalize(EyeVec);
scatter_uv.y = 0.000000;
vec3 Color = vec3(0.100000, 0.300000, 0.100000);
vec3 grass = vec3(0.100000, 0.300000, 0.100000);
vec3 dirt = vec3(0.100000);
vec3 snow = vec3(0.800000);
float grass_snow = smoothstep(0.000000, 0.150000, ((_56.g_CamPos.y + EyeVec.y) / 200.000000));
scatter_uv.y = 0.0;
vec3 Color = vec3(0.100000001490116119384765625, 0.300000011920928955078125, 0.100000001490116119384765625);
vec3 grass = vec3(0.100000001490116119384765625, 0.300000011920928955078125, 0.100000001490116119384765625);
vec3 dirt = vec3(0.100000001490116119384765625);
vec3 snow = vec3(0.800000011920928955078125);
float grass_snow = smoothstep(0.0, 0.1500000059604644775390625, ((_56.g_CamPos.y + EyeVec.y) / 200.0));
vec3 base = mix(grass, snow, vec3(grass_snow));
float edge = smoothstep(0.700000, 0.750000, Normal.y);
float edge = smoothstep(0.699999988079071044921875, 0.75, Normal.y);
Color = mix(dirt, base, vec3(edge));
Color = (Color * Color);
float Roughness = (1.000000 - (edge * grass_snow));
float Roughness = (1.0 - (edge * grass_snow));
highp vec3 param_1 = Color;
highp vec3 param_2 = Normal;
highp float param_3 = Roughness;
highp float param_4 = 0.000000;
highp float param_4 = 0.0;
Resolve(param_1, param_2, param_3, param_4);
}

View File

@ -13,9 +13,9 @@ in vec4 PLSIn3;
void main()
{
PLSOut0 = (PLSIn0 * 2.000000);
PLSOut1 = (PLSIn1 * 6.000000);
PLSOut2 = (PLSIn2 * 7.000000);
PLSOut3 = (PLSIn3 * 4.000000);
PLSOut0 = (PLSIn0 * 2.0);
PLSOut1 = (PLSIn1 * 6.0);
PLSOut2 = (PLSIn2 * 7.0);
PLSOut3 = (PLSIn3 * 4.0);
}

View File

@ -10,11 +10,11 @@ layout(location = 1) in vec3 vNormal;
void main()
{
FragColor = vec4(texture(samp, vUV).xyz, 1.000000);
FragColor = vec4(texture(samp, vUV).xz, 1.000000, 4.000000);
FragColor = vec4(texture(samp, vUV).xx, texture(samp, (vUV + vec2(0.100000))).yy);
FragColor = vec4(vNormal, 1.000000);
FragColor = vec4((vNormal + vec3(1.800000)), 1.000000);
FragColor = vec4(vUV, (vUV + vec2(1.800000)));
FragColor = vec4(texture(samp, vUV).xyz, 1.0);
FragColor = vec4(texture(samp, vUV).xz, 1.0, 4.0);
FragColor = vec4(texture(samp, vUV).xx, texture(samp, (vUV + vec2(0.100000001490116119384765625))).yy);
FragColor = vec4(vNormal, 1.0);
FragColor = vec4((vNormal + vec3(1.7999999523162841796875)), 1.0);
FragColor = vec4(vUV, (vUV + vec2(1.7999999523162841796875)));
}

View File

@ -16,10 +16,10 @@ void main()
vNormal = (vin[0].normal + vec3(float(gl_InvocationID)));
EmitVertex();
gl_Position = gl_in[1].gl_Position;
vNormal = (vin[1].normal + vec3((4.000000 * float(gl_InvocationID))));
vNormal = (vin[1].normal + vec3((4.0 * float(gl_InvocationID))));
EmitVertex();
gl_Position = gl_in[2].gl_Position;
vNormal = (vin[2].normal + vec3((2.000000 * float(gl_InvocationID))));
vNormal = (vin[2].normal + vec3((2.0 * float(gl_InvocationID))));
EmitVertex();
EndPrimitive();
}

View File

@ -6,12 +6,12 @@ out patch vec3 vFoo;
void main()
{
gl_TessLevelInner[0] = 8.900000;
gl_TessLevelInner[1] = 6.900000;
gl_TessLevelOuter[0] = 8.900000;
gl_TessLevelOuter[1] = 6.900000;
gl_TessLevelOuter[2] = 3.900000;
gl_TessLevelOuter[3] = 4.900000;
vFoo = vec3(1.000000);
gl_TessLevelInner[0] = 8.8999996185302734375;
gl_TessLevelInner[1] = 6.900000095367431640625;
gl_TessLevelOuter[0] = 8.8999996185302734375;
gl_TessLevelOuter[1] = 6.900000095367431640625;
gl_TessLevelOuter[2] = 3.900000095367431640625;
gl_TessLevelOuter[3] = 4.900000095367431640625;
vFoo = vec3(1.0);
}

View File

@ -18,14 +18,14 @@ in vec2 vPatchPosBase[32];
bool frustum_cull(vec2 p0)
{
vec2 min_xz = ((p0 - vec2(10.000000)) * _41.uScale.xy);
vec2 max_xz = (((p0 + _41.uPatchSize) + vec2(10.000000)) * _41.uScale.xy);
vec3 bb_min = vec3(min_xz.x, -10.000000, min_xz.y);
vec3 bb_max = vec3(max_xz.x, 10.000000, max_xz.y);
vec3 center = ((bb_min + bb_max) * 0.500000);
float radius = (0.500000 * length((bb_max - bb_min)));
vec3 f0 = vec3(dot(_41.uFrustum[0], vec4(center, 1.000000)), dot(_41.uFrustum[1], vec4(center, 1.000000)), dot(_41.uFrustum[2], vec4(center, 1.000000)));
vec3 f1 = vec3(dot(_41.uFrustum[3], vec4(center, 1.000000)), dot(_41.uFrustum[4], vec4(center, 1.000000)), dot(_41.uFrustum[5], vec4(center, 1.000000)));
vec2 min_xz = ((p0 - vec2(10.0)) * _41.uScale.xy);
vec2 max_xz = (((p0 + _41.uPatchSize) + vec2(10.0)) * _41.uScale.xy);
vec3 bb_min = vec3(min_xz.x, -10.0, min_xz.y);
vec3 bb_max = vec3(max_xz.x, 10.0, max_xz.y);
vec3 center = ((bb_min + bb_max) * 0.5);
float radius = (0.5 * length((bb_max - bb_min)));
vec3 f0 = vec3(dot(_41.uFrustum[0], vec4(center, 1.0)), dot(_41.uFrustum[1], vec4(center, 1.0)), dot(_41.uFrustum[2], vec4(center, 1.0)));
vec3 f1 = vec3(dot(_41.uFrustum[3], vec4(center, 1.0)), dot(_41.uFrustum[4], vec4(center, 1.0)), dot(_41.uFrustum[5], vec4(center, 1.0)));
bool _205 = any(lessThanEqual(f0, vec3((-radius))));
bool _215;
if ((!_205))
@ -42,9 +42,9 @@ bool frustum_cull(vec2 p0)
float lod_factor(vec2 pos_)
{
vec2 pos = (pos_ * _41.uScale.xy);
vec3 dist_to_cam = (_41.uCamPos - vec3(pos.x, 0.000000, pos.y));
float level = log2(((length(dist_to_cam) + 0.000100) * _41.uDistanceMod));
return clamp(level, 0.000000, _41.uMaxTessLevel.x);
vec3 dist_to_cam = (_41.uCamPos - vec3(pos.x, 0.0, pos.y));
float level = log2(((length(dist_to_cam) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod));
return clamp(level, 0.0, _41.uMaxTessLevel.x);
}
vec4 tess_level(vec4 lod)
@ -60,25 +60,25 @@ float tess_level(float lod)
void compute_tess_levels(vec2 p0)
{
vOutPatchPosBase = p0;
vec2 param = (p0 + (vec2(-0.500000) * _41.uPatchSize));
vec2 param = (p0 + (vec2(-0.5) * _41.uPatchSize));
float l00 = lod_factor(param);
vec2 param_1 = (p0 + (vec2(0.500000, -0.500000) * _41.uPatchSize));
vec2 param_1 = (p0 + (vec2(0.5, -0.5) * _41.uPatchSize));
float l10 = lod_factor(param_1);
vec2 param_2 = (p0 + (vec2(1.500000, -0.500000) * _41.uPatchSize));
vec2 param_2 = (p0 + (vec2(1.5, -0.5) * _41.uPatchSize));
float l20 = lod_factor(param_2);
vec2 param_3 = (p0 + (vec2(-0.500000, 0.500000) * _41.uPatchSize));
vec2 param_3 = (p0 + (vec2(-0.5, 0.5) * _41.uPatchSize));
float l01 = lod_factor(param_3);
vec2 param_4 = (p0 + (vec2(0.500000) * _41.uPatchSize));
vec2 param_4 = (p0 + (vec2(0.5) * _41.uPatchSize));
float l11 = lod_factor(param_4);
vec2 param_5 = (p0 + (vec2(1.500000, 0.500000) * _41.uPatchSize));
vec2 param_5 = (p0 + (vec2(1.5, 0.5) * _41.uPatchSize));
float l21 = lod_factor(param_5);
vec2 param_6 = (p0 + (vec2(-0.500000, 1.500000) * _41.uPatchSize));
vec2 param_6 = (p0 + (vec2(-0.5, 1.5) * _41.uPatchSize));
float l02 = lod_factor(param_6);
vec2 param_7 = (p0 + (vec2(0.500000, 1.500000) * _41.uPatchSize));
vec2 param_7 = (p0 + (vec2(0.5, 1.5) * _41.uPatchSize));
float l12 = lod_factor(param_7);
vec2 param_8 = (p0 + (vec2(1.500000) * _41.uPatchSize));
vec2 param_8 = (p0 + (vec2(1.5) * _41.uPatchSize));
float l22 = lod_factor(param_8);
vec4 lods = vec4(dot(vec4(l01, l11, l02, l12), vec4(0.250000)), dot(vec4(l00, l10, l01, l11), vec4(0.250000)), dot(vec4(l10, l20, l11, l21), vec4(0.250000)), dot(vec4(l11, l21, l12, l22), vec4(0.250000)));
vec4 lods = vec4(dot(vec4(l01, l11, l02, l12), vec4(0.25)), dot(vec4(l00, l10, l01, l11), vec4(0.25)), dot(vec4(l10, l20, l11, l21), vec4(0.25)), dot(vec4(l11, l21, l12, l22), vec4(0.25)));
vPatchLods = lods;
vec4 outer_lods = min(lods, lods.yzwx);
vec4 param_9 = outer_lods;
@ -101,12 +101,12 @@ void main()
vec2 param_1;
if ((!frustum_cull(param)))
{
gl_TessLevelOuter[0] = -1.000000;
gl_TessLevelOuter[1] = -1.000000;
gl_TessLevelOuter[2] = -1.000000;
gl_TessLevelOuter[3] = -1.000000;
gl_TessLevelInner[0] = -1.000000;
gl_TessLevelInner[1] = -1.000000;
gl_TessLevelOuter[0] = -1.0;
gl_TessLevelOuter[1] = -1.0;
gl_TessLevelOuter[2] = -1.0;
gl_TessLevelOuter[3] = -1.0;
gl_TessLevelInner[0] = -1.0;
gl_TessLevelInner[1] = -1.0;
}
else
{

View File

@ -35,7 +35,7 @@ mediump vec2 lod_factor(vec2 tess_coord)
mediump vec3 sample_height_displacement(vec2 uv, vec2 off, mediump vec2 lod)
{
return mix(textureLod(uHeightmapDisplacement, (uv + (off * 0.500000)), lod.x).xyz, textureLod(uHeightmapDisplacement, (uv + (off * 1.000000)), (lod.x + 1.000000)).xyz, vec3(lod.y));
return mix(textureLod(uHeightmapDisplacement, (uv + (off * 0.5)), lod.x).xyz, textureLod(uHeightmapDisplacement, (uv + (off * 1.0)), (lod.x + 1.0)).xyz, vec3(lod.y));
}
void main()
@ -49,13 +49,13 @@ void main()
pos = (pos * _31.uScale.xy);
mediump float delta_mod = exp2(lod.x);
vec2 off = (_31.uInvHeightmapSize * delta_mod);
vGradNormalTex = vec4((tex + (_31.uInvHeightmapSize * 0.500000)), (tex * _31.uScale.zw));
vGradNormalTex = vec4((tex + (_31.uInvHeightmapSize * 0.5)), (tex * _31.uScale.zw));
vec2 param_2 = tex;
vec2 param_3 = off;
vec2 param_4 = lod;
vec3 height_displacement = sample_height_displacement(param_2, param_3, param_4);
pos = (pos + height_displacement.yz);
vWorld = vec3(pos.x, height_displacement.x, pos.y);
gl_Position = (_31.uMVP * vec4(vWorld, 1.000000));
gl_Position = (_31.uMVP * vec4(vWorld, 1.0));
}

View File

@ -51,7 +51,7 @@ layout(location = 0) out vec2 TexCoord;
vec2 warp_position()
{
float vlod = dot(LODWeights, _284.Patches[gl_InstanceID].LODs);
vlod = mix(vlod, _284.Patches[gl_InstanceID].Position.w, all(equal(LODWeights, vec4(0.000000))));
vlod = mix(vlod, _284.Patches[gl_InstanceID].Position.w, all(equal(LODWeights, vec4(0.0))));
float floor_lod = floor(vlod);
float fract_lod = (vlod - floor_lod);
uint ufloor_lod = uint(floor_lod);
@ -85,7 +85,7 @@ vec2 warp_position()
vec2 lod_factor(vec2 uv)
{
float level = (textureLod(TexLOD, uv, 0.000000).x * 7.968750);
float level = (textureLod(TexLOD, uv, 0.0).x * 7.96875);
float floor_level = floor(level);
float fract_level = (level - floor_level);
return vec2(floor_level, fract_level);
@ -100,12 +100,12 @@ void main()
vec2 param = NormalizedPos;
vec2 lod = lod_factor(param);
vec2 Offset = (_381.InvGroundSize_PatchScale.xy * exp2(lod.x));
float Elevation = mix(textureLod(TexHeightmap, (NormalizedPos + (Offset * 0.500000)), lod.x).x, textureLod(TexHeightmap, (NormalizedPos + (Offset * 1.000000)), (lod.x + 1.000000)).x, lod.y);
float Elevation = mix(textureLod(TexHeightmap, (NormalizedPos + (Offset * 0.5)), lod.x).x, textureLod(TexHeightmap, (NormalizedPos + (Offset * 1.0)), (lod.x + 1.0)).x, lod.y);
vec3 WorldPos = vec3(NormalizedPos.x, Elevation, NormalizedPos.y);
WorldPos = (WorldPos * _381.GroundScale.xyz);
WorldPos = (WorldPos + _381.GroundPosition.xyz);
EyeVec = (WorldPos - _58.g_CamPos.xyz);
TexCoord = (NormalizedPos + (_381.InvGroundSize_PatchScale.xy * 0.500000));
TexCoord = (NormalizedPos + (_381.InvGroundSize_PatchScale.xy * 0.5));
gl_Position = ((((_58.g_ViewProj_Row0 * WorldPos.x) + (_58.g_ViewProj_Row1 * WorldPos.y)) + (_58.g_ViewProj_Row2 * WorldPos.z)) + _58.g_ViewProj_Row3);
}

View File

@ -52,7 +52,7 @@ layout(location = 1) out vec4 TexCoord;
vec2 warp_position()
{
float vlod = dot(LODWeights, _284.Patches[gl_InstanceID].LODs);
vlod = mix(vlod, _284.Patches[gl_InstanceID].Position.w, all(equal(LODWeights, vec4(0.000000))));
vlod = mix(vlod, _284.Patches[gl_InstanceID].Position.w, all(equal(LODWeights, vec4(0.0))));
float floor_lod = floor(vlod);
float fract_lod = (vlod - floor_lod);
uint ufloor_lod = uint(floor_lod);
@ -106,7 +106,7 @@ vec2 warp_position()
vec2 lod_factor(vec2 uv)
{
float level = (textureLod(TexLOD, uv, 0.000000).x * 7.968750);
float level = (textureLod(TexLOD, uv, 0.0).x * 7.96875);
float floor_level = floor(level);
float fract_level = (level - floor_level);
return vec2(floor_level, fract_level);
@ -122,12 +122,12 @@ void main()
vec2 param = NormalizedPos;
vec2 lod = lod_factor(param);
vec2 Offset = ((_405.InvOceanSize_PatchScale.xy * exp2(lod.x)) * _405.NormalTexCoordScale.zw);
vec3 Displacement = mix(textureLod(TexDisplacement, (NormalizedTex + (Offset * 0.500000)), lod.x).yxz, textureLod(TexDisplacement, (NormalizedTex + (Offset * 1.000000)), (lod.x + 1.000000)).yxz, vec3(lod.y));
vec3 WorldPos = (vec3(NormalizedPos.x, 0.000000, NormalizedPos.y) + Displacement);
vec3 Displacement = mix(textureLod(TexDisplacement, (NormalizedTex + (Offset * 0.5)), lod.x).yxz, textureLod(TexDisplacement, (NormalizedTex + (Offset * 1.0)), (lod.x + 1.0)).yxz, vec3(lod.y));
vec3 WorldPos = (vec3(NormalizedPos.x, 0.0, NormalizedPos.y) + Displacement);
WorldPos = (WorldPos * _405.OceanScale.xyz);
WorldPos = (WorldPos + _405.OceanPosition.xyz);
EyeVec = (WorldPos - _58.g_CamPos.xyz);
TexCoord = (vec4(NormalizedTex, (NormalizedTex * _405.NormalTexCoordScale.xy)) + ((_405.InvOceanSize_PatchScale.xyxy * 0.500000) * _405.NormalTexCoordScale.zwzw));
TexCoord = (vec4(NormalizedTex, (NormalizedTex * _405.NormalTexCoordScale.xy)) + ((_405.InvOceanSize_PatchScale.xyxy * 0.5) * _405.NormalTexCoordScale.zwzw));
gl_Position = ((((_58.g_ViewProj_Row0 * WorldPos.x) + (_58.g_ViewProj_Row1 * WorldPos.y)) + (_58.g_ViewProj_Row2 * WorldPos.z)) + _58.g_ViewProj_Row3);
}

View File

@ -19,6 +19,7 @@
#include <sstream>
#include <stdio.h>
#include <string.h>
namespace spir2cross
{
@ -77,6 +78,9 @@ namespace spir2cross
// Fallback to something more sane.
char buf[64];
sprintf(buf, "%.32g", t);
// Ensure that the literal is float.
if (!strchr(buf, '.') && !strchr(buf, 'e'))
strcat(buf, ".0");
return buf;
}
@ -86,6 +90,9 @@ namespace spir2cross
// Fallback to something more sane.
char buf[64];
sprintf(buf, "%.32g", t);
// Ensure that the literal is float.
if (!strchr(buf, '.') && !strchr(buf, 'e'))
strcat(buf, ".0");
return buf;
}