diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2022-05-18 12:26:20 +0200 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2022-05-18 16:37:33 +0200 |
commit | 23662668ddc143da50ee0ccef9a020d81800c9b5 (patch) | |
tree | 704638beccb72b67d8033dfe068a729b0c3a1e87 /reference/shaders-no-opt | |
parent | d0c8dc30450351321e611b2888a48f8410226a4c (diff) | |
download | SPIRV-Cross-23662668ddc143da50ee0ccef9a020d81800c9b5.tar.gz SPIRV-Cross-23662668ddc143da50ee0ccef9a020d81800c9b5.tar.bz2 SPIRV-Cross-23662668ddc143da50ee0ccef9a020d81800c9b5.zip |
Attempt more optimal codegen for OpCompositeInsert.
Speculate that we can modify the SSA value in-place. As long as it is
not used after the modify, this is fine.
Also need to make sure we don't attempt to RMW something that is
impossible to modify.
Diffstat (limited to 'reference/shaders-no-opt')
3 files changed, 31 insertions, 47 deletions
diff --git a/reference/shaders-no-opt/asm/frag/inliner-dominator-inside-loop.asm.frag b/reference/shaders-no-opt/asm/frag/inliner-dominator-inside-loop.asm.frag index ff9c122f..88b94d8c 100644 --- a/reference/shaders-no-opt/asm/frag/inliner-dominator-inside-loop.asm.frag +++ b/reference/shaders-no-opt/asm/frag/inliner-dominator-inside-loop.asm.frag @@ -97,36 +97,24 @@ vec4 _297; void main() { - VertexOutput _128 = _121; + VertexOutput _128; _128.HPosition = gl_FragCoord; - VertexOutput _130 = _128; - _130.Uv_EdgeDistance1 = IN_Uv_EdgeDistance1; - VertexOutput _132 = _130; - _132.UvStuds_EdgeDistance2 = IN_UvStuds_EdgeDistance2; - VertexOutput _134 = _132; - _134.Color = IN_Color; - VertexOutput _136 = _134; - _136.LightPosition_Fog = IN_LightPosition_Fog; - VertexOutput _138 = _136; - _138.View_Depth = IN_View_Depth; - VertexOutput _140 = _138; - _140.Normal_SpecPower = IN_Normal_SpecPower; - VertexOutput _142 = _140; - _142.Tangent = IN_Tangent; - VertexOutput _144 = _142; - _144.PosLightSpace_Reflectance = IN_PosLightSpace_Reflectance; - VertexOutput _146 = _144; - _146.studIndex = IN_studIndex; - SurfaceInput _147 = _122; + _128.Uv_EdgeDistance1 = IN_Uv_EdgeDistance1; + _128.UvStuds_EdgeDistance2 = IN_UvStuds_EdgeDistance2; + _128.Color = IN_Color; + _128.LightPosition_Fog = IN_LightPosition_Fog; + _128.View_Depth = IN_View_Depth; + _128.Normal_SpecPower = IN_Normal_SpecPower; + _128.Tangent = IN_Tangent; + _128.PosLightSpace_Reflectance = IN_PosLightSpace_Reflectance; + _128.studIndex = IN_studIndex; + SurfaceInput _147; _147.Color = IN_Color; - SurfaceInput _149 = _147; - _149.Uv = IN_Uv_EdgeDistance1.xy; - SurfaceInput _151 = _149; - _151.UvStuds = IN_UvStuds_EdgeDistance2.xy; - SurfaceInput _156 = _151; - _156.UvStuds.y = (fract(_151.UvStuds.y) + IN_studIndex) * 0.25; - float _160 = clamp(1.0 - (_146.View_Depth.w * 0.00333332992158830165863037109375), 0.0, 1.0); - float _163 = _146.View_Depth.w * _19.CB0.RefractionBias_FadeDistance_GlowFactor.y; + _147.Uv = IN_Uv_EdgeDistance1.xy; + _147.UvStuds = IN_UvStuds_EdgeDistance2.xy; + _147.UvStuds.y = (fract(_147.UvStuds.y) + IN_studIndex) * 0.25; + float _160 = clamp(1.0 - (_128.View_Depth.w * 0.00333332992158830165863037109375), 0.0, 1.0); + float _163 = _128.View_Depth.w * _19.CB0.RefractionBias_FadeDistance_GlowFactor.y; float _165 = clamp(1.0 - _163, 0.0, 1.0); vec2 _166 = IN_Uv_EdgeDistance1.xy * 1.0; bool _173; @@ -174,7 +162,7 @@ void main() vec3 _253 = vec3(_252.x, _252.y, _232.z); vec2 _255 = _253.xy * _165; vec3 _256 = vec3(_255.x, _255.y, _253.z); - vec4 _268 = texture(SPIRV_Cross_CombinedStudsMapTextureStudsMapSampler, _156.UvStuds); + vec4 _268 = texture(SPIRV_Cross_CombinedStudsMapTextureStudsMapSampler, _147.UvStuds); vec3 _271 = ((IN_Color.xyz * (_193 * 1.0).xyz) * (1.0 + (_256.x * 0.300000011920928955078125))) * (_268.x * 2.0); vec4 _298; for (;;) @@ -194,21 +182,17 @@ void main() break; } vec2 _303 = mix(vec2(0.800000011920928955078125, 120.0), (_298.xy * vec2(2.0, 256.0)) + vec2(0.0, 0.00999999977648258209228515625), vec2(_165)); - Surface _304 = _125; + Surface _304; _304.albedo = _271; - Surface _305 = _304; - _305.normal = _256; + _304.normal = _256; float _306 = _303.x; - Surface _307 = _305; - _307.specular = _306; + _304.specular = _306; float _308 = _303.y; - Surface _309 = _307; - _309.gloss = _308; + _304.gloss = _308; float _312 = (_298.xy.y * _165) * 0.0; - Surface _313 = _309; - _313.reflectance = _312; - vec4 _318 = vec4(_271, _146.Color.w); - vec3 _329 = normalize(((IN_Tangent * _313.normal.x) + (cross(IN_Normal_SpecPower.xyz, IN_Tangent) * _313.normal.y)) + (IN_Normal_SpecPower.xyz * _313.normal.z)); + _304.reflectance = _312; + vec4 _318 = vec4(_271, _128.Color.w); + vec3 _329 = normalize(((IN_Tangent * _304.normal.x) + (cross(IN_Normal_SpecPower.xyz, IN_Tangent) * _304.normal.y)) + (IN_Normal_SpecPower.xyz * _304.normal.z)); vec3 _332 = -_19.CB0.Lamp0Dir; float _333 = dot(_329, _332); float _357 = clamp(dot(step(_19.CB0.LightConfig3.xyz, abs(IN_LightPosition_Fog.xyz - _19.CB0.LightConfig2.xyz)), vec3(1.0)), 0.0, 1.0); @@ -217,13 +201,13 @@ void main() float _392 = (1.0 - (((step(_376.x, IN_PosLightSpace_Reflectance.xyz.z) * clamp(9.0 - (20.0 * abs(IN_PosLightSpace_Reflectance.xyz.z - 0.5)), 0.0, 1.0)) * _376.y) * _19.CB0.OutlineBrightness_ShadowInfo.w)) * _368.w; vec3 _403 = mix(_318.xyz, texture(SPIRV_Cross_CombinedEnvironmentMapTextureEnvironmentMapSampler, reflect(-IN_View_Depth.xyz, _329)).xyz, vec3(_312)); vec3 _422 = (((_19.CB0.AmbientColor + (((_19.CB0.Lamp0Color * clamp(_333, 0.0, 1.0)) + (_19.CB0.Lamp1Color * max(-_333, 0.0))) * _392)) + _368.xyz) * vec4(_403.x, _403.y, _403.z, _318.w).xyz) + (_19.CB0.Lamp0Color * (((step(0.0, _333) * _306) * _392) * pow(clamp(dot(_329, normalize(_332 + normalize(IN_View_Depth.xyz))), 0.0, 1.0), _308))); - vec4 _425 = vec4(_422.x, _422.y, _422.z, _124.w); - _425.w = vec4(_403.x, _403.y, _403.z, _318.w).w; + vec4 _423 = vec4(_422.x, _422.y, _422.z, _124.w); + _423.w = vec4(_403.x, _403.y, _403.z, _318.w).w; vec2 _435 = min(IN_Uv_EdgeDistance1.wz, IN_UvStuds_EdgeDistance2.wz); float _439 = min(_435.x, _435.y) / _163; - vec3 _445 = _425.xyz * clamp((clamp((_163 * _19.CB0.OutlineBrightness_ShadowInfo.x) + _19.CB0.OutlineBrightness_ShadowInfo.y, 0.0, 1.0) * (1.5 - _439)) + _439, 0.0, 1.0); - vec4 _446 = vec4(_445.x, _445.y, _445.z, _425.w); - vec3 _453 = mix(_19.CB0.FogColor, _446.xyz, vec3(clamp(_146.LightPosition_Fog.w, 0.0, 1.0))); + vec3 _445 = _423.xyz * clamp((clamp((_163 * _19.CB0.OutlineBrightness_ShadowInfo.x) + _19.CB0.OutlineBrightness_ShadowInfo.y, 0.0, 1.0) * (1.5 - _439)) + _439, 0.0, 1.0); + vec4 _446 = vec4(_445.x, _445.y, _445.z, _423.w); + vec3 _453 = mix(_19.CB0.FogColor, _446.xyz, vec3(clamp(_128.LightPosition_Fog.w, 0.0, 1.0))); _entryPointOutput = vec4(_453.x, _453.y, _453.z, _446.w); } diff --git a/reference/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag b/reference/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag index 2f7fee64..2ec47169 100644 --- a/reference/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag +++ b/reference/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag @@ -16,7 +16,7 @@ void main() _30 = _19; break; } - highp vec2 _29 = _19; + highp vec2 _29; _29.y = _19.y; _30 = _29; break; diff --git a/reference/shaders-no-opt/legacy/frag/switch-single-case-multiple-exit-cfg.legacy.asm.frag b/reference/shaders-no-opt/legacy/frag/switch-single-case-multiple-exit-cfg.legacy.asm.frag index be41ceef..f46bc2fd 100644 --- a/reference/shaders-no-opt/legacy/frag/switch-single-case-multiple-exit-cfg.legacy.asm.frag +++ b/reference/shaders-no-opt/legacy/frag/switch-single-case-multiple-exit-cfg.legacy.asm.frag @@ -14,7 +14,7 @@ void main() _30 = _19; break; } - highp vec2 _29 = _19; + highp vec2 _29; _29.y = _19.y; _30 = _29; break; |