Merge pull request #402 from KhronosGroup/fix-400

Fix CFG for forwarded temporaries.
This commit is contained in:
Hans-Kristian Arntzen 2018-01-21 14:04:56 +01:00 коммит произвёл GitHub
Родитель 3c0f539590 7d223b8987
Коммит 921c555cf3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
43 изменённых файлов: 174 добавлений и 330 удалений

Просмотреть файл

@ -15,8 +15,6 @@ float4 _21;
void frag_main()
{
float4 _15;
float4 _17;
float4 _33;
do
{

Просмотреть файл

@ -104,12 +104,6 @@ struct main0_out
fragment main0_out main0(main0_in in [[stage_in]], float4 gl_FragCoord [[position]], constant CB0& _19 [[buffer(0)]], texture3d<float> LightMapTexture [[texture(0)]], sampler LightMapSampler [[sampler(0)]], sampler ShadowMapSampler [[sampler(1)]], texture2d<float> ShadowMapTexture [[texture(1)]], texturecube<float> EnvironmentMapTexture [[texture(2)]], sampler EnvironmentMapSampler [[sampler(2)]], sampler DiffuseMapSampler [[sampler(3)]], texture2d<float> DiffuseMapTexture [[texture(3)]], sampler NormalMapSampler [[sampler(4)]], texture2d<float> NormalMapTexture [[texture(4)]], texture2d<float> NormalDetailMapTexture [[texture(5)]], sampler NormalDetailMapSampler [[sampler(5)]], texture2d<float> StudsMapTexture [[texture(6)]], sampler StudsMapSampler [[sampler(6)]], sampler SpecularMapSampler [[sampler(7)]], texture2d<float> SpecularMapTexture [[texture(7)]])
{
main0_out out = {};
float4 _178;
float4 _191;
float4 _205;
float4 _218;
float4 _283;
float4 _296;
bool _173;
VertexOutput _128 = _121;
_128.HPosition = gl_FragCoord;
@ -148,15 +142,13 @@ fragment main0_out main0(main0_in in [[stage_in]], float4 gl_FragCoord [[positio
_173 = 0.0 == 0.0;
if (_173)
{
_178 = DiffuseMapTexture.sample(DiffuseMapSampler, _166);
_193 = _178;
_193 = DiffuseMapTexture.sample(DiffuseMapSampler, _166);
break;
}
else
{
float _180 = 1.0 / (1.0 - 0.0);
_191 = mix(DiffuseMapTexture.sample(DiffuseMapSampler, (_166 * 0.25)), DiffuseMapTexture.sample(DiffuseMapSampler, _166), float4(clamp((clamp(1.0 - (_146.View_Depth.w * 0.00333332992158830165863037109375), 0.0, 1.0) * _180) - (0.0 * _180), 0.0, 1.0)));
_193 = _191;
_193 = mix(DiffuseMapTexture.sample(DiffuseMapSampler, (_166 * 0.25)), DiffuseMapTexture.sample(DiffuseMapSampler, _166), float4(clamp((clamp(1.0 - (_146.View_Depth.w * 0.00333332992158830165863037109375), 0.0, 1.0) * _180) - (0.0 * _180), 0.0, 1.0)));
break;
}
_193 = _192;
@ -167,15 +159,13 @@ fragment main0_out main0(main0_in in [[stage_in]], float4 gl_FragCoord [[positio
{
if (_173)
{
_205 = NormalMapTexture.sample(NormalMapSampler, _166);
_220 = _205;
_220 = NormalMapTexture.sample(NormalMapSampler, _166);
break;
}
else
{
float _207 = 1.0 / (1.0 - 0.0);
_218 = mix(NormalMapTexture.sample(NormalMapSampler, (_166 * 0.25)), NormalMapTexture.sample(NormalMapSampler, _166), float4(clamp((_165 * _207) - (0.0 * _207), 0.0, 1.0)));
_220 = _218;
_220 = mix(NormalMapTexture.sample(NormalMapSampler, (_166 * 0.25)), NormalMapTexture.sample(NormalMapSampler, _166), float4(clamp((_165 * _207) - (0.0 * _207), 0.0, 1.0)));
break;
}
_220 = _219;
@ -195,15 +185,13 @@ fragment main0_out main0(main0_in in [[stage_in]], float4 gl_FragCoord [[positio
{
if (0.75 == 0.0)
{
_283 = SpecularMapTexture.sample(SpecularMapSampler, _166);
_298 = _283;
_298 = SpecularMapTexture.sample(SpecularMapSampler, _166);
break;
}
else
{
float _285 = 1.0 / (1.0 - 0.75);
_296 = mix(SpecularMapTexture.sample(SpecularMapSampler, (_166 * 0.25)), SpecularMapTexture.sample(SpecularMapSampler, _166), float4(clamp((_165 * _285) - (0.75 * _285), 0.0, 1.0)));
_298 = _296;
_298 = mix(SpecularMapTexture.sample(SpecularMapSampler, (_166 * 0.25)), SpecularMapTexture.sample(SpecularMapSampler, _166), float4(clamp((_165 * _285) - (0.75 * _285), 0.0, 1.0)));
break;
}
_298 = _297;

Просмотреть файл

@ -5,9 +5,7 @@ using namespace metal;
fragment void main0()
{
int _16;
int _23;
for (int _22 = 35; _22 >= 0; _23 = _22 - 1, _22 = _23)
for (int _22 = 35; _22 >= 0; _22--)
{
}
}

Просмотреть файл

@ -14,8 +14,6 @@ struct main0_out
fragment main0_out main0()
{
main0_out out = {};
float4 _20;
float4 _21;
float4 _51;
float4 _52;
_51 = _50;

Просмотреть файл

@ -18,8 +18,6 @@ struct main0_out
fragment main0_out main0(main0_in in [[stage_in]])
{
main0_out out = {};
float4 _15;
float4 _17;
float4 _33;
do
{

Просмотреть файл

@ -16,12 +16,10 @@ struct SSBO2
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _28 [[buffer(0)]], device SSBO2& _52 [[buffer(1)]])
{
float4 _33;
float4 _42;
int i = 0;
_33 = _28.in_data[gl_GlobalInvocationID.x];
float4 _56;
_56 = _33;
_56 = _28.in_data[gl_GlobalInvocationID.x];
for (;;)
{
_42 = _28.mvp * _56;

Просмотреть файл

@ -12,8 +12,6 @@ constant int _69 = {};
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO2& _27 [[buffer(0)]])
{
int _29;
int _65;
if (gl_GlobalInvocationID.x == 2u)
{
_27.out_data[gl_GlobalInvocationID.x] = float4(20.0);
@ -26,7 +24,7 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic
return;
}
}
for (int _68 = 0; _68 < 20; _65 = _69 + 1, _68 = _65)
for (int _68 = 0; _68 < 20; _68 = _69 + 1)
{
return;
}

Просмотреть файл

@ -18,22 +18,13 @@ constant uint _98 = {};
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _24 [[buffer(0)]], device SSBO2& _89 [[buffer(1)]])
{
float4 _30;
float4 _46;
int _33;
int _48;
int _40;
int _77;
uint _12;
uint _75;
float4 _71;
uint _73;
int _83;
_30 = _24.in_data[gl_GlobalInvocationID.x];
float4 _93;
int _94;
_93 = _30;
_93 = _24.in_data[gl_GlobalInvocationID.x];
_94 = 0;
int _48;
float4 _46;
for (;;)
{
_40 = _94 + 1;
@ -56,17 +47,19 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic
_96 = _40;
float4 _100;
uint _101;
for (uint _97 = 0u, _99 = _98; _97 < 16u; _75 = _97 + uint(1), _77 = _96 + 1, _95 = _100, _96 = _77, _97 = _75, _99 = _101)
for (uint _97 = 0u, _99 = _98; _97 < 16u; _95 = _100, _96++, _97++, _99 = _101)
{
_100 = _95;
_101 = 0u;
for (; _101 < 30u; _73 = _101 + uint(1), _100 = _71, _101 = _73)
float4 _71;
for (; _101 < 30u; _100 = _71, _101++)
{
_71 = _24.mvp * _100;
}
}
int _102;
_102 = _96;
int _83;
for (;;)
{
_83 = _102 + 1;

Просмотреть файл

@ -11,36 +11,26 @@ struct main0_out
fragment main0_out main0()
{
main0_out out = {};
int _12;
int _27;
int _26;
int _43;
int _59;
int _83;
int2 _93;
int2 _139;
int _62;
int _128;
out.FragColor = 16;
for (int _140 = 0; _140 < 25; _27 = _140 + 1, _140 = _27)
for (int _140 = 0; _140 < 25; _140++)
{
out.FragColor += 10;
}
for (int _141 = 1; _141 < 30; _43 = _141 + 1, _141 = _43)
for (int _141 = 1; _141 < 30; _141++)
{
out.FragColor += 11;
}
int _142;
_142 = 0;
for (; _142 < 20; _59 = _142 + 1, _142 = _59)
for (; _142 < 20; _142++)
{
out.FragColor += 12;
}
_62 = _142 + 3;
int _62 = _142 + 3;
out.FragColor += _62;
if (_62 == 40)
{
for (int _143 = 0; _143 < 40; _83 = _143 + 1, _143 = _83)
for (int _143 = 0; _143 < 40; _143++)
{
out.FragColor += 13;
}
@ -52,11 +42,12 @@ fragment main0_out main0()
}
int2 _144;
_144 = int2(0);
int2 _139;
for (; _144.x < 10; _139 = _144, _139.x = _144.x + 4, _144 = _139)
{
out.FragColor += _144.y;
}
for (int _145 = _62; _145 < 40; _128 = _145 + 1, _145 = _128)
for (int _145 = _62; _145 < 40; _145++)
{
out.FragColor += _145;
}

Просмотреть файл

@ -31,11 +31,9 @@ struct main0_out
vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _21 [[buffer(0)]])
{
main0_out out = {};
int _12;
int _92;
out.gl_Position = _21.uMVP * in.aVertex;
out.vColor = float4(0.0);
for (int _103 = 0; _103 < 4; _92 = _103 + 1, _103 = _92)
for (int _103 = 0; _103 < 4; _103++)
{
float3 _68 = in.aVertex.xyz - _21.lights[_103].Position;
out.vColor += ((_21.lights[_103].Color * clamp(1.0 - (length(_68) / _21.lights[_103].Radius), 0.0, 1.0)) * dot(in.aNormal, normalize(_68)));

Просмотреть файл

@ -31,11 +31,9 @@ struct main0_out
vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _21 [[buffer(0)]])
{
main0_out out = {};
int _12;
int _81;
out.gl_Position = _21.uMVP * in.aVertex;
out.vColor = float4(0.0);
for (int _82 = 0; _82 < 4; _81 = _82 + 1, _82 = _81)
for (int _82 = 0; _82 < 4; _82++)
{
float3 _54 = in.aVertex.xyz - _21.lights[_82].Position;
out.vColor += ((_21.lights[_82].Color * clamp(1.0 - (length(_54) / _21.lights[_82].Radius), 0.0, 1.0)) * dot(in.aNormal, normalize(_54)));

Просмотреть файл

@ -97,12 +97,6 @@ vec4 _297;
void main()
{
vec4 _178;
vec4 _191;
vec4 _205;
vec4 _218;
vec4 _283;
vec4 _296;
bool _173;
VertexOutput _128 = _121;
_128.HPosition = gl_FragCoord;
@ -141,15 +135,13 @@ void main()
_173 = 0.0 == 0.0;
if (_173)
{
_178 = texture(SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler, _166);
_193 = _178;
_193 = texture(SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler, _166);
break;
}
else
{
float _180 = 1.0 / (1.0 - 0.0);
_191 = mix(texture(SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler, _166 * 0.25), texture(SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler, _166), vec4(clamp((clamp(1.0 - (_146.View_Depth.w * 0.00333332992158830165863037109375), 0.0, 1.0) * _180) - (0.0 * _180), 0.0, 1.0)));
_193 = _191;
_193 = mix(texture(SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler, _166 * 0.25), texture(SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler, _166), vec4(clamp((clamp(1.0 - (_146.View_Depth.w * 0.00333332992158830165863037109375), 0.0, 1.0) * _180) - (0.0 * _180), 0.0, 1.0)));
break;
}
_193 = _192;
@ -160,15 +152,13 @@ void main()
{
if (_173)
{
_205 = texture(SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler, _166);
_220 = _205;
_220 = texture(SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler, _166);
break;
}
else
{
float _207 = 1.0 / (1.0 - 0.0);
_218 = mix(texture(SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler, _166 * 0.25), texture(SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler, _166), vec4(clamp((_165 * _207) - (0.0 * _207), 0.0, 1.0)));
_220 = _218;
_220 = mix(texture(SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler, _166 * 0.25), texture(SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler, _166), vec4(clamp((_165 * _207) - (0.0 * _207), 0.0, 1.0)));
break;
}
_220 = _219;
@ -188,15 +178,13 @@ void main()
{
if (0.75 == 0.0)
{
_283 = texture(SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler, _166);
_298 = _283;
_298 = texture(SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler, _166);
break;
}
else
{
float _285 = 1.0 / (1.0 - 0.75);
_296 = mix(texture(SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler, _166 * 0.25), texture(SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler, _166), vec4(clamp((_165 * _285) - (0.75 * _285), 0.0, 1.0)));
_298 = _296;
_298 = mix(texture(SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler, _166 * 0.25), texture(SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler, _166), vec4(clamp((_165 * _285) - (0.75 * _285), 0.0, 1.0)));
break;
}
_298 = _297;

Просмотреть файл

@ -15,15 +15,11 @@ uint _155;
int GetCascade(vec3 fragWorldPosition)
{
uint _49;
uint _119;
mat4 _43;
mat4 _47;
mat4 _153;
_153 = _152;
uint _156;
mat4 _157;
for (uint _151 = 0u; _151 < _11.shadowCascadesNum; _119 = _156 + uint(1), _151 = _119, _153 = _157)
for (uint _151 = 0u; _151 < _11.shadowCascadesNum; _151 = _156 + uint(1), _153 = _157)
{
mat4 _154;
_154 = _153;

Просмотреть файл

@ -7,14 +7,10 @@ layout(location = 0) flat in mediump int counter;
void main()
{
int _37;
mediump int _22;
uint _38;
mediump uint _25;
FragColor = vec4(0.0);
int _53 = 0;
uint _54 = 1u;
for (; (_53 < 10) && (int(_54) < int(20u)); _22 = _53 + counter, _25 = _54 + uint(counter), _53 = _22, _54 = _25)
for (; (_53 < 10) && (int(_54) < int(20u)); _53 += counter, _54 += uint(counter))
{
FragColor += vec4(float(_53));
FragColor += vec4(float(_54));

Просмотреть файл

@ -2,9 +2,7 @@
void main()
{
int _16;
int _23;
for (int _22 = 35; _22 >= 0; _23 = _22 - 1, _22 = _23)
for (int _22 = 35; _22 >= 0; _22--)
{
}
}

Просмотреть файл

@ -14,13 +14,10 @@ layout(location = 0) out vec4 _entryPointOutput;
void main()
{
vec3 _14;
vec3 _29;
int _16;
int _32;
vec3 _28;
_28 = vec3(0.0);
for (int _31 = 0; _31 < 4; _32 = _31 + 1, _28 = _29, _31 = _32)
vec3 _29;
for (int _31 = 0; _31 < 4; _28 = _29, _31++)
{
_29 = _28 + _6.g_MyStruct[_31].color.xyz;
}

Просмотреть файл

@ -7,8 +7,6 @@ vec4 _50;
void main()
{
vec4 _20;
vec4 _21;
vec4 _51;
vec4 _52;
_51 = _50;

Просмотреть файл

@ -7,8 +7,6 @@ vec4 _21;
void main()
{
vec4 _15;
vec4 _17;
vec4 _33;
do
{

Просмотреть файл

@ -10,9 +10,6 @@ float _180;
void main()
{
int _13;
int _166;
float _168;
if (_11.data != 0.0)
{
_11.data = 10.0;
@ -47,7 +44,7 @@ void main()
}
float _181;
_181 = _180;
for (int _179 = 0; _179 < 20; _166 = _179 + 1, _168 = _181 + 10.0, _179 = _166, _181 = _168)
for (int _179 = 0; _179 < 20; _179++, _181 += 10.0)
{
}
_11.data = _181;

Просмотреть файл

@ -16,12 +16,10 @@ int i;
void main()
{
vec4 _33;
vec4 _42;
i = 0;
_33 = _28.in_data[gl_GlobalInvocationID.x];
vec4 _56;
_56 = _33;
_56 = _28.in_data[gl_GlobalInvocationID.x];
for (;;)
{
_42 = _28.mvp * _56;

Просмотреть файл

@ -18,9 +18,6 @@ layout(binding = 1, std430) writeonly buffer HeightmapFFT
void main()
{
uint _66;
uint _435;
uint _439;
uvec2 _263 = uvec2(64u, 1u) * gl_NumWorkGroups.xy;
uvec2 _268 = _263 - gl_GlobalInvocationID.xy;
bvec2 _270 = equal(gl_GlobalInvocationID.xy, uvec2(0u));
@ -31,8 +28,7 @@ void main()
}
else
{
_435 = _268.x;
_470 = _435;
_470 = _268.x;
}
uint _471;
if (_270.y)
@ -41,8 +37,7 @@ void main()
}
else
{
_439 = _268.y;
_471 = _439;
_471 = _268.y;
}
vec2 _296 = vec2(gl_GlobalInvocationID.xy);
vec2 _298 = vec2(_263);

Просмотреть файл

@ -10,8 +10,6 @@ int _69;
void main()
{
int _29;
int _65;
if (gl_GlobalInvocationID.x == 2u)
{
_27.out_data[gl_GlobalInvocationID.x] = vec4(20.0);
@ -24,7 +22,7 @@ void main()
return;
}
}
for (int _68 = 0; _68 < 20; _65 = _69 + 1, _68 = _65)
for (int _68 = 0; _68 < 20; _68 = _69 + 1)
{
return;
}

Просмотреть файл

@ -16,22 +16,13 @@ uint _98;
void main()
{
vec4 _30;
vec4 _46;
int _33;
int _48;
int _40;
int _77;
uint _12;
uint _75;
vec4 _71;
uint _73;
int _83;
_30 = _24.in_data[gl_GlobalInvocationID.x];
vec4 _93;
int _94;
_93 = _30;
_93 = _24.in_data[gl_GlobalInvocationID.x];
_94 = 0;
int _48;
vec4 _46;
for (;;)
{
_40 = _94 + 1;
@ -54,17 +45,19 @@ void main()
_96 = _40;
vec4 _100;
uint _101;
for (uint _97 = 0u, _99 = _98; _97 < 16u; _75 = _97 + uint(1), _77 = _96 + 1, _95 = _100, _96 = _77, _97 = _75, _99 = _101)
for (uint _97 = 0u, _99 = _98; _97 < 16u; _95 = _100, _96++, _97++, _99 = _101)
{
_100 = _95;
_101 = 0u;
for (; _101 < 30u; _73 = _101 + uint(1), _100 = _71, _101 = _73)
vec4 _71;
for (; _101 < 30u; _100 = _71, _101++)
{
_71 = _24.mvp * _100;
}
}
int _102;
_102 = _96;
int _83;
for (;;)
{
_83 = _102 + 1;

Просмотреть файл

@ -14,11 +14,9 @@ layout(location = 1) in vec3 aNormal;
void main()
{
int _12;
int _92;
gl_Position = mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex;
vColor = vec4(0.0);
for (int _103 = 0; _103 < 4; _92 = _103 + 1, _103 = _92)
for (int _103 = 0; _103 < 4; _103++)
{
vec3 _68 = aVertex.xyz - Light(UBO[_103 * 2 + 4].xyz, UBO[_103 * 2 + 4].w, UBO[_103 * 2 + 5]).Position;
vColor += (((UBO[_103 * 2 + 5]) * clamp(1.0 - (length(_68) / Light(UBO[_103 * 2 + 4].xyz, UBO[_103 * 2 + 4].w, UBO[_103 * 2 + 5]).Radius), 0.0, 1.0)) * dot(aNormal, normalize(_68)));

Просмотреть файл

@ -14,11 +14,9 @@ layout(location = 1) in vec3 aNormal;
void main()
{
int _12;
int _81;
gl_Position = mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex;
vColor = vec4(0.0);
for (int _82 = 0; _82 < 4; _81 = _82 + 1, _82 = _81)
for (int _82 = 0; _82 < 4; _82++)
{
vec3 _54 = aVertex.xyz - (UBO[_82 * 2 + 4].xyz);
vColor += (((UBO[_82 * 2 + 5]) * clamp(1.0 - (length(_54) / (UBO[_82 * 2 + 4].w)), 0.0, 1.0)) * dot(aNormal, normalize(_54)));

Просмотреть файл

@ -10,22 +10,18 @@ int _93;
void main()
{
int _9;
int _76;
int _74;
int _72;
vec4 values3[2 * 3 * 1];
int _96;
int _97;
for (int _92 = 0, _94 = _93, _95 = _93; _92 < 2; _76 = _92 + 1, _92 = _76, _94 = _96, _95 = _97)
for (int _92 = 0, _94 = _93, _95 = _93; _92 < 2; _92++, _94 = _96, _95 = _97)
{
_96 = 0;
_97 = _95;
int _98;
for (; _96 < 3; _74 = _96 + 1, _96 = _74, _97 = _98)
for (; _96 < 3; _96++, _97 = _98)
{
_98 = 0;
for (; _98 < 1; _72 = _98 + 1, _98 = _72)
for (; _98 < 1; _98++)
{
values3[_92 * 3 * 1 + _96 * 1 + _98] = texture(uTextures[_92 * 3 * 1 + _96 * 1 + _98], vUV);
}

Просмотреть файл

@ -6,36 +6,26 @@ layout(location = 0) out mediump int FragColor;
void main()
{
int _12;
mediump int _27;
int _26;
mediump int _43;
mediump int _59;
mediump int _83;
ivec2 _93;
ivec2 _139;
mediump int _62;
mediump int _128;
FragColor = 16;
for (int _140 = 0; _140 < 25; _27 = _140 + 1, _140 = _27)
for (int _140 = 0; _140 < 25; _140++)
{
FragColor += 10;
}
for (int _141 = 1; _141 < 30; _43 = _141 + 1, _141 = _43)
for (int _141 = 1; _141 < 30; _141++)
{
FragColor += 11;
}
int _142;
_142 = 0;
for (; _142 < 20; _59 = _142 + 1, _142 = _59)
for (; _142 < 20; _142++)
{
FragColor += 12;
}
_62 = _142 + 3;
mediump int _62 = _142 + 3;
FragColor += _62;
if (_62 == 40)
{
for (int _143 = 0; _143 < 40; _83 = _143 + 1, _143 = _83)
for (int _143 = 0; _143 < 40; _143++)
{
FragColor += 13;
}
@ -47,11 +37,12 @@ void main()
}
ivec2 _144;
_144 = ivec2(0);
ivec2 _139;
for (; _144.x < 10; _139 = _144, _139.x = _144.x + 4, _144 = _139)
{
FragColor += _144.y;
}
for (int _145 = _62; _145 < 40; _128 = _145 + 1, _145 = _128)
for (int _145 = _62; _145 < 40; _145++)
{
FragColor += _145;
}

Просмотреть файл

@ -18,20 +18,17 @@ layout(location = 0) in vec2 vPatchPosBase[];
void main()
{
bool _515;
bool _524;
vec2 _430 = (vPatchPosBase[0] - vec2(10.0)) * _41.uScale.xy;
vec2 _440 = ((vPatchPosBase[0] + _41.uPatchSize) + vec2(10.0)) * _41.uScale.xy;
vec3 _445 = vec3(_430.x, -10.0, _430.y);
vec3 _450 = vec3(_440.x, 10.0, _440.y);
vec3 _454 = (_445 + _450) * 0.5;
float _459 = 0.5 * length(_450 - _445);
_515 = any(lessThanEqual(vec3(dot(_41.uFrustum[0], vec4(_454, 1.0)), dot(_41.uFrustum[1], vec4(_454, 1.0)), dot(_41.uFrustum[2], vec4(_454, 1.0))), vec3(-_459)));
bool _515 = any(lessThanEqual(vec3(dot(_41.uFrustum[0], vec4(_454, 1.0)), dot(_41.uFrustum[1], vec4(_454, 1.0)), dot(_41.uFrustum[2], vec4(_454, 1.0))), vec3(-_459)));
bool _525;
if (!_515)
{
_524 = any(lessThanEqual(vec3(dot(_41.uFrustum[3], vec4(_454, 1.0)), dot(_41.uFrustum[4], vec4(_454, 1.0)), dot(_41.uFrustum[5], vec4(_454, 1.0))), vec3(-_459)));
_525 = _524;
_525 = any(lessThanEqual(vec3(dot(_41.uFrustum[3], vec4(_454, 1.0)), dot(_41.uFrustum[4], vec4(_454, 1.0)), dot(_41.uFrustum[5], vec4(_454, 1.0))), vec3(-_459)));
}
else
{

Просмотреть файл

@ -51,9 +51,6 @@ layout(location = 0) out vec2 TexCoord;
void main()
{
uint _372;
uint _28;
uint _376;
float _300 = all(equal(LODWeights, vec4(0.0))) ? _53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].Position.w : dot(LODWeights, _53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].LODs);
float _302 = floor(_300);
uint _307 = uint(_302);
@ -62,8 +59,7 @@ void main()
uint _395;
if (_309.x < 32u)
{
_372 = _316.x;
_395 = _372;
_395 = _316.x;
}
else
{
@ -72,8 +68,7 @@ void main()
uint _396;
if (_309.y < 32u)
{
_376 = _316.y;
_396 = _376;
_396 = _316.y;
}
else
{

Просмотреть файл

@ -54,11 +54,6 @@ uvec4 _483;
void main()
{
uint _443;
uint _28;
uint _449;
uint _455;
uint _461;
float _350 = all(equal(LODWeights, vec4(0.0))) ? _53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].Position.w : dot(LODWeights, _53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].LODs);
float _352 = floor(_350);
uint _357 = uint(_352);
@ -67,8 +62,7 @@ void main()
uint _482;
if (_359.x < 32u)
{
_443 = _366.x;
_482 = _443;
_482 = _366.x;
}
else
{
@ -79,8 +73,7 @@ void main()
uint _484;
if (_359.y < 32u)
{
_449 = _366.x;
_484 = _449;
_484 = _366.x;
}
else
{
@ -91,8 +84,7 @@ void main()
uint _485;
if (_359.x < 32u)
{
_455 = _366.y;
_485 = _455;
_485 = _366.y;
}
else
{
@ -103,8 +95,7 @@ void main()
uint _486;
if (_359.y < 32u)
{
_461 = _366.y;
_486 = _461;
_486 = _366.y;
}
else
{

Просмотреть файл

@ -15,8 +15,6 @@ float4 _21;
void frag_main()
{
float4 _15;
float4 _17;
float4 _24;
float4 _33;
_24 = _21;

Просмотреть файл

@ -104,12 +104,6 @@ struct main0_out
fragment main0_out main0(main0_in in [[stage_in]], float4 gl_FragCoord [[position]], constant CB0& _19 [[buffer(0)]], texture3d<float> LightMapTexture [[texture(0)]], sampler LightMapSampler [[sampler(0)]], sampler ShadowMapSampler [[sampler(1)]], texture2d<float> ShadowMapTexture [[texture(1)]], texturecube<float> EnvironmentMapTexture [[texture(2)]], sampler EnvironmentMapSampler [[sampler(2)]], sampler DiffuseMapSampler [[sampler(3)]], texture2d<float> DiffuseMapTexture [[texture(3)]], sampler NormalMapSampler [[sampler(4)]], texture2d<float> NormalMapTexture [[texture(4)]], texture2d<float> NormalDetailMapTexture [[texture(5)]], sampler NormalDetailMapSampler [[sampler(5)]], texture2d<float> StudsMapTexture [[texture(6)]], sampler StudsMapSampler [[sampler(6)]], sampler SpecularMapSampler [[sampler(7)]], texture2d<float> SpecularMapTexture [[texture(7)]])
{
main0_out out = {};
float4 _178;
float4 _191;
float4 _205;
float4 _218;
float4 _283;
float4 _296;
bool _173;
VertexOutput _128 = _121;
_128.HPosition = gl_FragCoord;
@ -148,15 +142,13 @@ fragment main0_out main0(main0_in in [[stage_in]], float4 gl_FragCoord [[positio
_173 = 0.0 == 0.0;
if (_173)
{
_178 = DiffuseMapTexture.sample(DiffuseMapSampler, _166);
_193 = _178;
_193 = DiffuseMapTexture.sample(DiffuseMapSampler, _166);
break;
}
else
{
float _180 = 1.0 / (1.0 - 0.0);
_191 = mix(DiffuseMapTexture.sample(DiffuseMapSampler, (_166 * 0.25)), DiffuseMapTexture.sample(DiffuseMapSampler, _166), float4(clamp((clamp(1.0 - (_146.View_Depth.w * 0.00333332992158830165863037109375), 0.0, 1.0) * _180) - (0.0 * _180), 0.0, 1.0)));
_193 = _191;
_193 = mix(DiffuseMapTexture.sample(DiffuseMapSampler, (_166 * 0.25)), DiffuseMapTexture.sample(DiffuseMapSampler, _166), float4(clamp((clamp(1.0 - (_146.View_Depth.w * 0.00333332992158830165863037109375), 0.0, 1.0) * _180) - (0.0 * _180), 0.0, 1.0)));
break;
}
_193 = _192;
@ -167,15 +159,13 @@ fragment main0_out main0(main0_in in [[stage_in]], float4 gl_FragCoord [[positio
{
if (_173)
{
_205 = NormalMapTexture.sample(NormalMapSampler, _166);
_220 = _205;
_220 = NormalMapTexture.sample(NormalMapSampler, _166);
break;
}
else
{
float _207 = 1.0 / (1.0 - 0.0);
_218 = mix(NormalMapTexture.sample(NormalMapSampler, (_166 * 0.25)), NormalMapTexture.sample(NormalMapSampler, _166), float4(clamp((_165 * _207) - (0.0 * _207), 0.0, 1.0)));
_220 = _218;
_220 = mix(NormalMapTexture.sample(NormalMapSampler, (_166 * 0.25)), NormalMapTexture.sample(NormalMapSampler, _166), float4(clamp((_165 * _207) - (0.0 * _207), 0.0, 1.0)));
break;
}
_220 = _219;
@ -195,15 +185,13 @@ fragment main0_out main0(main0_in in [[stage_in]], float4 gl_FragCoord [[positio
{
if (0.75 == 0.0)
{
_283 = SpecularMapTexture.sample(SpecularMapSampler, _166);
_298 = _283;
_298 = SpecularMapTexture.sample(SpecularMapSampler, _166);
break;
}
else
{
float _285 = 1.0 / (1.0 - 0.75);
_296 = mix(SpecularMapTexture.sample(SpecularMapSampler, (_166 * 0.25)), SpecularMapTexture.sample(SpecularMapSampler, _166), float4(clamp((_165 * _285) - (0.75 * _285), 0.0, 1.0)));
_298 = _296;
_298 = mix(SpecularMapTexture.sample(SpecularMapSampler, (_166 * 0.25)), SpecularMapTexture.sample(SpecularMapSampler, _166), float4(clamp((_165 * _285) - (0.75 * _285), 0.0, 1.0)));
break;
}
_298 = _297;

Просмотреть файл

@ -5,9 +5,7 @@ using namespace metal;
fragment void main0()
{
int _16;
int _23;
for (int _22 = 35; _22 >= 0; _23 = _22 - 1, _22 = _23)
for (int _22 = 35; _22 >= 0; _22--)
{
}
}

Просмотреть файл

@ -18,8 +18,6 @@ struct main0_out
fragment main0_out main0(main0_in in [[stage_in]])
{
main0_out out = {};
float4 _15;
float4 _17;
float4 _24;
float4 _33;
_24 = _21;

Просмотреть файл

@ -97,12 +97,6 @@ vec4 _297;
void main()
{
vec4 _178;
vec4 _191;
vec4 _205;
vec4 _218;
vec4 _283;
vec4 _296;
bool _173;
VertexOutput _128 = _121;
_128.HPosition = gl_FragCoord;
@ -141,15 +135,13 @@ void main()
_173 = 0.0 == 0.0;
if (_173)
{
_178 = texture(SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler, _166);
_193 = _178;
_193 = texture(SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler, _166);
break;
}
else
{
float _180 = 1.0 / (1.0 - 0.0);
_191 = mix(texture(SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler, _166 * 0.25), texture(SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler, _166), vec4(clamp((clamp(1.0 - (_146.View_Depth.w * 0.00333332992158830165863037109375), 0.0, 1.0) * _180) - (0.0 * _180), 0.0, 1.0)));
_193 = _191;
_193 = mix(texture(SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler, _166 * 0.25), texture(SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler, _166), vec4(clamp((clamp(1.0 - (_146.View_Depth.w * 0.00333332992158830165863037109375), 0.0, 1.0) * _180) - (0.0 * _180), 0.0, 1.0)));
break;
}
_193 = _192;
@ -160,15 +152,13 @@ void main()
{
if (_173)
{
_205 = texture(SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler, _166);
_220 = _205;
_220 = texture(SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler, _166);
break;
}
else
{
float _207 = 1.0 / (1.0 - 0.0);
_218 = mix(texture(SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler, _166 * 0.25), texture(SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler, _166), vec4(clamp((_165 * _207) - (0.0 * _207), 0.0, 1.0)));
_220 = _218;
_220 = mix(texture(SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler, _166 * 0.25), texture(SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler, _166), vec4(clamp((_165 * _207) - (0.0 * _207), 0.0, 1.0)));
break;
}
_220 = _219;
@ -188,15 +178,13 @@ void main()
{
if (0.75 == 0.0)
{
_283 = texture(SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler, _166);
_298 = _283;
_298 = texture(SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler, _166);
break;
}
else
{
float _285 = 1.0 / (1.0 - 0.75);
_296 = mix(texture(SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler, _166 * 0.25), texture(SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler, _166), vec4(clamp((_165 * _285) - (0.75 * _285), 0.0, 1.0)));
_298 = _296;
_298 = mix(texture(SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler, _166 * 0.25), texture(SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler, _166), vec4(clamp((_165 * _285) - (0.75 * _285), 0.0, 1.0)));
break;
}
_298 = _297;

Просмотреть файл

@ -2,9 +2,7 @@
void main()
{
int _16;
int _23;
for (int _22 = 35; _22 >= 0; _23 = _22 - 1, _22 = _23)
for (int _22 = 35; _22 >= 0; _22--)
{
}
}

Просмотреть файл

@ -14,13 +14,10 @@ layout(location = 0) out vec4 _entryPointOutput;
void main()
{
vec3 _14;
vec3 _29;
int _16;
int _32;
vec3 _28;
_28 = vec3(0.0);
for (int _31 = 0; _31 < 4; _32 = _31 + 1, _28 = _29, _31 = _32)
vec3 _29;
for (int _31 = 0; _31 < 4; _28 = _29, _31++)
{
_29 = _28 + _6.g_MyStruct[_31].color.xyz;
}

Просмотреть файл

@ -7,8 +7,6 @@ vec4 _21;
void main()
{
vec4 _15;
vec4 _17;
vec4 _24;
vec4 _33;
_24 = _21;

Просмотреть файл

@ -18,8 +18,6 @@ layout(location = 0) in vec2 vPatchPosBase[];
bool frustum_cull(vec2 p0)
{
bool _205;
bool _214;
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);
@ -28,12 +26,12 @@ bool frustum_cull(vec2 p0)
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)));
_205 = any(lessThanEqual(f0, vec3(-radius)));
vec3 _199 = f0;
bool _205 = any(lessThanEqual(_199, vec3(-radius)));
bool _215;
if (!_205)
{
_214 = any(lessThanEqual(f1, vec3(-radius)));
_215 = _214;
_215 = any(lessThanEqual(f1, vec3(-radius)));
}
else
{

Просмотреть файл

@ -3129,36 +3129,12 @@ void Compiler::analyze_variable_scope(SPIRFunction &entry)
accessed_variables_to_block[phi.function_variable].insert(block.self);
// Phi variables are also accessed in our target branch block.
accessed_variables_to_block[phi.function_variable].insert(next.self);
notify_variable_access(phi.local_variable, block.self);
}
}
};
// A Phi node might be reading other phi variables as input, so check for this as well.
for (auto &phi : block.phi_variables)
{
if (id_is_phi_variable(phi.local_variable))
accessed_variables_to_block[phi.local_variable].insert(block.self);
else
{
// Temporary variable, due to potential issues with scoping,
// always declare these variables up-front in the entry block.
if (!compiler.hoisted_temporaries.count(phi.local_variable))
{
auto *undef = compiler.maybe_get<SPIRUndef>(phi.local_variable);
// Undef variables are declared as global variables without initializer.
// Never declare these variables.
if (!undef)
{
auto &var = compiler.get<SPIRVariable>(phi.function_variable);
auto &entry_block = compiler.get<SPIRBlock>(entry.entry_block);
entry_block.declare_temporary.emplace_back(var.basetype, phi.local_variable);
compiler.hoisted_temporaries.insert(phi.local_variable);
compiler.forced_temporaries.insert(phi.local_variable);
}
}
}
}
switch (block.terminator)
{
case SPIRBlock::Direct:
@ -3212,6 +3188,11 @@ void Compiler::analyze_variable_scope(SPIRFunction &entry)
bool handle(spv::Op op, const uint32_t *args, uint32_t length)
{
// Keep track of the types of temporaries, so we can hoist them out as necessary.
uint32_t result_type, result_id;
if (compiler.instruction_to_result_type(result_type, result_id, op, args, length))
result_id_to_type[result_id] = result_type;
switch (op)
{
case OpStore:
@ -3374,6 +3355,7 @@ void Compiler::analyze_variable_scope(SPIRFunction &entry)
SPIRFunction &entry;
std::unordered_map<uint32_t, std::unordered_set<uint32_t>> accessed_variables_to_block;
std::unordered_map<uint32_t, std::unordered_set<uint32_t>> accessed_temporaries_to_block;
std::unordered_map<uint32_t, uint32_t> result_id_to_type;
std::unordered_map<uint32_t, std::unordered_set<uint32_t>> complete_write_variables_to_block;
const SPIRBlock *current_block = nullptr;
} handler(*this, entry);
@ -3445,18 +3427,48 @@ void Compiler::analyze_variable_scope(SPIRFunction &entry)
for (auto &var : handler.accessed_temporaries_to_block)
{
auto itr = handler.result_id_to_type.find(var.first);
if (itr == end(handler.result_id_to_type))
{
// We found a false positive ID being used, ignore.
// This should probably be an assert.
continue;
}
DominatorBuilder builder(cfg);
// Figure out which block is dominating all accesses of those temporaries.
auto &blocks = var.second;
for (auto &block : blocks)
{
builder.add_block(block);
builder.lift_continue_block_dominator();
// If a temporary is used in more than one block, we might have to lift continue block
// access up to loop header like we did for variables.
if (blocks.size() != 1 && this->is_continue(block))
builder.add_block(continue_block_to_loop_header[block]);
}
uint32_t dominating_block = builder.get_dominator();
if (dominating_block)
expected_dominator_for_temporary[var.first] = dominating_block;
{
// If we touch a variable in the dominating block, this is the expected setup.
// SPIR-V normally mandates this, but we have extra cases for temporary use inside loops.
bool first_use_is_dominator = blocks.count(dominating_block) != 0;
if (!first_use_is_dominator)
{
// This should be very rare, but if we try to declare a temporary inside a loop,
// and that temporary is used outside the loop as well (spirv-opt inliner likes this)
// we should actually emit the temporary outside the loop.
hoisted_temporaries.insert(var.first);
forced_temporaries.insert(var.first);
auto &block_temporaries = get<SPIRBlock>(dominating_block).declare_temporary;
block_temporaries.emplace_back(handler.result_id_to_type[var.first], var.first);
}
}
}
unordered_set<uint32_t> seen_blocks;
@ -3897,3 +3909,43 @@ std::string Compiler::get_remapped_declared_block_name(uint32_t id) const
return block_name.empty() ? get_block_fallback_name(id) : block_name;
}
}
bool Compiler::instruction_to_result_type(uint32_t &result_type, uint32_t &result_id, spv::Op op, const uint32_t *args,
uint32_t length)
{
// Most instructions follow the pattern of <result-type> <result-id> <arguments>.
// There are some exceptions.
switch (op)
{
case OpStore:
case OpCopyMemory:
case OpCopyMemorySized:
case OpImageWrite:
case OpAtomicStore:
case OpAtomicFlagClear:
case OpEmitStreamVertex:
case OpEndStreamPrimitive:
case OpControlBarrier:
case OpMemoryBarrier:
case OpGroupWaitEvents:
case OpRetainEvent:
case OpReleaseEvent:
case OpSetUserEventStatus:
case OpCaptureEventProfilingInfo:
case OpCommitReadPipe:
case OpCommitWritePipe:
case OpGroupCommitReadPipe:
case OpGroupCommitWritePipe:
return false;
default:
if (length > 1)
{
result_type = args[0];
result_id = args[1];
return true;
}
else
return false;
}
}

Просмотреть файл

@ -705,10 +705,6 @@ protected:
std::unordered_set<uint32_t> forwarded_temporaries;
std::unordered_set<uint32_t> hoisted_temporaries;
// Based on initial analysis, we expect a temporary to be declared in a certain block.
// If we end up declaring a temporary in another block, we'll hoist out that temporary later.
std::unordered_map<uint32_t, uint32_t> expected_dominator_for_temporary;
uint64_t active_input_builtins = 0;
uint64_t active_output_builtins = 0;
// Traverses all reachable opcodes and sets active_builtins to a bitmask of all builtin variables which are accessed in the shader.
@ -748,6 +744,9 @@ protected:
std::vector<spv::Capability> declared_capabilities;
std::vector<std::string> declared_extensions;
std::unordered_map<uint32_t, std::string> declared_block_names;
bool instruction_to_result_type(uint32_t &result_type, uint32_t &result_id, spv::Op op, const uint32_t *args,
uint32_t length);
};
}

Просмотреть файл

@ -2745,24 +2745,6 @@ string CompilerGLSL::declare_temporary(uint32_t result_type, uint32_t result_id)
auto &type = get<SPIRType>(result_type);
auto flags = meta[result_id].decoration.decoration_flags;
auto itr = expected_dominator_for_temporary.find(result_id);
if (!hoisted_temporaries.count(result_id) && itr != end(expected_dominator_for_temporary))
{
if (current_emitting_block->self != itr->second)
{
// This should be very rare, but if we try to declare a temporary inside a loop,
// and that temporary is used outside the loop as well (spirv-opt inliner likes this)
// we should actually emit the temporary outside the loop. We don't know the result types
// before declaring the temporary unless we check every possible opcode during CFG traversal,
// so do it lazily like this where we fallback in these rare scenarios.
hoisted_temporaries.insert(result_id);
forced_temporaries.insert(result_id);
get<SPIRBlock>(itr->second).declare_temporary.emplace_back(result_type, result_id);
force_recompile = true;
}
}
// If we're declaring temporaries inside continue blocks,
// we must declare the temporary in the loop header so that the continue block can avoid declaring new variables.
if (current_continue_block && !hoisted_temporaries.count(result_id))
@ -2774,6 +2756,7 @@ string CompilerGLSL::declare_temporary(uint32_t result_type, uint32_t result_id)
}) == end(header.declare_temporary))
{
header.declare_temporary.emplace_back(result_type, result_id);
hoisted_temporaries.insert(result_id);
force_recompile = true;
}

Просмотреть файл

@ -3449,34 +3449,9 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui
}
// If it has one, keep track of the instruction's result type, mapped by ID
switch (opcode)
{
case OpStore:
case OpCopyMemory:
case OpCopyMemorySized:
case OpImageWrite:
case OpAtomicStore:
case OpAtomicFlagClear:
case OpEmitStreamVertex:
case OpEndStreamPrimitive:
case OpControlBarrier:
case OpMemoryBarrier:
case OpGroupWaitEvents:
case OpRetainEvent:
case OpReleaseEvent:
case OpSetUserEventStatus:
case OpCaptureEventProfilingInfo:
case OpCommitReadPipe:
case OpCommitWritePipe:
case OpGroupCommitReadPipe:
case OpGroupCommitWritePipe:
break;
default:
if (length > 1)
result_types[args[1]] = args[0];
break;
}
uint32_t result_type, result_id;
if (compiler.instruction_to_result_type(result_type, result_id, opcode, args, length))
result_types[result_id] = result_type;
return true;
}