From 9fbd8b789e351c2bb772cec570c1105962056b43 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Mon, 12 Mar 2018 14:58:40 +0100 Subject: [PATCH] Update tests for latest SPIRV-Tools and glslang. --- ...n-constant-workgroup.noopt.nofxc.asm.comp} | 0 .../comp/storage-buffer-basic.nofxc.asm.comp | 2 + .../asm/frag/function-overload-alias.asm.frag | 2 +- .../asm/frag/unreachable.asm.frag | 16 +- reference/opt/shaders-hlsl/comp/barriers.comp | 2 - reference/opt/shaders-hlsl/comp/image.comp | 38 +-- reference/opt/shaders-hlsl/comp/shared.comp | 4 +- .../frag/array-lut-no-loop-variable.frag | 7 +- .../frag/image-query-selective.frag | 101 ++++++++ .../opt/shaders-hlsl/frag/image-query.frag | 107 ++++++++ .../frag/partial-write-preserve.frag | 6 - .../opt/shaders-hlsl/frag/resources.frag | 4 +- .../frag/sample-cmp-level-zero.frag | 4 +- .../opt/shaders-hlsl/frag/sampler-array.frag | 3 +- .../opt/shaders-hlsl/frag/spec-constant.frag | 4 +- .../opt/shaders-hlsl/frag/tex-sampling.frag | 58 ++--- .../opt/shaders-hlsl/frag/unary-enclose.frag | 2 +- .../opt/shaders-hlsl/vert/locations.vert | 12 +- .../opt/shaders-hlsl/vert/return-array.vert | 2 - ...specialization-constant-workgroup.asm.comp | 6 - .../asm/comp/storage-buffer-basic.asm.comp | 1 + .../asm/frag/default-member-names.asm.frag | 26 +- .../asm/frag/function-overload-alias.asm.frag | 2 +- .../asm/frag/op-constant-null.asm.frag | 6 - .../asm/frag/phi-loop-variable.asm.frag | 3 - .../asm/frag/undef-variable-store.asm.frag | 23 +- .../shaders-msl/asm/frag/unreachable.asm.frag | 16 +- .../asm/frag/vector-shuffle-oom.asm.frag | 128 +++++----- .../asm/vert/packing-test.asm.vert | 10 - .../opt/shaders-msl/comp/bake_gradient.comp | 22 -- reference/opt/shaders-msl/comp/barriers.comp | 2 - reference/opt/shaders-msl/comp/culling.comp | 2 - .../opt/shaders-msl/comp/defer-parens.comp | 7 +- reference/opt/shaders-msl/comp/dowhile.comp | 1 - reference/opt/shaders-msl/comp/image.comp | 3 +- .../opt/shaders-msl/comp/packing-test-1.comp | 10 +- .../opt/shaders-msl/comp/packing-test-2.comp | 2 - reference/opt/shaders-msl/comp/return.comp | 33 --- reference/opt/shaders-msl/comp/rmw-opt.comp | 3 +- .../comp/shared-array-of-arrays.comp | 4 +- reference/opt/shaders-msl/comp/shared.comp | 4 +- .../opt/shaders-msl/comp/struct-nested.comp | 18 +- .../opt/shaders-msl/comp/struct-packing.comp | 35 +-- .../opt/shaders-msl/comp/torture-loop.comp | 53 +--- .../opt/shaders-msl/comp/type-alias.comp | 26 +- reference/opt/shaders-msl/comp/udiv.comp | 9 +- .../shaders-msl/flatten/swizzle.flatten.vert | 2 +- .../frag/array-lut-no-loop-variable.frag | 7 +- .../opt/shaders-msl/frag/constant-array.frag | 2 +- .../opt/shaders-msl/frag/false-loop-init.frag | 16 +- .../opt/shaders-msl/frag/flush_params.frag | 5 - .../opt/shaders-msl/frag/for-loop-init.frag | 32 ++- .../opt/shaders-msl/frag/fp16.desktop.frag | 6 - reference/opt/shaders-msl/frag/mix.frag | 9 +- .../opt/shaders-msl/frag/packing-test-3.frag | 13 +- .../opt/shaders-msl/frag/unary-enclose.frag | 2 +- .../opt/shaders-msl/vert/copy.flatten.vert | 15 +- .../opt/shaders-msl/vert/dynamic.flatten.vert | 4 +- .../opt/shaders-msl/vert/packed_matrix.vert | 8 +- .../opt/shaders-msl/vert/return-array.vert | 2 - reference/opt/shaders/amd/fs.invalid.frag | 4 +- reference/opt/shaders/amd/gcn_shader.comp | 1 + reference/opt/shaders/amd/shader_ballot.comp | 6 +- .../opt/shaders/amd/shader_group_vote.comp | 7 + .../shaders/amd/shader_trinary_minmax.comp | 1 + ...specialization-constant-workgroup.asm.comp | 2 +- .../asm/comp/storage-buffer-basic.asm.comp | 2 + ...osite-construct-struct-no-swizzle.asm.frag | 6 - .../asm/frag/default-member-names.asm.frag | 26 +- .../asm/frag/function-overload-alias.asm.frag | 2 +- .../frag/image-fetch-no-sampler.asm.vk.frag | 4 +- .../image-fetch-no-sampler.asm.vk.frag.vk | 6 +- ...iner-dominator-inside-loop.noopt.asm.frag} | 0 ...op-body-dominator-continue-access.asm.frag | 28 +-- .../asm/frag/loop-header-to-continue.asm.frag | 2 +- .../asm/frag/loop-merge-to-continue.asm.frag | 13 +- .../asm/frag/multi-for-loop-init.asm.frag | 5 +- .../asm/frag/op-constant-null.asm.frag | 6 - .../asm/frag/phi-loop-variable.asm.frag | 3 - .../sampler-buffer-without-sampler.asm.frag | 4 +- .../frag/selection-merge-to-continue.asm.frag | 1 + .../frag/switch-merge-to-continue.asm.frag | 1 + .../asm/frag/temporary-phi-hoisting.asm.frag | 7 +- .../asm/frag/undef-variable-store.asm.frag | 23 +- .../opt/shaders/asm/frag/unreachable.asm.frag | 15 +- .../asm/frag/vector-shuffle-oom.asm.frag | 128 +++++----- ...s-fixed-input-array-builtin-array.asm.tesc | 59 +---- .../opt/shaders/asm/vert/empty-io.asm.vert | 10 - .../asm/vert/global-builtin.sso.asm.vert | 8 +- reference/opt/shaders/comp/bake_gradient.comp | 11 +- reference/opt/shaders/comp/casts.comp | 6 +- reference/opt/shaders/comp/cfg.comp | 19 +- .../opt/shaders/comp/composite-construct.comp | 14 +- reference/opt/shaders/comp/defer-parens.comp | 7 +- reference/opt/shaders/comp/dowhile.comp | 1 - .../opt/shaders/comp/generate_height.comp | 51 ++-- reference/opt/shaders/comp/image.comp | 3 +- reference/opt/shaders/comp/return.comp | 31 --- .../shaders/comp/return.noopt.comp} | 0 reference/opt/shaders/comp/rmw-opt.comp | 3 +- reference/opt/shaders/comp/shared.comp | 2 +- .../opt/shaders/comp/struct-packing.comp | 35 +-- reference/opt/shaders/comp/torture-loop.comp | 53 +--- reference/opt/shaders/comp/type-alias.comp | 11 +- reference/opt/shaders/comp/udiv.comp | 6 +- .../desktop-only/comp/enhanced-layouts.comp | 9 +- .../desktop-only/frag/fp16.desktop.frag | 6 - .../frag/image-query.desktop.frag | 9 + .../desktop-only/geom/basic.desktop.sso.geom | 7 +- .../opt/shaders/flatten/copy.flatten.vert | 8 +- .../opt/shaders/flatten/dynamic.flatten.vert | 4 +- ...multi-dimensional.desktop.flatten_dim.frag | 20 +- .../frag/array-lut-no-loop-variable.frag | 7 +- .../opt/shaders/frag/constant-array.frag | 2 +- .../frag/eliminate-dead-variables.frag | 14 -- .../opt/shaders/frag/false-loop-init.frag | 16 +- reference/opt/shaders/frag/flush_params.frag | 5 - reference/opt/shaders/frag/for-loop-init.frag | 32 ++- reference/opt/shaders/frag/ground.frag | 2 +- ...temporary-use-continue-block-as-value.frag | 19 +- reference/opt/shaders/frag/mix.frag | 8 +- .../shaders/frag/partial-write-preserve.frag | 6 - .../opt/shaders/frag/sampler-ms-query.frag | 14 -- reference/opt/shaders/frag/swizzle.frag | 2 +- reference/opt/shaders/frag/temporary.frag | 14 -- reference/opt/shaders/frag/unary-enclose.frag | 2 +- reference/opt/shaders/geom/basic.geom | 7 +- .../legacy/vert/struct-varying.legacy.vert | 5 +- reference/opt/shaders/tesc/water_tess.tesc | 8 +- reference/opt/shaders/tese/water_tess.tese | 7 +- reference/opt/shaders/vert/ocean.vert | 10 +- .../frag/separate-sampler-texture.vk.frag | 5 +- .../frag/separate-sampler-texture.vk.frag.vk | 5 +- .../vulkan/frag/spec-constant.noopt.vk.frag} | 0 .../frag/spec-constant.noopt.vk.frag.vk} | 0 .../shaders/vulkan/frag/spec-constant.vk.frag | 20 -- .../vulkan/frag/spec-constant.vk.frag.vk | 25 -- ...n-constant-workgroup.noopt.nofxc.asm.comp} | 0 reference/shaders-hlsl/frag/tex-sampling.frag | 48 ++-- .../inliner-dominator-inside-loop.asm.frag | 0 .../comp/return.comp | 0 .../vert/functions_nested.vert | 8 +- .../inliner-dominator-inside-loop.asm.frag | 236 ------------------ reference/shaders-msl/comp/bake_gradient.comp | 40 --- reference/shaders/amd/fs.invalid.frag | 4 +- ...iner-dominator-inside-loop.noopt.asm.frag} | 0 reference/shaders/comp/return.noopt.comp | 34 +++ .../desktop-only/comp/fp64.desktop.comp | 1 - .../shaders/vulkan/frag/push-constant.frag.vk | 18 -- .../vulkan/frag/spec-constant.noopt.vk.frag | 59 +++++ .../frag/spec-constant.noopt.vk.frag.vk | 68 +++++ .../shaders/vulkan/vert/vulkan-vertex.vert | 9 - .../shaders/vulkan/vert/vulkan-vertex.vert.vk | 7 - ...n-constant-workgroup.noopt.nofxc.asm.comp} | 0 shaders-hlsl/frag/tex-sampling.frag | 28 +-- .../inliner-dominator-inside-loop.asm.frag | 0 .../comp/return.comp | 0 shaders-msl/frag/swizzle.frag | 2 +- ...iner-dominator-inside-loop.noopt.asm.frag} | 0 .../comp/{return.comp => return.noopt.comp} | 0 shaders/desktop-only/comp/fp64.desktop.comp | 2 +- ...nt.vk.frag => spec-constant.noopt.vk.frag} | 0 spirv_cross.cpp | 8 +- spirv_cross.hpp | 6 + spirv_glsl.cpp | 15 +- 165 files changed, 951 insertions(+), 1525 deletions(-) rename reference/opt/shaders-hlsl/asm/comp/{specialization-constant-workgroup.nofxc.asm.comp => specialization-constant-workgroup.noopt.nofxc.asm.comp} (100%) delete mode 100644 reference/opt/shaders-msl/comp/bake_gradient.comp delete mode 100644 reference/opt/shaders-msl/comp/return.comp rename reference/opt/shaders/asm/frag/{inliner-dominator-inside-loop.asm.frag => inliner-dominator-inside-loop.noopt.asm.frag} (100%) delete mode 100644 reference/opt/shaders/comp/return.comp rename reference/{shaders/comp/return.comp => opt/shaders/comp/return.noopt.comp} (100%) delete mode 100644 reference/opt/shaders/frag/eliminate-dead-variables.frag delete mode 100644 reference/opt/shaders/frag/sampler-ms-query.frag delete mode 100644 reference/opt/shaders/frag/temporary.frag rename reference/{shaders/vulkan/frag/spec-constant.vk.frag => opt/shaders/vulkan/frag/spec-constant.noopt.vk.frag} (100%) rename reference/{shaders/vulkan/frag/spec-constant.vk.frag.vk => opt/shaders/vulkan/frag/spec-constant.noopt.vk.frag.vk} (100%) delete mode 100644 reference/opt/shaders/vulkan/frag/spec-constant.vk.frag delete mode 100644 reference/opt/shaders/vulkan/frag/spec-constant.vk.frag.vk rename reference/shaders-hlsl/asm/comp/{specialization-constant-workgroup.nofxc.asm.comp => specialization-constant-workgroup.noopt.nofxc.asm.comp} (100%) rename reference/{opt/shaders-msl => shaders-msl-no-opt}/asm/frag/inliner-dominator-inside-loop.asm.frag (100%) rename reference/{shaders-msl => shaders-msl-no-opt}/comp/return.comp (100%) delete mode 100644 reference/shaders-msl/asm/frag/inliner-dominator-inside-loop.asm.frag delete mode 100644 reference/shaders-msl/comp/bake_gradient.comp rename reference/shaders/asm/frag/{inliner-dominator-inside-loop.asm.frag => inliner-dominator-inside-loop.noopt.asm.frag} (100%) create mode 100644 reference/shaders/comp/return.noopt.comp delete mode 100644 reference/shaders/vulkan/frag/push-constant.frag.vk create mode 100644 reference/shaders/vulkan/frag/spec-constant.noopt.vk.frag create mode 100644 reference/shaders/vulkan/frag/spec-constant.noopt.vk.frag.vk delete mode 100644 reference/shaders/vulkan/vert/vulkan-vertex.vert delete mode 100644 reference/shaders/vulkan/vert/vulkan-vertex.vert.vk rename shaders-hlsl/asm/comp/{specialization-constant-workgroup.nofxc.asm.comp => specialization-constant-workgroup.noopt.nofxc.asm.comp} (100%) rename {shaders-msl => shaders-msl-no-opt}/asm/frag/inliner-dominator-inside-loop.asm.frag (100%) rename {shaders-msl => shaders-msl-no-opt}/comp/return.comp (100%) rename shaders/asm/frag/{inliner-dominator-inside-loop.asm.frag => inliner-dominator-inside-loop.noopt.asm.frag} (100%) rename shaders/comp/{return.comp => return.noopt.comp} (100%) rename shaders/vulkan/frag/{spec-constant.vk.frag => spec-constant.noopt.vk.frag} (100%) diff --git a/reference/opt/shaders-hlsl/asm/comp/specialization-constant-workgroup.nofxc.asm.comp b/reference/opt/shaders-hlsl/asm/comp/specialization-constant-workgroup.noopt.nofxc.asm.comp similarity index 100% rename from reference/opt/shaders-hlsl/asm/comp/specialization-constant-workgroup.nofxc.asm.comp rename to reference/opt/shaders-hlsl/asm/comp/specialization-constant-workgroup.noopt.nofxc.asm.comp diff --git a/reference/opt/shaders-hlsl/asm/comp/storage-buffer-basic.nofxc.asm.comp b/reference/opt/shaders-hlsl/asm/comp/storage-buffer-basic.nofxc.asm.comp index 1bdb27d7..1887eaa8 100644 --- a/reference/opt/shaders-hlsl/asm/comp/storage-buffer-basic.nofxc.asm.comp +++ b/reference/opt/shaders-hlsl/asm/comp/storage-buffer-basic.nofxc.asm.comp @@ -11,6 +11,8 @@ struct SPIRV_Cross_Input uint3 gl_WorkGroupID : SV_GroupID; }; +static uint3 _22 = gl_WorkGroupSize; + void comp_main() { _8.Store(gl_WorkGroupID.x * 4 + 0, asuint(asfloat(_9.Load(gl_WorkGroupID.x * 4 + 0)) + asfloat(_8.Load(gl_WorkGroupID.x * 4 + 0)))); diff --git a/reference/opt/shaders-hlsl/asm/frag/function-overload-alias.asm.frag b/reference/opt/shaders-hlsl/asm/frag/function-overload-alias.asm.frag index 432915da..93f8414e 100644 --- a/reference/opt/shaders-hlsl/asm/frag/function-overload-alias.asm.frag +++ b/reference/opt/shaders-hlsl/asm/frag/function-overload-alias.asm.frag @@ -7,7 +7,7 @@ struct SPIRV_Cross_Output void frag_main() { - FragColor = (((1.0f.xxxx + 1.0f.xxxx) + (1.0f.xxx.xyzz + 1.0f.xxxx)) + (1.0f.xxxx + 2.0f.xxxx)) + (1.0f.xx.xyxy + 2.0f.xxxx); + FragColor = 10.0f.xxxx; } SPIRV_Cross_Output main() diff --git a/reference/opt/shaders-hlsl/asm/frag/unreachable.asm.frag b/reference/opt/shaders-hlsl/asm/frag/unreachable.asm.frag index e7cb7902..ee3e4672 100644 --- a/reference/opt/shaders-hlsl/asm/frag/unreachable.asm.frag +++ b/reference/opt/shaders-hlsl/asm/frag/unreachable.asm.frag @@ -11,25 +11,23 @@ struct SPIRV_Cross_Output float4 FragColor : SV_Target0; }; -float4 _21; - void frag_main() { - float4 _33; - do + bool _29; + for (;;) { - if (counter == 10) + _29 = counter == 10; + if (_29) { - _33 = 10.0f.xxxx; break; } else { - _33 = 30.0f.xxxx; break; } - } while (false); - FragColor = _33; + } + bool4 _35 = _29.xxxx; + FragColor = float4(_35.x ? 10.0f.xxxx.x : 30.0f.xxxx.x, _35.y ? 10.0f.xxxx.y : 30.0f.xxxx.y, _35.z ? 10.0f.xxxx.z : 30.0f.xxxx.z, _35.w ? 10.0f.xxxx.w : 30.0f.xxxx.w); } SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) diff --git a/reference/opt/shaders-hlsl/comp/barriers.comp b/reference/opt/shaders-hlsl/comp/barriers.comp index 7ac2a656..b24e7c48 100644 --- a/reference/opt/shaders-hlsl/comp/barriers.comp +++ b/reference/opt/shaders-hlsl/comp/barriers.comp @@ -1,5 +1,3 @@ -static const uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u); - void comp_main() { GroupMemoryBarrier(); diff --git a/reference/opt/shaders-hlsl/comp/image.comp b/reference/opt/shaders-hlsl/comp/image.comp index a8fc1375..6c2b58cd 100644 --- a/reference/opt/shaders-hlsl/comp/image.comp +++ b/reference/opt/shaders-hlsl/comp/image.comp @@ -34,24 +34,26 @@ struct SPIRV_Cross_Input void comp_main() { - uImageOutF[int2(gl_GlobalInvocationID.xy)] = uImageInF[int2(gl_GlobalInvocationID.xy)].x; - uImageOutI[int2(gl_GlobalInvocationID.xy)] = uImageInI[int2(gl_GlobalInvocationID.xy)].x; - uImageOutU[int2(gl_GlobalInvocationID.xy)] = uImageInU[int2(gl_GlobalInvocationID.xy)].x; - uImageOutBuffer[int(gl_GlobalInvocationID.x)] = uImageInBuffer[int(gl_GlobalInvocationID.x)].x; - uImageOutF2[int2(gl_GlobalInvocationID.xy)] = uImageInF2[int2(gl_GlobalInvocationID.xy)].xy; - uImageOutI2[int2(gl_GlobalInvocationID.xy)] = uImageInI2[int2(gl_GlobalInvocationID.xy)].xy; - uImageOutU2[int2(gl_GlobalInvocationID.xy)] = uImageInU2[int2(gl_GlobalInvocationID.xy)].xy; - float4 _135 = uImageInBuffer2[int(gl_GlobalInvocationID.x)].xyyy; - uImageOutBuffer2[int(gl_GlobalInvocationID.x)] = _135.xy; - uImageOutF4[int2(gl_GlobalInvocationID.xy)] = uImageInF4[int2(gl_GlobalInvocationID.xy)]; - int4 _165 = uImageInI4[int2(gl_GlobalInvocationID.xy)]; - uImageOutI4[int2(gl_GlobalInvocationID.xy)] = _165; - uint4 _180 = uImageInU4[int2(gl_GlobalInvocationID.xy)]; - uImageOutU4[int2(gl_GlobalInvocationID.xy)] = _180; - uImageOutBuffer4[int(gl_GlobalInvocationID.x)] = uImageInBuffer4[int(gl_GlobalInvocationID.x)]; - uImageNoFmtF[int2(gl_GlobalInvocationID.xy)] = _135; - uImageNoFmtU[int2(gl_GlobalInvocationID.xy)] = _180; - uImageNoFmtI[int2(gl_GlobalInvocationID.xy)] = _165; + int2 _23 = int2(gl_GlobalInvocationID.xy); + uImageOutF[_23] = uImageInF[_23].x; + uImageOutI[_23] = uImageInI[_23].x; + uImageOutU[_23] = uImageInU[_23].x; + int _74 = int(gl_GlobalInvocationID.x); + uImageOutBuffer[_74] = uImageInBuffer[_74].x; + uImageOutF2[_23] = uImageInF2[_23].xy; + uImageOutI2[_23] = uImageInI2[_23].xy; + uImageOutU2[_23] = uImageInU2[_23].xy; + float4 _135 = uImageInBuffer2[_74].xyyy; + uImageOutBuffer2[_74] = _135.xy; + uImageOutF4[_23] = uImageInF4[_23]; + int4 _165 = uImageInI4[_23]; + uImageOutI4[_23] = _165; + uint4 _180 = uImageInU4[_23]; + uImageOutU4[_23] = _180; + uImageOutBuffer4[_74] = uImageInBuffer4[_74]; + uImageNoFmtF[_23] = _135; + uImageNoFmtU[_23] = _180; + uImageNoFmtI[_23] = _165; } [numthreads(1, 1, 1)] diff --git a/reference/opt/shaders-hlsl/comp/shared.comp b/reference/opt/shaders-hlsl/comp/shared.comp index 498241ea..a6b56f89 100644 --- a/reference/opt/shaders-hlsl/comp/shared.comp +++ b/reference/opt/shaders-hlsl/comp/shared.comp @@ -1,5 +1,3 @@ -static const uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u); - ByteAddressBuffer _22 : register(t0); RWByteAddressBuffer _44 : register(u1); @@ -17,7 +15,7 @@ void comp_main() { sShared[gl_LocalInvocationIndex] = asfloat(_22.Load(gl_GlobalInvocationID.x * 4 + 0)); GroupMemoryBarrierWithGroupSync(); - _44.Store(gl_GlobalInvocationID.x * 4 + 0, asuint(sShared[(4u - gl_LocalInvocationIndex) - 1u])); + _44.Store(gl_GlobalInvocationID.x * 4 + 0, asuint(sShared[3u - gl_LocalInvocationIndex])); } [numthreads(4, 1, 1)] diff --git a/reference/opt/shaders-hlsl/frag/array-lut-no-loop-variable.frag b/reference/opt/shaders-hlsl/frag/array-lut-no-loop-variable.frag index 46599d29..8cb52f0a 100644 --- a/reference/opt/shaders-hlsl/frag/array-lut-no-loop-variable.frag +++ b/reference/opt/shaders-hlsl/frag/array-lut-no-loop-variable.frag @@ -16,9 +16,12 @@ struct SPIRV_Cross_Output void frag_main() { float lut[5] = _17; - int _33; - for (int _46 = 0; _46 < 4; _33 = _46 + 1, FragColor += lut[_33].xxxx, _46 = _33) + for (int _46 = 0; _46 < 4; ) { + int _33 = _46 + 1; + FragColor += lut[_33].xxxx; + _46 = _33; + continue; } } diff --git a/reference/opt/shaders-hlsl/frag/image-query-selective.frag b/reference/opt/shaders-hlsl/frag/image-query-selective.frag index c73b742b..9194d0de 100644 --- a/reference/opt/shaders-hlsl/frag/image-query-selective.frag +++ b/reference/opt/shaders-hlsl/frag/image-query-selective.frag @@ -2,6 +2,30 @@ Texture1D uSampler1DUint : register(t0); SamplerState _uSampler1DUint_sampler : register(s0); Texture1D uSampler1DInt : register(t0); SamplerState _uSampler1DInt_sampler : register(s0); +Texture1D uSampler1DFloat : register(t0); +SamplerState _uSampler1DFloat_sampler : register(s0); +Texture2DArray uSampler2DArray : register(t2); +SamplerState _uSampler2DArray_sampler : register(s2); +Texture3D uSampler3D : register(t3); +SamplerState _uSampler3D_sampler : register(s3); +TextureCube uSamplerCube : register(t4); +SamplerState _uSamplerCube_sampler : register(s4); +TextureCubeArray uSamplerCubeArray : register(t5); +SamplerState _uSamplerCubeArray_sampler : register(s5); +Buffer uSamplerBuffer : register(t6); +Texture2DMS uSamplerMS : register(t7); +SamplerState _uSamplerMS_sampler : register(s7); +Texture2DMSArray uSamplerMSArray : register(t8); +SamplerState _uSamplerMSArray_sampler : register(s8); +Texture2D uSampler2D : register(t1); +SamplerState _uSampler2D_sampler : register(s1); + +uint SPIRV_Cross_textureSize(Texture1D Tex, uint Level, out uint Param) +{ + uint ret; + Tex.GetDimensions(Level, ret.x, Param); + return ret; +} uint SPIRV_Cross_textureSize(Texture1D Tex, uint Level, out uint Param) { @@ -17,10 +41,87 @@ uint SPIRV_Cross_textureSize(Texture1D Tex, uint Level, out uint Param) return ret; } +uint2 SPIRV_Cross_textureSize(Texture2D Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(Level, ret.x, ret.y, Param); + return ret; +} + +uint3 SPIRV_Cross_textureSize(Texture2DArray Tex, uint Level, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param); + return ret; +} + +uint3 SPIRV_Cross_textureSize(Texture3D Tex, uint Level, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param); + return ret; +} + +uint SPIRV_Cross_textureSize(Buffer Tex, uint Level, out uint Param) +{ + uint ret; + Tex.GetDimensions(ret.x); + Param = 0u; + return ret; +} + +uint2 SPIRV_Cross_textureSize(TextureCube Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(Level, ret.x, ret.y, Param); + return ret; +} + +uint3 SPIRV_Cross_textureSize(TextureCubeArray Tex, uint Level, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param); + return ret; +} + +uint2 SPIRV_Cross_textureSize(Texture2DMS Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(ret.x, ret.y, Param); + return ret; +} + +uint3 SPIRV_Cross_textureSize(Texture2DMSArray Tex, uint Level, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(ret.x, ret.y, ret.z, Param); + return ret; +} + void frag_main() { uint _17_dummy_parameter; uint _24_dummy_parameter; + uint _32_dummy_parameter; + uint _42_dummy_parameter; + uint _50_dummy_parameter; + uint _60_dummy_parameter; + uint _68_dummy_parameter; + uint _76_dummy_parameter; + uint _84_dummy_parameter; + uint _92_dummy_parameter; + int _100; + SPIRV_Cross_textureSize(uSampler2D, 0u, _100); + int _104; + SPIRV_Cross_textureSize(uSampler2DArray, 0u, _104); + int _108; + SPIRV_Cross_textureSize(uSampler3D, 0u, _108); + int _112; + SPIRV_Cross_textureSize(uSamplerCube, 0u, _112); + int _116; + SPIRV_Cross_textureSize(uSamplerMS, 0u, _116); + int _120; + SPIRV_Cross_textureSize(uSamplerMSArray, 0u, _120); } void main() diff --git a/reference/opt/shaders-hlsl/frag/image-query.frag b/reference/opt/shaders-hlsl/frag/image-query.frag index 3b50282f..20d8c159 100644 --- a/reference/opt/shaders-hlsl/frag/image-query.frag +++ b/reference/opt/shaders-hlsl/frag/image-query.frag @@ -1,5 +1,112 @@ +Texture1D uSampler1D : register(t0); +SamplerState _uSampler1D_sampler : register(s0); +Texture2D uSampler2D : register(t1); +SamplerState _uSampler2D_sampler : register(s1); +Texture2DArray uSampler2DArray : register(t2); +SamplerState _uSampler2DArray_sampler : register(s2); +Texture3D uSampler3D : register(t3); +SamplerState _uSampler3D_sampler : register(s3); +TextureCube uSamplerCube : register(t4); +SamplerState _uSamplerCube_sampler : register(s4); +TextureCubeArray uSamplerCubeArray : register(t5); +SamplerState _uSamplerCubeArray_sampler : register(s5); +Buffer uSamplerBuffer : register(t6); +Texture2DMS uSamplerMS : register(t7); +SamplerState _uSamplerMS_sampler : register(s7); +Texture2DMSArray uSamplerMSArray : register(t8); +SamplerState _uSamplerMSArray_sampler : register(s8); + +uint SPIRV_Cross_textureSize(Texture1D Tex, uint Level, out uint Param) +{ + uint ret; + Tex.GetDimensions(Level, ret.x, Param); + return ret; +} + +uint2 SPIRV_Cross_textureSize(Texture2D Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(Level, ret.x, ret.y, Param); + return ret; +} + +uint3 SPIRV_Cross_textureSize(Texture2DArray Tex, uint Level, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param); + return ret; +} + +uint3 SPIRV_Cross_textureSize(Texture3D Tex, uint Level, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param); + return ret; +} + +uint SPIRV_Cross_textureSize(Buffer Tex, uint Level, out uint Param) +{ + uint ret; + Tex.GetDimensions(ret.x); + Param = 0u; + return ret; +} + +uint2 SPIRV_Cross_textureSize(TextureCube Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(Level, ret.x, ret.y, Param); + return ret; +} + +uint3 SPIRV_Cross_textureSize(TextureCubeArray Tex, uint Level, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param); + return ret; +} + +uint2 SPIRV_Cross_textureSize(Texture2DMS Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(ret.x, ret.y, Param); + return ret; +} + +uint3 SPIRV_Cross_textureSize(Texture2DMSArray Tex, uint Level, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(ret.x, ret.y, ret.z, Param); + return ret; +} + void frag_main() { + uint _17_dummy_parameter; + uint _27_dummy_parameter; + uint _37_dummy_parameter; + uint _45_dummy_parameter; + uint _53_dummy_parameter; + uint _61_dummy_parameter; + uint _69_dummy_parameter; + uint _77_dummy_parameter; + uint _85_dummy_parameter; + int _89; + SPIRV_Cross_textureSize(uSampler1D, 0u, _89); + int _93; + SPIRV_Cross_textureSize(uSampler2D, 0u, _93); + int _97; + SPIRV_Cross_textureSize(uSampler2DArray, 0u, _97); + int _101; + SPIRV_Cross_textureSize(uSampler3D, 0u, _101); + int _105; + SPIRV_Cross_textureSize(uSamplerCube, 0u, _105); + int _109; + SPIRV_Cross_textureSize(uSamplerCubeArray, 0u, _109); + int _113; + SPIRV_Cross_textureSize(uSamplerMS, 0u, _113); + int _117; + SPIRV_Cross_textureSize(uSamplerMSArray, 0u, _117); } void main() diff --git a/reference/opt/shaders-hlsl/frag/partial-write-preserve.frag b/reference/opt/shaders-hlsl/frag/partial-write-preserve.frag index 20da99c3..3b50282f 100644 --- a/reference/opt/shaders-hlsl/frag/partial-write-preserve.frag +++ b/reference/opt/shaders-hlsl/frag/partial-write-preserve.frag @@ -1,9 +1,3 @@ -struct B -{ - float a; - float b; -}; - void frag_main() { } diff --git a/reference/opt/shaders-hlsl/frag/resources.frag b/reference/opt/shaders-hlsl/frag/resources.frag index 24b93c23..c8558e27 100644 --- a/reference/opt/shaders-hlsl/frag/resources.frag +++ b/reference/opt/shaders-hlsl/frag/resources.frag @@ -4,7 +4,7 @@ cbuffer cbuf : register(b3) }; cbuffer registers { - float4 registers_d : packoffset(c0); + float4 registers_a : packoffset(c0); }; Texture2D uSampledImage : register(t4); SamplerState _uSampledImage_sampler : register(s4); @@ -26,7 +26,7 @@ struct SPIRV_Cross_Output void frag_main() { - FragColor = (uSampledImage.Sample(_uSampledImage_sampler, vTex) + uTexture.Sample(uSampler, vTex)) + (cbuf_a + registers_d); + FragColor = (uSampledImage.Sample(_uSampledImage_sampler, vTex) + uTexture.Sample(uSampler, vTex)) + (cbuf_a + registers_a); } SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) diff --git a/reference/opt/shaders-hlsl/frag/sample-cmp-level-zero.frag b/reference/opt/shaders-hlsl/frag/sample-cmp-level-zero.frag index 6f5ae7e3..b6e91ce7 100644 --- a/reference/opt/shaders-hlsl/frag/sample-cmp-level-zero.frag +++ b/reference/opt/shaders-hlsl/frag/sample-cmp-level-zero.frag @@ -41,9 +41,7 @@ void frag_main() { float4 _80 = vDirRef; _80.z = vDirRef.w; - float4 _87 = vDirRef; - _87.z = vDirRef.w; - FragColor = (((((((uSampler2D.SampleCmp(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1)) + uSampler2DArray.SampleCmp(_uSampler2DArray_sampler, vDirRef.xyz, vDirRef.w, int2(-1, -1))) + uSamplerCube.SampleCmp(_uSamplerCube_sampler, vDirRef.xyz, vDirRef.w)) + uSamplerCubeArray.SampleCmp(_uSamplerCubeArray_sampler, vDirRef, 0.5f)) + uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1))) + uSampler2DArray.SampleCmpLevelZero(_uSampler2DArray_sampler, vDirRef.xyz, vDirRef.w, int2(-1, -1))) + uSamplerCube.SampleCmpLevelZero(_uSamplerCube_sampler, vDirRef.xyz, vDirRef.w)) + uSampler2D.SampleCmp(_uSampler2D_sampler, SPIRV_Cross_projectTextureCoordinate(_80.xyz), vDirRef.z, int2(1, 1))) + uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, SPIRV_Cross_projectTextureCoordinate(_87.xyz), vDirRef.z, int2(1, 1)); + FragColor = (((((((uSampler2D.SampleCmp(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1)) + uSampler2DArray.SampleCmp(_uSampler2DArray_sampler, vDirRef.xyz, vDirRef.w, int2(-1, -1))) + uSamplerCube.SampleCmp(_uSamplerCube_sampler, vDirRef.xyz, vDirRef.w)) + uSamplerCubeArray.SampleCmp(_uSamplerCubeArray_sampler, vDirRef, 0.5f)) + uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1))) + uSampler2DArray.SampleCmpLevelZero(_uSampler2DArray_sampler, vDirRef.xyz, vDirRef.w, int2(-1, -1))) + uSamplerCube.SampleCmpLevelZero(_uSamplerCube_sampler, vDirRef.xyz, vDirRef.w)) + uSampler2D.SampleCmp(_uSampler2D_sampler, SPIRV_Cross_projectTextureCoordinate(_80.xyz), vDirRef.z, int2(1, 1))) + uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, SPIRV_Cross_projectTextureCoordinate(_80.xyz), vDirRef.z, int2(1, 1)); } SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) diff --git a/reference/opt/shaders-hlsl/frag/sampler-array.frag b/reference/opt/shaders-hlsl/frag/sampler-array.frag index 5b8e492d..1eced29b 100644 --- a/reference/opt/shaders-hlsl/frag/sampler-array.frag +++ b/reference/opt/shaders-hlsl/frag/sampler-array.frag @@ -17,7 +17,8 @@ struct SPIRV_Cross_Input void frag_main() { - uImage[vIndex][int2(gl_FragCoord.xy)] = ((uCombined[vIndex].Sample(_uCombined_sampler[vIndex], vTex) + uTex[vIndex].Sample(uSampler[vIndex], vTex)) + (uCombined[vIndex + 1].Sample(_uCombined_sampler[vIndex + 1], vTex))) + (uTex[vIndex + 1].Sample(uSampler[vIndex + 1], vTex)); + int _72 = vIndex + 1; + uImage[vIndex][int2(gl_FragCoord.xy)] = ((uCombined[vIndex].Sample(_uCombined_sampler[vIndex], vTex) + uTex[vIndex].Sample(uSampler[vIndex], vTex)) + uCombined[_72].Sample(_uCombined_sampler[_72], vTex)) + uTex[_72].Sample(uSampler[_72], vTex); } void main(SPIRV_Cross_Input stage_input) diff --git a/reference/opt/shaders-hlsl/frag/spec-constant.frag b/reference/opt/shaders-hlsl/frag/spec-constant.frag index 781e3f20..749c18a0 100644 --- a/reference/opt/shaders-hlsl/frag/spec-constant.frag +++ b/reference/opt/shaders-hlsl/frag/spec-constant.frag @@ -17,11 +17,9 @@ struct SPIRV_Cross_Output void frag_main() { - float vec0[(c + 3)][8]; - vec0[0][0] = 10.0f; Foo foo; foo.elems[c] = 10.0f; - FragColor = (((a + b).xxxx + vec0[0][0].xxxx) + 20.0f.xxxx) + foo.elems[c].xxxx; + FragColor = ((a + b).xxxx + 30.0f.xxxx) + foo.elems[c].xxxx; } SPIRV_Cross_Output main() diff --git a/reference/opt/shaders-hlsl/frag/tex-sampling.frag b/reference/opt/shaders-hlsl/frag/tex-sampling.frag index 6ebca5d8..74e9c3ba 100644 --- a/reference/opt/shaders-hlsl/frag/tex-sampling.frag +++ b/reference/opt/shaders-hlsl/frag/tex-sampling.frag @@ -1,27 +1,27 @@ -Texture1D tex1d; -SamplerState _tex1d_sampler; -Texture2D tex2d; -SamplerState _tex2d_sampler; -Texture3D tex3d; -SamplerState _tex3d_sampler; -TextureCube texCube; -SamplerState _texCube_sampler; -Texture1D tex1dShadow; -SamplerComparisonState _tex1dShadow_sampler; -Texture2D tex2dShadow; -SamplerComparisonState _tex2dShadow_sampler; -TextureCube texCubeShadow; -SamplerComparisonState _texCubeShadow_sampler; -Texture1DArray tex1dArray; -SamplerState _tex1dArray_sampler; -Texture2DArray tex2dArray; -SamplerState _tex2dArray_sampler; -TextureCubeArray texCubeArray; -SamplerState _texCubeArray_sampler; -Texture2D separateTex2d; -SamplerState samplerNonDepth; -Texture2D separateTex2dDepth; -SamplerComparisonState samplerDepth; +Texture1D tex1d : register(t0); +SamplerState _tex1d_sampler : register(s0); +Texture2D tex2d : register(t1); +SamplerState _tex2d_sampler : register(s1); +Texture3D tex3d : register(t2); +SamplerState _tex3d_sampler : register(s2); +TextureCube texCube : register(t3); +SamplerState _texCube_sampler : register(s3); +Texture1D tex1dShadow : register(t4); +SamplerComparisonState _tex1dShadow_sampler : register(s4); +Texture2D tex2dShadow : register(t5); +SamplerComparisonState _tex2dShadow_sampler : register(s5); +TextureCube texCubeShadow : register(t6); +SamplerComparisonState _texCubeShadow_sampler : register(s6); +Texture1DArray tex1dArray : register(t7); +SamplerState _tex1dArray_sampler : register(s7); +Texture2DArray tex2dArray : register(t8); +SamplerState _tex2dArray_sampler : register(s8); +TextureCubeArray texCubeArray : register(t9); +SamplerState _texCubeArray_sampler : register(s9); +Texture2D separateTex2d : register(t12); +SamplerState samplerNonDepth : register(s11); +Texture2D separateTex2dDepth : register(t13); +SamplerComparisonState samplerDepth : register(s10); static float texCoord1d; static float2 texCoord2d; @@ -60,14 +60,8 @@ float3 SPIRV_Cross_projectTextureCoordinate(float4 coord) void frag_main() { float4 _162 = (((((((((((((((((((tex1d.Sample(_tex1d_sampler, texCoord1d) + tex1d.Sample(_tex1d_sampler, texCoord1d, 1)) + tex1d.SampleLevel(_tex1d_sampler, texCoord1d, 2.0f)) + tex1d.SampleGrad(_tex1d_sampler, texCoord1d, 1.0f, 2.0f)) + tex1d.Sample(_tex1d_sampler, SPIRV_Cross_projectTextureCoordinate(float2(texCoord1d, 2.0f)))) + tex1d.SampleBias(_tex1d_sampler, texCoord1d, 1.0f)) + tex2d.Sample(_tex2d_sampler, texCoord2d)) + tex2d.Sample(_tex2d_sampler, texCoord2d, int2(1, 2))) + tex2d.SampleLevel(_tex2d_sampler, texCoord2d, 2.0f)) + tex2d.SampleGrad(_tex2d_sampler, texCoord2d, float2(1.0f, 2.0f), float2(3.0f, 4.0f))) + tex2d.Sample(_tex2d_sampler, SPIRV_Cross_projectTextureCoordinate(float3(texCoord2d, 2.0f)))) + tex2d.SampleBias(_tex2d_sampler, texCoord2d, 1.0f)) + tex3d.Sample(_tex3d_sampler, texCoord3d)) + tex3d.Sample(_tex3d_sampler, texCoord3d, int3(1, 2, 3))) + tex3d.SampleLevel(_tex3d_sampler, texCoord3d, 2.0f)) + tex3d.SampleGrad(_tex3d_sampler, texCoord3d, float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f))) + tex3d.Sample(_tex3d_sampler, SPIRV_Cross_projectTextureCoordinate(float4(texCoord3d, 2.0f)))) + tex3d.SampleBias(_tex3d_sampler, texCoord3d, 1.0f)) + texCube.Sample(_texCube_sampler, texCoord3d)) + texCube.SampleLevel(_texCube_sampler, texCoord3d, 2.0f)) + texCube.SampleBias(_texCube_sampler, texCoord3d, 1.0f); - float _178 = _162.w + tex1dShadow.SampleCmp(_tex1dShadow_sampler, float3(texCoord1d, 0.0f, 0.0f).x, 0.0f); - float4 _327 = _162; - _327.w = _178; - float _193 = _178 + tex2dShadow.SampleCmp(_tex2dShadow_sampler, float3(texCoord2d, 0.0f).xy, 0.0f); - float4 _331 = _327; - _331.w = _193; - float4 _335 = _331; - _335.w = _193 + texCubeShadow.SampleCmp(_texCubeShadow_sampler, float4(texCoord3d, 0.0f).xyz, 0.0f); + float4 _335 = _162; + _335.w = ((_162.w + tex1dShadow.SampleCmp(_tex1dShadow_sampler, float3(texCoord1d, 0.0f, 0.0f).x, 0.0f)) + tex2dShadow.SampleCmp(_tex2dShadow_sampler, float3(texCoord2d, 0.0f).xy, 0.0f)) + texCubeShadow.SampleCmp(_texCubeShadow_sampler, float4(texCoord3d, 0.0f).xyz, 0.0f); float4 _308 = ((((((((((((((_335 + tex1dArray.Sample(_tex1dArray_sampler, texCoord2d)) + tex2dArray.Sample(_tex2dArray_sampler, texCoord3d)) + texCubeArray.Sample(_texCubeArray_sampler, texCoord4d)) + tex2d.GatherRed(_tex2d_sampler, texCoord2d)) + tex2d.GatherRed(_tex2d_sampler, texCoord2d)) + tex2d.GatherGreen(_tex2d_sampler, texCoord2d)) + tex2d.GatherBlue(_tex2d_sampler, texCoord2d)) + tex2d.GatherAlpha(_tex2d_sampler, texCoord2d)) + tex2d.GatherRed(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherRed(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherGreen(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherBlue(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherAlpha(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.Load(int3(int2(1, 2), 0))) + separateTex2d.Sample(samplerNonDepth, texCoord2d); float4 _339 = _308; _339.w = _308.w + separateTex2dDepth.SampleCmp(samplerDepth, texCoord3d.xy, texCoord3d.z); diff --git a/reference/opt/shaders-hlsl/frag/unary-enclose.frag b/reference/opt/shaders-hlsl/frag/unary-enclose.frag index 76e98a66..348b91c1 100644 --- a/reference/opt/shaders-hlsl/frag/unary-enclose.frag +++ b/reference/opt/shaders-hlsl/frag/unary-enclose.frag @@ -15,7 +15,7 @@ struct SPIRV_Cross_Output void frag_main() { - FragColor = -(-vIn); + FragColor = vIn; } SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) diff --git a/reference/opt/shaders-hlsl/vert/locations.vert b/reference/opt/shaders-hlsl/vert/locations.vert index ba36c4ae..b007582c 100644 --- a/reference/opt/shaders-hlsl/vert/locations.vert +++ b/reference/opt/shaders-hlsl/vert/locations.vert @@ -5,6 +5,8 @@ struct Foo float3 c; }; +static const Foo _71 = { 1.0f.xxx, 1.0f.xxx, 1.0f.xxx }; + static float4 gl_Position; static float4 Input2; static float4 Input4; @@ -40,8 +42,6 @@ struct SPIRV_Cross_Output float4 gl_Position : SV_Position; }; -Foo _70; - void vert_main() { gl_Position = ((1.0f.xxxx + Input2) + Input4) + Input0; @@ -49,13 +49,7 @@ void vert_main() vLocation1 = 1.0f; vLocation2[0] = 2.0f; vLocation2[1] = 2.0f; - Foo _65 = _70; - _65.a = 1.0f.xxx; - Foo _67 = _65; - _67.b = 1.0f.xxx; - Foo _69 = _67; - _69.c = 1.0f.xxx; - vLocation4 = _69; + vLocation4 = _71; vLocation9 = 9.0f; vout.color = 2.0f.xxx; vout.foo = 4.0f.xxx; diff --git a/reference/opt/shaders-hlsl/vert/return-array.vert b/reference/opt/shaders-hlsl/vert/return-array.vert index 902033b0..bd157556 100644 --- a/reference/opt/shaders-hlsl/vert/return-array.vert +++ b/reference/opt/shaders-hlsl/vert/return-array.vert @@ -1,5 +1,3 @@ -static const float4 _20[2] = { 10.0f.xxxx, 20.0f.xxxx }; - static float4 gl_Position; static float4 vInput0; static float4 vInput1; diff --git a/reference/opt/shaders-msl/asm/comp/specialization-constant-workgroup.asm.comp b/reference/opt/shaders-msl/asm/comp/specialization-constant-workgroup.asm.comp index 5802ddac..0c3b3059 100644 --- a/reference/opt/shaders-msl/asm/comp/specialization-constant-workgroup.asm.comp +++ b/reference/opt/shaders-msl/asm/comp/specialization-constant-workgroup.asm.comp @@ -3,12 +3,6 @@ using namespace metal; -constant uint _5_tmp [[function_constant(10)]]; -constant uint _5 = is_function_constant_defined(_5_tmp) ? _5_tmp : 9u; -constant uint _6_tmp [[function_constant(12)]]; -constant uint _6 = is_function_constant_defined(_6_tmp) ? _6_tmp : 4u; -constant uint3 gl_WorkGroupSize = uint3(_5, 20u, _6); - struct SSBO { float a; diff --git a/reference/opt/shaders-msl/asm/comp/storage-buffer-basic.asm.comp b/reference/opt/shaders-msl/asm/comp/storage-buffer-basic.asm.comp index 3df6161f..9e37362d 100644 --- a/reference/opt/shaders-msl/asm/comp/storage-buffer-basic.asm.comp +++ b/reference/opt/shaders-msl/asm/comp/storage-buffer-basic.asm.comp @@ -16,6 +16,7 @@ struct _6 kernel void main0(device _6& _8 [[buffer(0)]], device _6& _9 [[buffer(1)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) { + uint3 _23 = gl_WorkGroupSize; _8._m0[gl_WorkGroupID.x] = _9._m0[gl_WorkGroupID.x] + _8._m0[gl_WorkGroupID.x]; } diff --git a/reference/opt/shaders-msl/asm/frag/default-member-names.asm.frag b/reference/opt/shaders-msl/asm/frag/default-member-names.asm.frag index 1c730c7b..e9573a01 100644 --- a/reference/opt/shaders-msl/asm/frag/default-member-names.asm.frag +++ b/reference/opt/shaders-msl/asm/frag/default-member-names.asm.frag @@ -3,29 +3,7 @@ using namespace metal; -struct _9 -{ - float _m0; -}; - -struct _10 -{ - float _m0; - float _m1; - float _m2; - float _m3; - float _m4; - float _m5; - float _m6; - float _m7; - float _m8; - float _m9; - float _m10; - float _m11; - _9 _m12; -}; - -constant _10 _51 = {}; +constant float _57 = {}; struct main0_out { @@ -35,7 +13,7 @@ struct main0_out fragment main0_out main0() { main0_out out = {}; - out.m_3 = float4(_51._m0, _51._m1, _51._m2, _51._m3); + out.m_3 = float4(_57); return out; } diff --git a/reference/opt/shaders-msl/asm/frag/function-overload-alias.asm.frag b/reference/opt/shaders-msl/asm/frag/function-overload-alias.asm.frag index 624a3e48..64edee87 100644 --- a/reference/opt/shaders-msl/asm/frag/function-overload-alias.asm.frag +++ b/reference/opt/shaders-msl/asm/frag/function-overload-alias.asm.frag @@ -11,7 +11,7 @@ struct main0_out fragment main0_out main0() { main0_out out = {}; - out.FragColor = (((float4(1.0) + float4(1.0)) + (float3(1.0).xyzz + float4(1.0))) + (float4(1.0) + float4(2.0))) + (float2(1.0).xyxy + float4(2.0)); + out.FragColor = float4(10.0); return out; } diff --git a/reference/opt/shaders-msl/asm/frag/op-constant-null.asm.frag b/reference/opt/shaders-msl/asm/frag/op-constant-null.asm.frag index 9472add3..e1badb51 100644 --- a/reference/opt/shaders-msl/asm/frag/op-constant-null.asm.frag +++ b/reference/opt/shaders-msl/asm/frag/op-constant-null.asm.frag @@ -3,12 +3,6 @@ using namespace metal; -struct D -{ - float4 a; - float b; -}; - struct main0_out { float FragColor [[color(0)]]; diff --git a/reference/opt/shaders-msl/asm/frag/phi-loop-variable.asm.frag b/reference/opt/shaders-msl/asm/frag/phi-loop-variable.asm.frag index 036774d6..92ac1d9f 100644 --- a/reference/opt/shaders-msl/asm/frag/phi-loop-variable.asm.frag +++ b/reference/opt/shaders-msl/asm/frag/phi-loop-variable.asm.frag @@ -5,8 +5,5 @@ using namespace metal; fragment void main0() { - for (int _22 = 35; _22 >= 0; _22--) - { - } } diff --git a/reference/opt/shaders-msl/asm/frag/undef-variable-store.asm.frag b/reference/opt/shaders-msl/asm/frag/undef-variable-store.asm.frag index fb39c46f..a5380c51 100644 --- a/reference/opt/shaders-msl/asm/frag/undef-variable-store.asm.frag +++ b/reference/opt/shaders-msl/asm/frag/undef-variable-store.asm.frag @@ -3,9 +3,6 @@ using namespace metal; -constant float4 _38 = {}; -constant float4 _50 = {}; - struct main0_out { float4 _entryPointOutput [[color(0)]]; @@ -14,25 +11,7 @@ struct main0_out fragment main0_out main0() { main0_out out = {}; - float4 _51; - _51 = _50; - float4 _52; - for (;;) - { - if (0.0 != 0.0) - { - _52 = float4(1.0, 0.0, 0.0, 1.0); - break; - } - else - { - _52 = float4(1.0, 1.0, 0.0, 1.0); - break; - } - _52 = _38; - break; - } - out._entryPointOutput = _52; + out._entryPointOutput = float4(1.0, 1.0, 0.0, 1.0); return out; } diff --git a/reference/opt/shaders-msl/asm/frag/unreachable.asm.frag b/reference/opt/shaders-msl/asm/frag/unreachable.asm.frag index 3e80051e..b2aff863 100644 --- a/reference/opt/shaders-msl/asm/frag/unreachable.asm.frag +++ b/reference/opt/shaders-msl/asm/frag/unreachable.asm.frag @@ -3,8 +3,6 @@ using namespace metal; -constant float4 _21 = {}; - struct main0_in { int counter [[user(locn0)]]; @@ -18,21 +16,21 @@ struct main0_out fragment main0_out main0(main0_in in [[stage_in]]) { main0_out out = {}; - float4 _33; - do + bool _29; + for (;;) { - if (in.counter == 10) + _29 = in.counter == 10; + if (_29) { - _33 = float4(10.0); break; } else { - _33 = float4(30.0); break; } - } while (false); - out.FragColor = _33; + } + bool4 _35 = bool4(_29); + out.FragColor = float4(_35.x ? float4(10.0).x : float4(30.0).x, _35.y ? float4(10.0).y : float4(30.0).y, _35.z ? float4(10.0).z : float4(30.0).z, _35.w ? float4(10.0).w : float4(30.0).w); return out; } diff --git a/reference/opt/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag b/reference/opt/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag index 6bf9540f..b2fe21d8 100644 --- a/reference/opt/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag +++ b/reference/opt/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag @@ -98,34 +98,33 @@ struct main0_out fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buffer(1)]], constant _18& _19 [[buffer(2)]], texture2d _8 [[texture(0)]], texture2d _12 [[texture(1)]], texture2d _14 [[texture(2)]], sampler _9 [[sampler(0)]], sampler _13 [[sampler(1)]], sampler _15 [[sampler(2)]], float4 gl_FragCoord [[position]]) { main0_out out = {}; - _28 _77 = _74; - _77._m0 = float4(0.0); float2 _82 = gl_FragCoord.xy * _19._m23.xy; float4 _88 = _7._m2 * _7._m0.xyxy; - float2 _97 = clamp(_82 + (float3(0.0, -2.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + float2 _95 = _88.xy; + float2 _96 = _88.zw; + float2 _97 = clamp(_82 + (float2(0.0, -2.0) * _7._m0.xy), _95, _96); float3 _109 = _11._m5 * clamp(_8.sample(_9, _97, level(0.0)).w * _7._m1, 0.0, 1.0); float4 _113 = _12.sample(_13, _97, level(0.0)); + float _114 = _113.y; float3 _129; - if (_113.y > 0.0) + if (_114 > 0.0) { - _129 = _109 + (_14.sample(_15, _97, level(0.0)).xyz * clamp(_113.y * _113.z, 0.0, 1.0)); + _129 = _109 + (_14.sample(_15, _97, level(0.0)).xyz * clamp(_114 * _113.z, 0.0, 1.0)); } else { _129 = _109; } float3 _130 = _129 * 0.5; - float3 _133 = float4(0.0).xyz + _130; - float4 _134 = float4(_133.x, _133.y, _133.z, float4(0.0).w); - _28 _135 = _77; - _135._m0 = _134; - float2 _144 = clamp(_82 + (float3(-1.0, -1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + float4 _134 = float4(_130.x, _130.y, _130.z, float4(0.0).w); + float2 _144 = clamp(_82 + (float2(-1.0) * _7._m0.xy), _95, _96); float3 _156 = _11._m5 * clamp(_8.sample(_9, _144, level(0.0)).w * _7._m1, 0.0, 1.0); float4 _160 = _12.sample(_13, _144, level(0.0)); + float _161 = _160.y; float3 _176; - if (_160.y > 0.0) + if (_161 > 0.0) { - _176 = _156 + (_14.sample(_15, _144, level(0.0)).xyz * clamp(_160.y * _160.z, 0.0, 1.0)); + _176 = _156 + (_14.sample(_15, _144, level(0.0)).xyz * clamp(_161 * _160.z, 0.0, 1.0)); } else { @@ -134,15 +133,14 @@ fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buff float3 _177 = _176 * 0.5; float3 _180 = _134.xyz + _177; float4 _181 = float4(_180.x, _180.y, _180.z, _134.w); - _28 _182 = _135; - _182._m0 = _181; - float2 _191 = clamp(_82 + (float3(0.0, -1.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw); + float2 _191 = clamp(_82 + (float2(0.0, -1.0) * _7._m0.xy), _95, _96); float3 _203 = _11._m5 * clamp(_8.sample(_9, _191, level(0.0)).w * _7._m1, 0.0, 1.0); float4 _207 = _12.sample(_13, _191, level(0.0)); + float _208 = _207.y; float3 _223; - if (_207.y > 0.0) + if (_208 > 0.0) { - _223 = _203 + (_14.sample(_15, _191, level(0.0)).xyz * clamp(_207.y * _207.z, 0.0, 1.0)); + _223 = _203 + (_14.sample(_15, _191, level(0.0)).xyz * clamp(_208 * _207.z, 0.0, 1.0)); } else { @@ -151,15 +149,14 @@ fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buff float3 _224 = _223 * 0.75; float3 _227 = _181.xyz + _224; float4 _228 = float4(_227.x, _227.y, _227.z, _181.w); - _28 _229 = _182; - _229._m0 = _228; - float2 _238 = clamp(_82 + (float3(1.0, -1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + float2 _238 = clamp(_82 + (float2(1.0, -1.0) * _7._m0.xy), _95, _96); float3 _250 = _11._m5 * clamp(_8.sample(_9, _238, level(0.0)).w * _7._m1, 0.0, 1.0); float4 _254 = _12.sample(_13, _238, level(0.0)); + float _255 = _254.y; float3 _270; - if (_254.y > 0.0) + if (_255 > 0.0) { - _270 = _250 + (_14.sample(_15, _238, level(0.0)).xyz * clamp(_254.y * _254.z, 0.0, 1.0)); + _270 = _250 + (_14.sample(_15, _238, level(0.0)).xyz * clamp(_255 * _254.z, 0.0, 1.0)); } else { @@ -168,15 +165,14 @@ fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buff float3 _271 = _270 * 0.5; float3 _274 = _228.xyz + _271; float4 _275 = float4(_274.x, _274.y, _274.z, _228.w); - _28 _276 = _229; - _276._m0 = _275; - float2 _285 = clamp(_82 + (float3(-2.0, 0.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + float2 _285 = clamp(_82 + (float2(-2.0, 0.0) * _7._m0.xy), _95, _96); float3 _297 = _11._m5 * clamp(_8.sample(_9, _285, level(0.0)).w * _7._m1, 0.0, 1.0); float4 _301 = _12.sample(_13, _285, level(0.0)); + float _302 = _301.y; float3 _317; - if (_301.y > 0.0) + if (_302 > 0.0) { - _317 = _297 + (_14.sample(_15, _285, level(0.0)).xyz * clamp(_301.y * _301.z, 0.0, 1.0)); + _317 = _297 + (_14.sample(_15, _285, level(0.0)).xyz * clamp(_302 * _301.z, 0.0, 1.0)); } else { @@ -185,15 +181,14 @@ fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buff float3 _318 = _317 * 0.5; float3 _321 = _275.xyz + _318; float4 _322 = float4(_321.x, _321.y, _321.z, _275.w); - _28 _323 = _276; - _323._m0 = _322; - float2 _332 = clamp(_82 + (float3(-1.0, 0.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw); + float2 _332 = clamp(_82 + (float2(-1.0, 0.0) * _7._m0.xy), _95, _96); float3 _344 = _11._m5 * clamp(_8.sample(_9, _332, level(0.0)).w * _7._m1, 0.0, 1.0); float4 _348 = _12.sample(_13, _332, level(0.0)); + float _349 = _348.y; float3 _364; - if (_348.y > 0.0) + if (_349 > 0.0) { - _364 = _344 + (_14.sample(_15, _332, level(0.0)).xyz * clamp(_348.y * _348.z, 0.0, 1.0)); + _364 = _344 + (_14.sample(_15, _332, level(0.0)).xyz * clamp(_349 * _348.z, 0.0, 1.0)); } else { @@ -202,15 +197,14 @@ fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buff float3 _365 = _364 * 0.75; float3 _368 = _322.xyz + _365; float4 _369 = float4(_368.x, _368.y, _368.z, _322.w); - _28 _370 = _323; - _370._m0 = _369; - float2 _379 = clamp(_82 + (float3(0.0, 0.0, 1.0).xy * _7._m0.xy), _88.xy, _88.zw); + float2 _379 = clamp(_82, _95, _96); float3 _391 = _11._m5 * clamp(_8.sample(_9, _379, level(0.0)).w * _7._m1, 0.0, 1.0); float4 _395 = _12.sample(_13, _379, level(0.0)); + float _396 = _395.y; float3 _411; - if (_395.y > 0.0) + if (_396 > 0.0) { - _411 = _391 + (_14.sample(_15, _379, level(0.0)).xyz * clamp(_395.y * _395.z, 0.0, 1.0)); + _411 = _391 + (_14.sample(_15, _379, level(0.0)).xyz * clamp(_396 * _395.z, 0.0, 1.0)); } else { @@ -219,15 +213,14 @@ fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buff float3 _412 = _411 * 1.0; float3 _415 = _369.xyz + _412; float4 _416 = float4(_415.x, _415.y, _415.z, _369.w); - _28 _417 = _370; - _417._m0 = _416; - float2 _426 = clamp(_82 + (float3(1.0, 0.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw); + float2 _426 = clamp(_82 + (float2(1.0, 0.0) * _7._m0.xy), _95, _96); float3 _438 = _11._m5 * clamp(_8.sample(_9, _426, level(0.0)).w * _7._m1, 0.0, 1.0); float4 _442 = _12.sample(_13, _426, level(0.0)); + float _443 = _442.y; float3 _458; - if (_442.y > 0.0) + if (_443 > 0.0) { - _458 = _438 + (_14.sample(_15, _426, level(0.0)).xyz * clamp(_442.y * _442.z, 0.0, 1.0)); + _458 = _438 + (_14.sample(_15, _426, level(0.0)).xyz * clamp(_443 * _442.z, 0.0, 1.0)); } else { @@ -236,15 +229,14 @@ fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buff float3 _459 = _458 * 0.75; float3 _462 = _416.xyz + _459; float4 _463 = float4(_462.x, _462.y, _462.z, _416.w); - _28 _464 = _417; - _464._m0 = _463; - float2 _473 = clamp(_82 + (float3(2.0, 0.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + float2 _473 = clamp(_82 + (float2(2.0, 0.0) * _7._m0.xy), _95, _96); float3 _485 = _11._m5 * clamp(_8.sample(_9, _473, level(0.0)).w * _7._m1, 0.0, 1.0); float4 _489 = _12.sample(_13, _473, level(0.0)); + float _490 = _489.y; float3 _505; - if (_489.y > 0.0) + if (_490 > 0.0) { - _505 = _485 + (_14.sample(_15, _473, level(0.0)).xyz * clamp(_489.y * _489.z, 0.0, 1.0)); + _505 = _485 + (_14.sample(_15, _473, level(0.0)).xyz * clamp(_490 * _489.z, 0.0, 1.0)); } else { @@ -253,15 +245,14 @@ fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buff float3 _506 = _505 * 0.5; float3 _509 = _463.xyz + _506; float4 _510 = float4(_509.x, _509.y, _509.z, _463.w); - _28 _511 = _464; - _511._m0 = _510; - float2 _520 = clamp(_82 + (float3(-1.0, 1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + float2 _520 = clamp(_82 + (float2(-1.0, 1.0) * _7._m0.xy), _95, _96); float3 _532 = _11._m5 * clamp(_8.sample(_9, _520, level(0.0)).w * _7._m1, 0.0, 1.0); float4 _536 = _12.sample(_13, _520, level(0.0)); + float _537 = _536.y; float3 _552; - if (_536.y > 0.0) + if (_537 > 0.0) { - _552 = _532 + (_14.sample(_15, _520, level(0.0)).xyz * clamp(_536.y * _536.z, 0.0, 1.0)); + _552 = _532 + (_14.sample(_15, _520, level(0.0)).xyz * clamp(_537 * _536.z, 0.0, 1.0)); } else { @@ -270,15 +261,14 @@ fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buff float3 _553 = _552 * 0.5; float3 _556 = _510.xyz + _553; float4 _557 = float4(_556.x, _556.y, _556.z, _510.w); - _28 _558 = _511; - _558._m0 = _557; - float2 _567 = clamp(_82 + (float3(0.0, 1.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw); + float2 _567 = clamp(_82 + (float2(0.0, 1.0) * _7._m0.xy), _95, _96); float3 _579 = _11._m5 * clamp(_8.sample(_9, _567, level(0.0)).w * _7._m1, 0.0, 1.0); float4 _583 = _12.sample(_13, _567, level(0.0)); + float _584 = _583.y; float3 _599; - if (_583.y > 0.0) + if (_584 > 0.0) { - _599 = _579 + (_14.sample(_15, _567, level(0.0)).xyz * clamp(_583.y * _583.z, 0.0, 1.0)); + _599 = _579 + (_14.sample(_15, _567, level(0.0)).xyz * clamp(_584 * _583.z, 0.0, 1.0)); } else { @@ -287,15 +277,14 @@ fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buff float3 _600 = _599 * 0.75; float3 _603 = _557.xyz + _600; float4 _604 = float4(_603.x, _603.y, _603.z, _557.w); - _28 _605 = _558; - _605._m0 = _604; - float2 _614 = clamp(_82 + (float3(1.0, 1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + float2 _614 = clamp(_82 + _7._m0.xy, _95, _96); float3 _626 = _11._m5 * clamp(_8.sample(_9, _614, level(0.0)).w * _7._m1, 0.0, 1.0); float4 _630 = _12.sample(_13, _614, level(0.0)); + float _631 = _630.y; float3 _646; - if (_630.y > 0.0) + if (_631 > 0.0) { - _646 = _626 + (_14.sample(_15, _614, level(0.0)).xyz * clamp(_630.y * _630.z, 0.0, 1.0)); + _646 = _626 + (_14.sample(_15, _614, level(0.0)).xyz * clamp(_631 * _630.z, 0.0, 1.0)); } else { @@ -304,15 +293,14 @@ fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buff float3 _647 = _646 * 0.5; float3 _650 = _604.xyz + _647; float4 _651 = float4(_650.x, _650.y, _650.z, _604.w); - _28 _652 = _605; - _652._m0 = _651; - float2 _661 = clamp(_82 + (float3(0.0, 2.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + float2 _661 = clamp(_82 + (float2(0.0, 2.0) * _7._m0.xy), _95, _96); float3 _673 = _11._m5 * clamp(_8.sample(_9, _661, level(0.0)).w * _7._m1, 0.0, 1.0); float4 _677 = _12.sample(_13, _661, level(0.0)); + float _678 = _677.y; float3 _693; - if (_677.y > 0.0) + if (_678 > 0.0) { - _693 = _673 + (_14.sample(_15, _661, level(0.0)).xyz * clamp(_677.y * _677.z, 0.0, 1.0)); + _693 = _673 + (_14.sample(_15, _661, level(0.0)).xyz * clamp(_678 * _677.z, 0.0, 1.0)); } else { @@ -320,10 +308,8 @@ fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buff } float3 _697 = _651.xyz + (_693 * 0.5); float4 _698 = float4(_697.x, _697.y, _697.z, _651.w); - _28 _699 = _652; - _699._m0 = _698; - float3 _702 = _698.xyz / float3(((((((((((((0.0 + 0.5) + 0.5) + 0.75) + 0.5) + 0.5) + 0.75) + 1.0) + 0.75) + 0.5) + 0.5) + 0.75) + 0.5) + 0.5); - _28 _704 = _699; + float3 _702 = _698.xyz * float3(0.125); + _28 _704 = _74; _704._m0 = float4(_702.x, _702.y, _702.z, _698.w); _28 _705 = _704; _705._m0.w = 1.0; diff --git a/reference/opt/shaders-msl/asm/vert/packing-test.asm.vert b/reference/opt/shaders-msl/asm/vert/packing-test.asm.vert index ac2d30c8..9e024c20 100644 --- a/reference/opt/shaders-msl/asm/vert/packing-test.asm.vert +++ b/reference/opt/shaders-msl/asm/vert/packing-test.asm.vert @@ -3,16 +3,6 @@ using namespace metal; -struct TestStruct -{ - float4x4 transforms[6]; -}; - -struct CB0 -{ - TestStruct CB0[16]; -}; - vertex void main0() { } diff --git a/reference/opt/shaders-msl/comp/bake_gradient.comp b/reference/opt/shaders-msl/comp/bake_gradient.comp deleted file mode 100644 index fe7ac2b7..00000000 --- a/reference/opt/shaders-msl/comp/bake_gradient.comp +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include - -using namespace metal; - -constant uint3 gl_WorkGroupSize = uint3(8u, 8u, 1u); - -struct UBO -{ - float4 uInvSize; - float4 uScale; -}; - -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], constant UBO& _46 [[buffer(0)]], texture2d uHeight [[texture(0)]], sampler uHeightSmplr [[sampler(0)]], texture2d uDisplacement [[texture(1)]], sampler uDisplacementSmplr [[sampler(1)]], texture2d iHeightDisplacement [[texture(2)]], texture2d iGradJacobian [[texture(3)]]) -{ - float4 _59 = (float2(gl_GlobalInvocationID.xy) * _46.uInvSize.xy).xyxy + (_46.uInvSize * 0.5); - float2 _157 = ((uDisplacement.sample(uDisplacementSmplr, _59.zw, level(0.0), int2(1, 0)).xy - uDisplacement.sample(uDisplacementSmplr, _59.zw, level(0.0), int2(-1, 0)).xy) * 0.60000002384185791015625) * _46.uScale.z; - float2 _161 = ((uDisplacement.sample(uDisplacementSmplr, _59.zw, level(0.0), int2(0, 1)).xy - uDisplacement.sample(uDisplacementSmplr, _59.zw, level(0.0), int2(0, -1)).xy) * 0.60000002384185791015625) * _46.uScale.z; - iHeightDisplacement.write(float4(uHeight.sample(uHeightSmplr, _59.xy, level(0.0)).x, 0.0, 0.0, 0.0), uint2(int2(gl_GlobalInvocationID.xy))); - iGradJacobian.write(float4((_46.uScale.xy * 0.5) * float2(uHeight.sample(uHeightSmplr, _59.xy, level(0.0), int2(1, 0)).x - uHeight.sample(uHeightSmplr, _59.xy, level(0.0), int2(-1, 0)).x, uHeight.sample(uHeightSmplr, _59.xy, level(0.0), int2(0, 1)).x - uHeight.sample(uHeightSmplr, _59.xy, level(0.0), int2(0, -1)).x), ((1.0 + _157.x) * (1.0 + _161.y)) - (_157.y * _161.x), 0.0), uint2(int2(gl_GlobalInvocationID.xy))); -} - diff --git a/reference/opt/shaders-msl/comp/barriers.comp b/reference/opt/shaders-msl/comp/barriers.comp index 23a19914..476a30a9 100644 --- a/reference/opt/shaders-msl/comp/barriers.comp +++ b/reference/opt/shaders-msl/comp/barriers.comp @@ -3,8 +3,6 @@ using namespace metal; -constant uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u); - kernel void main0() { threadgroup_barrier(mem_flags::mem_threadgroup); diff --git a/reference/opt/shaders-msl/comp/culling.comp b/reference/opt/shaders-msl/comp/culling.comp index b20480bb..f30e4853 100644 --- a/reference/opt/shaders-msl/comp/culling.comp +++ b/reference/opt/shaders-msl/comp/culling.comp @@ -6,8 +6,6 @@ using namespace metal; -constant uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u); - struct SSBO { float in_data[1]; diff --git a/reference/opt/shaders-msl/comp/defer-parens.comp b/reference/opt/shaders-msl/comp/defer-parens.comp index b9a742a1..69a8aab9 100644 --- a/reference/opt/shaders-msl/comp/defer-parens.comp +++ b/reference/opt/shaders-msl/comp/defer-parens.comp @@ -12,10 +12,11 @@ struct SSBO kernel void main0(device SSBO& _13 [[buffer(0)]]) { float4 _17 = _13.data; - _13.data = float4(_17.x, _17.yz + float2(10.0), _17.w); + float2 _28 = _17.yz + float2(10.0); + _13.data = float4(_17.x, _28, _17.w); _13.data = (_17 + _17) + _17; - _13.data = (_17.yz + float2(10.0)).xxyy; - _13.data = float4((_17.yz + float2(10.0)).y); + _13.data = _28.xxyy; + _13.data = float4(_28.y); _13.data = float4((_17.zw + float2(10.0))[_13.index]); } diff --git a/reference/opt/shaders-msl/comp/dowhile.comp b/reference/opt/shaders-msl/comp/dowhile.comp index d76ca819..f8d45e7e 100644 --- a/reference/opt/shaders-msl/comp/dowhile.comp +++ b/reference/opt/shaders-msl/comp/dowhile.comp @@ -27,7 +27,6 @@ kernel void main0(device SSBO& _28 [[buffer(0)]], device SSBO2& _52 [[buffer(1)] if (i < 16) { _56 = _42; - continue; } else { diff --git a/reference/opt/shaders-msl/comp/image.comp b/reference/opt/shaders-msl/comp/image.comp index d615fb27..447732dd 100644 --- a/reference/opt/shaders-msl/comp/image.comp +++ b/reference/opt/shaders-msl/comp/image.comp @@ -5,6 +5,7 @@ using namespace metal; kernel void main0(texture2d uImageIn [[texture(0)]], texture2d uImageOut [[texture(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { - uImageOut.write(uImageIn.read(uint2((int2(gl_GlobalInvocationID.xy) + int2(uImageIn.get_width(), uImageIn.get_height())))), uint2(int2(gl_GlobalInvocationID.xy))); + int2 _23 = int2(gl_GlobalInvocationID.xy); + uImageOut.write(uImageIn.read(uint2((_23 + int2(uImageIn.get_width(), uImageIn.get_height())))), uint2(_23)); } diff --git a/reference/opt/shaders-msl/comp/packing-test-1.comp b/reference/opt/shaders-msl/comp/packing-test-1.comp index fa809ddb..073d8f26 100644 --- a/reference/opt/shaders-msl/comp/packing-test-1.comp +++ b/reference/opt/shaders-msl/comp/packing-test-1.comp @@ -3,15 +3,7 @@ using namespace metal; -constant uint3 gl_WorkGroupSize = uint3(32u, 1u, 1u); - struct T1 -{ - float3 a; - float b; -}; - -struct T1_1 { packed_float3 a; float b; @@ -19,7 +11,7 @@ struct T1_1 struct Buffer0 { - T1_1 buf0[1]; + T1 buf0[1]; }; struct Buffer1 diff --git a/reference/opt/shaders-msl/comp/packing-test-2.comp b/reference/opt/shaders-msl/comp/packing-test-2.comp index 4f3ab465..8d5350b6 100644 --- a/reference/opt/shaders-msl/comp/packing-test-2.comp +++ b/reference/opt/shaders-msl/comp/packing-test-2.comp @@ -3,8 +3,6 @@ using namespace metal; -constant uint3 gl_WorkGroupSize = uint3(32u, 1u, 1u); - struct T1 { packed_float3 a; diff --git a/reference/opt/shaders-msl/comp/return.comp b/reference/opt/shaders-msl/comp/return.comp deleted file mode 100644 index 06ce8d76..00000000 --- a/reference/opt/shaders-msl/comp/return.comp +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include - -using namespace metal; - -struct SSBO2 -{ - float4 out_data[1]; -}; - -constant int _69 = {}; - -kernel void main0(device SSBO2& _27 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) -{ - if (gl_GlobalInvocationID.x == 2u) - { - _27.out_data[gl_GlobalInvocationID.x] = float4(20.0); - } - else - { - if (gl_GlobalInvocationID.x == 4u) - { - _27.out_data[gl_GlobalInvocationID.x] = float4(10.0); - return; - } - } - for (int _68 = 0; _68 < 20; _68 = _69 + 1) - { - return; - } - _27.out_data[gl_GlobalInvocationID.x] = float4(10.0); -} - diff --git a/reference/opt/shaders-msl/comp/rmw-opt.comp b/reference/opt/shaders-msl/comp/rmw-opt.comp index 4bbd8b3c..05e1f6f2 100644 --- a/reference/opt/shaders-msl/comp/rmw-opt.comp +++ b/reference/opt/shaders-msl/comp/rmw-opt.comp @@ -20,7 +20,6 @@ kernel void main0(device SSBO& _9 [[buffer(0)]]) _9.a ^= 10; _9.a %= 40; _9.a |= 1; - bool _65 = false && true; - _9.a = int(_65 && (true || _65)); + _9.a = 0; } diff --git a/reference/opt/shaders-msl/comp/shared-array-of-arrays.comp b/reference/opt/shaders-msl/comp/shared-array-of-arrays.comp index db1ffebf..98290cce 100644 --- a/reference/opt/shaders-msl/comp/shared-array-of-arrays.comp +++ b/reference/opt/shaders-msl/comp/shared-array-of-arrays.comp @@ -3,8 +3,6 @@ using namespace metal; -constant uint3 gl_WorkGroupSize = uint3(4u, 4u, 1u); - struct SSBO { float out_data[1]; @@ -15,6 +13,6 @@ kernel void main0(device SSBO& _67 [[buffer(0)]], uint3 gl_LocalInvocationID [[t threadgroup float foo[4][4]; foo[gl_LocalInvocationID.x][gl_LocalInvocationID.y] = float(gl_LocalInvocationIndex); threadgroup_barrier(mem_flags::mem_threadgroup); - _67.out_data[gl_GlobalInvocationID.x] = (((0.0 + foo[gl_LocalInvocationID.x][0]) + foo[gl_LocalInvocationID.x][1]) + foo[gl_LocalInvocationID.x][2]) + foo[gl_LocalInvocationID.x][3]; + _67.out_data[gl_GlobalInvocationID.x] = ((foo[gl_LocalInvocationID.x][0] + foo[gl_LocalInvocationID.x][1]) + foo[gl_LocalInvocationID.x][2]) + foo[gl_LocalInvocationID.x][3]; } diff --git a/reference/opt/shaders-msl/comp/shared.comp b/reference/opt/shaders-msl/comp/shared.comp index ef82961e..425d7508 100644 --- a/reference/opt/shaders-msl/comp/shared.comp +++ b/reference/opt/shaders-msl/comp/shared.comp @@ -3,8 +3,6 @@ using namespace metal; -constant uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u); - struct SSBO { float in_data[1]; @@ -20,6 +18,6 @@ kernel void main0(device SSBO& _22 [[buffer(0)]], device SSBO2& _44 [[buffer(1)] threadgroup float sShared[4]; sShared[gl_LocalInvocationIndex] = _22.in_data[gl_GlobalInvocationID.x]; threadgroup_barrier(mem_flags::mem_threadgroup); - _44.out_data[gl_GlobalInvocationID.x] = sShared[(4u - gl_LocalInvocationIndex) - 1u]; + _44.out_data[gl_GlobalInvocationID.x] = sShared[3u - gl_LocalInvocationIndex]; } diff --git a/reference/opt/shaders-msl/comp/struct-nested.comp b/reference/opt/shaders-msl/comp/struct-nested.comp index aa978c30..6a1419ce 100644 --- a/reference/opt/shaders-msl/comp/struct-nested.comp +++ b/reference/opt/shaders-msl/comp/struct-nested.comp @@ -13,27 +13,13 @@ struct s2 s1 b; }; -struct s1_1 -{ - int a; -}; - -struct s2_1 -{ - s1_1 b; -}; - struct dstbuffer { - s2_1 test[1]; + s2 test[1]; }; -constant s2 _31 = {}; - kernel void main0(device dstbuffer& _19 [[buffer(0)]]) { - s2 _30 = _31; - _30.b.a = 0; - _19.test[0].b.a = _30.b.a; + _19.test[0].b.a = 0; } diff --git a/reference/opt/shaders-msl/comp/struct-packing.comp b/reference/opt/shaders-msl/comp/struct-packing.comp index 7921c43a..05bf22d8 100644 --- a/reference/opt/shaders-msl/comp/struct-packing.comp +++ b/reference/opt/shaders-msl/comp/struct-packing.comp @@ -73,41 +73,18 @@ struct S0_1 float b; }; -struct S1_1 -{ - packed_float3 a; - float b; -}; - -struct S2_1 -{ - float3 a[1]; - float b; -}; - -struct S3_1 -{ - float2 a; - float b; -}; - -struct S4_1 -{ - float2 c; -}; - struct Content_1 { S0_1 m0s[1]; - S1_1 m1s[1]; - S2_1 m2s[1]; + S1 m1s[1]; + S2 m2s[1]; S0_1 m0; - S1_1 m1; - S2_1 m2; - S3_1 m3; + S1 m1; + S2 m2; + S3 m3; char pad7[4]; float m4; - S4_1 m3s[8]; + S4 m3s[8]; }; struct SSBO0 diff --git a/reference/opt/shaders-msl/comp/torture-loop.comp b/reference/opt/shaders-msl/comp/torture-loop.comp index 1b239550..d12bd1d2 100644 --- a/reference/opt/shaders-msl/comp/torture-loop.comp +++ b/reference/opt/shaders-msl/comp/torture-loop.comp @@ -14,65 +14,28 @@ struct SSBO2 float4 out_data[1]; }; -constant uint _98 = {}; - kernel void main0(device SSBO& _24 [[buffer(0)]], device SSBO2& _89 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { float4 _93; - int _94; _93 = _24.in_data[gl_GlobalInvocationID.x]; - _94 = 0; - int _40; - float4 _46; - int _48; - for (;;) + for (int _94 = 0; (_94 + 1) < 10; ) { - _40 = _94 + 1; - if (_40 < 10) - { - _46 = _93 * 2.0; - _48 = _40 + 1; - _93 = _46; - _94 = _48; - continue; - } - else - { - break; - } + _93 *= 2.0; + _94 += 2; + continue; } float4 _95; - int _96; _95 = _93; - _96 = _40; float4 _100; - uint _101; - uint _99; - for (uint _97 = 0u; _97 < 16u; _95 = _100, _96++, _97++, _99 = _101) + for (uint _97 = 0u; _97 < 16u; _95 = _100, _97++) { _100 = _95; - _101 = 0u; - float4 _71; - for (; _101 < 30u; _100 = _71, _101++) + for (uint _101 = 0u; _101 < 30u; ) { - _71 = _24.mvp * _100; - } - } - int _102; - _102 = _96; - int _83; - for (;;) - { - _83 = _102 + 1; - if (_83 > 10) - { - _102 = _83; + _100 = _24.mvp * _100; + _101++; continue; } - else - { - break; - } } _89.out_data[gl_GlobalInvocationID.x] = _95; } diff --git a/reference/opt/shaders-msl/comp/type-alias.comp b/reference/opt/shaders-msl/comp/type-alias.comp index cb37b729..9a2550a1 100644 --- a/reference/opt/shaders-msl/comp/type-alias.comp +++ b/reference/opt/shaders-msl/comp/type-alias.comp @@ -8,29 +8,9 @@ struct S0 float4 a; }; -struct S1 -{ - float4 a; -}; - -struct S0_1 -{ - float4 a; -}; - struct SSBO0 { - S0_1 s0s[1]; -}; - -struct S1_1 -{ - float4 a; -}; - -struct SSBO1 -{ - S1_1 s1s[1]; + S0 s0s[1]; }; struct SSBO2 @@ -38,8 +18,8 @@ struct SSBO2 float4 outputs[1]; }; -kernel void main0(device SSBO0& _36 [[buffer(0)]], device SSBO1& _55 [[buffer(1)]], device SSBO2& _66 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(device SSBO0& _36 [[buffer(0)]], device SSBO0& _55 [[buffer(1)]], device SSBO2& _66 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { - _66.outputs[gl_GlobalInvocationID.x] = _36.s0s[gl_GlobalInvocationID.x].a + _55.s1s[gl_GlobalInvocationID.x].a; + _66.outputs[gl_GlobalInvocationID.x] = _36.s0s[gl_GlobalInvocationID.x].a + _55.s0s[gl_GlobalInvocationID.x].a; } diff --git a/reference/opt/shaders-msl/comp/udiv.comp b/reference/opt/shaders-msl/comp/udiv.comp index 32874ad7..852c704b 100644 --- a/reference/opt/shaders-msl/comp/udiv.comp +++ b/reference/opt/shaders-msl/comp/udiv.comp @@ -8,13 +8,8 @@ struct SSBO2 uint outputs[1]; }; -struct SSBO +kernel void main0(device SSBO2& _10 [[buffer(0)]], device SSBO2& _23 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { - uint inputs[1]; -}; - -kernel void main0(device SSBO2& _10 [[buffer(0)]], device SSBO& _23 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) -{ - _10.outputs[gl_GlobalInvocationID.x] = _23.inputs[gl_GlobalInvocationID.x] / 29u; + _10.outputs[gl_GlobalInvocationID.x] = _23.outputs[gl_GlobalInvocationID.x] / 29u; } diff --git a/reference/opt/shaders-msl/flatten/swizzle.flatten.vert b/reference/opt/shaders-msl/flatten/swizzle.flatten.vert index 53fc21f9..d6915065 100644 --- a/reference/opt/shaders-msl/flatten/swizzle.flatten.vert +++ b/reference/opt/shaders-msl/flatten/swizzle.flatten.vert @@ -39,7 +39,7 @@ vertex main0_out main0(constant UBO& _22 [[buffer(0)]]) out.oA = _22.A; out.oB = float4(_22.B0, _22.B1); out.oC = float4(_22.C0, _22.C1) + float4(_22.C1.xy, _22.C1.z, _22.C0); - out.oD = float4(_22.D0, _22.D1) + float4(float3(_22.D0).xy, float3(_22.D0).z, _22.D1); + out.oD = float4(_22.D0, _22.D1) + float4(_22.D0.xy, float3(_22.D0).z, _22.D1); out.oE = float4(_22.E0, _22.E1, _22.E2, _22.E3); out.oF = float4(_22.F0, _22.F1, _22.F2); return out; diff --git a/reference/opt/shaders-msl/frag/array-lut-no-loop-variable.frag b/reference/opt/shaders-msl/frag/array-lut-no-loop-variable.frag index f5df2f23..6c8299fa 100644 --- a/reference/opt/shaders-msl/frag/array-lut-no-loop-variable.frag +++ b/reference/opt/shaders-msl/frag/array-lut-no-loop-variable.frag @@ -30,9 +30,12 @@ fragment main0_out main0() { main0_out out = {}; float lut[5] = {1.0, 2.0, 3.0, 4.0, 5.0}; - int _33; - for (int _46 = 0; _46 < 4; _33 = _46 + 1, out.FragColor += float4(lut[_33]), _46 = _33) + for (int _46 = 0; _46 < 4; ) { + int _33 = _46 + 1; + out.FragColor += float4(lut[_33]); + _46 = _33; + continue; } return out; } diff --git a/reference/opt/shaders-msl/frag/constant-array.frag b/reference/opt/shaders-msl/frag/constant-array.frag index 9cdd5227..6fed8a92 100644 --- a/reference/opt/shaders-msl/frag/constant-array.frag +++ b/reference/opt/shaders-msl/frag/constant-array.frag @@ -47,7 +47,7 @@ fragment main0_out main0(main0_in in [[stage_in]]) float4 indexable[3] = {float4(1.0), float4(2.0), float4(3.0)}; float4 indexable_1[2][2] = {{float4(1.0), float4(2.0)}, {float4(8.0), float4(10.0)}}; Foobar indexable_2[2] = {{10.0, 40.0}, {90.0, 70.0}}; - out.FragColor = ((indexable[in.index] + (indexable_1[in.index][in.index + 1])) + float4(10.0 + 20.0)) + float4(indexable_2[in.index].a + indexable_2[in.index].b); + out.FragColor = ((indexable[in.index] + (indexable_1[in.index][in.index + 1])) + float4(30.0)) + float4(indexable_2[in.index].a + indexable_2[in.index].b); return out; } diff --git a/reference/opt/shaders-msl/frag/false-loop-init.frag b/reference/opt/shaders-msl/frag/false-loop-init.frag index c67bb9d3..03227b76 100644 --- a/reference/opt/shaders-msl/frag/false-loop-init.frag +++ b/reference/opt/shaders-msl/frag/false-loop-init.frag @@ -3,8 +3,6 @@ using namespace metal; -constant uint _49 = {}; - struct main0_in { float4 accum [[user(locn0)]]; @@ -19,19 +17,11 @@ fragment main0_out main0(main0_in in [[stage_in]]) { main0_out out = {}; out.result = float4(0.0); - uint _51; - uint _50; - for (int _48 = 0; _48 < 4; _48 += int(_51), _50 = _51) + for (int _48 = 0; _48 < 4; ) { - if (in.accum.y > 10.0) - { - _51 = 40u; - } - else - { - _51 = 30u; - } out.result += in.accum; + _48 += int((in.accum.y > 10.0) ? 40u : 30u); + continue; } return out; } diff --git a/reference/opt/shaders-msl/frag/flush_params.frag b/reference/opt/shaders-msl/frag/flush_params.frag index 059167fd..64edee87 100644 --- a/reference/opt/shaders-msl/frag/flush_params.frag +++ b/reference/opt/shaders-msl/frag/flush_params.frag @@ -3,11 +3,6 @@ using namespace metal; -struct Structy -{ - float4 c; -}; - struct main0_out { float4 FragColor [[color(0)]]; diff --git a/reference/opt/shaders-msl/frag/for-loop-init.frag b/reference/opt/shaders-msl/frag/for-loop-init.frag index 0e5c92c7..6068c2c0 100644 --- a/reference/opt/shaders-msl/frag/for-loop-init.frag +++ b/reference/opt/shaders-msl/frag/for-loop-init.frag @@ -12,44 +12,54 @@ fragment main0_out main0() { main0_out out = {}; out.FragColor = 16; - for (int _140 = 0; _140 < 25; _140++) + for (int _140 = 0; _140 < 25; ) { out.FragColor += 10; + _140++; + continue; } - for (int _141 = 1; _141 < 30; _141++) + for (int _141 = 1; _141 < 30; ) { out.FragColor += 11; + _141++; + continue; } int _142; _142 = 0; - for (; _142 < 20; _142++) + for (; _142 < 20; ) { out.FragColor += 12; + _142++; + continue; } int _62 = _142 + 3; out.FragColor += _62; if (_62 == 40) { - for (int _143 = 0; _143 < 40; _143++) + for (int _143 = 0; _143 < 40; ) { out.FragColor += 13; + _143++; + continue; } return out; } - else - { - out.FragColor += _62; - } + out.FragColor += _62; int2 _144; _144 = int2(0); - int2 _139; - for (; _144.x < 10; _139 = _144, _139.x = _144.x + 4, _144 = _139) + for (; _144.x < 10; ) { out.FragColor += _144.y; + int2 _139 = _144; + _139.x = _144.x + 4; + _144 = _139; + continue; } - for (int _145 = _62; _145 < 40; _145++) + for (int _145 = _62; _145 < 40; ) { out.FragColor += _145; + _145++; + continue; } out.FragColor += _62; return out; diff --git a/reference/opt/shaders-msl/frag/fp16.desktop.frag b/reference/opt/shaders-msl/frag/fp16.desktop.frag index 70e97568..d9a0390e 100644 --- a/reference/opt/shaders-msl/frag/fp16.desktop.frag +++ b/reference/opt/shaders-msl/frag/fp16.desktop.frag @@ -3,12 +3,6 @@ using namespace metal; -struct ResType -{ - half4 _m0; - int4 _m1; -}; - struct main0_in { half4 v4 [[user(locn3)]]; diff --git a/reference/opt/shaders-msl/frag/mix.frag b/reference/opt/shaders-msl/frag/mix.frag index 9c9b8398..846a8b98 100644 --- a/reference/opt/shaders-msl/frag/mix.frag +++ b/reference/opt/shaders-msl/frag/mix.frag @@ -19,11 +19,10 @@ struct main0_out fragment main0_out main0(main0_in in [[stage_in]]) { main0_out out = {}; - out.FragColor = float4(bool4(false, true, false, false).x ? in.vIn1.x : in.vIn0.x, bool4(false, true, false, false).y ? in.vIn1.y : in.vIn0.y, bool4(false, true, false, false).z ? in.vIn1.z : in.vIn0.z, bool4(false, true, false, false).w ? in.vIn1.w : in.vIn0.w); - out.FragColor = float4(true ? in.vIn3 : in.vIn2); - bool4 _37 = bool4(true); - out.FragColor = float4(_37.x ? in.vIn0.x : in.vIn1.x, _37.y ? in.vIn0.y : in.vIn1.y, _37.z ? in.vIn0.z : in.vIn1.z, _37.w ? in.vIn0.w : in.vIn1.w); - out.FragColor = float4(true ? in.vIn2 : in.vIn3); + out.FragColor = float4(in.vIn0.x, in.vIn1.y, in.vIn0.z, in.vIn0.w); + out.FragColor = float4(in.vIn3); + out.FragColor = in.vIn0.xyzw; + out.FragColor = float4(in.vIn2); return out; } diff --git a/reference/opt/shaders-msl/frag/packing-test-3.frag b/reference/opt/shaders-msl/frag/packing-test-3.frag index 2ce2bc32..6ed07cde 100644 --- a/reference/opt/shaders-msl/frag/packing-test-3.frag +++ b/reference/opt/shaders-msl/frag/packing-test-3.frag @@ -3,18 +3,7 @@ using namespace metal; -struct VertexOutput -{ - float4 HPosition; -}; - struct TestStruct -{ - float3 position; - float radius; -}; - -struct TestStruct_1 { packed_float3 position; float radius; @@ -22,7 +11,7 @@ struct TestStruct_1 struct CB0 { - TestStruct_1 CB0[16]; + TestStruct CB0[16]; }; struct main0_out diff --git a/reference/opt/shaders-msl/frag/unary-enclose.frag b/reference/opt/shaders-msl/frag/unary-enclose.frag index 7437f1df..47b2d178 100644 --- a/reference/opt/shaders-msl/frag/unary-enclose.frag +++ b/reference/opt/shaders-msl/frag/unary-enclose.frag @@ -16,7 +16,7 @@ struct main0_out fragment main0_out main0(main0_in in [[stage_in]]) { main0_out out = {}; - out.FragColor = -(-in.vIn); + out.FragColor = in.vIn; return out; } diff --git a/reference/opt/shaders-msl/vert/copy.flatten.vert b/reference/opt/shaders-msl/vert/copy.flatten.vert index 295a12d3..0c4a508e 100644 --- a/reference/opt/shaders-msl/vert/copy.flatten.vert +++ b/reference/opt/shaders-msl/vert/copy.flatten.vert @@ -16,13 +16,6 @@ struct UBO Light lights[4]; }; -struct Light_1 -{ - float3 Position; - float Radius; - float4 Color; -}; - struct main0_in { float3 aNormal [[attribute(1)]]; @@ -40,10 +33,12 @@ vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _21 [[buffer(0)]] main0_out out = {}; out.gl_Position = _21.uMVP * in.aVertex; out.vColor = float4(0.0); - for (int _103 = 0; _103 < 4; _103++) + for (int _96 = 0; _96 < 4; ) { - 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))); + float3 _68 = in.aVertex.xyz - _21.lights[_96].Position; + out.vColor += ((_21.lights[_96].Color * clamp(1.0 - (length(_68) / _21.lights[_96].Radius), 0.0, 1.0)) * dot(in.aNormal, normalize(_68))); + _96++; + continue; } return out; } diff --git a/reference/opt/shaders-msl/vert/dynamic.flatten.vert b/reference/opt/shaders-msl/vert/dynamic.flatten.vert index eb38ab4f..1b4134c7 100644 --- a/reference/opt/shaders-msl/vert/dynamic.flatten.vert +++ b/reference/opt/shaders-msl/vert/dynamic.flatten.vert @@ -33,10 +33,12 @@ vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _21 [[buffer(0)]] main0_out out = {}; out.gl_Position = _21.uMVP * in.aVertex; out.vColor = float4(0.0); - for (int _82 = 0; _82 < 4; _82++) + for (int _82 = 0; _82 < 4; ) { 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))); + _82++; + continue; } return out; } diff --git a/reference/opt/shaders-msl/vert/packed_matrix.vert b/reference/opt/shaders-msl/vert/packed_matrix.vert index 53d7d164..e1e8fdaa 100644 --- a/reference/opt/shaders-msl/vert/packed_matrix.vert +++ b/reference/opt/shaders-msl/vert/packed_matrix.vert @@ -40,14 +40,8 @@ struct main0_out vertex main0_out main0(main0_in in [[stage_in]], constant _15& _17 [[buffer(0)]], constant _42& _44 [[buffer(1)]]) { main0_out out = {}; - float3 _34; - do - { - _34 = normalize(float4(in.m_25.xyz, 0.0) * _17._m1); - break; - } while (false); float4 _70 = _44._m0 * float4(_44._m3 + (in.m_25.xyz * (_44._m6 + _44._m7)), 1.0); - out.m_72 = _34; + out.m_72 = normalize(float4(in.m_25.xyz, 0.0) * _17._m1); float4 _95 = _70; _95.y = -_70.y; out.gl_Position = _95; diff --git a/reference/opt/shaders-msl/vert/return-array.vert b/reference/opt/shaders-msl/vert/return-array.vert index 7804d2d9..35646b55 100644 --- a/reference/opt/shaders-msl/vert/return-array.vert +++ b/reference/opt/shaders-msl/vert/return-array.vert @@ -3,8 +3,6 @@ using namespace metal; -constant float4 _20[2] = {float4(10.0), float4(20.0)}; - struct main0_in { float4 vInput1 [[attribute(1)]]; diff --git a/reference/opt/shaders/amd/fs.invalid.frag b/reference/opt/shaders/amd/fs.invalid.frag index 97e7bcd1..aecf69eb 100644 --- a/reference/opt/shaders/amd/fs.invalid.frag +++ b/reference/opt/shaders/amd/fs.invalid.frag @@ -2,9 +2,9 @@ #extension GL_AMD_shader_fragment_mask : require #extension GL_AMD_shader_explicit_vertex_parameter : require -uniform sampler2DMS texture1; +layout(binding = 0) uniform sampler2DMS texture1; -layout(location = 0) in vec4 vary; +layout(location = 0) __explicitInterpAMD in vec4 vary; void main() { diff --git a/reference/opt/shaders/amd/gcn_shader.comp b/reference/opt/shaders/amd/gcn_shader.comp index 85851de5..e4bb67e9 100644 --- a/reference/opt/shaders/amd/gcn_shader.comp +++ b/reference/opt/shaders/amd/gcn_shader.comp @@ -1,5 +1,6 @@ #version 450 #extension GL_ARB_gpu_shader_int64 : require +#extension GL_AMD_gcn_shader : require layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; void main() diff --git a/reference/opt/shaders/amd/shader_ballot.comp b/reference/opt/shaders/amd/shader_ballot.comp index 8bdbfc9c..596929d3 100644 --- a/reference/opt/shaders/amd/shader_ballot.comp +++ b/reference/opt/shaders/amd/shader_ballot.comp @@ -9,9 +9,9 @@ layout(binding = 0, std430) buffer inputData float inputDataArray[]; } _12; -layout(binding = 1, std430) buffer outputData +layout(binding = 1, std430) buffer _10_74 { - float outputDataArray[]; + float inputDataArray[]; } _74; void main() @@ -20,7 +20,7 @@ void main() bool _31 = _25 > 0.0; if (_31) { - _74.outputDataArray[mbcntAMD(packUint2x32(uvec2(unpackUint2x32(ballotARB(_31)).xy)))] = _25; + _74.inputDataArray[mbcntAMD(packUint2x32(uvec2(unpackUint2x32(ballotARB(_31)).xy)))] = _25; } } diff --git a/reference/opt/shaders/amd/shader_group_vote.comp b/reference/opt/shaders/amd/shader_group_vote.comp index 77ea0349..26699817 100644 --- a/reference/opt/shaders/amd/shader_group_vote.comp +++ b/reference/opt/shaders/amd/shader_group_vote.comp @@ -1,7 +1,14 @@ #version 450 +#extension GL_ARB_shader_group_vote : require layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; +layout(binding = 0, std430) buffer inputData +{ + float inputDataArray[]; +} _12; + void main() { + bool _31 = _12.inputDataArray[gl_LocalInvocationID.x] > 0.0; } diff --git a/reference/opt/shaders/amd/shader_trinary_minmax.comp b/reference/opt/shaders/amd/shader_trinary_minmax.comp index 77ea0349..2644551e 100644 --- a/reference/opt/shaders/amd/shader_trinary_minmax.comp +++ b/reference/opt/shaders/amd/shader_trinary_minmax.comp @@ -1,4 +1,5 @@ #version 450 +#extension GL_AMD_shader_trinary_minmax : require layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; void main() diff --git a/reference/opt/shaders/asm/comp/specialization-constant-workgroup.asm.comp b/reference/opt/shaders/asm/comp/specialization-constant-workgroup.asm.comp index 1b2285a8..c1b84377 100644 --- a/reference/opt/shaders/asm/comp/specialization-constant-workgroup.asm.comp +++ b/reference/opt/shaders/asm/comp/specialization-constant-workgroup.asm.comp @@ -1,5 +1,5 @@ #version 310 es -layout(local_size_x = 9, local_size_y = 20, local_size_z = 4) in; +layout(local_size_x = 1, local_size_y = 20, local_size_z = 1) in; layout(binding = 0, std430) buffer SSBO { diff --git a/reference/opt/shaders/asm/comp/storage-buffer-basic.asm.comp b/reference/opt/shaders/asm/comp/storage-buffer-basic.asm.comp index 3de823fb..a2210eb1 100644 --- a/reference/opt/shaders/asm/comp/storage-buffer-basic.asm.comp +++ b/reference/opt/shaders/asm/comp/storage-buffer-basic.asm.comp @@ -11,6 +11,8 @@ layout(binding = 1, std430) buffer _6_9 float _m0[]; } _9; +uvec3 _22 = gl_WorkGroupSize; + void main() { _8._m0[gl_WorkGroupID.x] = _9._m0[gl_WorkGroupID.x] + _8._m0[gl_WorkGroupID.x]; diff --git a/reference/opt/shaders/asm/frag/composite-construct-struct-no-swizzle.asm.frag b/reference/opt/shaders/asm/frag/composite-construct-struct-no-swizzle.asm.frag index 23af1702..45e83dbc 100644 --- a/reference/opt/shaders/asm/frag/composite-construct-struct-no-swizzle.asm.frag +++ b/reference/opt/shaders/asm/frag/composite-construct-struct-no-swizzle.asm.frag @@ -2,12 +2,6 @@ precision mediump float; precision highp int; -struct SwizzleTest -{ - float a; - float b; -}; - layout(location = 0) in vec2 foo; layout(location = 0) out float FooOut; diff --git a/reference/opt/shaders/asm/frag/default-member-names.asm.frag b/reference/opt/shaders/asm/frag/default-member-names.asm.frag index 2cf68fd2..7203f2be 100644 --- a/reference/opt/shaders/asm/frag/default-member-names.asm.frag +++ b/reference/opt/shaders/asm/frag/default-member-names.asm.frag @@ -1,33 +1,11 @@ #version 450 -struct _9 -{ - float _m0; -}; - -struct _10 -{ - float _m0; - float _m1; - float _m2; - float _m3; - float _m4; - float _m5; - float _m6; - float _m7; - float _m8; - float _m9; - float _m10; - float _m11; - _9 _m12; -}; - layout(location = 0) out vec4 _3; -_10 _51; +float _57; void main() { - _3 = vec4(_51._m0, _51._m1, _51._m2, _51._m3); + _3 = vec4(_57); } diff --git a/reference/opt/shaders/asm/frag/function-overload-alias.asm.frag b/reference/opt/shaders/asm/frag/function-overload-alias.asm.frag index f726fabb..16b49941 100644 --- a/reference/opt/shaders/asm/frag/function-overload-alias.asm.frag +++ b/reference/opt/shaders/asm/frag/function-overload-alias.asm.frag @@ -6,6 +6,6 @@ layout(location = 0) out vec4 FragColor; void main() { - FragColor = (((vec4(1.0) + vec4(1.0)) + (vec3(1.0).xyzz + vec4(1.0))) + (vec4(1.0) + vec4(2.0))) + (vec2(1.0).xyxy + vec4(2.0)); + FragColor = vec4(10.0); } diff --git a/reference/opt/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag b/reference/opt/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag index ebf8c120..452fd6fb 100644 --- a/reference/opt/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag +++ b/reference/opt/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag @@ -7,7 +7,7 @@ layout(location = 0) out vec4 _entryPointOutput; void main() { - ivec3 _122 = ivec3(int(gl_FragCoord.x * 1280.0), int(gl_FragCoord.y * 720.0), 0); - _entryPointOutput = ((texelFetch(SPIRV_Cross_CombinedSampledImageSPIRV_Cross_DummySampler, _122.xy, 0) + texelFetch(SPIRV_Cross_CombinedSampledImageSPIRV_Cross_DummySampler, _122.xy, 0)) + texture(SPIRV_Cross_CombinedSampledImageSampler, gl_FragCoord.xy)) + texture(SPIRV_Cross_CombinedSampledImageSampler, gl_FragCoord.xy); + ivec2 _152 = ivec3(int(gl_FragCoord.x * 1280.0), int(gl_FragCoord.y * 720.0), 0).xy; + _entryPointOutput = ((texelFetch(SPIRV_Cross_CombinedSampledImageSPIRV_Cross_DummySampler, _152, 0) + texelFetch(SPIRV_Cross_CombinedSampledImageSPIRV_Cross_DummySampler, _152, 0)) + texture(SPIRV_Cross_CombinedSampledImageSampler, gl_FragCoord.xy)) + texture(SPIRV_Cross_CombinedSampledImageSampler, gl_FragCoord.xy); } diff --git a/reference/opt/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag.vk b/reference/opt/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag.vk index 433f5bc2..23acab0b 100644 --- a/reference/opt/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag.vk +++ b/reference/opt/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag.vk @@ -2,13 +2,13 @@ layout(set = 0, binding = 0) uniform sampler Sampler; layout(set = 0, binding = 0) uniform texture2D SampledImage; -uniform sampler SPIRV_Cross_DummySampler; +layout(set = 0, binding = 0) uniform sampler SPIRV_Cross_DummySampler; layout(location = 0) out vec4 _entryPointOutput; void main() { - ivec3 _122 = ivec3(int(gl_FragCoord.x * 1280.0), int(gl_FragCoord.y * 720.0), 0); - _entryPointOutput = ((texelFetch(sampler2D(SampledImage, SPIRV_Cross_DummySampler), _122.xy, 0) + texelFetch(sampler2D(SampledImage, SPIRV_Cross_DummySampler), _122.xy, 0)) + texture(sampler2D(SampledImage, Sampler), gl_FragCoord.xy)) + texture(sampler2D(SampledImage, Sampler), gl_FragCoord.xy); + ivec2 _152 = ivec3(int(gl_FragCoord.x * 1280.0), int(gl_FragCoord.y * 720.0), 0).xy; + _entryPointOutput = ((texelFetch(sampler2D(SampledImage, SPIRV_Cross_DummySampler), _152, 0) + texelFetch(sampler2D(SampledImage, SPIRV_Cross_DummySampler), _152, 0)) + texture(sampler2D(SampledImage, Sampler), gl_FragCoord.xy)) + texture(sampler2D(SampledImage, Sampler), gl_FragCoord.xy); } diff --git a/reference/opt/shaders/asm/frag/inliner-dominator-inside-loop.asm.frag b/reference/opt/shaders/asm/frag/inliner-dominator-inside-loop.noopt.asm.frag similarity index 100% rename from reference/opt/shaders/asm/frag/inliner-dominator-inside-loop.asm.frag rename to reference/opt/shaders/asm/frag/inliner-dominator-inside-loop.noopt.asm.frag diff --git a/reference/opt/shaders/asm/frag/loop-body-dominator-continue-access.asm.frag b/reference/opt/shaders/asm/frag/loop-body-dominator-continue-access.asm.frag index 4fb4b757..b64f16d4 100644 --- a/reference/opt/shaders/asm/frag/loop-body-dominator-continue-access.asm.frag +++ b/reference/opt/shaders/asm/frag/loop-body-dominator-continue-access.asm.frag @@ -10,36 +10,34 @@ layout(binding = 0, std140) uniform Foo layout(location = 0) in vec3 fragWorld; layout(location = 0) out int _entryPointOutput; -mat4 _152; -uint _155; - int GetCascade(vec3 fragWorldPosition) { - mat4 _153; - _153 = _152; - uint _156; - mat4 _157; - for (uint _151 = 0u; _151 < _11.shadowCascadesNum; _151 = _156 + uint(1), _153 = _157) + for (uint _151 = 0u; _151 < _11.shadowCascadesNum; _151++) { - mat4 _154; - _154 = _153; + mat4 _157; for (;;) { if (_11.test == 0) { - _156 = _151; _157 = mat4(vec4(0.5, 0.0, 0.0, 0.0), vec4(0.0, 0.5, 0.0, 0.0), vec4(0.0, 0.0, 0.5, 0.0), vec4(0.0, 0.0, 0.0, 1.0)); break; } - _156 = _151; _157 = mat4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0)); break; } - vec4 _92 = (_157 * _11.lightVP[_156]) * vec4(fragWorldPosition, 1.0); - if ((((_92.z >= 0.0) && (_92.z <= 1.0)) && (max(_92.x, _92.y) <= 1.0)) && (min(_92.x, _92.y) >= 0.0)) + vec4 _92 = (_157 * _11.lightVP[_151]) * vec4(fragWorldPosition, 1.0); + float _140 = _92.z; + float _144 = _92.x; + float _146 = _92.y; + if ((((_140 >= 0.0) && (_140 <= 1.0)) && (max(_144, _146) <= 1.0)) && (min(_144, _146) >= 0.0)) { - return int(_156); + return int(_151); } + else + { + continue; + } + continue; } return -1; } diff --git a/reference/opt/shaders/asm/frag/loop-header-to-continue.asm.frag b/reference/opt/shaders/asm/frag/loop-header-to-continue.asm.frag index a99322d6..c2dba928 100644 --- a/reference/opt/shaders/asm/frag/loop-header-to-continue.asm.frag +++ b/reference/opt/shaders/asm/frag/loop-header-to-continue.asm.frag @@ -32,7 +32,7 @@ void main() { float _64 = float(_60); vec4 _72 = texture(SPIRV_Cross_CombinedmapTexturemapSampler, IN_uv + (vec2(0.0, _8.CB1.TextureSize.w) * _64)); - float _78 = exp(((-_64) * _64) * 0.2222220003604888916015625) * float(abs(_72.y - _50) < clamp((_50 * 80.0) * 0.0007999999797903001308441162109375, 7.999999797903001308441162109375e-05, 0.008000000379979610443115234375)); + float _78 = exp(((-_64) * _64) * 0.2222220003604888916015625) * float(abs(_72.y - _50) < clamp(_50 * 0.06399999558925628662109375, 7.999999797903001308441162109375e-05, 0.008000000379979610443115234375)); _55 += (_72.x * _78); _58 += _78; _60++; diff --git a/reference/opt/shaders/asm/frag/loop-merge-to-continue.asm.frag b/reference/opt/shaders/asm/frag/loop-merge-to-continue.asm.frag index 2388da7f..a1cbe932 100644 --- a/reference/opt/shaders/asm/frag/loop-merge-to-continue.asm.frag +++ b/reference/opt/shaders/asm/frag/loop-merge-to-continue.asm.frag @@ -3,19 +3,18 @@ layout(location = 0) out vec4 FragColor; layout(location = 0) in vec4 v0; -int _51; - void main() { FragColor = vec4(1.0); - int _53; - int _52; - for (int _50 = 0; _50 < 4; _50++, _52 = _53) + int _50; + _50 = 0; + for (; _50 < 4; _50++) { - _53 = 0; - for (; _53 < 4; _53++) + for (int _53 = 0; _53 < 4; ) { FragColor += vec4(v0[(_50 + _53) & 3]); + _53++; + continue; } } } diff --git a/reference/opt/shaders/asm/frag/multi-for-loop-init.asm.frag b/reference/opt/shaders/asm/frag/multi-for-loop-init.asm.frag index c41c77c7..b8e56995 100644 --- a/reference/opt/shaders/asm/frag/multi-for-loop-init.asm.frag +++ b/reference/opt/shaders/asm/frag/multi-for-loop-init.asm.frag @@ -10,10 +10,13 @@ void main() FragColor = vec4(0.0); int _53 = 0; uint _54 = 1u; - for (; (_53 < 10) && (int(_54) < int(20u)); _53 += counter, _54 += uint(counter)) + for (; (_53 < 10) && (int(_54) < int(20u)); ) { FragColor += vec4(float(_53)); FragColor += vec4(float(_54)); + _53 += counter; + _54 += uint(counter); + continue; } } diff --git a/reference/opt/shaders/asm/frag/op-constant-null.asm.frag b/reference/opt/shaders/asm/frag/op-constant-null.asm.frag index cb882cd7..873a64cb 100644 --- a/reference/opt/shaders/asm/frag/op-constant-null.asm.frag +++ b/reference/opt/shaders/asm/frag/op-constant-null.asm.frag @@ -2,12 +2,6 @@ precision mediump float; precision highp int; -struct D -{ - vec4 a; - float b; -}; - layout(location = 0) out float FragColor; void main() diff --git a/reference/opt/shaders/asm/frag/phi-loop-variable.asm.frag b/reference/opt/shaders/asm/frag/phi-loop-variable.asm.frag index 786ac74d..05ce10ad 100644 --- a/reference/opt/shaders/asm/frag/phi-loop-variable.asm.frag +++ b/reference/opt/shaders/asm/frag/phi-loop-variable.asm.frag @@ -2,8 +2,5 @@ void main() { - for (int _22 = 35; _22 >= 0; _22--) - { - } } diff --git a/reference/opt/shaders/asm/frag/sampler-buffer-without-sampler.asm.frag b/reference/opt/shaders/asm/frag/sampler-buffer-without-sampler.asm.frag index 560a4e79..89058f14 100644 --- a/reference/opt/shaders/asm/frag/sampler-buffer-without-sampler.asm.frag +++ b/reference/opt/shaders/asm/frag/sampler-buffer-without-sampler.asm.frag @@ -1,7 +1,7 @@ #version 450 -layout(rgba32f) uniform writeonly imageBuffer RWTex; -uniform samplerBuffer Tex; +layout(binding = 0, rgba32f) uniform writeonly imageBuffer RWTex; +layout(binding = 1) uniform samplerBuffer Tex; layout(location = 0) out vec4 _entryPointOutput; diff --git a/reference/opt/shaders/asm/frag/selection-merge-to-continue.asm.frag b/reference/opt/shaders/asm/frag/selection-merge-to-continue.asm.frag index 19b0ef13..05c17c7a 100644 --- a/reference/opt/shaders/asm/frag/selection-merge-to-continue.asm.frag +++ b/reference/opt/shaders/asm/frag/selection-merge-to-continue.asm.frag @@ -18,6 +18,7 @@ void main() FragColor += vec4(v0[_54 & 1]); continue; } + continue; } } diff --git a/reference/opt/shaders/asm/frag/switch-merge-to-continue.asm.frag b/reference/opt/shaders/asm/frag/switch-merge-to-continue.asm.frag index d40a3f80..ea4a2599 100644 --- a/reference/opt/shaders/asm/frag/switch-merge-to-continue.asm.frag +++ b/reference/opt/shaders/asm/frag/switch-merge-to-continue.asm.frag @@ -25,6 +25,7 @@ void main() break; } } + continue; } } diff --git a/reference/opt/shaders/asm/frag/temporary-phi-hoisting.asm.frag b/reference/opt/shaders/asm/frag/temporary-phi-hoisting.asm.frag index 3917594d..1ecd61d7 100644 --- a/reference/opt/shaders/asm/frag/temporary-phi-hoisting.asm.frag +++ b/reference/opt/shaders/asm/frag/temporary-phi-hoisting.asm.frag @@ -16,10 +16,11 @@ void main() { vec3 _28; _28 = vec3(0.0); - vec3 _29; - for (int _31 = 0; _31 < 4; _28 = _29, _31++) + for (int _31 = 0; _31 < 4; ) { - _29 = _28 + _6.g_MyStruct[_31].color.xyz; + _28 += _6.g_MyStruct[_31].color.xyz; + _31++; + continue; } _entryPointOutput = vec4(_28, 1.0); } diff --git a/reference/opt/shaders/asm/frag/undef-variable-store.asm.frag b/reference/opt/shaders/asm/frag/undef-variable-store.asm.frag index 23576ed8..84eb23a2 100644 --- a/reference/opt/shaders/asm/frag/undef-variable-store.asm.frag +++ b/reference/opt/shaders/asm/frag/undef-variable-store.asm.frag @@ -2,29 +2,8 @@ layout(location = 0) out vec4 _entryPointOutput; -vec4 _38; -vec4 _50; - void main() { - vec4 _51; - _51 = _50; - vec4 _52; - for (;;) - { - if (0.0 != 0.0) - { - _52 = vec4(1.0, 0.0, 0.0, 1.0); - break; - } - else - { - _52 = vec4(1.0, 1.0, 0.0, 1.0); - break; - } - _52 = _38; - break; - } - _entryPointOutput = _52; + _entryPointOutput = vec4(1.0, 1.0, 0.0, 1.0); } diff --git a/reference/opt/shaders/asm/frag/unreachable.asm.frag b/reference/opt/shaders/asm/frag/unreachable.asm.frag index d8126d75..eb7e8a91 100644 --- a/reference/opt/shaders/asm/frag/unreachable.asm.frag +++ b/reference/opt/shaders/asm/frag/unreachable.asm.frag @@ -3,24 +3,21 @@ layout(location = 0) flat in int counter; layout(location = 0) out vec4 FragColor; -vec4 _21; - void main() { - vec4 _33; - do + bool _29; + for (;;) { - if (counter == 10) + _29 = counter == 10; + if (_29) { - _33 = vec4(10.0); break; } else { - _33 = vec4(30.0); break; } - } while (false); - FragColor = _33; + } + FragColor = mix(vec4(30.0), vec4(10.0), bvec4(_29)); } diff --git a/reference/opt/shaders/asm/frag/vector-shuffle-oom.asm.frag b/reference/opt/shaders/asm/frag/vector-shuffle-oom.asm.frag index cdaf7872..e5408d53 100644 --- a/reference/opt/shaders/asm/frag/vector-shuffle-oom.asm.frag +++ b/reference/opt/shaders/asm/frag/vector-shuffle-oom.asm.frag @@ -94,34 +94,33 @@ _28 _74; void main() { - _28 _77 = _74; - _77._m0 = vec4(0.0); vec2 _82 = gl_FragCoord.xy * _19._m23.xy; vec4 _88 = _7._m2 * _7._m0.xyxy; - vec2 _97 = clamp(_82 + (vec3(0.0, -2.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + vec2 _95 = _88.xy; + vec2 _96 = _88.zw; + vec2 _97 = clamp(_82 + (vec2(0.0, -2.0) * _7._m0.xy), _95, _96); vec3 _109 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _97, 0.0).w * _7._m1, 0.0, 1.0); vec4 _113 = textureLod(SPIRV_Cross_Combined_1, _97, 0.0); + float _114 = _113.y; vec3 _129; - if (_113.y > 0.0) + if (_114 > 0.0) { - _129 = _109 + (textureLod(SPIRV_Cross_Combined_2, _97, 0.0).xyz * clamp(_113.y * _113.z, 0.0, 1.0)); + _129 = _109 + (textureLod(SPIRV_Cross_Combined_2, _97, 0.0).xyz * clamp(_114 * _113.z, 0.0, 1.0)); } else { _129 = _109; } vec3 _130 = _129 * 0.5; - vec3 _133 = vec4(0.0).xyz + _130; - vec4 _134 = vec4(_133.x, _133.y, _133.z, vec4(0.0).w); - _28 _135 = _77; - _135._m0 = _134; - vec2 _144 = clamp(_82 + (vec3(-1.0, -1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + vec4 _134 = vec4(_130.x, _130.y, _130.z, vec4(0.0).w); + vec2 _144 = clamp(_82 + (vec2(-1.0) * _7._m0.xy), _95, _96); vec3 _156 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _144, 0.0).w * _7._m1, 0.0, 1.0); vec4 _160 = textureLod(SPIRV_Cross_Combined_1, _144, 0.0); + float _161 = _160.y; vec3 _176; - if (_160.y > 0.0) + if (_161 > 0.0) { - _176 = _156 + (textureLod(SPIRV_Cross_Combined_2, _144, 0.0).xyz * clamp(_160.y * _160.z, 0.0, 1.0)); + _176 = _156 + (textureLod(SPIRV_Cross_Combined_2, _144, 0.0).xyz * clamp(_161 * _160.z, 0.0, 1.0)); } else { @@ -130,15 +129,14 @@ void main() vec3 _177 = _176 * 0.5; vec3 _180 = _134.xyz + _177; vec4 _181 = vec4(_180.x, _180.y, _180.z, _134.w); - _28 _182 = _135; - _182._m0 = _181; - vec2 _191 = clamp(_82 + (vec3(0.0, -1.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw); + vec2 _191 = clamp(_82 + (vec2(0.0, -1.0) * _7._m0.xy), _95, _96); vec3 _203 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _191, 0.0).w * _7._m1, 0.0, 1.0); vec4 _207 = textureLod(SPIRV_Cross_Combined_1, _191, 0.0); + float _208 = _207.y; vec3 _223; - if (_207.y > 0.0) + if (_208 > 0.0) { - _223 = _203 + (textureLod(SPIRV_Cross_Combined_2, _191, 0.0).xyz * clamp(_207.y * _207.z, 0.0, 1.0)); + _223 = _203 + (textureLod(SPIRV_Cross_Combined_2, _191, 0.0).xyz * clamp(_208 * _207.z, 0.0, 1.0)); } else { @@ -147,15 +145,14 @@ void main() vec3 _224 = _223 * 0.75; vec3 _227 = _181.xyz + _224; vec4 _228 = vec4(_227.x, _227.y, _227.z, _181.w); - _28 _229 = _182; - _229._m0 = _228; - vec2 _238 = clamp(_82 + (vec3(1.0, -1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + vec2 _238 = clamp(_82 + (vec2(1.0, -1.0) * _7._m0.xy), _95, _96); vec3 _250 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _238, 0.0).w * _7._m1, 0.0, 1.0); vec4 _254 = textureLod(SPIRV_Cross_Combined_1, _238, 0.0); + float _255 = _254.y; vec3 _270; - if (_254.y > 0.0) + if (_255 > 0.0) { - _270 = _250 + (textureLod(SPIRV_Cross_Combined_2, _238, 0.0).xyz * clamp(_254.y * _254.z, 0.0, 1.0)); + _270 = _250 + (textureLod(SPIRV_Cross_Combined_2, _238, 0.0).xyz * clamp(_255 * _254.z, 0.0, 1.0)); } else { @@ -164,15 +161,14 @@ void main() vec3 _271 = _270 * 0.5; vec3 _274 = _228.xyz + _271; vec4 _275 = vec4(_274.x, _274.y, _274.z, _228.w); - _28 _276 = _229; - _276._m0 = _275; - vec2 _285 = clamp(_82 + (vec3(-2.0, 0.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + vec2 _285 = clamp(_82 + (vec2(-2.0, 0.0) * _7._m0.xy), _95, _96); vec3 _297 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _285, 0.0).w * _7._m1, 0.0, 1.0); vec4 _301 = textureLod(SPIRV_Cross_Combined_1, _285, 0.0); + float _302 = _301.y; vec3 _317; - if (_301.y > 0.0) + if (_302 > 0.0) { - _317 = _297 + (textureLod(SPIRV_Cross_Combined_2, _285, 0.0).xyz * clamp(_301.y * _301.z, 0.0, 1.0)); + _317 = _297 + (textureLod(SPIRV_Cross_Combined_2, _285, 0.0).xyz * clamp(_302 * _301.z, 0.0, 1.0)); } else { @@ -181,15 +177,14 @@ void main() vec3 _318 = _317 * 0.5; vec3 _321 = _275.xyz + _318; vec4 _322 = vec4(_321.x, _321.y, _321.z, _275.w); - _28 _323 = _276; - _323._m0 = _322; - vec2 _332 = clamp(_82 + (vec3(-1.0, 0.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw); + vec2 _332 = clamp(_82 + (vec2(-1.0, 0.0) * _7._m0.xy), _95, _96); vec3 _344 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _332, 0.0).w * _7._m1, 0.0, 1.0); vec4 _348 = textureLod(SPIRV_Cross_Combined_1, _332, 0.0); + float _349 = _348.y; vec3 _364; - if (_348.y > 0.0) + if (_349 > 0.0) { - _364 = _344 + (textureLod(SPIRV_Cross_Combined_2, _332, 0.0).xyz * clamp(_348.y * _348.z, 0.0, 1.0)); + _364 = _344 + (textureLod(SPIRV_Cross_Combined_2, _332, 0.0).xyz * clamp(_349 * _348.z, 0.0, 1.0)); } else { @@ -198,15 +193,14 @@ void main() vec3 _365 = _364 * 0.75; vec3 _368 = _322.xyz + _365; vec4 _369 = vec4(_368.x, _368.y, _368.z, _322.w); - _28 _370 = _323; - _370._m0 = _369; - vec2 _379 = clamp(_82 + (vec3(0.0, 0.0, 1.0).xy * _7._m0.xy), _88.xy, _88.zw); + vec2 _379 = clamp(_82, _95, _96); vec3 _391 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _379, 0.0).w * _7._m1, 0.0, 1.0); vec4 _395 = textureLod(SPIRV_Cross_Combined_1, _379, 0.0); + float _396 = _395.y; vec3 _411; - if (_395.y > 0.0) + if (_396 > 0.0) { - _411 = _391 + (textureLod(SPIRV_Cross_Combined_2, _379, 0.0).xyz * clamp(_395.y * _395.z, 0.0, 1.0)); + _411 = _391 + (textureLod(SPIRV_Cross_Combined_2, _379, 0.0).xyz * clamp(_396 * _395.z, 0.0, 1.0)); } else { @@ -215,15 +209,14 @@ void main() vec3 _412 = _411 * 1.0; vec3 _415 = _369.xyz + _412; vec4 _416 = vec4(_415.x, _415.y, _415.z, _369.w); - _28 _417 = _370; - _417._m0 = _416; - vec2 _426 = clamp(_82 + (vec3(1.0, 0.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw); + vec2 _426 = clamp(_82 + (vec2(1.0, 0.0) * _7._m0.xy), _95, _96); vec3 _438 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _426, 0.0).w * _7._m1, 0.0, 1.0); vec4 _442 = textureLod(SPIRV_Cross_Combined_1, _426, 0.0); + float _443 = _442.y; vec3 _458; - if (_442.y > 0.0) + if (_443 > 0.0) { - _458 = _438 + (textureLod(SPIRV_Cross_Combined_2, _426, 0.0).xyz * clamp(_442.y * _442.z, 0.0, 1.0)); + _458 = _438 + (textureLod(SPIRV_Cross_Combined_2, _426, 0.0).xyz * clamp(_443 * _442.z, 0.0, 1.0)); } else { @@ -232,15 +225,14 @@ void main() vec3 _459 = _458 * 0.75; vec3 _462 = _416.xyz + _459; vec4 _463 = vec4(_462.x, _462.y, _462.z, _416.w); - _28 _464 = _417; - _464._m0 = _463; - vec2 _473 = clamp(_82 + (vec3(2.0, 0.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + vec2 _473 = clamp(_82 + (vec2(2.0, 0.0) * _7._m0.xy), _95, _96); vec3 _485 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _473, 0.0).w * _7._m1, 0.0, 1.0); vec4 _489 = textureLod(SPIRV_Cross_Combined_1, _473, 0.0); + float _490 = _489.y; vec3 _505; - if (_489.y > 0.0) + if (_490 > 0.0) { - _505 = _485 + (textureLod(SPIRV_Cross_Combined_2, _473, 0.0).xyz * clamp(_489.y * _489.z, 0.0, 1.0)); + _505 = _485 + (textureLod(SPIRV_Cross_Combined_2, _473, 0.0).xyz * clamp(_490 * _489.z, 0.0, 1.0)); } else { @@ -249,15 +241,14 @@ void main() vec3 _506 = _505 * 0.5; vec3 _509 = _463.xyz + _506; vec4 _510 = vec4(_509.x, _509.y, _509.z, _463.w); - _28 _511 = _464; - _511._m0 = _510; - vec2 _520 = clamp(_82 + (vec3(-1.0, 1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + vec2 _520 = clamp(_82 + (vec2(-1.0, 1.0) * _7._m0.xy), _95, _96); vec3 _532 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _520, 0.0).w * _7._m1, 0.0, 1.0); vec4 _536 = textureLod(SPIRV_Cross_Combined_1, _520, 0.0); + float _537 = _536.y; vec3 _552; - if (_536.y > 0.0) + if (_537 > 0.0) { - _552 = _532 + (textureLod(SPIRV_Cross_Combined_2, _520, 0.0).xyz * clamp(_536.y * _536.z, 0.0, 1.0)); + _552 = _532 + (textureLod(SPIRV_Cross_Combined_2, _520, 0.0).xyz * clamp(_537 * _536.z, 0.0, 1.0)); } else { @@ -266,15 +257,14 @@ void main() vec3 _553 = _552 * 0.5; vec3 _556 = _510.xyz + _553; vec4 _557 = vec4(_556.x, _556.y, _556.z, _510.w); - _28 _558 = _511; - _558._m0 = _557; - vec2 _567 = clamp(_82 + (vec3(0.0, 1.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw); + vec2 _567 = clamp(_82 + (vec2(0.0, 1.0) * _7._m0.xy), _95, _96); vec3 _579 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _567, 0.0).w * _7._m1, 0.0, 1.0); vec4 _583 = textureLod(SPIRV_Cross_Combined_1, _567, 0.0); + float _584 = _583.y; vec3 _599; - if (_583.y > 0.0) + if (_584 > 0.0) { - _599 = _579 + (textureLod(SPIRV_Cross_Combined_2, _567, 0.0).xyz * clamp(_583.y * _583.z, 0.0, 1.0)); + _599 = _579 + (textureLod(SPIRV_Cross_Combined_2, _567, 0.0).xyz * clamp(_584 * _583.z, 0.0, 1.0)); } else { @@ -283,15 +273,14 @@ void main() vec3 _600 = _599 * 0.75; vec3 _603 = _557.xyz + _600; vec4 _604 = vec4(_603.x, _603.y, _603.z, _557.w); - _28 _605 = _558; - _605._m0 = _604; - vec2 _614 = clamp(_82 + (vec3(1.0, 1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + vec2 _614 = clamp(_82 + _7._m0.xy, _95, _96); vec3 _626 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _614, 0.0).w * _7._m1, 0.0, 1.0); vec4 _630 = textureLod(SPIRV_Cross_Combined_1, _614, 0.0); + float _631 = _630.y; vec3 _646; - if (_630.y > 0.0) + if (_631 > 0.0) { - _646 = _626 + (textureLod(SPIRV_Cross_Combined_2, _614, 0.0).xyz * clamp(_630.y * _630.z, 0.0, 1.0)); + _646 = _626 + (textureLod(SPIRV_Cross_Combined_2, _614, 0.0).xyz * clamp(_631 * _630.z, 0.0, 1.0)); } else { @@ -300,15 +289,14 @@ void main() vec3 _647 = _646 * 0.5; vec3 _650 = _604.xyz + _647; vec4 _651 = vec4(_650.x, _650.y, _650.z, _604.w); - _28 _652 = _605; - _652._m0 = _651; - vec2 _661 = clamp(_82 + (vec3(0.0, 2.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + vec2 _661 = clamp(_82 + (vec2(0.0, 2.0) * _7._m0.xy), _95, _96); vec3 _673 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _661, 0.0).w * _7._m1, 0.0, 1.0); vec4 _677 = textureLod(SPIRV_Cross_Combined_1, _661, 0.0); + float _678 = _677.y; vec3 _693; - if (_677.y > 0.0) + if (_678 > 0.0) { - _693 = _673 + (textureLod(SPIRV_Cross_Combined_2, _661, 0.0).xyz * clamp(_677.y * _677.z, 0.0, 1.0)); + _693 = _673 + (textureLod(SPIRV_Cross_Combined_2, _661, 0.0).xyz * clamp(_678 * _677.z, 0.0, 1.0)); } else { @@ -316,10 +304,8 @@ void main() } vec3 _697 = _651.xyz + (_693 * 0.5); vec4 _698 = vec4(_697.x, _697.y, _697.z, _651.w); - _28 _699 = _652; - _699._m0 = _698; - vec3 _702 = _698.xyz / vec3(((((((((((((0.0 + 0.5) + 0.5) + 0.75) + 0.5) + 0.5) + 0.75) + 1.0) + 0.75) + 0.5) + 0.5) + 0.75) + 0.5) + 0.5); - _28 _704 = _699; + vec3 _702 = _698.xyz * vec3(0.125); + _28 _704 = _74; _704._m0 = vec4(_702.x, _702.y, _702.z, _698.w); _28 _705 = _704; _705._m0.w = 1.0; diff --git a/reference/opt/shaders/asm/tesc/tess-fixed-input-array-builtin-array.asm.tesc b/reference/opt/shaders/asm/tesc/tess-fixed-input-array-builtin-array.asm.tesc index dc43d91a..4a315a3a 100644 --- a/reference/opt/shaders/asm/tesc/tess-fixed-input-array-builtin-array.asm.tesc +++ b/reference/opt/shaders/asm/tesc/tess-fixed-input-array-builtin-array.asm.tesc @@ -7,75 +7,28 @@ struct VertexOutput vec2 uv; }; -struct HSOut -{ - vec4 pos; - vec2 uv; -}; - -struct HSConstantOut -{ - float EdgeTess[3]; - float InsideTess; -}; - struct VertexOutput_1 { vec2 uv; }; -struct HSOut_1 -{ - vec2 uv; -}; - layout(location = 0) in VertexOutput_1 p[]; -layout(location = 0) out HSOut_1 _entryPointOutput[3]; +layout(location = 0) out VertexOutput_1 _entryPointOutput[3]; void main() { - VertexOutput p_1[3]; - p_1[0].pos = gl_in[0].gl_Position; - p_1[0].uv = p[0].uv; - p_1[1].pos = gl_in[1].gl_Position; - p_1[1].uv = p[1].uv; - p_1[2].pos = gl_in[2].gl_Position; - p_1[2].uv = p[2].uv; - VertexOutput param[3] = p_1; - HSOut _158; - HSOut _197 = _158; - _197.pos = param[gl_InvocationID].pos; - HSOut _199 = _197; - _199.uv = param[gl_InvocationID].uv; - _158 = _199; + VertexOutput param[3] = VertexOutput[](VertexOutput(gl_in[0].gl_Position, p[0].uv), VertexOutput(gl_in[1].gl_Position, p[1].uv), VertexOutput(gl_in[2].gl_Position, p[2].uv)); gl_out[gl_InvocationID].gl_Position = param[gl_InvocationID].pos; _entryPointOutput[gl_InvocationID].uv = param[gl_InvocationID].uv; barrier(); if (int(gl_InvocationID) == 0) { - VertexOutput param_1[3] = p_1; - vec2 _174 = vec2(1.0) + param_1[0].uv; + vec2 _174 = vec2(1.0) + p[0].uv; float _175 = _174.x; - HSConstantOut _169; - HSConstantOut _205 = _169; - _205.EdgeTess[0] = _175; - vec2 _180 = vec2(1.0) + param_1[0].uv; - float _181 = _180.x; - HSConstantOut _207 = _205; - _207.EdgeTess[1] = _181; - vec2 _186 = vec2(1.0) + param_1[0].uv; - float _187 = _186.x; - HSConstantOut _209 = _207; - _209.EdgeTess[2] = _187; - vec2 _192 = vec2(1.0) + param_1[0].uv; - float _193 = _192.x; - HSConstantOut _211 = _209; - _211.InsideTess = _193; - _169 = _211; gl_TessLevelOuter[0] = _175; - gl_TessLevelOuter[1] = _181; - gl_TessLevelOuter[2] = _187; - gl_TessLevelInner[0] = _193; + gl_TessLevelOuter[1] = _175; + gl_TessLevelOuter[2] = _175; + gl_TessLevelInner[0] = _175; } } diff --git a/reference/opt/shaders/asm/vert/empty-io.asm.vert b/reference/opt/shaders/asm/vert/empty-io.asm.vert index 52862693..82273a1f 100644 --- a/reference/opt/shaders/asm/vert/empty-io.asm.vert +++ b/reference/opt/shaders/asm/vert/empty-io.asm.vert @@ -1,15 +1,5 @@ #version 450 -struct VSInput -{ - vec4 position; -}; - -struct VSOutput -{ - vec4 position; -}; - layout(location = 0) in vec4 position; void main() diff --git a/reference/opt/shaders/asm/vert/global-builtin.sso.asm.vert b/reference/opt/shaders/asm/vert/global-builtin.sso.asm.vert index 2fc44c52..20cb3b17 100644 --- a/reference/opt/shaders/asm/vert/global-builtin.sso.asm.vert +++ b/reference/opt/shaders/asm/vert/global-builtin.sso.asm.vert @@ -8,15 +8,9 @@ out gl_PerVertex struct VSOut { float a; - vec4 pos; }; -struct VSOut_1 -{ - float a; -}; - -layout(location = 0) out VSOut_1 _entryPointOutput; +layout(location = 0) out VSOut _entryPointOutput; void main() { diff --git a/reference/opt/shaders/comp/bake_gradient.comp b/reference/opt/shaders/comp/bake_gradient.comp index 0af48339..69634d5d 100644 --- a/reference/opt/shaders/comp/bake_gradient.comp +++ b/reference/opt/shaders/comp/bake_gradient.comp @@ -15,9 +15,12 @@ layout(binding = 3, rgba16f) uniform writeonly mediump image2D iGradJacobian; void main() { vec4 _59 = (vec2(gl_GlobalInvocationID.xy) * _46.uInvSize.xy).xyxy + (_46.uInvSize * 0.5); - vec2 _157 = ((textureLodOffset(uDisplacement, _59.zw, 0.0, ivec2(1, 0)).xy - textureLodOffset(uDisplacement, _59.zw, 0.0, ivec2(-1, 0)).xy) * 0.60000002384185791015625) * _46.uScale.z; - vec2 _161 = ((textureLodOffset(uDisplacement, _59.zw, 0.0, ivec2(0, 1)).xy - textureLodOffset(uDisplacement, _59.zw, 0.0, ivec2(0, -1)).xy) * 0.60000002384185791015625) * _46.uScale.z; - imageStore(iHeightDisplacement, ivec2(gl_GlobalInvocationID.xy), vec4(textureLod(uHeight, _59.xy, 0.0).x, 0.0, 0.0, 0.0)); - imageStore(iGradJacobian, ivec2(gl_GlobalInvocationID.xy), vec4((_46.uScale.xy * 0.5) * vec2(textureLodOffset(uHeight, _59.xy, 0.0, ivec2(1, 0)).x - textureLodOffset(uHeight, _59.xy, 0.0, ivec2(-1, 0)).x, textureLodOffset(uHeight, _59.xy, 0.0, ivec2(0, 1)).x - textureLodOffset(uHeight, _59.xy, 0.0, ivec2(0, -1)).x), ((1.0 + _157.x) * (1.0 + _161.y)) - (_157.y * _161.x), 0.0)); + vec2 _67 = _59.xy; + vec2 _128 = _59.zw; + vec2 _157 = ((textureLodOffset(uDisplacement, _128, 0.0, ivec2(1, 0)).xy - textureLodOffset(uDisplacement, _128, 0.0, ivec2(-1, 0)).xy) * 0.60000002384185791015625) * _46.uScale.z; + vec2 _161 = ((textureLodOffset(uDisplacement, _128, 0.0, ivec2(0, 1)).xy - textureLodOffset(uDisplacement, _128, 0.0, ivec2(0, -1)).xy) * 0.60000002384185791015625) * _46.uScale.z; + ivec2 _172 = ivec2(gl_GlobalInvocationID.xy); + imageStore(iHeightDisplacement, _172, vec4(textureLod(uHeight, _67, 0.0).x, 0.0, 0.0, 0.0)); + imageStore(iGradJacobian, _172, vec4((_46.uScale.xy * 0.5) * vec2(textureLodOffset(uHeight, _67, 0.0, ivec2(1, 0)).x - textureLodOffset(uHeight, _67, 0.0, ivec2(-1, 0)).x, textureLodOffset(uHeight, _67, 0.0, ivec2(0, 1)).x - textureLodOffset(uHeight, _67, 0.0, ivec2(0, -1)).x), ((1.0 + _157.x) * (1.0 + _161.y)) - (_157.y * _161.x), 0.0)); } diff --git a/reference/opt/shaders/comp/casts.comp b/reference/opt/shaders/comp/casts.comp index 11ef3628..43de6aa6 100644 --- a/reference/opt/shaders/comp/casts.comp +++ b/reference/opt/shaders/comp/casts.comp @@ -6,13 +6,13 @@ layout(binding = 1, std430) buffer SSBO1 ivec4 outputs[]; } _21; -layout(binding = 0, std430) buffer SSBO0 +layout(binding = 0, std430) buffer _19_27 { - ivec4 inputs[]; + ivec4 outputs[]; } _27; void main() { - _21.outputs[gl_GlobalInvocationID.x] = mix(ivec4(0), ivec4(1), notEqual((_27.inputs[gl_GlobalInvocationID.x] & ivec4(3)), ivec4(uvec4(0u)))); + _21.outputs[gl_GlobalInvocationID.x] = mix(ivec4(0), ivec4(1), notEqual((_27.outputs[gl_GlobalInvocationID.x] & ivec4(3)), ivec4(uvec4(0u)))); } diff --git a/reference/opt/shaders/comp/cfg.comp b/reference/opt/shaders/comp/cfg.comp index c2c7136b..631f6fd3 100644 --- a/reference/opt/shaders/comp/cfg.comp +++ b/reference/opt/shaders/comp/cfg.comp @@ -31,26 +31,15 @@ void main() break; } } - switch (int(_11.data)) - { - case 0: - { - break; - } - case 1: - { - break; - } - } float _181; _181 = _180; - for (int _179 = 0; _179 < 20; _179++, _181 += 10.0) + for (int _179 = 0; _179 < 20; ) { + _179++; + _181 += 10.0; + continue; } _11.data = _181; - do - { - } while (_180 != 20.0); _11.data = _180; } diff --git a/reference/opt/shaders/comp/composite-construct.comp b/reference/opt/shaders/comp/composite-construct.comp index 5371f7e5..3e44af99 100644 --- a/reference/opt/shaders/comp/composite-construct.comp +++ b/reference/opt/shaders/comp/composite-construct.comp @@ -1,26 +1,18 @@ #version 310 es layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -struct Composite -{ - vec4 a[2]; - vec4 b[2]; -}; - layout(binding = 0, std430) buffer SSBO0 { vec4 as[]; } _41; -layout(binding = 1, std430) buffer SSBO1 +layout(binding = 1, std430) buffer _39_55 { - vec4 bs[]; + vec4 as[]; } _55; void main() { - vec4 _60[2] = vec4[](_41.as[gl_GlobalInvocationID.x], _55.bs[gl_GlobalInvocationID.x]); - vec4 param[3][2] = vec4[][](_60, vec4[](vec4(10.0), vec4(30.0)), _60); - _41.as[gl_GlobalInvocationID.x] = ((param[0][0] + param[2][1]) + param[0][1]) + param[1][0]; + _41.as[gl_GlobalInvocationID.x] = ((_41.as[gl_GlobalInvocationID.x] + _55.as[gl_GlobalInvocationID.x]) + _55.as[gl_GlobalInvocationID.x]) + vec4(10.0); } diff --git a/reference/opt/shaders/comp/defer-parens.comp b/reference/opt/shaders/comp/defer-parens.comp index 51fa7f0a..c48fb9e0 100644 --- a/reference/opt/shaders/comp/defer-parens.comp +++ b/reference/opt/shaders/comp/defer-parens.comp @@ -10,10 +10,11 @@ layout(binding = 0, std430) buffer SSBO void main() { vec4 _17 = _13.data; - _13.data = vec4(_17.x, _17.yz + vec2(10.0), _17.w); + vec2 _28 = _17.yz + vec2(10.0); + _13.data = vec4(_17.x, _28, _17.w); _13.data = (_17 + _17) + _17; - _13.data = (_17.yz + vec2(10.0)).xxyy; - _13.data = vec4((_17.yz + vec2(10.0)).y); + _13.data = _28.xxyy; + _13.data = vec4(_28.y); _13.data = vec4((_17.zw + vec2(10.0))[_13.index]); } diff --git a/reference/opt/shaders/comp/dowhile.comp b/reference/opt/shaders/comp/dowhile.comp index 61a3735d..c62a89e4 100644 --- a/reference/opt/shaders/comp/dowhile.comp +++ b/reference/opt/shaders/comp/dowhile.comp @@ -27,7 +27,6 @@ void main() if (i < 16) { _56 = _42; - continue; } else { diff --git a/reference/opt/shaders/comp/generate_height.comp b/reference/opt/shaders/comp/generate_height.comp index 1b5e0c3d..17d3073d 100644 --- a/reference/opt/shaders/comp/generate_height.comp +++ b/reference/opt/shaders/comp/generate_height.comp @@ -4,51 +4,52 @@ layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; layout(binding = 0, std430) readonly buffer Distribution { vec2 distribution[]; -} _136; +} _137; layout(binding = 2, std140) uniform UBO { vec4 uModTime; -} _165; +} _166; layout(binding = 1, std430) writeonly buffer HeightmapFFT { uint heights[]; -} _224; +} _225; void main() { - uvec2 _263 = uvec2(64u, 1u) * gl_NumWorkGroups.xy; - uvec2 _268 = _263 - gl_GlobalInvocationID.xy; - bvec2 _270 = equal(gl_GlobalInvocationID.xy, uvec2(0u)); - uint _470; - if (_270.x) + uvec2 _264 = uvec2(64u, 1u) * gl_NumWorkGroups.xy; + uvec2 _269 = _264 - gl_GlobalInvocationID.xy; + bvec2 _271 = equal(gl_GlobalInvocationID.xy, uvec2(0u)); + uint _475; + if (_271.x) { - _470 = 0u; + _475 = 0u; } else { - _470 = _268.x; + _475 = _269.x; } - uint _471; - if (_270.y) + uint _476; + if (_271.y) { - _471 = 0u; + _476 = 0u; } else { - _471 = _268.y; + _476 = _269.y; } - vec2 _296 = vec2(gl_GlobalInvocationID.xy); - vec2 _298 = vec2(_263); - float _308 = sqrt(9.81000041961669921875 * length(_165.uModTime.xy * mix(_296, _296 - _298, greaterThan(_296, _298 * 0.5)))) * _165.uModTime.z; - float _310 = cos(_308); - float _312 = sin(_308); - vec2 _315 = vec2(_310, _312); - vec2 _394 = _315.yy * (_136.distribution[(gl_GlobalInvocationID.xy.y * _263.x) + gl_GlobalInvocationID.xy.x]).yx; - vec2 _320 = vec2(_310, _312); - vec2 _420 = _320.yy * (_136.distribution[(_471 * _263.x) + _470]).yx; - vec2 _428 = ((_136.distribution[(_471 * _263.x) + _470]) * _320.xx) + vec2(-_420.x, _420.y); - _224.heights[(gl_GlobalInvocationID.xy.y * _263.x) + gl_GlobalInvocationID.xy.x] = packHalf2x16((((_136.distribution[(gl_GlobalInvocationID.xy.y * _263.x) + gl_GlobalInvocationID.xy.x]) * _315.xx) + vec2(-_394.x, _394.y)) + vec2(_428.x, -_428.y)); + uint _448 = _264.x; + uint _280 = (gl_GlobalInvocationID.y * _448) + gl_GlobalInvocationID.x; + vec2 _297 = vec2(gl_GlobalInvocationID.xy); + vec2 _299 = vec2(_264); + float _309 = sqrt(9.81000041961669921875 * length(_166.uModTime.xy * mix(_297, _297 - _299, greaterThan(_297, _299 * 0.5)))) * _166.uModTime.z; + vec2 _316 = vec2(cos(_309), sin(_309)); + vec2 _387 = _316.xx; + vec2 _392 = _316.yy; + vec2 _395 = _392 * _137.distribution[_280].yx; + vec2 _421 = _392 * (_137.distribution[(_476 * _448) + _475]).yx; + vec2 _429 = ((_137.distribution[(_476 * _448) + _475]) * _387) + vec2(-_421.x, _421.y); + _225.heights[_280] = packHalf2x16(((_137.distribution[_280] * _387) + vec2(-_395.x, _395.y)) + vec2(_429.x, -_429.y)); } diff --git a/reference/opt/shaders/comp/image.comp b/reference/opt/shaders/comp/image.comp index 8bd7dd06..cdb57142 100644 --- a/reference/opt/shaders/comp/image.comp +++ b/reference/opt/shaders/comp/image.comp @@ -6,6 +6,7 @@ layout(binding = 1, rgba8) uniform writeonly mediump image2D uImageOut; void main() { - imageStore(uImageOut, ivec2(gl_GlobalInvocationID.xy), imageLoad(uImageIn, ivec2(gl_GlobalInvocationID.xy) + imageSize(uImageIn))); + ivec2 _23 = ivec2(gl_GlobalInvocationID.xy); + imageStore(uImageOut, _23, imageLoad(uImageIn, _23 + imageSize(uImageIn))); } diff --git a/reference/opt/shaders/comp/return.comp b/reference/opt/shaders/comp/return.comp deleted file mode 100644 index ea41907a..00000000 --- a/reference/opt/shaders/comp/return.comp +++ /dev/null @@ -1,31 +0,0 @@ -#version 310 es -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; - -layout(binding = 1, std430) writeonly buffer SSBO2 -{ - vec4 out_data[]; -} _27; - -int _69; - -void main() -{ - if (gl_GlobalInvocationID.x == 2u) - { - _27.out_data[gl_GlobalInvocationID.x] = vec4(20.0); - } - else - { - if (gl_GlobalInvocationID.x == 4u) - { - _27.out_data[gl_GlobalInvocationID.x] = vec4(10.0); - return; - } - } - for (int _68 = 0; _68 < 20; _68 = _69 + 1) - { - return; - } - _27.out_data[gl_GlobalInvocationID.x] = vec4(10.0); -} - diff --git a/reference/shaders/comp/return.comp b/reference/opt/shaders/comp/return.noopt.comp similarity index 100% rename from reference/shaders/comp/return.comp rename to reference/opt/shaders/comp/return.noopt.comp diff --git a/reference/opt/shaders/comp/rmw-opt.comp b/reference/opt/shaders/comp/rmw-opt.comp index 7d4d24b2..342e6632 100644 --- a/reference/opt/shaders/comp/rmw-opt.comp +++ b/reference/opt/shaders/comp/rmw-opt.comp @@ -18,7 +18,6 @@ void main() _9.a ^= 10; _9.a %= 40; _9.a |= 1; - bool _65 = false && true; - _9.a = int(_65 && (true || _65)); + _9.a = 0; } diff --git a/reference/opt/shaders/comp/shared.comp b/reference/opt/shaders/comp/shared.comp index 66ec1c2c..f95cb2b8 100644 --- a/reference/opt/shaders/comp/shared.comp +++ b/reference/opt/shaders/comp/shared.comp @@ -18,6 +18,6 @@ void main() sShared[gl_LocalInvocationIndex] = _22.in_data[gl_GlobalInvocationID.x]; memoryBarrierShared(); barrier(); - _44.out_data[gl_GlobalInvocationID.x] = sShared[(4u - gl_LocalInvocationIndex) - 1u]; + _44.out_data[gl_GlobalInvocationID.x] = sShared[3u - gl_LocalInvocationIndex]; } diff --git a/reference/opt/shaders/comp/struct-packing.comp b/reference/opt/shaders/comp/struct-packing.comp index d8ece843..ecd7932b 100644 --- a/reference/opt/shaders/comp/struct-packing.comp +++ b/reference/opt/shaders/comp/struct-packing.comp @@ -49,40 +49,17 @@ struct S0_1 float b; }; -struct S1_1 -{ - vec3 a; - float b; -}; - -struct S2_1 -{ - vec3 a[1]; - float b; -}; - -struct S3_1 -{ - vec2 a; - float b; -}; - -struct S4_1 -{ - vec2 c; -}; - struct Content_1 { S0_1 m0s[1]; - S1_1 m1s[1]; - S2_1 m2s[1]; + S1 m1s[1]; + S2 m2s[1]; S0_1 m0; - S1_1 m1; - S2_1 m2; - S3_1 m3; + S1 m1; + S2 m2; + S3 m3; float m4; - S4_1 m3s[8]; + S4 m3s[8]; }; layout(binding = 1, std430) buffer SSBO1 diff --git a/reference/opt/shaders/comp/torture-loop.comp b/reference/opt/shaders/comp/torture-loop.comp index 640142b3..245e84d3 100644 --- a/reference/opt/shaders/comp/torture-loop.comp +++ b/reference/opt/shaders/comp/torture-loop.comp @@ -12,65 +12,28 @@ layout(binding = 1, std430) writeonly buffer SSBO2 vec4 out_data[]; } _89; -uint _98; - void main() { vec4 _93; - int _94; _93 = _24.in_data[gl_GlobalInvocationID.x]; - _94 = 0; - int _40; - vec4 _46; - int _48; - for (;;) + for (int _94 = 0; (_94 + 1) < 10; ) { - _40 = _94 + 1; - if (_40 < 10) - { - _46 = _93 * 2.0; - _48 = _40 + 1; - _93 = _46; - _94 = _48; - continue; - } - else - { - break; - } + _93 *= 2.0; + _94 += 2; + continue; } vec4 _95; - int _96; _95 = _93; - _96 = _40; vec4 _100; - uint _101; - uint _99; - for (uint _97 = 0u; _97 < 16u; _95 = _100, _96++, _97++, _99 = _101) + for (uint _97 = 0u; _97 < 16u; _95 = _100, _97++) { _100 = _95; - _101 = 0u; - vec4 _71; - for (; _101 < 30u; _100 = _71, _101++) + for (uint _101 = 0u; _101 < 30u; ) { - _71 = _24.mvp * _100; - } - } - int _102; - _102 = _96; - int _83; - for (;;) - { - _83 = _102 + 1; - if (_83 > 10) - { - _102 = _83; + _100 = _24.mvp * _100; + _101++; continue; } - else - { - break; - } } _89.out_data[gl_GlobalInvocationID.x] = _95; } diff --git a/reference/opt/shaders/comp/type-alias.comp b/reference/opt/shaders/comp/type-alias.comp index c0f57f4b..a6e13156 100644 --- a/reference/opt/shaders/comp/type-alias.comp +++ b/reference/opt/shaders/comp/type-alias.comp @@ -6,19 +6,14 @@ struct S0 vec4 a; }; -struct S1 -{ - vec4 a; -}; - layout(binding = 0, std430) buffer SSBO0 { S0 s0s[]; } _36; -layout(binding = 1, std430) buffer SSBO1 +layout(binding = 1, std430) buffer _34_55 { - S1 s1s[]; + S0 s0s[]; } _55; layout(binding = 2, std430) buffer SSBO2 @@ -28,6 +23,6 @@ layout(binding = 2, std430) buffer SSBO2 void main() { - _66.outputs[gl_GlobalInvocationID.x] = _36.s0s[gl_GlobalInvocationID.x].a + _55.s1s[gl_GlobalInvocationID.x].a; + _66.outputs[gl_GlobalInvocationID.x] = _36.s0s[gl_GlobalInvocationID.x].a + _55.s0s[gl_GlobalInvocationID.x].a; } diff --git a/reference/opt/shaders/comp/udiv.comp b/reference/opt/shaders/comp/udiv.comp index 0c1f926a..80d1c7f5 100644 --- a/reference/opt/shaders/comp/udiv.comp +++ b/reference/opt/shaders/comp/udiv.comp @@ -6,13 +6,13 @@ layout(binding = 0, std430) buffer SSBO2 uint outputs[]; } _10; -layout(binding = 0, std430) buffer SSBO +layout(binding = 0, std430) buffer _8_23 { - uint inputs[]; + uint outputs[]; } _23; void main() { - _10.outputs[gl_GlobalInvocationID.x] = _23.inputs[gl_GlobalInvocationID.x] / 29u; + _10.outputs[gl_GlobalInvocationID.x] = _23.outputs[gl_GlobalInvocationID.x] / 29u; } diff --git a/reference/opt/shaders/desktop-only/comp/enhanced-layouts.comp b/reference/opt/shaders/desktop-only/comp/enhanced-layouts.comp index 45b25064..ba37ca23 100644 --- a/reference/opt/shaders/desktop-only/comp/enhanced-layouts.comp +++ b/reference/opt/shaders/desktop-only/comp/enhanced-layouts.comp @@ -8,13 +8,6 @@ struct Foo int c; }; -struct Foo_1 -{ - int a; - int b; - int c; -}; - layout(binding = 1, std140) buffer SSBO1 { layout(offset = 4) int a; @@ -27,7 +20,7 @@ layout(binding = 2, std430) buffer SSBO2 { layout(offset = 4) int a; layout(offset = 8) int b; - layout(offset = 16) Foo_1 foo; + layout(offset = 16) Foo foo; layout(offset = 48) int c[8]; } ssbo2; diff --git a/reference/opt/shaders/desktop-only/frag/fp16.desktop.frag b/reference/opt/shaders/desktop-only/frag/fp16.desktop.frag index a6ff2b2b..1761424e 100644 --- a/reference/opt/shaders/desktop-only/frag/fp16.desktop.frag +++ b/reference/opt/shaders/desktop-only/frag/fp16.desktop.frag @@ -1,12 +1,6 @@ #version 450 #extension GL_AMD_gpu_shader_half_float : require -struct ResType -{ - f16vec4 _m0; - ivec4 _m1; -}; - layout(location = 3) in f16vec4 v4; void main() diff --git a/reference/opt/shaders/desktop-only/frag/image-query.desktop.frag b/reference/opt/shaders/desktop-only/frag/image-query.desktop.frag index fa1ac0ab..3eaaa8a4 100644 --- a/reference/opt/shaders/desktop-only/frag/image-query.desktop.frag +++ b/reference/opt/shaders/desktop-only/frag/image-query.desktop.frag @@ -9,6 +9,15 @@ layout(binding = 5) uniform samplerCubeArray uSamplerCubeArray; layout(binding = 6) uniform samplerBuffer uSamplerBuffer; layout(binding = 7) uniform sampler2DMS uSamplerMS; layout(binding = 8) uniform sampler2DMSArray uSamplerMSArray; +layout(binding = 9, r32f) uniform readonly writeonly image1D uImage1D; +layout(binding = 10, r32f) uniform readonly writeonly image2D uImage2D; +layout(binding = 11, r32f) uniform readonly writeonly image2DArray uImage2DArray; +layout(binding = 12, r32f) uniform readonly writeonly image3D uImage3D; +layout(binding = 13, r32f) uniform readonly writeonly imageCube uImageCube; +layout(binding = 14, r32f) uniform readonly writeonly imageCubeArray uImageCubeArray; +layout(binding = 15, r32f) uniform readonly writeonly imageBuffer uImageBuffer; +layout(binding = 16, r32f) uniform readonly writeonly image2DMS uImageMS; +layout(binding = 17, r32f) uniform readonly writeonly image2DMSArray uImageMSArray; void main() { diff --git a/reference/opt/shaders/desktop-only/geom/basic.desktop.sso.geom b/reference/opt/shaders/desktop-only/geom/basic.desktop.sso.geom index f1afee69..8e51cfa3 100644 --- a/reference/opt/shaders/desktop-only/geom/basic.desktop.sso.geom +++ b/reference/opt/shaders/desktop-only/geom/basic.desktop.sso.geom @@ -22,13 +22,14 @@ layout(location = 0) in VertexData void main() { gl_Position = gl_in[0].gl_Position; - vNormal = vin[0].normal + vec3(float(gl_InvocationID)); + float _37 = float(gl_InvocationID); + vNormal = vin[0].normal + vec3(_37); EmitVertex(); gl_Position = gl_in[1].gl_Position; - vNormal = vin[1].normal + vec3(4.0 * float(gl_InvocationID)); + vNormal = vin[1].normal + vec3(4.0 * _37); EmitVertex(); gl_Position = gl_in[2].gl_Position; - vNormal = vin[2].normal + vec3(2.0 * float(gl_InvocationID)); + vNormal = vin[2].normal + vec3(2.0 * _37); EmitVertex(); EndPrimitive(); } diff --git a/reference/opt/shaders/flatten/copy.flatten.vert b/reference/opt/shaders/flatten/copy.flatten.vert index 59f0dc1b..27ce450d 100644 --- a/reference/opt/shaders/flatten/copy.flatten.vert +++ b/reference/opt/shaders/flatten/copy.flatten.vert @@ -16,10 +16,12 @@ void main() { gl_Position = mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex; vColor = vec4(0.0); - for (int _103 = 0; _103 < 4; _103++) + for (int _96 = 0; _96 < 4; ) { - 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))); + vec3 _68 = aVertex.xyz - Light(UBO[_96 * 2 + 4].xyz, UBO[_96 * 2 + 4].w, UBO[_96 * 2 + 5]).Position; + vColor += (((UBO[_96 * 2 + 5]) * clamp(1.0 - (length(_68) / Light(UBO[_96 * 2 + 4].xyz, UBO[_96 * 2 + 4].w, UBO[_96 * 2 + 5]).Radius), 0.0, 1.0)) * dot(aNormal, normalize(_68))); + _96++; + continue; } } diff --git a/reference/opt/shaders/flatten/dynamic.flatten.vert b/reference/opt/shaders/flatten/dynamic.flatten.vert index c08f7445..8fc8ff6e 100644 --- a/reference/opt/shaders/flatten/dynamic.flatten.vert +++ b/reference/opt/shaders/flatten/dynamic.flatten.vert @@ -16,10 +16,12 @@ void main() { gl_Position = mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex; vColor = vec4(0.0); - for (int _82 = 0; _82 < 4; _82++) + for (int _82 = 0; _82 < 4; ) { 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))); + _82++; + continue; } } diff --git a/reference/opt/shaders/flatten/multi-dimensional.desktop.flatten_dim.frag b/reference/opt/shaders/flatten/multi-dimensional.desktop.flatten_dim.frag index 6ccede21..ca8ab845 100644 --- a/reference/opt/shaders/flatten/multi-dimensional.desktop.flatten_dim.frag +++ b/reference/opt/shaders/flatten/multi-dimensional.desktop.flatten_dim.frag @@ -6,26 +6,22 @@ layout(location = 1) in vec2 vUV; layout(location = 0) out vec4 FragColor; layout(location = 0) flat in int vIndex; -int _93; - void main() { + int _92; + _92 = 0; vec4 values3[2 * 3 * 1]; - int _96; - int _97; - int _94; - int _95; - for (int _92 = 0; _92 < 2; _92++, _94 = _96, _95 = _97) + for (; _92 < 2; _92++) { + int _96; _96 = 0; - _97 = _95; - int _98; - for (; _96 < 3; _96++, _97 = _98) + for (; _96 < 3; _96++) { - _98 = 0; - for (; _98 < 1; _98++) + for (int _98 = 0; _98 < 1; ) { values3[_92 * 3 * 1 + _96 * 1 + _98] = texture(uTextures[_92 * 3 * 1 + _96 * 1 + _98], vUV); + _98++; + continue; } } } diff --git a/reference/opt/shaders/frag/array-lut-no-loop-variable.frag b/reference/opt/shaders/frag/array-lut-no-loop-variable.frag index a125bd6c..7bdfe543 100644 --- a/reference/opt/shaders/frag/array-lut-no-loop-variable.frag +++ b/reference/opt/shaders/frag/array-lut-no-loop-variable.frag @@ -7,9 +7,12 @@ layout(location = 0) out vec4 FragColor; void main() { float lut[5] = float[](1.0, 2.0, 3.0, 4.0, 5.0); - mediump int _33; - for (int _46 = 0; _46 < 4; _33 = _46 + 1, FragColor += vec4(lut[_33]), _46 = _33) + for (int _46 = 0; _46 < 4; ) { + mediump int _33 = _46 + 1; + FragColor += vec4(lut[_33]); + _46 = _33; + continue; } } diff --git a/reference/opt/shaders/frag/constant-array.frag b/reference/opt/shaders/frag/constant-array.frag index a6ffda07..2af87ad8 100644 --- a/reference/opt/shaders/frag/constant-array.frag +++ b/reference/opt/shaders/frag/constant-array.frag @@ -16,6 +16,6 @@ void main() 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 indexable_2[2] = Foobar[](Foobar(10.0, 40.0), Foobar(90.0, 70.0)); - FragColor = ((indexable[index] + (indexable_1[index][index + 1])) + vec4(10.0 + 20.0)) + vec4(indexable_2[index].a + indexable_2[index].b); + FragColor = ((indexable[index] + (indexable_1[index][index + 1])) + vec4(30.0)) + vec4(indexable_2[index].a + indexable_2[index].b); } diff --git a/reference/opt/shaders/frag/eliminate-dead-variables.frag b/reference/opt/shaders/frag/eliminate-dead-variables.frag deleted file mode 100644 index c97ae20f..00000000 --- a/reference/opt/shaders/frag/eliminate-dead-variables.frag +++ /dev/null @@ -1,14 +0,0 @@ -#version 310 es -precision mediump float; -precision highp int; - -layout(binding = 0) uniform mediump sampler2D uSampler; - -layout(location = 0) out vec4 FragColor; -layout(location = 0) in vec2 vTexCoord; - -void main() -{ - FragColor = texture(uSampler, vTexCoord); -} - diff --git a/reference/opt/shaders/frag/false-loop-init.frag b/reference/opt/shaders/frag/false-loop-init.frag index 1db46c1b..2d5902a3 100644 --- a/reference/opt/shaders/frag/false-loop-init.frag +++ b/reference/opt/shaders/frag/false-loop-init.frag @@ -5,24 +5,14 @@ precision highp int; layout(location = 0) out vec4 result; layout(location = 0) in vec4 accum; -uint _49; - void main() { result = vec4(0.0); - uint _51; - uint _50; - for (int _48 = 0; _48 < 4; _48 += int(_51), _50 = _51) + for (int _48 = 0; _48 < 4; ) { - if (accum.y > 10.0) - { - _51 = 40u; - } - else - { - _51 = 30u; - } result += accum; + _48 += int((accum.y > 10.0) ? 40u : 30u); + continue; } } diff --git a/reference/opt/shaders/frag/flush_params.frag b/reference/opt/shaders/frag/flush_params.frag index 5f386dff..16b49941 100644 --- a/reference/opt/shaders/frag/flush_params.frag +++ b/reference/opt/shaders/frag/flush_params.frag @@ -2,11 +2,6 @@ precision mediump float; precision highp int; -struct Structy -{ - vec4 c; -}; - layout(location = 0) out vec4 FragColor; void main() diff --git a/reference/opt/shaders/frag/for-loop-init.frag b/reference/opt/shaders/frag/for-loop-init.frag index 626d7c8d..f9701cc8 100644 --- a/reference/opt/shaders/frag/for-loop-init.frag +++ b/reference/opt/shaders/frag/for-loop-init.frag @@ -7,44 +7,54 @@ layout(location = 0) out mediump int FragColor; void main() { FragColor = 16; - for (int _140 = 0; _140 < 25; _140++) + for (int _140 = 0; _140 < 25; ) { FragColor += 10; + _140++; + continue; } - for (int _141 = 1; _141 < 30; _141++) + for (int _141 = 1; _141 < 30; ) { FragColor += 11; + _141++; + continue; } int _142; _142 = 0; - for (; _142 < 20; _142++) + for (; _142 < 20; ) { FragColor += 12; + _142++; + continue; } mediump int _62 = _142 + 3; FragColor += _62; if (_62 == 40) { - for (int _143 = 0; _143 < 40; _143++) + for (int _143 = 0; _143 < 40; ) { FragColor += 13; + _143++; + continue; } return; } - else - { - FragColor += _62; - } + FragColor += _62; ivec2 _144; _144 = ivec2(0); - ivec2 _139; - for (; _144.x < 10; _139 = _144, _139.x = _144.x + 4, _144 = _139) + for (; _144.x < 10; ) { FragColor += _144.y; + ivec2 _139 = _144; + _139.x = _144.x + 4; + _144 = _139; + continue; } - for (int _145 = _62; _145 < 40; _145++) + for (int _145 = _62; _145 < 40; ) { FragColor += _145; + _145++; + continue; } FragColor += _62; } diff --git a/reference/opt/shaders/frag/ground.frag b/reference/opt/shaders/frag/ground.frag index aaca58c1..f59a402f 100644 --- a/reference/opt/shaders/frag/ground.frag +++ b/reference/opt/shaders/frag/ground.frag @@ -24,7 +24,7 @@ layout(location = 1) in vec3 EyeVec; void main() { vec3 _68 = normalize((texture(TexNormalmap, TexCoord).xyz * 2.0) - vec3(1.0)); - float _113 = smoothstep(0.0, 0.1500000059604644775390625, (_101.g_CamPos.y + EyeVec.y) / 200.0); + float _113 = smoothstep(0.0, 0.1500000059604644775390625, (_101.g_CamPos.y + EyeVec.y) * 0.004999999888241291046142578125); float _125 = smoothstep(0.699999988079071044921875, 0.75, _68.y); vec3 _130 = mix(vec3(0.100000001490116119384765625), mix(vec3(0.100000001490116119384765625, 0.300000011920928955078125, 0.100000001490116119384765625), vec3(0.800000011920928955078125), vec3(_113)), vec3(_125)); LightingOut = vec4(0.0); diff --git a/reference/opt/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag b/reference/opt/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag index 1d8e0235..c6550dce 100644 --- a/reference/opt/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag +++ b/reference/opt/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag @@ -9,29 +9,20 @@ layout(location = 1) flat in mediump int vB; void main() { FragColor = vec4(0.0); - mediump int _49; int _60; - for (int _57 = 0, _58 = 0; _58 < vA; _57 = _60, _58 += _49) + for (int _57 = 0, _58 = 0; _58 < vA; FragColor += vec4(1.0), _57 = _60, _58 += (_60 + 10)) { if ((vA + _58) == 20) { _60 = 50; + continue; } else { - int _59; - if ((vB + _58) == 40) - { - _59 = 60; - } - else - { - _59 = _57; - } - _60 = _59; + _60 = ((vB + _58) == 40) ? 60 : _57; + continue; } - _49 = _60 + 10; - FragColor += vec4(1.0); + continue; } } diff --git a/reference/opt/shaders/frag/mix.frag b/reference/opt/shaders/frag/mix.frag index f1494e07..f791d45c 100644 --- a/reference/opt/shaders/frag/mix.frag +++ b/reference/opt/shaders/frag/mix.frag @@ -10,9 +10,9 @@ layout(location = 3) in float vIn3; void main() { - FragColor = mix(vIn0, vIn1, bvec4(false, true, false, false)); - FragColor = vec4(true ? vIn3 : vIn2); - FragColor = mix(vIn1, vIn0, bvec4(true)); - FragColor = vec4(true ? vIn2 : vIn3); + FragColor = vec4(vIn0.x, vIn1.y, vIn0.z, vIn0.w); + FragColor = vec4(vIn3); + FragColor = vIn0.xyzw; + FragColor = vec4(vIn2); } diff --git a/reference/opt/shaders/frag/partial-write-preserve.frag b/reference/opt/shaders/frag/partial-write-preserve.frag index 527b661b..d6c1fe8b 100644 --- a/reference/opt/shaders/frag/partial-write-preserve.frag +++ b/reference/opt/shaders/frag/partial-write-preserve.frag @@ -2,12 +2,6 @@ precision mediump float; precision highp int; -struct B -{ - float a; - float b; -}; - void main() { } diff --git a/reference/opt/shaders/frag/sampler-ms-query.frag b/reference/opt/shaders/frag/sampler-ms-query.frag deleted file mode 100644 index 4c30ed15..00000000 --- a/reference/opt/shaders/frag/sampler-ms-query.frag +++ /dev/null @@ -1,14 +0,0 @@ -#version 450 - -layout(binding = 0) uniform sampler2DMS uSampler; -layout(binding = 1) uniform sampler2DMSArray uSamplerArray; -layout(binding = 2, rgba8) uniform readonly writeonly image2DMS uImage; -layout(binding = 3, rgba8) uniform readonly writeonly image2DMSArray uImageArray; - -layout(location = 0) out vec4 FragColor; - -void main() -{ - FragColor = vec4(float(((textureSamples(uSampler) + textureSamples(uSamplerArray)) + imageSamples(uImage)) + imageSamples(uImageArray))); -} - diff --git a/reference/opt/shaders/frag/swizzle.frag b/reference/opt/shaders/frag/swizzle.frag index e619be2f..a229e5b0 100644 --- a/reference/opt/shaders/frag/swizzle.frag +++ b/reference/opt/shaders/frag/swizzle.frag @@ -2,7 +2,7 @@ precision mediump float; precision highp int; -layout(location = 0) uniform mediump sampler2D samp; +layout(binding = 0) uniform mediump sampler2D samp; layout(location = 0) out vec4 FragColor; layout(location = 2) in vec2 vUV; diff --git a/reference/opt/shaders/frag/temporary.frag b/reference/opt/shaders/frag/temporary.frag deleted file mode 100644 index ec9d3e49..00000000 --- a/reference/opt/shaders/frag/temporary.frag +++ /dev/null @@ -1,14 +0,0 @@ -#version 310 es -precision mediump float; -precision highp int; - -uniform mediump sampler2D uTex; - -layout(location = 0) in vec2 vTex; -layout(location = 0) out vec4 FragColor; - -void main() -{ - FragColor = vec4(vTex.xxy, 1.0) + vec4(texture(uTex, vTex).xyz, 1.0); -} - diff --git a/reference/opt/shaders/frag/unary-enclose.frag b/reference/opt/shaders/frag/unary-enclose.frag index 118787bd..e7b0bf53 100644 --- a/reference/opt/shaders/frag/unary-enclose.frag +++ b/reference/opt/shaders/frag/unary-enclose.frag @@ -7,6 +7,6 @@ layout(location = 0) in vec4 vIn; void main() { - FragColor = -(-vIn); + FragColor = vIn; } diff --git a/reference/opt/shaders/geom/basic.geom b/reference/opt/shaders/geom/basic.geom index 296ce579..f91136f6 100644 --- a/reference/opt/shaders/geom/basic.geom +++ b/reference/opt/shaders/geom/basic.geom @@ -13,13 +13,14 @@ layout(location = 0) in VertexData void main() { gl_Position = gl_in[0].gl_Position; - vNormal = vin[0].normal + vec3(float(gl_InvocationID)); + float _37 = float(gl_InvocationID); + vNormal = vin[0].normal + vec3(_37); EmitVertex(); gl_Position = gl_in[1].gl_Position; - vNormal = vin[1].normal + vec3(4.0 * float(gl_InvocationID)); + vNormal = vin[1].normal + vec3(4.0 * _37); EmitVertex(); gl_Position = gl_in[2].gl_Position; - vNormal = vin[2].normal + vec3(2.0 * float(gl_InvocationID)); + vNormal = vin[2].normal + vec3(2.0 * _37); EmitVertex(); EndPrimitive(); } diff --git a/reference/opt/shaders/legacy/vert/struct-varying.legacy.vert b/reference/opt/shaders/legacy/vert/struct-varying.legacy.vert index 8520e2d5..01a3d735 100644 --- a/reference/opt/shaders/legacy/vert/struct-varying.legacy.vert +++ b/reference/opt/shaders/legacy/vert/struct-varying.legacy.vert @@ -21,9 +21,8 @@ void main() vout_a = vout.a; vout_b = vout.b; } - Output _22 = Output(vout_a, vout_b); - vout_a = _22.a; - vout_b = _22.b; + vout_a = Output(vout_a, vout_b).a; + vout_b = Output(vout_a, vout_b).b; vout_a.x = 1.0; vout_b.y = 1.0; } diff --git a/reference/opt/shaders/tesc/water_tess.tesc b/reference/opt/shaders/tesc/water_tess.tesc index 0320fff2..69307d3c 100644 --- a/reference/opt/shaders/tesc/water_tess.tesc +++ b/reference/opt/shaders/tesc/water_tess.tesc @@ -22,13 +22,13 @@ void main() 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); - 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))); + vec4 _466 = vec4((_445 + _450) * 0.5, 1.0); + vec3 _513 = vec3(length(_450 - _445) * (-0.5)); + bool _515 = any(lessThanEqual(vec3(dot(_41.uFrustum[0], _466), dot(_41.uFrustum[1], _466), dot(_41.uFrustum[2], _466)), _513)); bool _525; if (!_515) { - _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))); + _525 = any(lessThanEqual(vec3(dot(_41.uFrustum[3], _466), dot(_41.uFrustum[4], _466), dot(_41.uFrustum[5], _466)), _513)); } else { diff --git a/reference/opt/shaders/tese/water_tess.tese b/reference/opt/shaders/tese/water_tess.tese index 6efa9f0a..a2aa1044 100644 --- a/reference/opt/shaders/tese/water_tess.tese +++ b/reference/opt/shaders/tese/water_tess.tese @@ -22,14 +22,13 @@ layout(location = 0) out vec3 vWorld; void main() { vec2 _201 = vOutPatchPosBase + (gl_TessCoord.xy * _31.uPatchSize); - vec2 _214 = mix(vPatchLods.yx, vPatchLods.zw, vec2(gl_TessCoord.xy.x)); - float _221 = mix(_214.x, _214.y, gl_TessCoord.xy.y); + vec2 _214 = mix(vPatchLods.yx, vPatchLods.zw, vec2(gl_TessCoord.x)); + float _221 = mix(_214.x, _214.y, gl_TessCoord.y); mediump float _223 = floor(_221); - mediump float _226 = _221 - _223; vec2 _125 = _201 * _31.uInvHeightmapSize; vec2 _141 = _31.uInvHeightmapSize * exp2(_223); vGradNormalTex = vec4(_125 + (_31.uInvHeightmapSize * 0.5), _125 * _31.uScale.zw); - mediump vec3 _253 = mix(textureLod(uHeightmapDisplacement, _125 + (_141 * 0.5), _223).xyz, textureLod(uHeightmapDisplacement, _125 + (_141 * 1.0), _223 + 1.0).xyz, vec3(_226)); + mediump vec3 _253 = mix(textureLod(uHeightmapDisplacement, _125 + (_141 * 0.5), _223).xyz, textureLod(uHeightmapDisplacement, _125 + (_141 * 1.0), _223 + 1.0).xyz, vec3(_221 - _223)); vec2 _171 = (_201 * _31.uScale.xy) + _253.yz; vWorld = vec3(_171.x, _253.x, _171.y); gl_Position = _31.uMVP * vec4(vWorld, 1.0); diff --git a/reference/opt/shaders/vert/ocean.vert b/reference/opt/shaders/vert/ocean.vert index d37a0a8a..53b69de2 100644 --- a/reference/opt/shaders/vert/ocean.vert +++ b/reference/opt/shaders/vert/ocean.vert @@ -59,8 +59,9 @@ void main() uint _357 = uint(_352); uvec4 _359 = uvec4(Position); uvec2 _366 = (uvec2(1u) << uvec2(_357, _357 + 1u)) - uvec2(1u); + bool _369 = _359.x < 32u; uint _482; - if (_359.x < 32u) + if (_369) { _482 = _366.x; } @@ -70,8 +71,9 @@ void main() } uvec4 _445 = _483; _445.x = _482; + bool _379 = _359.y < 32u; uint _484; - if (_359.y < 32u) + if (_379) { _484 = _366.x; } @@ -82,7 +84,7 @@ void main() uvec4 _451 = _445; _451.y = _484; uint _485; - if (_359.x < 32u) + if (_369) { _485 = _366.y; } @@ -93,7 +95,7 @@ void main() uvec4 _457 = _451; _457.z = _485; uint _486; - if (_359.y < 32u) + if (_379) { _486 = _366.y; } diff --git a/reference/opt/shaders/vulkan/frag/separate-sampler-texture.vk.frag b/reference/opt/shaders/vulkan/frag/separate-sampler-texture.vk.frag index a52d5bc7..aad1e436 100644 --- a/reference/opt/shaders/vulkan/frag/separate-sampler-texture.vk.frag +++ b/reference/opt/shaders/vulkan/frag/separate-sampler-texture.vk.frag @@ -13,8 +13,7 @@ layout(location = 0) out vec4 FragColor; void main() { - vec2 _54 = vec2(1.0) / vec2(textureSize(SPIRV_Cross_CombineduTextureuSampler, 0)); - vec2 _64 = vec2(1.0) / vec2(textureSize(SPIRV_Cross_CombineduTextureuSampler, 1)); - FragColor = (((texture(SPIRV_Cross_CombineduTextureuSampler, (vTex + _54) + _64) + texture(SPIRV_Cross_CombineduTextureuSampler, (vTex + _54) + _64)) + texture(SPIRV_Cross_CombineduTextureArrayuSampler, vTex3)) + texture(SPIRV_Cross_CombineduTextureCubeuSampler, vTex3)) + texture(SPIRV_Cross_CombineduTexture3DuSampler, vTex3); + vec2 _73 = (vTex + (vec2(1.0) / vec2(textureSize(SPIRV_Cross_CombineduTextureuSampler, 0)))) + (vec2(1.0) / vec2(textureSize(SPIRV_Cross_CombineduTextureuSampler, 1))); + FragColor = (((texture(SPIRV_Cross_CombineduTextureuSampler, _73) + texture(SPIRV_Cross_CombineduTextureuSampler, _73)) + texture(SPIRV_Cross_CombineduTextureArrayuSampler, vTex3)) + texture(SPIRV_Cross_CombineduTextureCubeuSampler, vTex3)) + texture(SPIRV_Cross_CombineduTexture3DuSampler, vTex3); } diff --git a/reference/opt/shaders/vulkan/frag/separate-sampler-texture.vk.frag.vk b/reference/opt/shaders/vulkan/frag/separate-sampler-texture.vk.frag.vk index 105ca76e..b79374ab 100644 --- a/reference/opt/shaders/vulkan/frag/separate-sampler-texture.vk.frag.vk +++ b/reference/opt/shaders/vulkan/frag/separate-sampler-texture.vk.frag.vk @@ -14,8 +14,7 @@ layout(location = 0) out vec4 FragColor; void main() { - vec2 _54 = vec2(1.0) / vec2(textureSize(sampler2D(uTexture, uSampler), 0)); - vec2 _64 = vec2(1.0) / vec2(textureSize(sampler2D(uTexture, uSampler), 1)); - FragColor = (((texture(sampler2D(uTexture, uSampler), (vTex + _54) + _64) + texture(sampler2D(uTexture, uSampler), (vTex + _54) + _64)) + texture(sampler2DArray(uTextureArray, uSampler), vTex3)) + texture(samplerCube(uTextureCube, uSampler), vTex3)) + texture(sampler3D(uTexture3D, uSampler), vTex3); + vec2 _73 = (vTex + (vec2(1.0) / vec2(textureSize(sampler2D(uTexture, uSampler), 0)))) + (vec2(1.0) / vec2(textureSize(sampler2D(uTexture, uSampler), 1))); + FragColor = (((texture(sampler2D(uTexture, uSampler), _73) + texture(sampler2D(uTexture, uSampler), _73)) + texture(sampler2DArray(uTextureArray, uSampler), vTex3)) + texture(samplerCube(uTextureCube, uSampler), vTex3)) + texture(sampler3D(uTexture3D, uSampler), vTex3); } diff --git a/reference/shaders/vulkan/frag/spec-constant.vk.frag b/reference/opt/shaders/vulkan/frag/spec-constant.noopt.vk.frag similarity index 100% rename from reference/shaders/vulkan/frag/spec-constant.vk.frag rename to reference/opt/shaders/vulkan/frag/spec-constant.noopt.vk.frag diff --git a/reference/shaders/vulkan/frag/spec-constant.vk.frag.vk b/reference/opt/shaders/vulkan/frag/spec-constant.noopt.vk.frag.vk similarity index 100% rename from reference/shaders/vulkan/frag/spec-constant.vk.frag.vk rename to reference/opt/shaders/vulkan/frag/spec-constant.noopt.vk.frag.vk diff --git a/reference/opt/shaders/vulkan/frag/spec-constant.vk.frag b/reference/opt/shaders/vulkan/frag/spec-constant.vk.frag deleted file mode 100644 index 4f9b6f51..00000000 --- a/reference/opt/shaders/vulkan/frag/spec-constant.vk.frag +++ /dev/null @@ -1,20 +0,0 @@ -#version 310 es -precision mediump float; -precision highp int; - -struct Foo -{ - float elems[(4 + 2)]; -}; - -layout(location = 0) out vec4 FragColor; - -float _146[(3 + 2)]; - -void main() -{ - float vec0[(3 + 3)][8]; - Foo foo; - FragColor = ((vec4(1.0 + 2.0) + vec4(vec0[0][0])) + vec4(_146[0])) + vec4(foo.elems[3]); -} - diff --git a/reference/opt/shaders/vulkan/frag/spec-constant.vk.frag.vk b/reference/opt/shaders/vulkan/frag/spec-constant.vk.frag.vk deleted file mode 100644 index 0b74896a..00000000 --- a/reference/opt/shaders/vulkan/frag/spec-constant.vk.frag.vk +++ /dev/null @@ -1,25 +0,0 @@ -#version 310 es -precision mediump float; -precision highp int; - -layout(constant_id = 1) const float a = 1.0; -layout(constant_id = 2) const float b = 2.0; -layout(constant_id = 3) const int c = 3; -layout(constant_id = 4) const int d = 4; - -struct Foo -{ - float elems[(d + 2)]; -}; - -layout(location = 0) out vec4 FragColor; - -float _146[(c + 2)]; - -void main() -{ - float vec0[(c + 3)][8]; - Foo foo; - FragColor = ((vec4(a + b) + vec4(vec0[0][0])) + vec4(_146[0])) + vec4(foo.elems[c]); -} - diff --git a/reference/shaders-hlsl/asm/comp/specialization-constant-workgroup.nofxc.asm.comp b/reference/shaders-hlsl/asm/comp/specialization-constant-workgroup.noopt.nofxc.asm.comp similarity index 100% rename from reference/shaders-hlsl/asm/comp/specialization-constant-workgroup.nofxc.asm.comp rename to reference/shaders-hlsl/asm/comp/specialization-constant-workgroup.noopt.nofxc.asm.comp diff --git a/reference/shaders-hlsl/frag/tex-sampling.frag b/reference/shaders-hlsl/frag/tex-sampling.frag index 7e10bfdd..7fa60957 100644 --- a/reference/shaders-hlsl/frag/tex-sampling.frag +++ b/reference/shaders-hlsl/frag/tex-sampling.frag @@ -1,27 +1,27 @@ -Texture1D tex1d; -SamplerState _tex1d_sampler; -Texture2D tex2d; -SamplerState _tex2d_sampler; -Texture3D tex3d; -SamplerState _tex3d_sampler; -TextureCube texCube; -SamplerState _texCube_sampler; -Texture1D tex1dShadow; -SamplerComparisonState _tex1dShadow_sampler; -Texture2D tex2dShadow; -SamplerComparisonState _tex2dShadow_sampler; -TextureCube texCubeShadow; -SamplerComparisonState _texCubeShadow_sampler; -Texture1DArray tex1dArray; -SamplerState _tex1dArray_sampler; -Texture2DArray tex2dArray; -SamplerState _tex2dArray_sampler; -TextureCubeArray texCubeArray; -SamplerState _texCubeArray_sampler; -Texture2D separateTex2d; -SamplerState samplerNonDepth; -Texture2D separateTex2dDepth; -SamplerComparisonState samplerDepth; +Texture1D tex1d : register(t0); +SamplerState _tex1d_sampler : register(s0); +Texture2D tex2d : register(t1); +SamplerState _tex2d_sampler : register(s1); +Texture3D tex3d : register(t2); +SamplerState _tex3d_sampler : register(s2); +TextureCube texCube : register(t3); +SamplerState _texCube_sampler : register(s3); +Texture1D tex1dShadow : register(t4); +SamplerComparisonState _tex1dShadow_sampler : register(s4); +Texture2D tex2dShadow : register(t5); +SamplerComparisonState _tex2dShadow_sampler : register(s5); +TextureCube texCubeShadow : register(t6); +SamplerComparisonState _texCubeShadow_sampler : register(s6); +Texture1DArray tex1dArray : register(t7); +SamplerState _tex1dArray_sampler : register(s7); +Texture2DArray tex2dArray : register(t8); +SamplerState _tex2dArray_sampler : register(s8); +TextureCubeArray texCubeArray : register(t9); +SamplerState _texCubeArray_sampler : register(s9); +Texture2D separateTex2d : register(t12); +SamplerState samplerNonDepth : register(s11); +Texture2D separateTex2dDepth : register(t13); +SamplerComparisonState samplerDepth : register(s10); static float texCoord1d; static float2 texCoord2d; diff --git a/reference/opt/shaders-msl/asm/frag/inliner-dominator-inside-loop.asm.frag b/reference/shaders-msl-no-opt/asm/frag/inliner-dominator-inside-loop.asm.frag similarity index 100% rename from reference/opt/shaders-msl/asm/frag/inliner-dominator-inside-loop.asm.frag rename to reference/shaders-msl-no-opt/asm/frag/inliner-dominator-inside-loop.asm.frag diff --git a/reference/shaders-msl/comp/return.comp b/reference/shaders-msl-no-opt/comp/return.comp similarity index 100% rename from reference/shaders-msl/comp/return.comp rename to reference/shaders-msl-no-opt/comp/return.comp diff --git a/reference/shaders-msl-no-opt/vert/functions_nested.vert b/reference/shaders-msl-no-opt/vert/functions_nested.vert index aa663046..5c7d0f0c 100644 --- a/reference/shaders-msl-no-opt/vert/functions_nested.vert +++ b/reference/shaders-msl-no-opt/vert/functions_nested.vert @@ -114,16 +114,16 @@ float4 fetch_attr(thread const attr_desc& desc, thread const int& vertex_id, thr } } } - float4 _209; + float4 _210; if (reverse_order) { - _209 = result.wzyx; + _210 = result.wzyx; } else { - _209 = result; + _210 = result; } - return _209; + return _210; } float4 read_location(thread const int& location, constant VertexBuffer& v_227, thread uint& gl_VertexIndex, thread texture2d buff_in_2, thread texture2d buff_in_1) diff --git a/reference/shaders-msl/asm/frag/inliner-dominator-inside-loop.asm.frag b/reference/shaders-msl/asm/frag/inliner-dominator-inside-loop.asm.frag deleted file mode 100644 index 18fb7dca..00000000 --- a/reference/shaders-msl/asm/frag/inliner-dominator-inside-loop.asm.frag +++ /dev/null @@ -1,236 +0,0 @@ -#include -#include - -using namespace metal; - -struct VertexOutput -{ - float4 HPosition; - float4 Uv_EdgeDistance1; - float4 UvStuds_EdgeDistance2; - float4 Color; - float4 LightPosition_Fog; - float4 View_Depth; - float4 Normal_SpecPower; - float3 Tangent; - float4 PosLightSpace_Reflectance; - float studIndex; -}; - -struct Surface -{ - float3 albedo; - float3 normal; - float specular; - float gloss; - float reflectance; - float opacity; -}; - -struct SurfaceInput -{ - float4 Color; - float2 Uv; - float2 UvStuds; -}; - -struct Globals -{ - float4x4 ViewProjection; - float4 ViewRight; - float4 ViewUp; - float4 ViewDir; - float3 CameraPosition; - float3 AmbientColor; - float3 Lamp0Color; - float3 Lamp0Dir; - float3 Lamp1Color; - float4 FogParams; - float3 FogColor; - float4 LightBorder; - float4 LightConfig0; - float4 LightConfig1; - float4 LightConfig2; - float4 LightConfig3; - float4 RefractionBias_FadeDistance_GlowFactor; - float4 OutlineBrightness_ShadowInfo; - float4 ShadowMatrix0; - float4 ShadowMatrix1; - float4 ShadowMatrix2; -}; - -struct Params -{ - float4 LqmatFarTilingFactor; -}; - -struct CB0 -{ - Globals CB0; -}; - -struct CB2 -{ - Params CB2; -}; - -constant VertexOutput _121 = {}; -constant SurfaceInput _122 = {}; -constant float2 _123 = {}; -constant float4 _124 = {}; -constant Surface _125 = {}; -constant float4 _192 = {}; -constant float4 _219 = {}; -constant float4 _297 = {}; - -struct main0_in -{ - float IN_studIndex [[user(locn8)]]; - float4 IN_PosLightSpace_Reflectance [[user(locn7)]]; - float3 IN_Tangent [[user(locn6)]]; - float4 IN_Normal_SpecPower [[user(locn5)]]; - float4 IN_View_Depth [[user(locn4)]]; - float4 IN_LightPosition_Fog [[user(locn3)]]; - float4 IN_Color [[user(locn2)]]; - float4 IN_UvStuds_EdgeDistance2 [[user(locn1)]]; - float4 IN_Uv_EdgeDistance1 [[user(locn0)]]; -}; - -struct main0_out -{ - float4 _entryPointOutput [[color(0)]]; -}; - -fragment main0_out main0(main0_in in [[stage_in]], constant CB0& _19 [[buffer(0)]], texture3d LightMapTexture [[texture(0)]], texture2d ShadowMapTexture [[texture(1)]], texturecube EnvironmentMapTexture [[texture(2)]], texture2d DiffuseMapTexture [[texture(3)]], texture2d NormalMapTexture [[texture(4)]], texture2d NormalDetailMapTexture [[texture(5)]], texture2d StudsMapTexture [[texture(6)]], texture2d SpecularMapTexture [[texture(7)]], sampler LightMapSampler [[sampler(0)]], sampler ShadowMapSampler [[sampler(1)]], sampler EnvironmentMapSampler [[sampler(2)]], sampler DiffuseMapSampler [[sampler(3)]], sampler NormalMapSampler [[sampler(4)]], sampler NormalDetailMapSampler [[sampler(5)]], sampler StudsMapSampler [[sampler(6)]], sampler SpecularMapSampler [[sampler(7)]], float4 gl_FragCoord [[position]]) -{ - main0_out out = {}; - VertexOutput _128 = _121; - _128.HPosition = gl_FragCoord; - VertexOutput _130 = _128; - _130.Uv_EdgeDistance1 = in.IN_Uv_EdgeDistance1; - VertexOutput _132 = _130; - _132.UvStuds_EdgeDistance2 = in.IN_UvStuds_EdgeDistance2; - VertexOutput _134 = _132; - _134.Color = in.IN_Color; - VertexOutput _136 = _134; - _136.LightPosition_Fog = in.IN_LightPosition_Fog; - VertexOutput _138 = _136; - _138.View_Depth = in.IN_View_Depth; - VertexOutput _140 = _138; - _140.Normal_SpecPower = in.IN_Normal_SpecPower; - VertexOutput _142 = _140; - _142.Tangent = in.IN_Tangent; - VertexOutput _144 = _142; - _144.PosLightSpace_Reflectance = in.IN_PosLightSpace_Reflectance; - VertexOutput _146 = _144; - _146.studIndex = in.IN_studIndex; - SurfaceInput _147 = _122; - _147.Color = in.IN_Color; - SurfaceInput _149 = _147; - _149.Uv = in.IN_Uv_EdgeDistance1.xy; - SurfaceInput _151 = _149; - _151.UvStuds = in.IN_UvStuds_EdgeDistance2.xy; - SurfaceInput _156 = _151; - _156.UvStuds.y = (fract(_151.UvStuds.y) + in.IN_studIndex) * 0.25; - float _163 = _146.View_Depth.w * _19.CB0.RefractionBias_FadeDistance_GlowFactor.y; - float _165 = clamp(1.0 - _163, 0.0, 1.0); - float2 _166 = in.IN_Uv_EdgeDistance1.xy * 1.0; - bool _173; - float4 _193; - do - { - _173 = 0.0 == 0.0; - if (_173) - { - _193 = DiffuseMapTexture.sample(DiffuseMapSampler, _166); - break; - } - else - { - float _180 = 1.0 / (1.0 - 0.0); - _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; - break; - } while (false); - float4 _194 = _193 * 1.0; - float4 _220; - do - { - if (_173) - { - _220 = NormalMapTexture.sample(NormalMapSampler, _166); - break; - } - else - { - float _207 = 1.0 / (1.0 - 0.0); - _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; - break; - } while (false); - float2 _223 = float2(1.0); - float2 _224 = (_220.wy * 2.0) - _223; - float3 _232 = float3(_224, sqrt(clamp(1.0 + dot(-_224, _224), 0.0, 1.0))); - float2 _240 = (NormalDetailMapTexture.sample(NormalDetailMapSampler, (_166 * 0.0)).wy * 2.0) - _223; - float2 _252 = _232.xy + (float3(_240, sqrt(clamp(1.0 + dot(-_240, _240), 0.0, 1.0))).xy * 0.0); - float3 _253 = float3(_252.x, _252.y, _232.z); - float2 _255 = _253.xy * _165; - float3 _256 = float3(_255.x, _255.y, _253.z); - float3 _271 = ((in.IN_Color.xyz * _194.xyz) * (1.0 + (_256.x * 0.300000011920928955078125))) * (StudsMapTexture.sample(StudsMapSampler, _156.UvStuds).x * 2.0); - float4 _298; - do - { - if (0.75 == 0.0) - { - _298 = SpecularMapTexture.sample(SpecularMapSampler, _166); - break; - } - else - { - float _285 = 1.0 / (1.0 - 0.75); - _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; - break; - } while (false); - float2 _303 = mix(float2(0.800000011920928955078125, 120.0), (_298.xy * float2(2.0, 256.0)) + float2(0.0, 0.00999999977648258209228515625), float2(_165)); - Surface _304 = _125; - _304.albedo = _271; - Surface _305 = _304; - _305.normal = _256; - float _306 = _303.x; - Surface _307 = _305; - _307.specular = _306; - float _308 = _303.y; - Surface _309 = _307; - _309.gloss = _308; - float _312 = (_298.xy.y * _165) * 0.0; - Surface _313 = _309; - _313.reflectance = _312; - float4 _318 = float4(_271, _146.Color.w); - float3 _329 = normalize(((in.IN_Tangent * _313.normal.x) + (cross(in.IN_Normal_SpecPower.xyz, in.IN_Tangent) * _313.normal.y)) + (in.IN_Normal_SpecPower.xyz * _313.normal.z)); - float3 _332 = -_19.CB0.Lamp0Dir; - float _333 = dot(_329, _332); - float _357 = clamp(dot(step(_19.CB0.LightConfig3.xyz, abs(in.IN_LightPosition_Fog.xyz - _19.CB0.LightConfig2.xyz)), float3(1.0)), 0.0, 1.0); - float4 _368 = mix(LightMapTexture.sample(LightMapSampler, (in.IN_LightPosition_Fog.xyz.yzx - (in.IN_LightPosition_Fog.xyz.yzx * _357))), _19.CB0.LightBorder, float4(_357)); - float2 _376 = ShadowMapTexture.sample(ShadowMapSampler, in.IN_PosLightSpace_Reflectance.xyz.xy).xy; - float _392 = (1.0 - (((step(_376.x, in.IN_PosLightSpace_Reflectance.xyz.z) * clamp(9.0 - (20.0 * abs(in.IN_PosLightSpace_Reflectance.xyz.z - 0.5)), 0.0, 1.0)) * _376.y) * _19.CB0.OutlineBrightness_ShadowInfo.w)) * _368.w; - float3 _403 = mix(_318.xyz, EnvironmentMapTexture.sample(EnvironmentMapSampler, reflect(-in.IN_View_Depth.xyz, _329)).xyz, float3(_312)); - float4 _404 = float4(_403.x, _403.y, _403.z, _318.w); - float3 _422 = (((_19.CB0.AmbientColor + (((_19.CB0.Lamp0Color * clamp(_333, 0.0, 1.0)) + (_19.CB0.Lamp1Color * max(-_333, 0.0))) * _392)) + _368.xyz) * _404.xyz) + (_19.CB0.Lamp0Color * (((step(0.0, _333) * _306) * _392) * pow(clamp(dot(_329, normalize(_332 + normalize(in.IN_View_Depth.xyz))), 0.0, 1.0), _308))); - float4 _425 = float4(_422.x, _422.y, _422.z, _124.w); - _425.w = _404.w; - float2 _435 = min(in.IN_Uv_EdgeDistance1.wz, in.IN_UvStuds_EdgeDistance2.wz); - float _439 = min(_435.x, _435.y) / _163; - float3 _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); - float4 _446 = float4(_445.x, _445.y, _445.z, _425.w); - float3 _453 = mix(_19.CB0.FogColor, _446.xyz, float3(clamp(_146.LightPosition_Fog.w, 0.0, 1.0))); - out._entryPointOutput = float4(_453.x, _453.y, _453.z, _446.w); - return out; -} - diff --git a/reference/shaders-msl/comp/bake_gradient.comp b/reference/shaders-msl/comp/bake_gradient.comp deleted file mode 100644 index 1118f18f..00000000 --- a/reference/shaders-msl/comp/bake_gradient.comp +++ /dev/null @@ -1,40 +0,0 @@ -#pragma clang diagnostic ignored "-Wmissing-prototypes" - -#include -#include - -using namespace metal; - -constant uint3 gl_WorkGroupSize = uint3(8u, 8u, 1u); - -struct UBO -{ - float4 uInvSize; - float4 uScale; -}; - -float jacobian(thread const float2& dDdx, thread const float2& dDdy) -{ - return ((1.0 + dDdx.x) * (1.0 + dDdy.y)) - (dDdx.y * dDdy.x); -} - -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], constant UBO& _46 [[buffer(0)]], texture2d uHeight [[texture(0)]], sampler uHeightSmplr [[sampler(0)]], texture2d uDisplacement [[texture(1)]], sampler uDisplacementSmplr [[sampler(1)]], texture2d iHeightDisplacement [[texture(2)]], texture2d iGradJacobian [[texture(3)]]) -{ - float4 uv = (float2(gl_GlobalInvocationID.xy) * _46.uInvSize.xy).xyxy + (_46.uInvSize * 0.5); - float h = uHeight.sample(uHeightSmplr, uv.xy, level(0.0)).x; - float x0 = uHeight.sample(uHeightSmplr, uv.xy, level(0.0), int2(-1, 0)).x; - float x1 = uHeight.sample(uHeightSmplr, uv.xy, level(0.0), int2(1, 0)).x; - float y0 = uHeight.sample(uHeightSmplr, uv.xy, level(0.0), int2(0, -1)).x; - float y1 = uHeight.sample(uHeightSmplr, uv.xy, level(0.0), int2(0, 1)).x; - float2 grad = (_46.uScale.xy * 0.5) * float2(x1 - x0, y1 - y0); - float2 displacement = uDisplacement.sample(uDisplacementSmplr, uv.zw, level(0.0)).xy * 1.2000000476837158203125; - float2 dDdx = (uDisplacement.sample(uDisplacementSmplr, uv.zw, level(0.0), int2(1, 0)).xy - uDisplacement.sample(uDisplacementSmplr, uv.zw, level(0.0), int2(-1, 0)).xy) * 0.60000002384185791015625; - float2 dDdy = (uDisplacement.sample(uDisplacementSmplr, uv.zw, level(0.0), int2(0, 1)).xy - uDisplacement.sample(uDisplacementSmplr, uv.zw, level(0.0), int2(0, -1)).xy) * 0.60000002384185791015625; - float2 param = dDdx * _46.uScale.z; - float2 param_1 = dDdy * _46.uScale.z; - float j = jacobian(param, param_1); - displacement = float2(0.0); - iHeightDisplacement.write(float4(h, displacement, 0.0), uint2(int2(gl_GlobalInvocationID.xy))); - iGradJacobian.write(float4(grad, j, 0.0), uint2(int2(gl_GlobalInvocationID.xy))); -} - diff --git a/reference/shaders/amd/fs.invalid.frag b/reference/shaders/amd/fs.invalid.frag index 97e7bcd1..aecf69eb 100644 --- a/reference/shaders/amd/fs.invalid.frag +++ b/reference/shaders/amd/fs.invalid.frag @@ -2,9 +2,9 @@ #extension GL_AMD_shader_fragment_mask : require #extension GL_AMD_shader_explicit_vertex_parameter : require -uniform sampler2DMS texture1; +layout(binding = 0) uniform sampler2DMS texture1; -layout(location = 0) in vec4 vary; +layout(location = 0) __explicitInterpAMD in vec4 vary; void main() { diff --git a/reference/shaders/asm/frag/inliner-dominator-inside-loop.asm.frag b/reference/shaders/asm/frag/inliner-dominator-inside-loop.noopt.asm.frag similarity index 100% rename from reference/shaders/asm/frag/inliner-dominator-inside-loop.asm.frag rename to reference/shaders/asm/frag/inliner-dominator-inside-loop.noopt.asm.frag diff --git a/reference/shaders/comp/return.noopt.comp b/reference/shaders/comp/return.noopt.comp new file mode 100644 index 00000000..4be20e93 --- /dev/null +++ b/reference/shaders/comp/return.noopt.comp @@ -0,0 +1,34 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + vec4 out_data[]; +} _27; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + if (ident == 2u) + { + _27.out_data[ident] = vec4(20.0); + } + else + { + if (ident == 4u) + { + _27.out_data[ident] = vec4(10.0); + return; + } + } + for (int i = 0; i < 20; i++) + { + if (i == 10) + { + break; + } + return; + } + _27.out_data[ident] = vec4(10.0); +} + diff --git a/reference/shaders/desktop-only/comp/fp64.desktop.comp b/reference/shaders/desktop-only/comp/fp64.desktop.comp index 18869eda..c9e5e849 100644 --- a/reference/shaders/desktop-only/comp/fp64.desktop.comp +++ b/reference/shaders/desktop-only/comp/fp64.desktop.comp @@ -67,7 +67,6 @@ void main() dvec3 e = cross(a.xyz, a.yzw); a = faceforward(a, a, a); a = reflect(a, a); - a = refract(a, a, a.x); dmat4 l = dmat4(amat[0] * amat[0], amat[1] * amat[1], amat[2] * amat[2], amat[3] * amat[3]); l = outerProduct(a, a); l = transpose(l); diff --git a/reference/shaders/vulkan/frag/push-constant.frag.vk b/reference/shaders/vulkan/frag/push-constant.frag.vk deleted file mode 100644 index 748a0286..00000000 --- a/reference/shaders/vulkan/frag/push-constant.frag.vk +++ /dev/null @@ -1,18 +0,0 @@ -#version 310 es -precision mediump float; -precision highp int; - -layout(push_constant, std430) uniform PushConstants -{ - vec4 value0; - vec4 value1; -} push; - -layout(location = 0) out vec4 FragColor; -layout(location = 0) in vec4 vColor; - -void main() -{ - FragColor = ((vColor + push.value0) + push.value1); -} - diff --git a/reference/shaders/vulkan/frag/spec-constant.noopt.vk.frag b/reference/shaders/vulkan/frag/spec-constant.noopt.vk.frag new file mode 100644 index 00000000..7976042a --- /dev/null +++ b/reference/shaders/vulkan/frag/spec-constant.noopt.vk.frag @@ -0,0 +1,59 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct Foo +{ + float elems[(4 + 2)]; +}; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + float t0 = 1.0; + float t1 = 2.0; + mediump uint c0 = (uint(3) + 0u); + mediump int c1 = (-3); + mediump int c2 = (~3); + mediump int c3 = (3 + 4); + mediump int c4 = (3 - 4); + mediump int c5 = (3 * 4); + mediump int c6 = (3 / 4); + mediump uint c7 = (5u / 6u); + mediump int c8 = (3 % 4); + mediump uint c9 = (5u % 6u); + mediump int c10 = (3 >> 4); + mediump uint c11 = (5u >> 6u); + mediump int c12 = (3 << 4); + mediump int c13 = (3 | 4); + mediump int c14 = (3 ^ 4); + mediump int c15 = (3 & 4); + bool c16 = (false || true); + bool c17 = (false && true); + bool c18 = (!false); + bool c19 = (false == true); + bool c20 = (false != true); + bool c21 = (3 == 4); + bool c22 = (3 != 4); + bool c23 = (3 < 4); + bool c24 = (5u < 6u); + bool c25 = (3 > 4); + bool c26 = (5u > 6u); + bool c27 = (3 <= 4); + bool c28 = (5u <= 6u); + bool c29 = (3 >= 4); + bool c30 = (5u >= 6u); + mediump int c31 = c8 + c3; + mediump int c32 = int(5u + 0u); + bool c33 = (3 != int(0u)); + bool c34 = (5u != 0u); + mediump int c35 = int(false); + mediump uint c36 = uint(false); + float c37 = float(false); + float vec0[(3 + 3)][8]; + float vec1[(3 + 2)]; + Foo foo; + FragColor = ((vec4(t0 + t1) + vec4(vec0[0][0])) + vec4(vec1[0])) + vec4(foo.elems[3]); +} + diff --git a/reference/shaders/vulkan/frag/spec-constant.noopt.vk.frag.vk b/reference/shaders/vulkan/frag/spec-constant.noopt.vk.frag.vk new file mode 100644 index 00000000..d0765cc8 --- /dev/null +++ b/reference/shaders/vulkan/frag/spec-constant.noopt.vk.frag.vk @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(constant_id = 1) const float a = 1.0; +layout(constant_id = 2) const float b = 2.0; +layout(constant_id = 3) const int c = 3; +layout(constant_id = 4) const int d = 4; +layout(constant_id = 5) const uint e = 5u; +layout(constant_id = 6) const uint f = 6u; +layout(constant_id = 7) const bool g = false; +layout(constant_id = 8) const bool h = true; + +struct Foo +{ + float elems[(d + 2)]; +}; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + float t0 = a; + float t1 = b; + mediump uint c0 = (uint(c) + 0u); + mediump int c1 = (-c); + mediump int c2 = (~c); + mediump int c3 = (c + d); + mediump int c4 = (c - d); + mediump int c5 = (c * d); + mediump int c6 = (c / d); + mediump uint c7 = (e / f); + mediump int c8 = (c % d); + mediump uint c9 = (e % f); + mediump int c10 = (c >> d); + mediump uint c11 = (e >> f); + mediump int c12 = (c << d); + mediump int c13 = (c | d); + mediump int c14 = (c ^ d); + mediump int c15 = (c & d); + bool c16 = (g || h); + bool c17 = (g && h); + bool c18 = (!g); + bool c19 = (g == h); + bool c20 = (g != h); + bool c21 = (c == d); + bool c22 = (c != d); + bool c23 = (c < d); + bool c24 = (e < f); + bool c25 = (c > d); + bool c26 = (e > f); + bool c27 = (c <= d); + bool c28 = (e <= f); + bool c29 = (c >= d); + bool c30 = (e >= f); + mediump int c31 = c8 + c3; + mediump int c32 = int(e + 0u); + bool c33 = (c != int(0u)); + bool c34 = (e != 0u); + mediump int c35 = int(g); + mediump uint c36 = uint(g); + float c37 = float(g); + float vec0[(c + 3)][8]; + float vec1[(c + 2)]; + Foo foo; + FragColor = ((vec4(t0 + t1) + vec4(vec0[0][0])) + vec4(vec1[0])) + vec4(foo.elems[c]); +} + diff --git a/reference/shaders/vulkan/vert/vulkan-vertex.vert b/reference/shaders/vulkan/vert/vulkan-vertex.vert deleted file mode 100644 index 8de2b111..00000000 --- a/reference/shaders/vulkan/vert/vulkan-vertex.vert +++ /dev/null @@ -1,9 +0,0 @@ -#version 310 es - -uniform int SPIRV_Cross_BaseInstance; - -void main() -{ - gl_Position = (vec4(1.0, 2.0, 3.0, 4.0) * float((gl_VertexID + (gl_InstanceID + SPIRV_Cross_BaseInstance)))); -} - diff --git a/reference/shaders/vulkan/vert/vulkan-vertex.vert.vk b/reference/shaders/vulkan/vert/vulkan-vertex.vert.vk deleted file mode 100644 index 9ee3cc09..00000000 --- a/reference/shaders/vulkan/vert/vulkan-vertex.vert.vk +++ /dev/null @@ -1,7 +0,0 @@ -#version 310 es - -void main() -{ - gl_Position = (vec4(1.0, 2.0, 3.0, 4.0) * float((gl_VertexIndex + gl_InstanceIndex))); -} - diff --git a/shaders-hlsl/asm/comp/specialization-constant-workgroup.nofxc.asm.comp b/shaders-hlsl/asm/comp/specialization-constant-workgroup.noopt.nofxc.asm.comp similarity index 100% rename from shaders-hlsl/asm/comp/specialization-constant-workgroup.nofxc.asm.comp rename to shaders-hlsl/asm/comp/specialization-constant-workgroup.noopt.nofxc.asm.comp diff --git a/shaders-hlsl/frag/tex-sampling.frag b/shaders-hlsl/frag/tex-sampling.frag index 4a386c0d..762c60ac 100644 --- a/shaders-hlsl/frag/tex-sampling.frag +++ b/shaders-hlsl/frag/tex-sampling.frag @@ -1,22 +1,22 @@ #version 450 -uniform sampler1D tex1d; -uniform sampler2D tex2d; -uniform sampler3D tex3d; -uniform samplerCube texCube; +layout(binding = 0) uniform sampler1D tex1d; +layout(binding = 1) uniform sampler2D tex2d; +layout(binding = 2) uniform sampler3D tex3d; +layout(binding = 3) uniform samplerCube texCube; -uniform sampler1DShadow tex1dShadow; -uniform sampler2DShadow tex2dShadow; -uniform samplerCubeShadow texCubeShadow; +layout(binding = 4) uniform sampler1DShadow tex1dShadow; +layout(binding = 5) uniform sampler2DShadow tex2dShadow; +layout(binding = 6) uniform samplerCubeShadow texCubeShadow; -uniform sampler1DArray tex1dArray; -uniform sampler2DArray tex2dArray; -uniform samplerCubeArray texCubeArray; +layout(binding = 7) uniform sampler1DArray tex1dArray; +layout(binding = 8) uniform sampler2DArray tex2dArray; +layout(binding = 9) uniform samplerCubeArray texCubeArray; -uniform samplerShadow samplerDepth; -uniform sampler samplerNonDepth; -uniform texture2D separateTex2d; -uniform texture2D separateTex2dDepth; +layout(binding = 10) uniform samplerShadow samplerDepth; +layout(binding = 11) uniform sampler samplerNonDepth; +layout(binding = 12) uniform texture2D separateTex2d; +layout(binding = 13) uniform texture2D separateTex2dDepth; layout(location = 0) in float texCoord1d; layout(location = 1) in vec2 texCoord2d; diff --git a/shaders-msl/asm/frag/inliner-dominator-inside-loop.asm.frag b/shaders-msl-no-opt/asm/frag/inliner-dominator-inside-loop.asm.frag similarity index 100% rename from shaders-msl/asm/frag/inliner-dominator-inside-loop.asm.frag rename to shaders-msl-no-opt/asm/frag/inliner-dominator-inside-loop.asm.frag diff --git a/shaders-msl/comp/return.comp b/shaders-msl-no-opt/comp/return.comp similarity index 100% rename from shaders-msl/comp/return.comp rename to shaders-msl-no-opt/comp/return.comp diff --git a/shaders-msl/frag/swizzle.frag b/shaders-msl/frag/swizzle.frag index 271ba6cb..af22dd65 100644 --- a/shaders-msl/frag/swizzle.frag +++ b/shaders-msl/frag/swizzle.frag @@ -1,7 +1,7 @@ #version 310 es precision mediump float; -layout(location = 0) uniform sampler2D samp; +layout(binding = 0) uniform sampler2D samp; layout(location = 0) out vec4 FragColor; layout(location = 1) in vec3 vNormal; layout(location = 2) in vec2 vUV; diff --git a/shaders/asm/frag/inliner-dominator-inside-loop.asm.frag b/shaders/asm/frag/inliner-dominator-inside-loop.noopt.asm.frag similarity index 100% rename from shaders/asm/frag/inliner-dominator-inside-loop.asm.frag rename to shaders/asm/frag/inliner-dominator-inside-loop.noopt.asm.frag diff --git a/shaders/comp/return.comp b/shaders/comp/return.noopt.comp similarity index 100% rename from shaders/comp/return.comp rename to shaders/comp/return.noopt.comp diff --git a/shaders/desktop-only/comp/fp64.desktop.comp b/shaders/desktop-only/comp/fp64.desktop.comp index dd488a30..2c2d5018 100644 --- a/shaders/desktop-only/comp/fp64.desktop.comp +++ b/shaders/desktop-only/comp/fp64.desktop.comp @@ -72,7 +72,7 @@ void main() dvec3 e = cross(a.xyz, a.yzw); a = faceforward(a, a, a); a = reflect(a, a); - a = refract(a, a, a.x); + //a = refract(a, a, 1.45); dmat4 l = matrixCompMult(amat, amat); l = outerProduct(a, a); diff --git a/shaders/vulkan/frag/spec-constant.vk.frag b/shaders/vulkan/frag/spec-constant.noopt.vk.frag similarity index 100% rename from shaders/vulkan/frag/spec-constant.vk.frag rename to shaders/vulkan/frag/spec-constant.noopt.vk.frag diff --git a/spirv_cross.cpp b/spirv_cross.cpp index 595c1580..e3cd0b34 100644 --- a/spirv_cross.cpp +++ b/spirv_cross.cpp @@ -3757,6 +3757,7 @@ void Compiler::analyze_variable_scope(SPIRFunction &entry) } DominatorBuilder builder(cfg); + bool force_temporary = false; // Figure out which block is dominating all accesses of those temporaries. auto &blocks = var.second; @@ -3768,6 +3769,11 @@ void Compiler::analyze_variable_scope(SPIRFunction &entry) // access up to loop header like we did for variables. if (blocks.size() != 1 && this->is_continue(block)) builder.add_block(this->continue_block_to_loop_header[block]); + else if (blocks.size() != 1 && this->is_single_block_loop(block)) + { + // Awkward case, because the loop header is also the continue block. + force_temporary = true; + } } uint32_t dominating_block = builder.get_dominator(); @@ -3777,7 +3783,7 @@ void Compiler::analyze_variable_scope(SPIRFunction &entry) // 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) + if (!first_use_is_dominator || force_temporary) { // 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) diff --git a/spirv_cross.hpp b/spirv_cross.hpp index 34666006..d169117f 100644 --- a/spirv_cross.hpp +++ b/spirv_cross.hpp @@ -586,6 +586,12 @@ protected: return continue_blocks.find(next) != end(continue_blocks); } + inline bool is_single_block_loop(uint32_t next) const + { + auto &block = get(next); + return block.merge == SPIRBlock::MergeLoop && block.continue_block == next; + } + inline bool is_break(uint32_t next) const { return loop_merge_targets.find(next) != end(loop_merge_targets) || diff --git a/spirv_glsl.cpp b/spirv_glsl.cpp index 7ad274c9..d933ee95 100644 --- a/spirv_glsl.cpp +++ b/spirv_glsl.cpp @@ -682,7 +682,7 @@ string CompilerGLSL::to_interpolation_qualifiers(const Bitset &flags) if (flags.get(DecorationInvariant)) res += "invariant "; if (flags.get(DecorationExplicitInterpAMD)) - res += "__explicitInterpAMD"; + res += "__explicitInterpAMD "; return res; } @@ -8360,9 +8360,11 @@ void CompilerGLSL::flush_phi(uint32_t from, uint32_t to) void CompilerGLSL::branch_to_continue(uint32_t from, uint32_t to) { - assert(is_continue(to)); - auto &to_block = get(to); + if (from == to) + return; + + assert(is_continue(to)); if (to_block.complex_continue) { // Just emit the whole block chain as is. @@ -8430,8 +8432,13 @@ void CompilerGLSL::branch(uint32_t from, uint32_t to) } else if (is_break(to)) statement("break;"); - else if (is_continue(to)) + else if (is_continue(to) || (from == to)) + { + // For from == to case can happen for a do-while loop which branches into itself. + // We don't mark these cases as continue blocks, but the only possible way to branch into + // ourselves is through means of continue blocks. branch_to_continue(from, to); + } else if (!is_conditional(to)) emit_block_chain(get(to));